WordPress.org

Ready to get started?Download WordPress

Forums

WP Smush.it
[resolved] WP Smush.it and $wp_file_descriptions conflict (4 posts)

  1. Jesin A
    Member
    Posted 11 months ago #

    After enabling this plugin the "Theme Editor" administration screen doesn't display the names of templates.

    Taking a look at this screenshot will make understanding easier.

    This is because wp-smushit.php contains the following code in lines 48-50

    if ( !function_exists( 'download_url' ) ) {
    require_once( ABSPATH . 'wp-admin/includes/file.php' );
    }

    This included file contains a function get_file_description($file). Passing the name of a theme file gets the description of it. This function retrieves the description from an array variable of "global" scope called $wp_file_description.

    Since wp-admin/includes/file.php is being included inside the WpSmushit class, this array variable loses its global scope. So get_file_description() simply returns the name of the file back.

    This issue can be fixed by moving the above mentioned code to the top of the file before class_exists check. So the new file will look as follows

    /*
    Plugin details and license stuff
    */
    if ( !function_exists( 'download_url' ) ) {
    	require_once( ABSPATH . 'wp-admin/includes/file.php' );
    }
    
    if ( !class_exists( 'WpSmushit' ) ) {
    
    class WpSmushit {
    /*Rest of the code continues here*/

    Request WPMUDEV and Alex Dunae to make this change in the next version.

    http://wordpress.org/plugins/wp-smushit/

  2. WPMUDEV
    WPMU DEV Support Staff
    Plugin Author

    Posted 11 months ago #

    @jesin,

    Yep. good catch. Not sure why the previous developer put this inside the constructor function. Working on some other reported bug related to Windows paths. Will include this changes in the upcoming 1.6.5.2 should be in the next few days.

  3. Jesin A
    Member
    Posted 11 months ago #

    Thanks for fixing it in version 1.6.5.2

    Works great now!

  4. Mike
    WPMU DEV Support Staff
    Posted 11 months ago #

    Awesome, thanks for letting us know :-)

Reply

You must log in to post.

About this Plugin

About this Topic