File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,24 +110,27 @@ function ha_shortcode($atts)
110110 $ type = $ atts ['type ' ];
111111 $ allowed_styles = array (
112112 'style ' => array (
113+ 'width ' => array (),
113114 'height ' => array (),
114115 'border ' => array (),
115116 ),
116117 );
117118
119+ $ pattern = '/^\d+px$/ ' ;
120+
118121 if ($ type == "widget-bouton " )
119122 {
120- $ height = $ atts ['height ' ] ?? "70px " ;
123+ $ height = preg_match ( $ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts [ ' height ' ] : "70px " ;
121124 $ styleIframe = 'style="width:200px; height: ' . $ height . '; border:none;" ' ;
122125 }
123126 else if ($ type == "widget " )
124127 {
125- $ height = $ atts ['height ' ] ?? "750px " ;
128+ $ height = preg_match ( $ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts [ ' height ' ] : "750px " ;
126129 $ styleIframe = 'style="width:100%; height: ' . $ height . '; border:none;" ' ;
127130 }
128131 else if ($ type == "widget-vignette " )
129132 {
130- $ height = $ atts ['height ' ] ?? "450px " ;
133+ $ height = preg_match ( $ pattern , $ atts ['height ' ] ?? 0 ) ? $ atts [ ' height ' ] : "450px " ;
131134 $ styleIframe = 'style="width:350px; height: ' . $ height . '; border:none;" ' ;
132135 }
133136
You can’t perform that action at this time.
0 commit comments