Changeset 3255528
- Timestamp:
- 03/13/2025 05:43:22 PM (10 months ago)
- Location:
- fastpixel-website-accelerator/trunk
- Files:
-
- 8 edited
-
fastpixel.php (modified) (2 diffs)
-
inc/backend/controllers/cache.php (modified) (6 diffs)
-
inc/backend/controllers/classes/post-types-statuses.php (modified) (2 diffs)
-
inc/classes/local-cache.php (modified) (1 diff)
-
inc/functions.php (modified) (4 diffs)
-
inc/url.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fastpixel-website-accelerator/trunk/fastpixel.php
r3251166 r3255528 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 37 * Version: 1.0.44 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 3');23 define('FASTPIXEL_VERSION', '1.0.44'); 24 24 define('FASTPIXEL_NAME', 'FastPixel'); 25 25 if (!defined('FASTPIXEL_PLUGIN_DIR')) -
fastpixel-website-accelerator/trunk/inc/backend/controllers/cache.php
r3251166 r3255528 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_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']); 271 add_action('activated_plugin', function(string $plugin, bool $network_wide) { 272 $this->purge_all_with_message_no_request(); 273 }, 10, 2); 274 add_action('deactivated_plugin', function (string $plugin, bool $network_wide) { 275 $this->purge_all_with_message_no_request(); 276 }, 10, 2); 277 add_action('after_switch_theme', function(string $old_name, \WP_Theme $old_theme) 278 { 279 $this->purge_all_with_message_no_request(); 280 }, 10, 2); 274 281 add_action('upgrader_process_complete', [$this, 'check_upgraded'], 10, 2); 282 /* 283 * Different update hooks 284 */ 285 add_action('wp_update_nav_menu', function(int $menu_id, array $menu_data) { 286 $this->purge_all_with_message_no_request(); 287 }, 10, 2); // When a custom menu is update. 288 add_action('update_option_sidebars_widgets', function($old_value, $value, string $option) { 289 $this->purge_all_with_message_no_request(); 290 }, 10, 3); // When you change the order of widgets. 291 add_action('update_option_category_base', function ($old_value, $value, string $option) { 292 $this->purge_all_with_message_no_request(); 293 }, 10, 3); // When category permalink is updated. 294 add_action('update_option_tag_base', function ($old_value, $value, string $option) { 295 $this->purge_all_with_message_no_request(); 296 }, 10, 3); // When tag permalink is updated. 297 add_action('add_link', function (int $link_id) { 298 $this->purge_all_with_message_no_request(); 299 }, 10, 1); // When a link is added. 300 add_action('edit_link', function (int $link_id) { 301 $this->purge_all_with_message_no_request(); 302 }, 10, 1); // When a link is updated. 303 add_action('delete_link', function (int $link_id) { 304 $this->purge_all_with_message_no_request(); 305 }, 10, 1); // When a link is deleted. 306 add_action('customize_save', function (\WP_Customize_Manager $manager) { 307 $this->purge_all_with_message_no_request(); 308 }, 10, 1); // When customizer is saved. 275 309 } 276 310 … … 757 791 if ($diag->run_activation_tests()) { 758 792 $this->functions->update_ac_file(); 793 $this->purge_all_with_message_no_request(); 759 794 } 760 795 return $new; … … 831 866 } 832 867 833 public function check_upgraded( $upgrader,$extra)868 public function check_upgraded(\WP_Upgrader $upgrader, array $extra) 834 869 { 835 870 if ($this->debug) { … … 840 875 $run_purge = false; 841 876 $skin = $upgrader->skin; 842 $purge_message = __('Cache has been cleared!', 'fastpixel-website-accelerator');843 877 if ($extra['type'] === 'plugin') { 844 878 if (property_exists($skin, 'plugin_active') && $skin->plugin_active) { 845 $run_purge = true; 879 if (property_exists($skin, 'result') && !empty($skin->result['destination_name']) && $skin->result['destination_name'] != FASTPIXEL_TEXTDOMAIN) { 880 $run_purge = true; 881 } 846 882 } 847 883 } … … 859 895 } 860 896 if ($run_purge) { 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'); 882 } 883 } 884 885 public function purge_all_without_request() 897 $this->purge_all_with_message_no_request(); 898 } 899 } 900 901 public function purge_all_with_message_no_request(bool $display_message = true, string $message = '') 886 902 { 887 903 if ($this->debug) { … … 894 910 add_filter('fastpixel/purge_all/clear_cache_folder', function () { 895 911 return false; }); 896 return $this->purge_all(); 912 if ($this->purge_all()) { 913 if ($display_message) { 914 if (empty($message)) { 915 $purge_message = __('Cache has been cleared!', 'fastpixel-website-accelerator'); 916 } else { 917 $purge_message = $message; 918 } 919 $notices = FASTPIXEL_Notices::get_instance(); 920 $notices->add_flash_notice($purge_message, 'success', false, 'purge-all-notice'); 921 } 922 return true; 923 } 924 return false; 897 925 } 898 926 } -
fastpixel-website-accelerator/trunk/inc/backend/controllers/classes/post-types-statuses.php
r3251166 r3255528 134 134 $cache_status = $this->be_functions->cache_status_display($url, $status_data); 135 135 $extra_pages[] = [ 136 'ID' => 'homepage', 137 'post_title' => esc_html__('Homepage', 'fastpixel-website-accelerator'), 138 'url' => $url, 139 'cache_status' => $cache_status['status_display'], 140 'cachestatus' => $cache_status['status'], 141 'display_status' => '<b>published</b>', 142 'post_status' => 'publish' 136 'ID' => 'homepage', 137 'post_title' => esc_html__('Homepage', 'fastpixel-website-accelerator'), 138 'url' => $url, 139 'cache_status' => $cache_status['status_display'], 140 'cachestatus' => $cache_status['status'], 141 'display_status' => '<b>published</b>', 142 'html_created_time' => $cache_status['html_created_time'], 143 'post_status' => 'publish' 143 144 ]; 144 145 } … … 170 171 $purge_id = $item['ID']; 171 172 //setting links for homepage 172 if ( $item['ID'] == null&& $item['post_title'] == 'Homepage') {173 if (($item['ID'] == null || $item['ID'] == 'homepage') && $item['post_title'] == 'Homepage') { 173 174 $purge_id = 'homepage'; 174 175 $link = get_home_url(); 175 176 } 176 $edit_link = get_edit_post_link($item['ID']); 177 if (is_numeric($item['ID'])) { 178 $edit_link = get_edit_post_link($item['ID']); 179 } else { 180 $edit_link = ''; 181 } 177 182 $purge_link = sprintf('admin-post.php?action=%1$s&nonce=%2$s&id=%3$s&type=%4$s&selected_of_type=%5$s', 'fastpixel_admin_purge_cache', $this->nonce, $purge_id, $this->type, $this->selected_post_type); 178 183 //actions -
fastpixel-website-accelerator/trunk/inc/classes/local-cache.php
r3223801 r3255528 19 19 $this->functions = FASTPIXEL_Functions::get_instance(); 20 20 $this->config = FASTPIXEL_Config_Model::get_instance(); 21 //starting output beffering on fastpixel/init 22 add_action('fastpixel/cachefiles/exists', function($exists = false) { 23 if (!$exists) { 24 if ($this->debug) { 25 FASTPIXEL_Debug::log('Class FASTPIXEL_Local_Cache: Starting output buffering', $_SERVER['REQUEST_URI']); 21 //starting output beffering on fastpixel/init, also checking if user is not logged in 22 if (!$this->functions->user_is_logged_in()) { 23 add_action('fastpixel/cachefiles/exists', function($exists = false) { 24 if (!$exists) { 25 if ($this->debug) { 26 FASTPIXEL_Debug::log('Class FASTPIXEL_Local_Cache: Starting output buffering', $_SERVER['REQUEST_URI']); 27 } 28 ob_start(); //starting buffering output 29 add_action('fastpixel/shutdown', [$this, 'get_buffer'], 10); //getting buffer into variable 30 add_action('fastpixel/shutdown/request/before', [$this, 'save'], 10, 1); //saving buffer to file, if page passed validation 26 31 } 27 ob_start(); //starting buffering output 28 add_action('fastpixel/shutdown', [$this, 'get_buffer'], 10); //getting buffer into variable 29 add_action('fastpixel/shutdown/request/before', [$this, 'save'], 10, 1); //saving buffer to file, if page passed validation 30 } 31 }); 32 }); 33 } 32 34 add_action('fastpixel/cachefiles/saved', [$this, 'delete_file_on_api_request'], 10, 1); 33 35 add_action('fastpixel/post/trashed', [$this, 'delete_file_on_trashed'], 10, 1); -
fastpixel-website-accelerator/trunk/inc/functions.php
r3251166 r3255528 184 184 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- none available before WordPress is loaded. 185 185 $meta = json_decode(file_get_contents($meta_file), true); //phpcs:ignore 186 if (empty($meta)) { //duplicate initialization in case file was broken or json_decode returned null 187 $meta = [ 188 'invalidated_time' => 0, 189 'cache_request_time' => 0 190 ]; 191 } 186 192 $data['local_invalidation_time'] = $meta['invalidated_time']; 187 193 $data['last_cache_request_time'] = $meta['cache_request_time']; … … 232 238 $meta = ['invalidated_time' => false, 'cache_request_time' => false]; 233 239 if (file_exists($cache_dir . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . 'meta')) { 240 $loaded_meta = json_decode(file_get_contents($cache_dir . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . 'meta'), true); 241 if (empty($loaded_meta)) { 242 $loaded_meta = []; 243 } 234 244 //can't use native WP functions because file is included early in advanced-cache.php 235 245 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- none available before WordPress is loaded. 236 $meta = array_merge($meta, json_decode(file_get_contents($cache_dir . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . 'meta'), true)); //phpcs:ignore246 $meta = array_merge($meta, $loaded_meta); //phpcs:ignore 237 247 } 238 248 if ($invalidated) { … … 382 392 $var_value_str = $var_value == true ? 'true' : 'false'; 383 393 //checking if entry already exists 384 if (!empty($matches[0][0]) && !empty($matches[ 1][0])) {394 if (!empty($matches[0][0]) && !empty($matches[2][0])) { 385 395 //entry exists, checking status 386 if (filter_var($matches[ 1][0], FILTER_VALIDATE_BOOLEAN) != $var_value) {396 if (filter_var($matches[2][0], FILTER_VALIDATE_BOOLEAN) != $var_value) { 387 397 //need to update status 388 398 $wp_config_content_replaced = preg_replace($this->match_regexp, "$1define(\"" . self::FASTPIXEL_CACHE_VAR_NAME . "\", " . $var_value_str . ");", $wp_config_content); … … 425 435 } 426 436 } 427 $url = new FASTPIXEL_Url($url); 437 if (!is_a($url, 'FASTPIXEL\FASTPIXEL_Url')) { 438 $url = new FASTPIXEL_Url($url); 439 } 428 440 $dirs = explode(DIRECTORY_SEPARATOR, $url->get_url_path()); 429 441 $path = $cache_dir; -
fastpixel-website-accelerator/trunk/inc/url.php
r3245943 r3255528 209 209 (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] ? $functions->sanitize_text_field($_SERVER['HTTP_X_FORWARDED_PROTO']) : 210 210 (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] ? $functions->sanitize_text_field($_SERVER['REQUEST_SCHEME']) : 211 (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https' : 'http'))) . '://' . $functions->sanitize_text_field($this->get_request_host_name()) . '/' . $functions->sanitize_text_field(ltrim( $_SERVER['REQUEST_URI'], '/')));211 (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https' : 'http'))) . '://' . $functions->sanitize_text_field($this->get_request_host_name()) . '/' . $functions->sanitize_text_field(ltrim(!empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '', '/'))); 212 212 } 213 213 public function get_path() -
fastpixel-website-accelerator/trunk/readme.txt
r3251166 r3255528 5 5 Tested up to: 6.7 6 6 Requires PHP: 5.6 7 Stable tag: 1.0.4 37 Stable tag: 1.0.44 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 🔄 The Smarter Cache Update 204 205 = 1.0.44 = 206 207 🚀 Enhancements 208 209 * Improved Automatic Cache Purging: Introduced new hooks to ensure fresh content is always served after changes, making your site even more responsive and up-to-date. 210 211 🛠️ Fixes & Improvements 212 213 * Bug Fixes: Resolved various issues for better stability and performance. 214 215 Update now to keep your site lightning-fast with smarter cache management! 🚀 216 203 217 = 1.0.43 = 204 218 -
fastpixel-website-accelerator/trunk/vendor/composer/installed.php
r3251166 r3255528 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' bcfe655a7a8207ebf8105d77dd6b0633a4d9ccf5',6 'reference' => '12cc62107ef979074d4d13b1b8f3619fcb393a19', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' bcfe655a7a8207ebf8105d77dd6b0633a4d9ccf5',16 'reference' => '12cc62107ef979074d4d13b1b8f3619fcb393a19', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.