Changeset 1794220
- Timestamp:
- 12/29/2017 02:48:58 PM (8 years ago)
- Location:
- ttfb-toolkit
- Files:
-
- 50 added
- 3 edited
-
tags/1.0 (added)
-
tags/1.0/LICENSE (added)
-
tags/1.0/README.md (added)
-
tags/1.0/assets (added)
-
tags/1.0/assets/css (added)
-
tags/1.0/assets/css/alerts.css (added)
-
tags/1.0/assets/css/alerts.min.css (added)
-
tags/1.0/includes (added)
-
tags/1.0/includes/alerts.php (added)
-
tags/1.0/includes/author (added)
-
tags/1.0/includes/author/widget.php (added)
-
tags/1.0/includes/controls (added)
-
tags/1.0/includes/controls/html-control.php (added)
-
tags/1.0/includes/font-awesome.php (added)
-
tags/1.0/includes/hooks.php (added)
-
tags/1.0/includes/performance (added)
-
tags/1.0/includes/performance/clean.php (added)
-
tags/1.0/includes/performance/lazyload.php (added)
-
tags/1.0/includes/performance/metabox-options.php (added)
-
tags/1.0/includes/performance/performance-init.php (added)
-
tags/1.0/includes/performance/preload.php (added)
-
tags/1.0/includes/sharing (added)
-
tags/1.0/includes/sharing/controls.php (added)
-
tags/1.0/includes/sharing/functions.php (added)
-
tags/1.0/includes/sharing/sharing.php (added)
-
tags/1.0/includes/sharing/widget.php (added)
-
tags/1.0/readme.txt (added)
-
tags/1.0/ttfb-toolkit.php (added)
-
tags/1.0/vendor (added)
-
tags/1.0/vendor/fontawesome (added)
-
tags/1.0/vendor/fontawesome/fa-brands.js (added)
-
tags/1.0/vendor/fontawesome/fa-brands.min.js (added)
-
tags/1.0/vendor/fontawesome/fa-regular.js (added)
-
tags/1.0/vendor/fontawesome/fa-regular.min.js (added)
-
tags/1.0/vendor/fontawesome/fa-solid.js (added)
-
tags/1.0/vendor/fontawesome/fa-solid.min.js (added)
-
tags/1.0/vendor/fontawesome/fa-v4-shims.js (added)
-
tags/1.0/vendor/fontawesome/fa-v4-shims.min.js (added)
-
tags/1.0/vendor/fontawesome/fontawesome-all.js (added)
-
tags/1.0/vendor/fontawesome/fontawesome-all.min.js (added)
-
tags/1.0/vendor/fontawesome/fontawesome.js (added)
-
tags/1.0/vendor/fontawesome/fontawesome.min.js (added)
-
tags/1.0/vendor/lazysizes (added)
-
tags/1.0/vendor/lazysizes/lazysizes-all.js (added)
-
tags/1.0/vendor/lazysizes/lazysizes-all.min.js (added)
-
tags/1.0/vendor/lazysizes/plugins (added)
-
tags/1.0/vendor/lazysizes/plugins/bgset (added)
-
tags/1.0/vendor/lazysizes/plugins/bgset/ls.bgset.min.js (added)
-
tags/1.0/vendor/lazysizes/plugins/respimg (added)
-
tags/1.0/vendor/lazysizes/plugins/respimg/ls.respimg.min.js (added)
-
trunk/includes/performance/lazyload.php (modified) (8 diffs)
-
trunk/includes/performance/performance-init.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ttfb-toolkit/trunk/includes/performance/lazyload.php
r1790790 r1794220 73 73 74 74 /* 75 * Detect on page lazyload disabled 76 */ 77 add_action('wp', 'ttfb_toolkit_on_page_lazyload_ off');78 function ttfb_toolkit_on_page_lazyload_ off(){75 * Detect on page lazyload disabled for image 76 */ 77 add_action('wp', 'ttfb_toolkit_on_page_lazyload_image_disabled'); 78 function ttfb_toolkit_on_page_lazyload_image_disabled(){ 79 79 if( !is_page() && !is_single() ){ return; } 80 80 81 81 global $post; 82 82 if( is_object( $post ) && get_post_meta($post->ID, 'ttfb_toolkit_options_disable_image_lazy_load', true) ){ 83 add_filter( 'do_ttfb_toolkit_lazyload', '__return_false' ); 83 add_filter( 'do_ttfb_toolkit_lazyload_image', '__return_false' ); 84 } 85 } 86 87 /* 88 * Detect on page lazyload disabled for iframe 89 */ 90 add_action('wp', 'ttfb_toolkit_on_page_lazyload_iframe_disabled'); 91 function ttfb_toolkit_on_page_lazyload_iframe_disabled(){ 92 if( !is_page() && !is_single() ){ return; } 93 94 global $post; 95 if( is_object( $post ) && get_post_meta($post->ID, 'ttfb_toolkit_options_disable_iframe_lazy_load', true) ){ 96 add_filter( 'do_ttfb_toolkit_lazyload_iframe', '__return_false' ); 84 97 } 85 98 } … … 99 112 100 113 if ( ! get_option('ttfb_toolkit_perf_lazyload_img', false) || 101 ! apply_filters( 'do_ttfb_toolkit_lazyload ', true ) ||114 ! apply_filters( 'do_ttfb_toolkit_lazyload_image', true ) || 102 115 is_admin() || 103 116 ttfb_toolkit_is_rest() ) { … … 180 193 */ 181 194 add_filter( 'the_content', 'ttfb_toolkit_lazyload_iframes', PHP_INT_MAX ); 182 add_filter( 'widget_text', 'ttfb_toolkit_lazyload_iframes', PHP_INT_MAX );195 //add_filter( 'widget_text', 'ttfb_toolkit_lazyload_iframes', PHP_INT_MAX ); 183 196 function ttfb_toolkit_lazyload_iframes( $html ) { 184 197 185 198 if ( ! get_option('ttfb_toolkit_perf_lazyload_iframe', false) || 186 ! apply_filters( 'do_ttfb_toolkit_lazyload ', true ) ||199 ! apply_filters( 'do_ttfb_toolkit_lazyload_iframe', true ) || 187 200 is_search() || 188 201 is_admin() ) { … … 190 203 } 191 204 192 global $post;193 194 205 $matches = array(); 195 206 preg_match_all( '/<iframe\s+.*?>/', $html, $matches ); … … 197 208 foreach ( $matches[0] as $k=>$iframe ) { 198 209 199 // Don't mess with the Gravity Forms ajax iframe 200 if ( strpos( $iframe, 'gform_ajax_frame' ) ) { 210 211 if ( strpos( $iframe, 'gform_ajax_frame' ) || // Don't mess with the Gravity Forms ajax iframe 212 strpos( $iframe, 'data-src' ) ) { // Don't mess with already lazy iframe 201 213 continue; 202 214 } … … 204 216 $placeholder = 'data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs='; 205 217 206 $iframe = preg_replace( '/<iframe(.*?)src=/is', '<iframe$1src="' . $placeholder . '" class="lazyload blur-up" data-src=', $iframe );218 $iframe = preg_replace( '/<iframe(.*?)src=/is', '<iframe$1src="' . $placeholder . '" class="lazyload" data-src=', $iframe ); 207 219 208 220 $html = str_replace( $matches[0][ $k ], $iframe, $html ); … … 211 223 212 224 213 return $html;225 return $html; 214 226 } 215 227 … … 217 229 add_action("wp_head","ttfb_toolkit_lazyload_picturefill"); 218 230 function ttfb_toolkit_lazyload_picturefill(){ 219 if ( ( ! get_option('ttfb_toolkit_perf_lazyload_img', false) && ! get_option('ttfb_toolkit_perf_lazyload_iframe', false) ) || ! apply_filters( 'do_ttfb_toolkit_lazyload', true ) ) { 231 if( 232 ( ! get_option('ttfb_toolkit_perf_lazyload_img', false) && ! get_option('ttfb_toolkit_perf_lazyload_iframe', false) ) || 233 ( !apply_filters('do_ttfb_toolkit_lazyload_image', true) && !apply_filters('do_ttfb_toolkit_lazyload_iframe', true) ) ) { 220 234 return; 221 235 } -
ttfb-toolkit/trunk/includes/performance/performance-init.php
r1790790 r1794220 16 16 'capability' => 'edit_theme_options', 17 17 ) ); 18 } 19 20 /** 21 * Performance Panel Customizer Styles 22 */ 23 add_action( 'customize_controls_print_styles', 'ttfb_toolkit_performance_panel_styles', 999 ); 24 function ttfb_toolkit_performance_panel_styles() { ?> 25 <style> 26 li#accordion-panel-ttfb_toolkit_performance > h3.accordion-section-title:before { 27 content: "\f226"; 28 font-family: dashicons; 29 padding: 0 3px 0 0; 30 vertical-align: middle; 31 font-size: 22px; 32 line-height: 1; 33 } 34 </style> 35 <?php 18 36 } 19 37 -
ttfb-toolkit/trunk/readme.txt
r1790790 r1794220 6 6 Requires at least: 4.6 7 7 Tested up to: 4.9 8 Stable tag: 1. 08 Stable tag: 1.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 ==Changelog== 35 = v1.1 - December 29, 2017 = 36 * Fix - Iframe lazy load. 37 * Fix - Add missing performance icon 38 35 39 = v1.0 - December 20, 2017 = 36 40 * Original Release.
Note: See TracChangeset
for help on using the changeset viewer.