Plugin Directory

Changeset 2536446


Ignore:
Timestamp:
05/24/2021 12:17:26 PM (5 years ago)
Author:
john1302
Message:

Use different lozadContentProcessing actions on different case

Location:
wp-lozad/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-lozad/trunk/classes/FrontPageProcessing.php

    r2535299 r2536446  
    2828        });
    2929
    30         ob_start();
    31         add_action('shutdown', function() {
    32             $finalBuffer = '';
    33             for ($i = 0, $levels = ob_get_level(); $i < $levels; $i++) {
    34                 $finalBuffer .= ob_get_clean();
     30        add_action('plugins_loaded', function () {
     31            if (is_admin()) {
     32                return true;
    3533            }
    3634
    37             echo is_admin() ? $finalBuffer : (new ContentProcessing($finalBuffer))->handle();
    38         }, 0);
     35            global $cache_enabled;
     36            if (has_filter('final_output')) {
     37                add_filter('final_output', [$this, 'lozadContentProcessing']);
     38            } elseif (
     39                $cache_enabled
     40                && function_exists('wp_cache_user_agent_is_rejected') && !wp_cache_user_agent_is_rejected()
     41                && function_exists('wpsc_is_backend') && !wpsc_is_backend()
     42            ) {
     43                add_filter('wp_cache_ob_callback_filter', [$this, 'lozadContentProcessing']);
     44            } else {
     45                add_action('template_redirect', [$this, 'lozadContentProcessing']);
     46            }
     47            return true;
     48        }) ;
     49    }
     50
     51    public function lozadContentProcessing($content)
     52    {
     53        return (new ContentProcessing($content))->handle();
    3954    }
    4055}
  • wp-lozad/trunk/lozad.php

    r2535299 r2536446  
    44Description: lazy loading of images by baroda algorithm
    55Author: Evgeniy Kozenok
    6 Version: 1.4.4
     6Version: 1.4.5
    77*/
    88
  • wp-lozad/trunk/readme.txt

    r2535299 r2536446  
    44Requires at least: 5.0
    55Tested up to: 5.5
    6 Stable tag: 1.4.4
     6Stable tag: 1.4.5
    77License: GPL2
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2424
    2525== Changelog ==
     26= 1.4.5 =
     27* 2021-05-24: Use different  lozadContentProcessing actions on different case
     28
    2629= 1.4.4 =
    2730* 2021-05-21: Move base plugin action to wp shutdown action
Note: See TracChangeset for help on using the changeset viewer.