Changeset 3378203
- Timestamp:
- 10/14/2025 01:53:01 PM (4 months ago)
- Location:
- fastcache-by-host-it/trunk
- Files:
-
- 7 edited
-
README.txt (modified) (2 diffs)
-
admin/class-fastcache-admin.php (modified) (3 diffs)
-
admin/js/fastcache-admin.js (modified) (1 diff)
-
admin/partials/fastcache-admin-display.php (modified) (2 diffs)
-
fastcache.php (modified) (1 diff)
-
public/class-fastcache-public.php (modified) (4 diffs)
-
public/workarounds.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
fastcache-by-host-it/trunk/README.txt
r3333481 r3378203 3 3 Tags: cache, speed, seo, cdn, varnish 4 4 Requires at least: 6.0.0 5 Tested up to: 6.8. 25 Tested up to: 6.8.3 6 6 Requires PHP: 8.0 7 Stable Tag: 1.2. 197 Stable Tag: 1.2.20 8 8 License: GPL-2.0+ 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 76 76 77 77 == Changelog == 78 1.2.20 79 Fix for compatibility with Wordpress plugin best practices 80 Add Url Exclusion 81 Add Workaround for minicart woocommerce 78 82 79 83 1.2.12 -
fastcache-by-host-it/trunk/admin/class-fastcache-admin.php
r3161311 r3378203 393 393 ) 394 394 ); 395 395 add_settings_section( 396 FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion-section', 397 'Url Exclusion', 398 array( $this, 'sandbox_add_urlexclusion_section' ), 399 FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion', 400 array( 401 'before_section' => '<section id="urlexclusion" class="%s %s">', 402 'after_section' => '</section>', 403 'section_class' => 'togglerTabs', 404 ) 405 ); 406 407 register_setting( 408 FASTCACHEHOST_HOST_PLUGINNAME . '-settings', 409 FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion', 410 array( $this, 'record_urlexclusion' ) 411 ); 412 413 add_settings_field( 414 FASTCACHEHOST_HOST_PLUGINNAME . '-url-exclusion-textarea', 415 'Url da escludere', 416 array( $this, 'fieldUrlExclusion' ), 417 FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion', 418 FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion-section', 419 array( 420 'label_for' => 'url-exclusion-textarea', 421 'class'=>'w-2/3 text-gray-800 p-4 bg-white border-[1px] border-gray-800 rounded-lg hover:bg-gray-50', 422 'description'=>'Inserire nella textarea sottostante gli URL (uno per riga) che non devono essere inseriti nella cache' 423 424 ) 425 ); 396 426 } 397 427 … … 470 500 return; 471 501 502 } 503 public function sandbox_add_urlexclusion_section() { 504 return; 472 505 } 473 506 public function field_single_checkbox( $args ) { … … 654 687 $html = str_replace("--iconButton--",$iconButton,$html); 655 688 echo wp_kses($html, FASTCACHEHOST_ALLOWEDHTML); 689 } 690 public function fieldUrlExclusion($args) { 691 $options = get_option(FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS); 692 $utils=new \FASTCACHEHOST_HCommon\FASTCACHEHOST_HCommon(); 693 $utils->fr($options); 694 $value = ''; 695 if (!empty($options['urlExclusion'])) { 696 $valuesj = $options['urlExclusion']; 697 $valuesArr=json_decode($valuesj,true); 698 $value=implode("\n",$valuesArr); 699 } 700 $html = "<li class=\"group\">"; 701 $classLabel = "inline-flex items-center justify-between w-full p-5 text-gray-500 bg-white border-2 border-gray-200 rounded-lg cursor-pointer peer-checked:border-blue-600 hover:text-gray-600 peer-checked:text-gray-600 hover:bg-gray-50 "; 702 703 $html .= '<textarea class="' . $classLabel . '" name="' . FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion[url-exclusion-textarea]" id="' . esc_attr($args['label_for']) . '" rows="10" cols="80" class="large-text">' . esc_textarea($value) . '</textarea>'; 704 705 // pulsante "Inserisci" 706 $html .= '<button id="fastcache-host-settings-urlexclusionbutton" type="button" class="button button-primary" >Inserisci</button>'; 707 708 709 if (!empty($args['description'])) { 710 $html .= '<p class="w-full text-gray-500">' . esc_html($args['description']) . '</p>'; 711 } 712 $html .= "</li>"; 713 $html .= $this->endpoints(); 714 echo $html; 715 } 716 private function endpoints() { 717 $html =""; 718 if ( function_exists('WC') ) { 719 720 $classLabel = " w-full p-5 text-gray-500 bg-white border-2 border-gray-200 rounded-lg cursor-pointer peer-checked:border-blue-600 hover:text-gray-600 peer-checked:text-gray-600 hover:bg-gray-50 "; 721 722 $html .= "<div class=\"" . $classLabel . "\">"; 723 $html .= "<h3 style='padding-top: 10px; padding-bottom: 10px;'>Qui in seguito alcuni url che in caso di woocommerce sono da disattivare</h3>"; 724 $html .= "<p style='padding: 10px;'>In caso di \"lingua italiana\" sono da inserirsi anche tradotti (carrello / mio-account / cassa / paga-ordine / ordine-ricevuto / visualizza-ordine...)</p>"; 725 $endpoints = WC()->query->query_vars; 726 foreach ($endpoints as $endpoint) { 727 $html .= "<div style='font-weight: bold ;'>" . esc_html($endpoint) . "</div>"; 728 } 729 $html .= "<div style='font-weight: bold ;'>cart</div>"; 730 $html .= "<div style='font-weight: bold ;'>my-account</div>"; 731 732 $html .= "</div>"; 733 } 734 return $html; 656 735 } 657 736 /** -
fastcache-by-host-it/trunk/admin/js/fastcache-admin.js
r3160435 r3378203 29 29 }); 30 30 } 31 if(jQuery('#fastcache-host-settings-urlexclusionbutton').length>0){ 32 jQuery('#fastcache-host-settings-urlexclusionbutton').click(function (e) { 33 e.preventDefault(); 34 jQuery.post(ajax_var.url, { 35 nonce: ajax_var.nonce, 36 action: 'urlExclusion', 37 urlExclusion: jQuery('#url-exclusion-textarea').val() 38 }, function (response) { 39 jQuery('#fastcache-host-settings-urlexclusionbutton').html(response); 40 location.reload(); 41 }); 42 }); 31 43 44 } 32 45 33 46 if(jQuery('#button-test').length>0) { -
fastcache-by-host-it/trunk/admin/partials/fastcache-admin-display.php
r3160435 r3378203 26 26 </li> 27 27 28 <li class="me-2 mb-0 fastcachetabs" id="tab-urlexclusion"> 29 <span data-menu="urlexclusion" 30 onclick="fastcache_host_switch_Section('urlexclusion')" 31 class="cursor-pointer inline-block p-4 rounded-t-lg hover:text-gray-600 hover:bg-gray-50 ">Url Exclusion</span> 32 </li> 33 28 34 <li class="me-2 mb-0 fastcachetabs" id="tab-debug"> 29 35 <span data-menu="debug" … … 46 52 $utils->override_do_settings_sections_host( FASTCACHEHOST_HOST_PLUGINNAME . '-settings' ); 47 53 $utils->override_do_settings_sections_host( FASTCACHEHOST_HOST_PLUGINNAME . '-ttl' ); 54 $utils->override_do_settings_sections_host( FASTCACHEHOST_HOST_PLUGINNAME . '-urlexclusion' ); 48 55 $utils->override_do_settings_sections_host( FASTCACHEHOST_HOST_PLUGINNAME . '-debug' ); 49 56 $utils->override_do_settings_sections_host( FASTCACHEHOST_HOST_PLUGINNAME . '-contacts' ); -
fastcache-by-host-it/trunk/fastcache.php
r3333481 r3378203 17 17 * Plugin URI: https://fastcachecdn.com/ 18 18 * Description: Abilita il tuo sito Wordpress alla prima vera CDN realizzata PER Wordpress e configurata AD-HOC per il tuo sito. Il massimo della velocità senza difficoltà di setup. 19 * Version: 1.2. 1919 * Version: 1.2.20 20 20 * Author: Host.it - Alessandro Poletto 21 21 * Author URI: https://fastcachecdn.com/ -
fastcache-by-host-it/trunk/public/class-fastcache-public.php
r3161311 r3378203 60 60 add_action("wp_ajax_updatetoken", array($this, "updatetoken")); 61 61 add_action("wp_ajax_updatettl", array($this, "updatettl")); 62 add_action("wp_ajax_urlExclusion", array($this, "urlExclusion")); 63 62 64 add_action('transition_post_status', array($this,'purgePostTransitionPostStatus'), 10, 3); 63 65 … … 197 199 $ttl=60; 198 200 } 199 if ($enable==1 && trim($token)!="") { 201 $excluded=$this->ttlExcludedUrls(); 202 if($excluded>0) { 203 header('X-HST-CACHE-Enabled: NO:Url Exclusion Matched', true); 204 } else if ($enable==1 && trim($token)!="") { 200 205 if (is_user_logged_in()) { 201 206 Header('X-HST-CACHE-Enabled: false:User is logged in', true); … … 212 217 } 213 218 } 219 private function ttlExcludedUrls() { 220 $options = get_option(FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS); 221 222 if (!isset($options['urlExclusion']) || empty($options['urlExclusion'])) { 223 return; 224 } 225 226 $urls = json_decode($options['urlExclusion'], true); 227 if (!is_array($urls)) { 228 return; 229 } 230 231 // URL attuale assoluto 232 $utils = new \FASTCACHEHOST_HCommon\FASTCACHEHOST_HCommon(); 233 $current_url = home_url( add_query_arg( null, null ) ); 234 $current_url = strtolower(untrailingslashit($current_url)); 235 $excluded=0; 236 foreach ($urls as $url) { 237 $url = strtolower(untrailingslashit(trim($url))); 238 if ($url !== '' && strpos($current_url, $url) !== false) { 239 $excluded++; 240 } 241 } 242 return $excluded; 243 } 214 244 public function attivazionefastcache() { 215 245 … … 248 278 } 249 279 echo "KO"; 280 exit(); 281 } 282 public function urlExclusion() { 283 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['nonce'] ) ) , 'ajax-nonce' ) ) { 284 die ( 'Alcuni controlli di sicurezza non sono andati a buon fine, consigliamo di contattare l\'assistenza del plugin!'); 285 } 286 $vars = get_option( FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS ); 287 if( $_POST['urlExclusion']!="") { 288 $tUrlExclusion=trim($_POST['urlExclusion']); 289 $exploded=explode("\n",$tUrlExclusion); 290 $enc=json_encode($exploded); 291 $vars['urlExclusion']=sanitize_text_field($enc); 292 update_option( FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS , $vars ); 293 echo"OK - Waiting to reload"; 294 exit(); 295 } 296 echo "KO - Waiting to reload"; 250 297 exit(); 251 298 } -
fastcache-by-host-it/trunk/public/workarounds.class.php
r3333481 r3378203 26 26 } 27 27 $Storefront->actions(); 28 } 29 } 30 if ( defined( 'WOOCOMMERCE_VERSION' ) ) { 31 $theme= wp_get_theme(); 32 if($theme->get( 'Name' ) == 'Blocksy' || $theme->get( 'Name' ) == 'Blocksy Child'){ 33 require_once plugin_dir_path(dirname(__FILE__)) . 'workarounds/esiMiniCart.class.php'; 34 $esiMiniCart = new FASTCACHEHST_esiMiniCart(); 35 $esiMiniCart->actions(); 28 36 } 29 37 }
Note: See TracChangeset
for help on using the changeset viewer.