Plugin Directory

Changeset 2250533


Ignore:
Timestamp:
02/26/2020 10:02:49 AM (6 years ago)
Author:
greencp
Message:

v2.2.5: some minor fixes and improvements

Location:
wp-performance-pack/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wp-performance-pack/trunk/admin/class.admin-renderer.php

    r2228316 r2250533  
    112112
    113113    public function render_options() {
     114        wp_localize_script( 'wppp-admin-script', 'wpppData', array( json_encode( array() ) ) ); // to prevent javascript error localize "empty" data
    114115        ?>
    115116        <h3 class="title"><?php _e( 'Modules', 'wp-performance-pack' ); ?></h3>
  • wp-performance-pack/trunk/modules/disable_widgets/class.wppp_disable_widgets.php

    r2235673 r2250533  
    1818    }
    1919
    20     function early_init () {   
     20    function early_init() {
    2121        $this->known_default_widgets = $this->wppp->get_option( 'wppp_known_default_widgets' );
    2222
     
    2525        // This action (function defined in "wp-includes/widgets.php") would try to register all widget classes from "default-widgets.php"
    2626        remove_action( 'init', 'wp_widgets_init', 1 );
    27         // by removing the original action the action "widgets_init" won't be fired
    28         // so always add the override which will at least fire "widgets_init"
    29         add_action( 'init', array( $this, 'init_wp_default_widgets' ), 1 );
    3027    }
    3128
    32     function init_wp_default_widgets() {
    33         // Fires after all default WordPress widgets have been registered.
     29    function init() {
     30        // Load and register only the via WPPP enabled core widgets
    3431        foreach( $this->known_default_widgets as $widget => $files ) {
    3532            if ( !in_array( $widget, $this->wppp->options[ 'disabled_widgets' ] ) ) {
     
    4138        }
    4239
    43         // because "load_default_widgets" in early_init did return false, the widget submenu wasn't added
    44         // so add the menu if any widget was added or if any other plugin or theme already has added a widget
    45         //if ( $this->default_widget_loaded )
    46             add_action( '_admin_menu', 'wp_widgets_add_menu' );
    47        
    48         do_action( 'widgets_init' );   
     40        // Because "load_default_widgets" in early_init did return false, the widget submenu wasn't added yet
     41        add_action( '_admin_menu', 'wp_widgets_add_menu' );
     42
     43        // The "original" action "wp_widgets_init" normally fires the action "widgets_init".
     44        // This hasn't happend yet (because the action was removed in early_init) do so now
     45        do_action( 'widgets_init' );
    4946    }
    5047
  • wp-performance-pack/trunk/modules/disable_widgets/class.wppp_disable_widgets_simple.php

    r2214271 r2250533  
    1212
    1313    public function render_options () {
    14     ?>
     14        wp_localize_script( 'wppp-admin-script', 'wpppData', array( json_encode( array() ) ) ); // to prevent javascript error localize "empty" data
     15        ?>
    1516        <h3 class="title"><?php _e( 'Disable widgets', 'wp-performance-pack' );?></h3>
    1617
     
    2021
    2122        <hr/>
    22     <?php
     23        <?php
    2324    }
    2425}
  • wp-performance-pack/trunk/modules/dynamic_images/class.wppp_dynamic_images.php

    r2240498 r2250533  
    5555   
    5656    function early_init () {
    57         add_action( 'setup_theme',  array( $this, 'replace_wp_rewrite' ) );
     57        if ( $this->wppp->is_network ) {
     58            add_action( 'setup_theme',  array( $this, 'replace_wp_rewrite' ) );
     59        }
    5860    }
    5961
     
    8385
    8486    function replace_wp_rewrite() {
    85         if ( $this->wppp->is_network ) {
    86             include( sprintf( "%s/class.wppp_rewrite.php", dirname( __FILE__ ) ) );
    87             $rewrite = new WPPP_Rewrite();
    88             $rewrite->wppp = $this->wppp;
    89             $GLOBALS['wp_rewrite'] = $rewrite;
    90         }
     87        include( sprintf( "%s/class.wppp_rewrite.php", dirname( __FILE__ ) ) );
     88        $rewrite = new WPPP_Rewrite();
     89        $rewrite->wppp = $this->wppp;
     90        $GLOBALS['wp_rewrite'] = $rewrite;
    9191    }
    9292
  • wp-performance-pack/trunk/modules/l10n_improvements/class.wppp_mo_dynamic.php

    r2235673 r2250533  
    99 * Author: Bjoern Ahrens <bjoern@ahrens.net>
    1010 * Author URI: http://www.bjoernahrens.de
    11  * Version: 2.1.2
     11 * Version: 2.1.3
    1212 */
    1313
     
    120120        $current_url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    121121        if ( ( $len = strlen( $_SERVER['QUERY_STRING'] ) ) > 0 ) {
    122             $current_url = substr ( $current_url, 0, strlen($current_url) - $len - 1 );
     122            $current_url = substr( $current_url, 0, strlen($current_url) - $len - 1 );
    123123        }
    124124        if ( substr( $current_url, -10 ) === '/wp-admin/' ) {
     
    513513        if ( $t !== false ) {
    514514            if ( false !== ( $i = strpos( $t, self::PLURAL_SEP ) ) ) {
    515                 return substr( $t, self::PLURAL_SEP, $i );
     515                return substr( $t, 0, $i );
    516516            } else {
    517517                return $t;
  • wp-performance-pack/trunk/modules/wpfeatures/class.wppp_wpfeatures_simple.php

    r2209823 r2250533  
    1212
    1313    public function render_options () {
    14     ?>
     14        wp_localize_script( 'wppp-admin-script', 'wpppData', array( json_encode( array() ) ) ); // to prevent javascript error localize "empty" data
     15        ?>
    1516        <h3 class="title"><?php _e( 'WordPress features', 'wp-performance-pack' );?></h3>
    1617
     
    2021
    2122        <hr/>
    22     <?php
     23        <?php
    2324    }
    2425}
  • wp-performance-pack/trunk/readme.txt

    r2241642 r2250533  
    44Requires at least: 4.7
    55Tested up to: 5.3.2
    6 Stable tag: 2.2.4
     6Stable tag: 2.2.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    127127== Changelog ==
    128128
     129= 2.2.5 =
     130* Fixed some JavaScript errors in options.
     131* [mo-dynamic] Fixed PHP notice (thanks @erwinbr)
     132* Some minor changes and improvements
     133
    129134= 2.2.4 =
    130135* [dynimg] Delete rewrite rules on plugin deactivation (thanks @lucabarelli)
  • wp-performance-pack/trunk/wp-performance-pack.php

    r2241623 r2250533  
    44    Plugin URI: http://wordpress.org/plugins/wp-performance-pack
    55    Description: Performance optimizations for WordPress. Improve localization performance and image handling, serve images through CDN. 
    6     Version: 2.2.4
     6    Version: 2.2.5
    77    Text Domain: wp-performance-pack
    88    Author: Bj&ouml;rn Ahrens
     
    2525*/
    2626
    27 
     27/**
     28 * Base class for all WPPP modules
     29 * @abstract
     30 */
    2831abstract class WPPP_Module {
    2932    protected $wppp = NULL;
    3033
    31     // return if module is available, i.e. can be activated
    32     public function is_available() { return true; }
    33 
    34     // validate options
    35     // input contains actual input
    36     // output contains the output so far
    37     // unset processed options in input
     34    /**
     35     * Test is the module is available, i.e. are all requirements met in order for the
     36     * module to get activated
     37     *
     38     * @return bool
     39     */
     40     public function is_available() { return true; }
     41
     42    /**
     43     * Validate options. Processed options should get unset in input
     44     *
     45     * @param array input   Contains actual input values
     46     * @param array output  Contains the output so far
     47     * @param array default Default values for this module
     48     */
    3849    public function validate_options( &$input, $output, $default ) {
    3950        foreach ( $default as $optname => $opt ) {
     
    7182    }
    7283
    73     public function __construct ( $parent ) { $this->wppp = $parent; }
    74     // initializations done at WPPP construction
     84    public function __construct( $parent ) { $this->wppp = $parent; }
     85
     86    /**
     87     * Override for initializations at WPPP construction
     88     */
    7589    public function early_init() {}
    76     // initializations done at init action
     90
     91    /**
     92     * Override for initializations at "init" action
     93     */
    7794    public function init() {}
    78     // initializations done at admin_init action
     95
     96    /**
     97     * Override for initializations at "admin_init" action
     98     */
    7999    public function admin_init() {}
    80100
    81101    // admin render functions
    82     public function load_renderer () {}
    83 
    84     public function add_help_tab ( $renderer ) {
     102    public function load_renderer() {}
     103
     104    public function add_help_tab( $renderer ) {
    85105        $this->load_renderer( $renderer->view );
    86106        if ( $this->renderer !== NULL ) {
     
    88108        }
    89109    }
    90     public function render_options ( $renderer ) {
     110    public function render_options( $renderer ) {
    91111        $this->load_renderer( $renderer->view );
    92112        if ( $this->renderer !== NULL ) {
     
    97117
    98118class WP_Performance_Pack {
    99     const cache_group = 'wppp1.0';  // WPPP cache group name = wppp + version of last change to cache. This way no cache conflicts occur while old cache entries just expire.
    100     const wppp_version = '2.2.4';
     119    /**
     120     * WPPP cache group name = wppp + version of last change to cache. This way no cache
     121     * conflicts occur while old cache entries just expire.
     122     *
     123     * @const string
     124     */
     125    const cache_group = 'wppp1.0';
     126
     127    /**
     128     * WPPP version
     129     *
     130     * @const string
     131     */
     132    const wppp_version = '2.2.5';
     133
     134    /**
     135     * Name for WPPP options
     136     *
     137     * @const string
     138     */
    101139    const wppp_options_name = 'wppp_option';
    102140
     
    233271                }
    234272            }
    235            
     273
    236274            // check that WPPP is loaded as first plugin
    237275            self::plugin_load_first();
     
    242280    }
    243281
    244     public function init () {
     282    public function init() {
    245283        // execute "late" updates
    246284        foreach ( $this->late_updates as $updatefunc ) {
Note: See TracChangeset for help on using the changeset viewer.