WordPress.org

Support

Support » Plugins and Hacks » [Plugin: IFrame Widget] Height and width not working (w/ fix)

[Plugin: IFrame Widget] Height and width not working (w/ fix)

  • I just downloaded 2.0, and couldn’t get the height and width to work, so I opened up the iframe-widget.php and found the function widget_iframe_on_page($text) where the if’s for height and widths are wrong. It uses is_nan to check the width and height parameters where it really should use is_numeric (is_nan checks if the value is Not A Number).

    Change from:

    function widget_iframe_on_page($text){
    	$regex = '#\[dciframe]((?:[^\[]|\[(?!/?dciframe])|(?R))+)\[/dciframe]#';
    	if (is_array($text)) {
    		//Read the Width/Height Parameters, if given
    	  $param = explode(",", $text[1]);
    		$others = "";
    		if(isset($param[1]) && is_nan($param[1])){
    			$others = ' width="' .$param[1] . '"';
    		}
    		if(isset($param[2]) && is_nan($param[2])){
    			$others .= ' height="' .$param[2] . '"';
    		}
    		//generate the IFRAME tag
            $text = '<iFrame frameborder="0" src="'.$param[0].'"'.$others.'></iFrame>';
        }
    	return preg_replace_callback($regex, 'widget_iframe_on_page', $text);
    }

    To:

    function widget_iframe_on_page($text){
    	$regex = '#\[dciframe]((?:[^\[]|\[(?!/?dciframe])|(?R))+)\[/dciframe]#';
    	if (is_array($text)) {
    		//Read the Width/Height Parameters, if given
    	  $param = explode(",", $text[1]);
    		$others = "";
    		if(isset($param[1]) &amp;&amp; is_numeric($param[1])){
    			$others = ' width="' .$param[1] . '"';
    		}
    		if(isset($param[2]) &amp;&amp; is_numeric($param[2])){
    			$others .= ' height="' .$param[2] . '"';
    		}
    		//generate the IFRAME tag
            $text = '<iFrame frameborder="0" src="'.$param[0].'"'.$others.'></iFrame>';
        }
    	return preg_replace_callback($regex, 'widget_iframe_on_page', $text);
    }

    http://wordpress.org/extend/plugins/iframe-widget/

Viewing 1 replies (of 1 total)
  • Apologies for this extreme delay eddan, the changes suggested by you have been done in 3.0 version. Thanks for pointing out the bug.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: IFrame Widget] Height and width not working (w/ fix)’ is closed to new replies.
Skip to toolbar