Changeset 3440599
- Timestamp:
- 01/15/2026 08:35:38 PM (3 months ago)
- Location:
- 365i-performance-optimizer/trunk
- Files:
-
- 4 edited
-
365i-performance-optimizer.php (modified) (2 diffs)
-
includes/class-i365-po-local-fonts.php (modified) (2 diffs)
-
includes/class-i365-po-plugin.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
365i-performance-optimizer/trunk/365i-performance-optimizer.php
r3437152 r3440599 4 4 * Plugin URI: https://www.365i.co.uk/plugins/365i-performance-optimizer 5 5 * Description: Comprehensive performance optimization for WordPress: speculation rules, script deferral/delay, local fonts, database cleanup, WooCommerce optimization, and more. Elementor-safe with per-page overrides. 6 * Version: 2.0. 06 * Version: 2.0.1 7 7 * Author: Mark McNeece (365i) 8 8 * Author URI: https://www.365i.co.uk/author/mark-mcneece/ … … 21 21 } 22 22 23 define( 'I365_PO_VERSION', '2.0. 0' );23 define( 'I365_PO_VERSION', '2.0.1' ); 24 24 define( 'I365_PO_PLUGIN_FILE', __FILE__ ); 25 25 define( 'I365_PO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
365i-performance-optimizer/trunk/includes/class-i365-po-local-fonts.php
r3437152 r3440599 38 38 */ 39 39 public static function init() { 40 // AJAX handlers must always be registered so admin can download fonts. 41 add_action( 'wp_ajax_i365_po_download_fonts', array( __CLASS__, 'ajax_download_fonts' ) ); 42 add_action( 'wp_ajax_i365_po_clear_fonts', array( __CLASS__, 'ajax_clear_fonts' ) ); 43 40 44 $settings = I365_PO_Plugin::get_settings(); 41 45 42 // Only run if enabled.46 // Frontend hooks only run if enabled. 43 47 if ( empty( $settings['local_fonts_enabled'] ) ) { 44 48 return; … … 50 54 add_filter( 'style_loader_src', array( __CLASS__, 'intercept_google_fonts' ), 10, 2 ); 51 55 add_action( 'wp_print_styles', array( __CLASS__, 'dequeue_google_fonts' ), 100 ); 52 53 // AJAX handler for manual font download.54 add_action( 'wp_ajax_i365_po_download_fonts', array( __CLASS__, 'ajax_download_fonts' ) );55 add_action( 'wp_ajax_i365_po_clear_fonts', array( __CLASS__, 'ajax_clear_fonts' ) );56 56 } 57 57 -
365i-performance-optimizer/trunk/includes/class-i365-po-plugin.php
r3437152 r3440599 217 217 $output['speculation_exclusions'] = array(); 218 218 if ( ! empty( $input['speculation_exclusions'] ) ) { 219 $exclusions = preg_split( '/[\r\n,]+/', $input['speculation_exclusions'], -1, PREG_SPLIT_NO_EMPTY ); 219 $exclusions_input = $input['speculation_exclusions']; 220 if ( is_array( $exclusions_input ) ) { 221 $exclusions = array_filter( $exclusions_input ); 222 } else { 223 $exclusions = preg_split( '/[\r\n,]+/', $exclusions_input, -1, PREG_SPLIT_NO_EMPTY ); 224 } 220 225 foreach ( (array) $exclusions as $path ) { 221 226 $path = sanitize_text_field( $path ); … … 227 232 $output['enable_preload'] = ! empty( $input['enable_preload'] ); 228 233 229 $hosts = array_filter( 230 array_map( 231 'trim', 232 preg_split( '/[\r\n,]+/', $input['preconnect_hosts'] ?? '', -1, PREG_SPLIT_NO_EMPTY ) 233 ) 234 ); 234 $hosts_input = $input['preconnect_hosts'] ?? ''; 235 if ( is_array( $hosts_input ) ) { 236 $hosts = array_filter( array_map( 'trim', $hosts_input ) ); 237 } else { 238 $hosts = array_filter( 239 array_map( 240 'trim', 241 preg_split( '/[\r\n,]+/', $hosts_input, -1, PREG_SPLIT_NO_EMPTY ) 242 ) 243 ); 244 } 235 245 $output['preconnect_hosts'] = array(); 236 246 foreach ( $hosts as $host ) { … … 251 261 $output['defer_scripts'] = ! empty( $input['defer_scripts'] ); 252 262 253 $handles_raw = preg_split( '/[\r\n,]+/', $input['excluded_defer_handles'] ?? '', -1, PREG_SPLIT_NO_EMPTY ); 254 $handles = array(); 263 $handles_input = $input['excluded_defer_handles'] ?? ''; 264 if ( is_array( $handles_input ) ) { 265 $handles_raw = array_filter( $handles_input ); 266 } else { 267 $handles_raw = preg_split( '/[\r\n,]+/', $handles_input, -1, PREG_SPLIT_NO_EMPTY ); 268 } 269 $handles = array(); 255 270 if ( is_array( $handles_raw ) ) { 256 271 foreach ( $handles_raw as $handle ) { … … 277 292 $output['delay_js_timeout'] = max( 1000, min( 30000, $output['delay_js_timeout'] ) ); 278 293 279 $delay_exclude_raw = preg_split( '/[\r\n,]+/', $input['delay_js_exclude'] ?? '', -1, PREG_SPLIT_NO_EMPTY ); 280 $delay_exclude = array(); 294 $delay_input = $input['delay_js_exclude'] ?? ''; 295 if ( is_array( $delay_input ) ) { 296 $delay_exclude_raw = array_filter( $delay_input ); 297 } else { 298 $delay_exclude_raw = preg_split( '/[\r\n,]+/', $delay_input, -1, PREG_SPLIT_NO_EMPTY ); 299 } 300 $delay_exclude = array(); 281 301 if ( is_array( $delay_exclude_raw ) ) { 282 302 foreach ( $delay_exclude_raw as $handle ) { -
365i-performance-optimizer/trunk/readme.txt
r3437152 r3440599 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2.0. 07 Stable tag: 2.0.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 106 106 == Changelog == 107 107 108 = 2.0.1 = 109 * FIX: Critical error when saving settings due to preg_split receiving array instead of string. 110 * FIX: Local Fonts download button now works even when feature is disabled. 111 * FIX: Documented pro-elements-handlers exclusion needed for Elementor Pro nav menus with JS delay. 112 108 113 = 2.0.0 = 109 114 * NEW: Settings backup system with 5 automatic snapshots and one-click restore.
Note: See TracChangeset
for help on using the changeset viewer.