Changeset 3251166
- Timestamp:
- 03/05/2025 02:32:25 PM (13 months ago)
- Location:
- fastpixel-website-accelerator/trunk
- Files:
-
- 2 added
- 9 edited
-
fastpixel.php (modified) (2 diffs)
-
inc/backend/assets/backend.js (modified) (4 diffs)
-
inc/backend/controllers/cache.php (modified) (12 diffs)
-
inc/backend/controllers/classes/post-types-statuses.php (modified) (4 diffs)
-
inc/backend/controllers/classes/taxonomies-statuses.php (modified) (3 diffs)
-
inc/backend/controllers/classes/translatepress.php (added)
-
inc/backend/models/posts-ui.php (modified) (9 diffs)
-
inc/classes/translatepress.php (added)
-
inc/functions.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fastpixel-website-accelerator/trunk/fastpixel.php
r3245943 r3251166 5 5 * Description: Faster WordPress Made Easy – Solve all your website speed problems effortlessly with just a few clicks. 6 6 * Author: ShortPixel 7 * Version: 1.0.4 27 * Version: 1.0.43 8 8 * Text Domain: fastpixel-website-accelerator 9 9 * Domain Path: /languages … … 21 21 defined('ABSPATH') || exit; 22 22 23 define('FASTPIXEL_VERSION', '1.0.4 2');23 define('FASTPIXEL_VERSION', '1.0.43'); 24 24 define('FASTPIXEL_NAME', 'FastPixel'); 25 25 if (!defined('FASTPIXEL_PLUGIN_DIR')) -
fastpixel-website-accelerator/trunk/inc/backend/assets/backend.js
r3223801 r3251166 101 101 id: id, 102 102 type: type, 103 selected_of_type: selected_of_type 104 } 103 selected_of_type: selected_of_type, 104 extra_params: fastpixel_backend_status.extra_params 105 }; 105 106 let original; 106 107 … … 142 143 id: id, 143 144 type: type, 144 selected_of_type: selected_of_type 145 } 145 selected_of_type: selected_of_type, 146 extra_params: fastpixel_backend_status.extra_params 147 }; 146 148 let original; 147 149 … … 183 185 ids: ids, 184 186 type: type, 185 selected_of_type: selected_of_type 186 } 187 selected_of_type: selected_of_type, 188 extra_params: fastpixel_backend_status.extra_params 189 }; 190 187 191 jQuery.ajax({ 188 192 url: fastpixel_backend.ajax_url, … … 560 564 } 561 565 }); 562 jQuery('.fastpixel-mobile-header-menu').on('classChange', function (e) {563 console.log('class change');564 });565 566 }); -
fastpixel-website-accelerator/trunk/inc/backend/controllers/cache.php
r3245950 r3251166 269 269 * reset cache status when plugins are activated, deactivated, upgraded, theme is changed or upgraded 270 270 */ 271 add_action('activated_plugin', [$this, 'purge_all_ without_request']);272 add_action('deactivated_plugin', [$this, 'purge_all_ without_request']);273 add_action('after_switch_theme', [$this, 'purge_all_ without_request']);271 add_action('activated_plugin', [$this, 'purge_all_on_plugin_activation_deactivation']); 272 add_action('deactivated_plugin', [$this, 'purge_all_on_plugin_activation_deactivation']); 273 add_action('after_switch_theme', [$this, 'purge_all_on_theme_switch']); 274 274 add_action('upgrader_process_complete', [$this, 'check_upgraded'], 10, 2); 275 275 } … … 383 383 } 384 384 $url = new FASTPIXEL_Url( (int)$post->ID); 385 $url = new FASTPIXEL_Url(apply_filters('fastpixel/purge_post_object/url', $url->get_url(), $args)); //creating new url after filters applied 385 386 $path = untrailingslashit($url->get_url_path()); 386 387 $args['url'] = $url->get_url(); … … 416 417 } 417 418 //purging categories/tags/taxonomies pages 418 $this->admin_purge_taxonomies($ args['id']);419 $this->admin_purge_taxonomies($post->ID); 419 420 return true; 420 421 } else { … … 440 441 if (!empty($term_link)) { 441 442 $url = new FASTPIXEL_Url($term_link); 443 $url = new FASTPIXEL_Url(apply_filters('fastpixel/purge_term_object/url', $url->get_url(), $args)); //creating new url after filters applied 442 444 $path = untrailingslashit($url->get_url_path()); 443 445 $args['url'] = $url->get_url(); … … 525 527 //remove cache folder if serve_stale is disabled 526 528 $clear_folder = apply_filters('fastpixel/purge_all/clear_cache_folder', true); 529 $serve_stale = $this->functions->get_option('fastpixel_serve_stale'); 527 530 if ($this->debug) { 528 531 FASTPIXEL_DEBUG::log('Class FASTPIXEL_Backend_Cache: ACTION purge_all, clear cache directory', $clear_folder); 529 }530 $serve_stale = $this->functions->get_option('fastpixel_serve_stale');532 FASTPIXEL_DEBUG::log('Class FASTPIXEL_Backend_Cache: ACTION purge_all, serve stale', $serve_stale); 533 } 531 534 if (($clear_folder && !$serve_stale)) { 532 535 add_action('fastpixel/shutdown', function () { … … 543 546 if (file_exists($cache_dir)) { 544 547 $wp_filesystem->rmdir($cache_dir, true); 548 } else { 549 if ($this->debug) { 550 FASTPIXEL_DEBUG::log('Class FASTPIXEL_Backend_Cache: ACTION purge_all, Error: Directory not exists', $cache_dir); 551 } 552 return false; 545 553 } 546 554 }); 547 } else {548 if ($this->debug) {549 FASTPIXEL_DEBUG::log('Class FASTPIXEL_Backend_Cache: ACTION purge_all, Error: Can\'t clear cache directory');550 }551 return false;552 555 } 553 556 return true; … … 575 578 } 576 579 } 577 $args = ['id' => $id, 'type' => $type, 'selected_of_type' => $selected_of_type]; 580 $extra_params = []; 581 if (!empty($_REQUEST['extra_params']) && is_array($_REQUEST['extra_params'])) { 582 foreach ($_REQUEST['extra_params'] as $key => $value) { 583 $extra_params[$key] = sanitize_text_field($value); 584 } 585 } 586 $args = ['id' => $id, 'type' => $type, 'selected_of_type' => $selected_of_type, 'extra_params' => $extra_params]; 578 587 //handling purge without ajax 579 588 $cache_reset_type = apply_filters('fastpixel/backend/purge/single/reset_type', 'url', $args); … … 649 658 wp_die(); 650 659 } 660 $extra_params = []; 661 if (!empty($_REQUEST['extra_params']) && is_array($_REQUEST['extra_params'])) { 662 foreach ($_REQUEST['extra_params'] as $key => $value) { 663 $extra_params[$key] = sanitize_text_field($value); 664 } 665 } 651 666 $type = sanitize_text_field($_POST['type']); 652 667 $selected_of_type = sanitize_text_field($_POST['selected_of_type']); … … 656 671 } 657 672 $statuses = ['status' => 'success', 'items' => []]; 658 $items = apply_filters('fastpixel/status_page/get_statuses', [], ['type' => $type, 'selected_of_type' => $selected_of_type, 'ids' => $post_ids ]);673 $items = apply_filters('fastpixel/status_page/get_statuses', [], ['type' => $type, 'selected_of_type' => $selected_of_type, 'ids' => $post_ids, 'extra_params' => $extra_params]); 659 674 if (!empty($items)) { 660 675 $statuses['items'] = $items; … … 825 840 $run_purge = false; 826 841 $skin = $upgrader->skin; 842 $purge_message = __('Cache has been cleared!', 'fastpixel-website-accelerator'); 827 843 if ($extra['type'] === 'plugin') { 828 844 if (property_exists($skin, 'plugin_active') && $skin->plugin_active) { … … 843 859 } 844 860 if ($run_purge) { 845 $this->purge_all_without_request(); 861 if ($this->purge_all_without_request()) { 862 $notices = FASTPIXEL_Notices::get_instance(); 863 $notices->add_flash_notice($purge_message, 'success', false, 'plugin-theme-change-notice'); 864 } 865 } 866 } 867 868 public function purge_all_on_plugin_activation_deactivation() { 869 if ($this->purge_all_without_request()) { 870 $purge_message = __('Cache has been cleared!', 'fastpixel-website-accelerator'); 871 $notices = FASTPIXEL_Notices::get_instance(); 872 $notices->add_flash_notice($purge_message, 'success', false, 'plugin-theme-change-notice'); 873 } 874 } 875 876 public function purge_all_theme_switch() 877 { 878 if ($this->purge_all_without_request()) { 879 $purge_message = __('Cache has been cleared!', 'fastpixel-website-accelerator'); 880 $notices = FASTPIXEL_Notices::get_instance(); 881 $notices->add_flash_notice($purge_message, 'success', false, 'plugin-theme-change-notice'); 846 882 } 847 883 } … … 858 894 add_filter('fastpixel/purge_all/clear_cache_folder', function () { 859 895 return false; }); 860 $this->purge_all();896 return $this->purge_all(); 861 897 } 862 898 } -
fastpixel-website-accelerator/trunk/inc/backend/controllers/classes/post-types-statuses.php
r3245943 r3251166 77 77 'type' => $this->type, 78 78 'selected_of_type' => $this->selected_post_type, 79 'delete_cached_link' => sprintf('admin-post.php?action=%1$s&nonce=%2$s&selected_of_type=%3$s&id=', 'fastpixel_admin_delete_cached', $this->nonce, $this->selected_post_type) 79 'delete_cached_link' => sprintf('admin-post.php?action=%1$s&nonce=%2$s&selected_of_type=%3$s&id=', 'fastpixel_admin_delete_cached', $this->nonce, $this->selected_post_type), 80 'extra_params' => apply_filters('fastpixel/status_page/extra_params', []) 80 81 ]); 81 82 }); … … 108 109 foreach($posts as $post) { 109 110 $url = get_permalink($post); 110 $cache_status = $this->be_functions->cache_status_display($url, ['id' => $post->ID, 'selected_of_type' => $this->selected_post_type]); 111 $status_data = ['id' => $post->ID, 'selected_of_type' => $this->selected_post_type, 'type' => $this->type]; 112 $url = apply_filters('fastpixel/status_page/permalink', $url, $status_data); 113 $cache_status = $this->be_functions->cache_status_display($url, $status_data); 111 114 $posts_list[] = [ 112 115 'ID' => $post->ID, … … 126 129 //if static page is not set, adding homepage to list 127 130 if (($show_on_front == 'posts' || $page_on_front == 0) && $args['current_page'] == 1 && empty($args['s'])) { 128 $cache_status = $this->be_functions->cache_status_display(get_home_url(), ['id' => 'homepage', 'post_type' => $this->selected_post_type]); 131 $url = get_home_url(); 132 $status_data = ['id' => 'homepage', 'selected_of_type' => $this->selected_post_type, 'type' => $this->type]; 133 $url = apply_filters('fastpixel/status_page/permalink', $url, $status_data); 134 $cache_status = $this->be_functions->cache_status_display($url, $status_data); 129 135 $extra_pages[] = [ 130 136 'ID' => 'homepage', 131 137 'post_title' => esc_html__('Homepage', 'fastpixel-website-accelerator'), 132 'url' => get_home_url(),138 'url' => $url, 133 139 'cache_status' => $cache_status['status_display'], 134 140 'cachestatus' => $cache_status['status'], … … 350 356 $permalink = get_permalink($id); 351 357 } 352 $status = $this->be_functions->cache_status_display($permalink, ['id' => $id, 'selected_of_type' => $args['selected_of_type'], 'url' => $permalink]); 358 $status_data = ['id' => $id, 'selected_of_type' => $args['selected_of_type'], 'url' => $permalink, 'extra_params' => $args['extra_params']]; 359 $permalink = apply_filters('fastpixel/status_page/ajax/permalink', $permalink, $status_data); 360 $status_data['url'] = $permalink; 361 $status = $this->be_functions->cache_status_display($permalink, $status_data); 353 362 if ($status) { 354 363 $items[$id] = $status; -
fastpixel-website-accelerator/trunk/inc/backend/controllers/classes/taxonomies-statuses.php
r3245943 r3251166 59 59 'type' => $this->type, 60 60 'selected_of_type' => $this->selected_taxonomy, 61 'delete_cached_link' => sprintf('admin-post.php?action=%1$s&nonce=%2$s&selected_of_type=%3$s&type=%4$s&id=', 'fastpixel_admin_delete_cached', $this->nonce, $this->selected_taxonomy, $this->type) 61 'delete_cached_link' => sprintf('admin-post.php?action=%1$s&nonce=%2$s&selected_of_type=%3$s&type=%4$s&id=', 'fastpixel_admin_delete_cached', $this->nonce, $this->selected_taxonomy, $this->type), 62 'extra_params' => apply_filters('fastpixel/status_page/extra_params', []) 62 63 ]); 63 64 }); … … 99 100 foreach($terms as $term) { 100 101 $url = get_term_link($term); 101 $cache_status = $this->be_functions->cache_status_display($url, ['id' => $term->term_id, 'taxonomy' => $this->selected_taxonomy]); 102 $status_data = ['id' => $term->term_id, 'taxonomy' => $this->selected_taxonomy]; 103 $url = apply_filters('fastpixel/status_page/permalink', $url, $status_data); 104 $cache_status = $this->be_functions->cache_status_display($url, $status_data); 102 105 $list[] = [ 103 106 'ID' => $term->term_id, … … 234 237 $term = get_term($id, $args['selected_of_type']); 235 238 $permalink = get_term_link($term); 236 $status = $this->be_functions->cache_status_display($permalink, ['id' => $id, 'taxonomy' => $args['selected_of_type'], 'url' => $permalink]); 239 $status_data = ['id' => $id, 'taxonomy' => $args['selected_of_type'], 'url' => $permalink, 'extra_params' => $args['extra_params']]; 240 $permalink = apply_filters('fastpixel/status_page/ajax/permalink', $permalink, $status_data); 241 $status_data['url'] = $permalink; 242 $status = $this->be_functions->cache_status_display($permalink, $status_data); 237 243 if ($status) { 238 244 $items[$id] = $status; -
fastpixel-website-accelerator/trunk/inc/backend/models/posts-ui.php
r3245943 r3251166 155 155 protected function display_tablenav($which) 156 156 { 157 $output = ''; 157 158 if ($which == 'top') { 158 159 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- wordpress page is accessed without any nonces, no data is posted. … … 160 161 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- wordpress page is accessed without any nonces, no data is posted. 161 162 $orderby = isset($_GET['orderby']) ? sanitize_key($_GET['orderby']) : false; //phpcs:ignore 162 echo '<form method="get" action="' . esc_url(admin_url('admin.php?page=' . FASTPIXEL_TEXTDOMAIN)) . '">'; } ?> 163 <?php $this->display_search($which); ?> 164 <div class="tablenav <?php echo esc_attr($which); ?>"> 165 <input type="hidden" name="page" value="<?php echo esc_html(FASTPIXEL_TEXTDOMAIN); ?>" /> 166 <?php echo (isset($orderby) && $orderby ? '<input type="hidden" name="orderby" value="' . esc_html($orderby) . '" />' : '') 167 . (isset($order) && $order ? '<input type="hidden" name="order" value="' . esc_html($order) . '" />' : ''); 168 169 if ($this->has_items()): ?> 170 <div class="alignleft actions bulkactions"> 171 <?php $this->bulk_actions($which); ?> 172 </div> 173 <?php endif; 174 $this->extra_tablenav($which); 175 $this->pagination($which); 176 ?> 177 <br class="clear" /> 178 </div> 179 <?php 180 if ($which == 'bottom') { 181 echo '</form>'; 163 $output .= '<form method="get" action="' . esc_url(admin_url('admin.php?page=' . FASTPIXEL_TEXTDOMAIN)) . '">'; 182 164 } 165 $output .= $this->display_search($which); 166 $output .= '<div class="tablenav ' . esc_attr($which) . '"> 167 <input type="hidden" name="page" value="' . esc_html(FASTPIXEL_TEXTDOMAIN) . '" /> 168 ' . (isset($orderby) && $orderby ? '<input type="hidden" name="orderby" value="' . esc_html($orderby) . '" />' : '') 169 . (isset($order) && $order ? '<input type="hidden" name="order" value="' . esc_html($order) . '" />' : ''); 170 if ($this->has_items()) { 171 $output .= '<div class="alignleft actions bulkactions">'; 172 ob_start(); 173 $this->bulk_actions($which); 174 $output .= ob_get_clean(); 175 $output .= '</div>'; 176 } 177 $output .= $this->extra_tablenav($which); 178 ob_start(); 179 $this->pagination($which); 180 $output .= ob_get_clean(); 181 $output .= '<br class="clear" /></div>'; 182 if ($which == 'bottom') { 183 $output .= '</form>'; 184 } 185 $output = apply_filters('fastpixel/status_page/tablenav', $output, $which); 186 echo $output; // phpcs:ignore 183 187 } 184 188 … … 187 191 switch ($which) { 188 192 case 'top': 189 $this->display_posts_filter('posts_filter');193 return $this->display_posts_filter('posts_filter'); 190 194 break; 191 195 case 'bottom': … … 201 205 } 202 206 $options = apply_filters('fastpixel/status_page/options', '', $this->selected_post_type); 203 echo wp_kses('<div class="alignleft actions"> 204 <select name="ptype">'.$options.'</select> 205 <input type="submit" value="' .esc_html__('Filter', 'fastpixel-website-accelerator') . '" class="button action"/> 206 </div>', ['div' => ['class' => []], 'select' => ['name' =>[]], 'option' => ['value' => [], 'selected' => []], 'optgroup' => ['label' => []], 'input' => ['type' => [], 'value' => [], 'class' => []]]); 207 $output = '<div class="fastpixel-post-types-selector-container alignleft actions">'; 208 $output .= '<select name="ptype">'.$options.'</select>'; 209 $output .= apply_filters('fastpixel/status_page/extra_filters', ''); 210 $output .= '<input type="submit" value="' .esc_html__('Filter', 'fastpixel-website-accelerator') . '" class="fastpixel-post-types-submit-button button action"/>'; 211 $output .= '</div>'; 212 wp_kses($output, ['div' => ['class' => []], 'select' => ['name' =>[]], 'option' => ['value' => [], 'selected' => []], 'optgroup' => ['label' => []], 'input' => ['type' => [], 'value' => [], 'class' => []]]); 213 $output = apply_filters('fastpixel/status_page/display_posts_filter', $output, ['id' => $id, 'selected_post_type' => $this->selected_post_type]); 214 return $output; 207 215 } 208 216 … … 219 227 { 220 228 $action = array( 221 'reset' => esc_html__('Purge Cache', 'fastpixel-website-accelerator') 229 'purge' => esc_html__('Purge Cache', 'fastpixel-website-accelerator'), 230 'request' => esc_html__('Cache Pages', 'fastpixel-website-accelerator') 222 231 ); 223 232 return $action; … … 235 244 } 236 245 } 237 if ( 'reset' === $action&& !empty($rids)) {246 if (in_array($action, ['purge', 'request']) && !empty($rids)) { 238 247 $statuses_type = apply_filters('fastpixel/backend/bulk/type', false, ['selected_of_type' => $this->selected_post_type]); 239 248 $notices = FASTPIXEL_Notices::get_instance(); … … 285 294 286 295 protected function display_search($which = 'top') { 296 $output = ''; 287 297 //preventing search field display for non-post types lists 288 298 $display_search = apply_filters('fastpixel/status_page/display_search', false); … … 290 300 $post_type_name = apply_filters('fastpixel/status_page/search/post_type_name', __('Posts', 'fastpixel-website-accelerator'), $this->selected_post_type); 291 301 switch ($which) { 292 case 'top': 293 ?> 294 <p class="search-box"> 295 <label class="-reader-text" for="post-search-input"><?php 302 case 'top': 296 303 /* translators: %s is used to display Post type */ 297 printf(esc_html__('Search %s', 'fastpixel-website-accelerator'), esc_html($post_type_name)); ?>:</label> 298 <input type="search" id="post-search-input" name="s" value="<?php echo !empty($this->search) ? esc_attr($this->search) : ''; ?>"> 299 <input type="submit" id="search-submit" class="button" value="<?php 300 /* translators: %s is used to display Post type */ 301 printf(esc_html__('Search %s', 'fastpixel-website-accelerator'), esc_html($post_type_name)); ?>"></p> 302 <?php break; 304 $search_text = sprintf(esc_html__('Search %s', 'fastpixel-website-accelerator'), esc_html($post_type_name)); 305 $output .= '<p class="search-box"><label class="-reader-text" for="post-search-input">' . $search_text . ':</label>'; 306 $output .= '<input type="search" id="post-search-input" name="s" value="' . (!empty($this->search) ? esc_attr($this->search) : '') .'"/> 307 <input type="submit" id="search-submit" class="button" value="' . $search_text . '"></p>'; 308 break; 303 309 case 'bottom': 304 310 break; … … 307 313 } 308 314 } 315 $output = apply_filters('fastpixel/status_page/display_search_html', $output, $which); 316 return $output; 309 317 } 310 318 } -
fastpixel-website-accelerator/trunk/inc/functions.php
r3245943 r3251166 15 15 protected $wp_config_path; 16 16 const FASTPIXEL_CACHE_VAR_NAME = 'WP_CACHE'; 17 protected $match_regexp = '/ \s*?define\(\s*?[\'|"]' . self::FASTPIXEL_CACHE_VAR_NAME . '[\'|"]\s*?,\s*?(true|false)[^\)]*?\)\s*?;/im';17 protected $match_regexp = '/(\s*?)define\(\s*?[\'|"]' . self::FASTPIXEL_CACHE_VAR_NAME . '[\'|"]\s*?,\s*?(true|false)[^\)]*?\)\s*?;/im'; 18 18 19 19 public function __construct() … … 386 386 if (filter_var($matches[1][0], FILTER_VALIDATE_BOOLEAN) != $var_value) { 387 387 //need to update status 388 $wp_config_content_replaced = preg_replace($this->match_regexp, " define(\"" . self::FASTPIXEL_CACHE_VAR_NAME . "\", " . $var_value_str . ");", $wp_config_content);388 $wp_config_content_replaced = preg_replace($this->match_regexp, "$1define(\"" . self::FASTPIXEL_CACHE_VAR_NAME . "\", " . $var_value_str . ");", $wp_config_content); 389 389 $need_save = true; 390 390 } -
fastpixel-website-accelerator/trunk/readme.txt
r3245961 r3251166 5 5 Tested up to: 6.7 6 6 Requires PHP: 5.6 7 Stable tag: 1.0.4 27 Stable tag: 1.0.43 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 201 201 == Changelog == 202 202 203 = 1.0.43 = 204 205 🌍 The Multilingual Performance Update 206 207 Release Date: March 3, 2025 208 209 🚀 New Features 210 211 * TranslatePress Compatibility: FastPixel now fully supports websites using TranslatePress, ensuring seamless optimization for multilingual sites. Your translated pages will now be superfast! 212 213 🛠️ Fixes 214 215 * BugFixes: Various optimizations and refinements to enhance stability and performance. 216 217 Update now to keep your multilingual website running at peak speed! 🚀 218 203 219 = 1.0.42 = 204 220 -
fastpixel-website-accelerator/trunk/vendor/composer/installed.php
r3245950 r3251166 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' f674dcbcf1e0322c5b1ca792141c7e527f3f0e50',6 'reference' => 'bcfe655a7a8207ebf8105d77dd6b0633a4d9ccf5', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' f674dcbcf1e0322c5b1ca792141c7e527f3f0e50',16 'reference' => 'bcfe655a7a8207ebf8105d77dd6b0633a4d9ccf5', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.