Plugin Directory

Changeset 3440599


Ignore:
Timestamp:
01/15/2026 08:35:38 PM (3 months ago)
Author:
bsolveit
Message:

Version 2.0.1: Fix critical settings save error and local fonts AJAX

Location:
365i-performance-optimizer/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 365i-performance-optimizer/trunk/365i-performance-optimizer.php

    r3437152 r3440599  
    44 * Plugin URI: https://www.365i.co.uk/plugins/365i-performance-optimizer
    55 * 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.0
     6 * Version: 2.0.1
    77 * Author: Mark McNeece (365i)
    88 * Author URI: https://www.365i.co.uk/author/mark-mcneece/
     
    2121}
    2222
    23 define( 'I365_PO_VERSION', '2.0.0' );
     23define( 'I365_PO_VERSION', '2.0.1' );
    2424define( 'I365_PO_PLUGIN_FILE', __FILE__ );
    2525define( 'I365_PO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • 365i-performance-optimizer/trunk/includes/class-i365-po-local-fonts.php

    r3437152 r3440599  
    3838     */
    3939    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
    4044        $settings = I365_PO_Plugin::get_settings();
    4145
    42         // Only run if enabled.
     46        // Frontend hooks only run if enabled.
    4347        if ( empty( $settings['local_fonts_enabled'] ) ) {
    4448            return;
     
    5054        add_filter( 'style_loader_src', array( __CLASS__, 'intercept_google_fonts' ), 10, 2 );
    5155        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' ) );
    5656    }
    5757
  • 365i-performance-optimizer/trunk/includes/class-i365-po-plugin.php

    r3437152 r3440599  
    217217        $output['speculation_exclusions'] = array();
    218218        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            }
    220225            foreach ( (array) $exclusions as $path ) {
    221226                $path = sanitize_text_field( $path );
     
    227232        $output['enable_preload'] = ! empty( $input['enable_preload'] );
    228233
    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        }
    235245        $output['preconnect_hosts'] = array();
    236246        foreach ( $hosts as $host ) {
     
    251261        $output['defer_scripts'] = ! empty( $input['defer_scripts'] );
    252262
    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();
    255270        if ( is_array( $handles_raw ) ) {
    256271            foreach ( $handles_raw as $handle ) {
     
    277292        $output['delay_js_timeout'] = max( 1000, min( 30000, $output['delay_js_timeout'] ) );
    278293
    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();
    281301        if ( is_array( $delay_exclude_raw ) ) {
    282302            foreach ( $delay_exclude_raw as $handle ) {
  • 365i-performance-optimizer/trunk/readme.txt

    r3437152 r3440599  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 2.0.0
     7Stable tag: 2.0.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    106106== Changelog ==
    107107
     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
    108113= 2.0.0 =
    109114* NEW: Settings backup system with 5 automatic snapshots and one-click restore.
Note: See TracChangeset for help on using the changeset viewer.