| @@ -1,16 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | -Plugin Name: iframe | |
| 4 | -Plugin URI: http://wordpress.org/extend/plugins/iframe/ | |
| 5 | -Description: [iframe src="http://player.vimeo.com/video/819138" width="100%" height="480"] shortcode | |
| 6 | -Version: 2.4 | |
| 3 | +Plugin Name: [iframe] | |
| 4 | +Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/ | |
| 5 | +Description: [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode | |
| 6 | +Version: 2.2 | |
| 7 | 7 | Author: webvitaly |
| 8 | -Author URI: http://profiles.wordpress.org/webvitaly/ | |
| 9 | -License: GPLv2 or later | |
| 8 | +Author Email: webvitaly(at)gmail.com | |
| 9 | +Author URI: http://web-profile.com.ua/wordpress/ | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | - | |
| 13 | 12 | if ( !function_exists( 'iframe_embed_shortcode' ) ) : |
| 14 | 13 | |
| 15 | 14 | function iframe_enqueue_script() { |
| 16 | 15 | wp_enqueue_script( 'jquery' ); |
| @@ -18,9 +17,8 @@ | ||
| 18 | 17 | add_action('wp_enqueue_scripts', 'iframe_enqueue_script'); |
| 19 | 18 | |
| 20 | 19 | function iframe_embed_shortcode($atts, $content = null) { |
| 21 | 20 | $defaults = array( |
| 22 | - 'src' => 'http://player.vimeo.com/video/819138', | |
| 23 | 21 | 'width' => '100%', |
| 24 | 22 | 'height' => '480', |
| 25 | 23 | 'scrolling' => 'no', |
| 26 | 24 | 'class' => 'iframe-class', |
| @@ -25,16 +23,16 @@ | ||
| 25 | 23 | 'scrolling' => 'no', |
| 26 | 24 | 'class' => 'iframe-class', |
| 27 | 25 | 'frameborder' => '0' |
| 28 | 26 | ); |
| 29 | - | |
| 30 | - foreach ($defaults as $default => $value) { // add defaults | |
| 31 | - if (!@array_key_exists($default, $atts)) { // hide warning with "@" when no params at all | |
| 27 | + // add defaults | |
| 28 | + foreach ($defaults as $default => $value) { | |
| 29 | + if (!array_key_exists($default, $atts)) { | |
| 32 | 30 | $atts[$default] = $value; |
| 33 | 31 | } |
| 34 | 32 | } |
| 35 | - | |
| 36 | - $src_cut = substr($atts["src"], 0, 35); // special case maps | |
| 33 | + // special case maps | |
| 34 | + $src_cut = substr($atts["src"], 0, 35); | |
| 37 | 35 | if(strpos($src_cut, 'maps.google' )){ |
| 38 | 36 | $atts["src"] .= '&output=embed'; |
| 39 | 37 | } |
| 40 | 38 | $html = ''; |
| @@ -73,9 +71,9 @@ | ||
| 73 | 71 | </script> |
| 74 | 72 | '; |
| 75 | 73 | } |
| 76 | 74 | } |
| 77 | - $html .= "\n".'<!-- iframe plugin v.2.4 wordpress.org/extend/plugins/iframe/ -->'."\n"; | |
| 75 | + $html .= "\n".'<!-- Iframe plugin v.2.2 (wordpress.org/extend/plugins/iframe/) -->'."\n"; | |
| 78 | 76 | $html .= '<iframe'; |
| 79 | 77 | foreach ($atts as $attr => $value) { |
| 80 | 78 | if( $attr != 'same_height_as' ){ // remove some attributes |
| 81 | 79 | if( $value != '' ) { // adding all attributes |
| @@ -90,14 +88,4 @@ | ||
| 90 | 88 | } |
| 91 | 89 | add_shortcode('iframe', 'iframe_embed_shortcode'); |
| 92 | 90 | |
| 93 | 91 | endif; |
| 94 | - | |
| 95 | - | |
| 96 | -function iframe_unqprfx_plugin_meta( $links, $file ) { // add 'Support' and 'Donate' links to plugin meta row | |
| 97 | - if ( strpos( $file, 'iframe.php' ) !== false ) { | |
| 98 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/iframe/" title="Need help?">' . __('Support') . '</a>' ) ); | |
| 99 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">' . __('Donate') . '</a>' ) ); | |
| 100 | - } | |
| 101 | - return $links; | |
| 102 | -} | |
| 103 | -add_filter( 'plugin_row_meta', 'iframe_unqprfx_plugin_meta', 10, 2 ); | |