PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 1.4.62 All 260 releases
← All changes | includes/class-ph-frontend-scripts.php +17 -1 2.2.32.3.0 View file →
@@ -19,8 +19,9 @@
19 19 * Hook in methods
20 20 */
21 21 public static function init() {
22 22 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
23 + add_filter( 'script_loader_tag', array( __CLASS__, 'embed_script_attributes' ), 10, 2 );
23 24 add_action( 'wp_print_scripts', array( __CLASS__, 'check_jquery' ), 25 );
24 25 add_action( 'wp_print_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
25 26 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
26 27 }
@@ -25,8 +26,22 @@
25 26 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
26 27 }
27 28
28 29 /**
30 + * Preserve the provider attributes used by the original Reel embeds.
31 + */
32 + public static function embed_script_attributes( $tag, $handle ) {
33 + if ( 'propertyhive-instagram-embed' === $handle ) {
34 + return str_replace( '<script ', '<script async ', $tag );
35 + }
36 + if ( 'propertyhive-facebook-embed' === $handle ) {
37 + $tag = str_replace( array( 'id="propertyhive-facebook-embed-js"', "id='propertyhive-facebook-embed-js'" ), 'id="facebook-jssdk"', $tag );
38 + return str_replace( '<script ', '<script async defer crossorigin="anonymous" ', $tag );
39 + }
40 + return $tag;
41 + }
42 +
43 + /**
29 44 * Get styles for the frontend
30 45 * @return array
31 46 */
32 47 public static function get_styles() {
@@ -89,8 +104,9 @@
89 104 if ( $captcha_service == 'turnstile' )
90 105 {
91 106 if ( get_option( 'propertyhive_captcha_site_key', '' ) != '' && get_option( 'propertyhive_captcha_secret', '' ) != '' )
92 107 {
108 + // phpcs:ignore PluginCheck.CodeAnalysis.EnqueuedResourceOffloading.OffloadedContent -- Required by the configured Cloudflare Turnstile service.
93 109 wp_enqueue_script( 'turnstile', 'https://challenges.cloudflare.com/turnstile/v0/api.js?onload=ph_init_turnstile', array(), PH_VERSION, array( 'strategy' => 'defer', 'in_footer' => true ) );
94 110 }
95 111 }
96 112
@@ -209,9 +225,9 @@
209 225
210 226 // Enforce minimum version of jQuery
211 227 if ( ! empty( $wp_scripts->registered['jquery']->ver ) && ! empty( $wp_scripts->registered['jquery']->src ) && 0 >= version_compare( $wp_scripts->registered['jquery']->ver, '1.8' ) ) {
212 228 wp_deregister_script( 'jquery' );
213 - wp_register_script( 'jquery', '/wp-includes/js/jquery/jquery.js', array(), '1.8' );
229 + wp_register_script( 'jquery', '/wp-includes/js/jquery/jquery.js', array(), '1.8', false );
214 230 wp_enqueue_script( 'jquery' );
215 231 }
216 232 }
217 233 }