Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter tomaskavalek

    (@tomaskavalek)

    Hi,

    thank you very much. It’s exactly filter what I need. Well done. I don’t understand how I could miss that.

    Thanks a lot.

    Sometimes I see same problem. .htaccess is writable, file owners and permission is OK.

    Thread Starter tomaskavalek

    (@tomaskavalek)

    If you run update from /update-core.php, there is a iframe, which contains upgrade messages and progress. In this iframe (update.php?action=update-selected...), there is script at the bottom, which include this – /load-scripts.php?c=0&load%5B%5D=hoverIntent,common,underscore,wp-util,wp-a11y,updates&ver=4.9.2'.

    It’s genereted by iframe_footer() from wp-admin/includes/template.php.

    I tried to use a lot of filter hooks, but without expected result.

    Hope this works, but no replacing the content from iframe_footer():

    
    add_filter('wp-hide/ob_start_callback', function ($buffer) {
        global $wph;
    
        $admin_url = $wph->functions->get_module_item_setting('admin_url');
    
        return str_replace('/wp-admin', '/' . $admin_url, $buffer);
    });
    

    So for my testing, with expected result, I hardcored this:

    
    function wp_hide_print_scripts()
    {
        global $wp_scripts, $compress_scripts, $wph;
    
        $admin_url = $wph->functions->get_module_item_setting('admin_url');
    
        $zip = $compress_scripts ? 1 : 0;
        if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
            $zip = 'gzip';
        }
    
        if ($concat = trim($wp_scripts->concat, ', ')) {
    
            if ( ! empty($wp_scripts->print_code)) {
                echo "\n<script type='text/javascript'>\n";
                echo "/* <![CDATA[ */\n"; // not needed in HTML 5
                echo $wp_scripts->print_code;
                echo "/* ]]> */\n";
                echo "</script>\n";
            }
    
            $concat = str_split($concat, 128);
            $concat = 'load%5B%5D=' . implode('&load%5B%5D=', $concat);
    
            $src = $wp_scripts->base_url . "/{$admin_url}/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
            echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
        }
    
        if ( ! empty($wp_scripts->print_html)) {
            echo $wp_scripts->print_html;
        }
    }
    
    add_filter('print_footer_scripts', 'wp_hide_print_scripts');
    

    And it works well.

    Is it good described now? Looks like the problem is in AJAX (iframe) upgrading of plugins/templates/languages.

    [ Please do not bump. ]

    Thread Starter tomaskavalek

    (@tomaskavalek)

    Especially script-loader.php at the bottom of the page. Still loading from WP-admin.

Viewing 4 replies - 1 through 4 (of 4 total)