| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | -Plugin Name: iframe | |
| 3 | +Plugin Name: [iframe] | |
| 4 | 4 | Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/ |
| 5 | -Description: Plugin shows iframe with [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode. | |
| 6 | -Version: 2.0 | |
| 5 | +Description: [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode | |
| 6 | +Version: 2.2 | |
| 7 | 7 | Author: webvitaly |
| 8 | 8 | Author Email: webvitaly(at)gmail.com |
| 9 | 9 | Author URI: http://web-profile.com.ua/wordpress/ |
| 10 | 10 | */ |
| @@ -14,15 +14,16 @@ | ||
| 14 | 14 | function iframe_enqueue_script() { |
| 15 | 15 | wp_enqueue_script( 'jquery' ); |
| 16 | 16 | } |
| 17 | 17 | add_action('wp_enqueue_scripts', 'iframe_enqueue_script'); |
| 18 | - | |
| 18 | + | |
| 19 | 19 | function iframe_embed_shortcode($atts, $content = null) { |
| 20 | 20 | $defaults = array( |
| 21 | 21 | 'width' => '100%', |
| 22 | 22 | 'height' => '480', |
| 23 | 23 | 'scrolling' => 'no', |
| 24 | - 'class' => 'iframe-class' | |
| 24 | + 'class' => 'iframe-class', | |
| 25 | + 'frameborder' => '0' | |
| 25 | 26 | ); |
| 26 | 27 | // add defaults |
| 27 | 28 | foreach ($defaults as $default => $value) { |
| 28 | 29 | if (!array_key_exists($default, $atts)) { |
| @@ -34,9 +35,14 @@ | ||
| 34 | 35 | if(strpos($src_cut, 'maps.google' )){ |
| 35 | 36 | $atts["src"] .= '&output=embed'; |
| 36 | 37 | } |
| 37 | 38 | $html = ''; |
| 38 | - $same_height_as = $atts["same_height_as"]; | |
| 39 | + if( isset( $atts["same_height_as"] ) ){ | |
| 40 | + $same_height_as = $atts["same_height_as"]; | |
| 41 | + }else{ | |
| 42 | + $same_height_as = ''; | |
| 43 | + } | |
| 44 | + | |
| 39 | 45 | if( $same_height_as != '' ){ |
| 40 | 46 | $atts["same_height_as"] = ''; |
| 41 | 47 | if( $same_height_as != 'content' ){ // we are setting the height of the iframe like as target element |
| 42 | 48 | if( $same_height_as == 'document' || $same_height_as == 'window' ){ // remove quotes for window or document selectors |
| @@ -65,9 +71,9 @@ | ||
| 65 | 71 | </script> |
| 66 | 72 | '; |
| 67 | 73 | } |
| 68 | 74 | } |
| 69 | - $html .= "\n".'<!-- powered by Iframe plugin ver.2.0 (wordpress.org/extend/plugins/iframe/) -->'."\n"; | |
| 75 | + $html .= "\n".'<!-- Iframe plugin v.2.2 (wordpress.org/extend/plugins/iframe/) -->'."\n"; | |
| 70 | 76 | $html .= '<iframe'; |
| 71 | 77 | foreach ($atts as $attr => $value) { |
| 72 | 78 | if( $attr != 'same_height_as' ){ // remove some attributes |
| 73 | 79 | if( $value != '' ) { // adding all attributes |