Changeset 2535299
- Timestamp:
- 05/21/2021 08:35:48 AM (5 years ago)
- Location:
- wp-lozad/trunk
- Files:
-
- 3 edited
-
classes/FrontPageProcessing.php (modified) (1 diff)
-
lozad.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-lozad/trunk/classes/FrontPageProcessing.php
r2400514 r2535299 14 14 private function handle() 15 15 { 16 add_action('wp_enqueue_scripts', [$this, 'includeLozadJs']); 16 add_action('wp_enqueue_scripts', function () { 17 $pluginOptions = get_option(SettingsConstants::PAGE_SETTING_OPTION_NAME); 17 18 18 //add_filter('the_content', [$this, 'lozadContentProcessing']);19 add_filter('final_output', [$this, 'lozadContentProcessing']);20 }19 $pluginDirUrl = plugin_dir_url(__DIR__); 20 $includeInFooter = isset($pluginOptions[SettingsConstants::SETTING_WHERE_INCLUDE_SCRIPT]) 21 && $pluginOptions[SettingsConstants::SETTING_WHERE_INCLUDE_SCRIPT]; 21 22 22 public function lozadContentProcessing($content) 23 { 24 return (new ContentProcessing($content))->handle(); 25 } 23 wp_enqueue_script('jquery'); 24 wp_register_script('lozad_script', "{$pluginDirUrl}js/lozad.js", ['jquery'], false, $includeInFooter); 25 wp_enqueue_script('lozad_script'); 26 wp_register_script('lozad_init_script', "{$pluginDirUrl}js/initLozad.js", ['jquery','lozad_script'], false, $includeInFooter); 27 wp_enqueue_script('lozad_init_script'); 28 }); 26 29 27 public function includeLozadJs() 28 { 29 $pluginOptions = get_option(SettingsConstants::PAGE_SETTING_OPTION_NAME); 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(); 35 } 30 36 31 $pluginDirUrl = plugin_dir_url(__DIR__); 32 $includeInFooter = isset($pluginOptions[SettingsConstants::SETTING_WHERE_INCLUDE_SCRIPT]) 33 && $pluginOptions[SettingsConstants::SETTING_WHERE_INCLUDE_SCRIPT]; 34 35 wp_enqueue_script('jquery'); 36 wp_register_script('lozad_script', "{$pluginDirUrl}js/lozad.js", ['jquery'], false, $includeInFooter); 37 wp_enqueue_script('lozad_script'); 38 wp_register_script('lozad_init_script', "{$pluginDirUrl}js/initLozad.js", ['jquery','lozad_script'], false, $includeInFooter); 39 wp_enqueue_script('lozad_init_script'); 37 echo is_admin() ? $finalBuffer : (new ContentProcessing($finalBuffer))->handle(); 38 }, 0); 40 39 } 41 40 } -
wp-lozad/trunk/lozad.php
r2530037 r2535299 4 4 Description: lazy loading of images by baroda algorithm 5 5 Author: Evgeniy Kozenok 6 Version: 1.4. 36 Version: 1.4.4 7 7 */ 8 8 -
wp-lozad/trunk/readme.txt
r2530037 r2535299 4 4 Requires at least: 5.0 5 5 Tested up to: 5.5 6 Stable tag: 1.4. 36 Stable tag: 1.4.4 7 7 License: GPL2 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 24 24 25 25 == Changelog == 26 = 1.4.4 = 27 * 2021-05-21: Move base plugin action to wp shutdown action 28 26 29 = 1.4.3 = 27 30 * 2021-05-11: Fix space
Note: See TracChangeset
for help on using the changeset viewer.