Changeset 2574499
- Timestamp:
- 07/29/2021 08:21:04 AM (4 years ago)
- Location:
- cf7-optimizer/trunk
- Files:
-
- 2 edited
-
cf7-optimizer.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cf7-optimizer/trunk/cf7-optimizer.php
r2574486 r2574499 4 4 * Plugin URI: https://github.com/gianlucagaspari/contact-form-7-optimizer 5 5 * Description: Removes js, css and ajax behaviors from Contact Form 7 that may slow the site 6 * Version: 1.0 7 * Author: Gianluca6 * Version: 1.0.1 7 * Author: Five Studio 8 8 * Author URI: https://www.fivestudio.it 9 9 * Tested up to: 5.8 … … 14 14 */ 15 15 function wpcf7_custom_enqueue_scripts() { 16 wp_dequeue_script( 'wpcf7-recaptcha' ); 17 wp_dequeue_script( 'google-recaptcha' ); 18 wp_dequeue_style( 'contact-form-7' ); 19 global $post; 20 if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'contact-form-7' ) ) { 21 if ( function_exists( 'wpcf7_enqueue_scripts' ) ) { 22 wpcf7_enqueue_scripts(); 23 wp_enqueue_script( 'wpcf7-recaptcha' ); 24 wp_enqueue_script( 'google-recaptcha' ); 16 if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { 17 wp_dequeue_script( 'wpcf7-recaptcha' ); 18 wp_dequeue_script( 'google-recaptcha' ); 19 wp_dequeue_style( 'contact-form-7' ); 20 global $post; 21 if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'contact-form-7' ) ) { 22 if ( function_exists( 'wpcf7_enqueue_scripts' ) ) { 23 wpcf7_enqueue_scripts(); 24 wp_enqueue_script( 'wpcf7-recaptcha' ); 25 wp_enqueue_script( 'google-recaptcha' ); 26 } 27 if ( function_exists( 'wpcf7_enqueue_styles' ) ) { 28 wpcf7_enqueue_styles(); 29 } 25 30 } 26 if ( function_exists( 'wpcf7_enqueue_styles' ) ) { 27 wpcf7_enqueue_styles(); 31 $service = WPCF7_RECAPTCHA::get_instance(); 32 if ( ! $service->is_active() ) { 33 return; 28 34 } 35 wp_add_inline_script( 'contact-form-7', 'wpcf7.cached = 0;', 'before' ); 29 36 } 30 $service = WPCF7_RECAPTCHA::get_instance();31 if ( ! $service->is_active() ) {32 return;33 }34 wp_add_inline_script( 'contact-form-7', 'wpcf7.cached = 0;', 'before' );35 37 } 36 if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { 37 add_filter( 'wpcf7_load_js', '__return_false' ); 38 add_filter( 'wpcf7_load_css', '__return_false' ); 39 add_action( 'wp_enqueue_scripts', 'wpcf7_custom_enqueue_scripts', 20, 0 ); 40 } 38 add_filter( 'wpcf7_load_js', '__return_false' ); 39 add_filter( 'wpcf7_load_css', '__return_false' ); 40 add_action( 'wp_enqueue_scripts', 'wpcf7_custom_enqueue_scripts', 10000, 0 ); -
cf7-optimizer/trunk/readme.txt
r2574486 r2574499 4 4 Requires PHP: 5.6 5 5 Tested up to: 5.8 6 Stable tag: 1.0 6 Stable tag: 1.0.1 7 7 License: GPLv3 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 28 28 = Version 1.0 - 28.07.2021 = 29 29 * Initial release 30 31 = Version 1.0.1 - 29.07.2021 = 32 * Fixed is_plugin_active potential error
Note: See TracChangeset
for help on using the changeset viewer.