@@ -98,7 +98,6 @@ public function enqueue_scripts()
9898 * class.
9999 */
100100
101- wp_enqueue_script ('iframe-resizer ' , plugin_dir_url (__FILE__ ) . 'js/iframe-resizer.jquery.js ' , array ('jquery ' ), $ this ->version , false );
102101 wp_enqueue_script ($ this ->plugin_name , plugin_dir_url (__FILE__ ) . 'js/hello-asso-public.js ' , array ('jquery ' ), $ this ->version , false );
103102 }
104103
@@ -113,22 +112,23 @@ function ha_shortcode($atts)
113112 $ allowed_styles = array (
114113 'style ' => array (
115114 'width ' => array (),
116- 'height ' => array (),
117- 'border ' => array (),
118- ),
115+ 'height ' => array ()
116+ )
119117 );
120118
121119 $ pattern = '/^\d+px$/ ' ;
122120
121+ $ height = "750px " ;
122+ $ width = "100% " ;
123123 if ($ type == "widget-bouton " ) {
124124 $ height = preg_match ($ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts ['height ' ] : "70px " ;
125- $ styleIframe = 'style="width: 200px; height: ' . $ height . ' ; border:none;" ' ;
125+ $ width = '200px ' ;
126126 } else if ($ type == "widget " ) {
127127 $ height = preg_match ($ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts ['height ' ] : "750px " ;
128- $ styleIframe = 'style="width: 100%; height: ' . $ height . ' ; border:none;" ' ;
128+ $ width = '100% ' ;
129129 } else if ($ type == "widget-vignette " ) {
130130 $ height = preg_match ($ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts ['height ' ] : "450px " ;
131- $ styleIframe = 'style="width: 350px; height: ' . $ height . ' ; border:none;" ' ;
131+ $ width = '350px ' ;
132132 } else {
133133 $ type = "" ;
134134 }
@@ -139,7 +139,15 @@ function ha_shortcode($atts)
139139
140140 ob_start ();
141141?>
142- <iframe src="<?= esc_url ($ url ); ?> <?= esc_html ($ type ); ?> " id="idIframe" <?= wp_kses ($ styleIframe , $ allowed_styles ); ?> border="0"></iframe>
142+ <iframe
143+ id="idIframe"
144+ src="<?= esc_url ($ url ); ?> <?= esc_html ($ type ); ?> "
145+ <?= wp_kses ('height= ' . $ height . '" ' , $ allowed_styles ); ?>
146+ <?= wp_kses ('width= ' . $ width . '" ' , $ allowed_styles ); ?>
147+ frameborder="0"
148+ loading="lazy"
149+ allowtransparency="true"
150+ onload="resizeIframeMessage()"></iframe>
143151<?php
144152 return ob_get_clean ();
145153 }
0 commit comments