• To the developers,

    This plugin makes a lot of HTTP requests to open config files of available themes, but the function wp_remote_get() is unnecessary as these files are in local directories. The PHP function file_get_contents() should be use instead in theses functions: Theme_Manager->get_available_theme_settings(), Theme_Manager->get_theme_dir(), Theme_Manager->get_themes_from_uploads(), Theme_Manager->get_theme_preview_url() and Theme_Manager->get_theme_index_file().

    Here and example of the change:

    
    foreach ( $theme_dirs as $theme_dir ) {
        //$config_theme_url = str_replace( RMP_PLUGIN_PATH_V4, RMP_PLUGIN_URL_V4, $theme_dir );
        //$config_theme_url = str_replace( $theme_dir_path, $upload_theme_url, $config_theme_url );
        //$config_file      = wp_remote_get( $config_theme_url . '/config.json' );
        $config_file      = file_get_content( $theme_dir . '/config.json' );
        if ( is_array( $config_file ) && ! is_wp_error( $config_file ) ) {
            //$config = json_decode( $config_file['body'], true );
            $config = json_decode( $config_file, true );
            if ( $config['name'] === $theme_name ) {
                $min_version  = ! empty( $config['min_rm_version'] ) ? $config['min_rm_version'] : '4.0.0';
                //$options_file = wp_remote_get( $config_theme_url . '/options.json' );
                $options_file = file_get_contents( $theme_dir . '/options.json' );
                if ( is_array( $options_file ) && ! is_wp_error( $options_file ) ) {
                    //$options = json_decode( $options_file['body'], true );
                    $options = json_decode( $options_file, true );
                }
                break;
            }
        }
    }

    Kind regards

Viewing 1 replies (of 1 total)
  • Hi Benjamin Danon,

    This issue has been fixed in the latest plugin update. I request you to update RM to its latest version (v4.1.9) and check.
    Do let me know if you still face the issue.

    Regards,
    Sumit

Viewing 1 replies (of 1 total)
  • The topic ‘Unnecessary HTTP requests to theme config files’ is closed to new replies.