| @@ -1,26 +1,26 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: iframe |
| 4 | 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.5 | |
| 5 | +Description: [iframe src="http://www.youtube.com/embed/A3PDXmYoF5U" width="100%" height="480"] shortcode | |
| 6 | +Version: 2.6 | |
| 7 | 7 | Author: webvitaly |
| 8 | -Author URI: http://profiles.wordpress.org/webvitaly/ | |
| 8 | +Author URI: http://web-profile.com.ua/wordpress/plugins/ | |
| 9 | 9 | License: GPLv2 or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | -if ( !function_exists( 'iframe_unqprfx_embed_shortcode' ) ) : | |
| 13 | +if ( ! function_exists( 'iframe_unqprfx_embed_shortcode' ) ) : | |
| 14 | 14 | |
| 15 | 15 | function iframe_unqprfx_enqueue_script() { |
| 16 | 16 | wp_enqueue_script( 'jquery' ); |
| 17 | 17 | } |
| 18 | - add_action('wp_enqueue_scripts', 'iframe_unqprfx_enqueue_script'); | |
| 18 | + add_action( 'wp_enqueue_scripts', 'iframe_unqprfx_enqueue_script' ); | |
| 19 | 19 | |
| 20 | - function iframe_unqprfx_embed_shortcode($atts, $content = null) { | |
| 20 | + function iframe_unqprfx_embed_shortcode( $atts, $content = null ) { | |
| 21 | 21 | $defaults = array( |
| 22 | - 'src' => 'http://player.vimeo.com/video/819138', | |
| 22 | + 'src' => 'http://www.youtube.com/embed/A3PDXmYoF5U', | |
| 23 | 23 | 'width' => '100%', |
| 24 | 24 | 'height' => '480', |
| 25 | 25 | 'scrolling' => 'no', |
| 26 | 26 | 'class' => 'iframe-class', |
| @@ -26,10 +26,10 @@ | ||
| 26 | 26 | 'class' => 'iframe-class', |
| 27 | 27 | 'frameborder' => '0' |
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | - foreach ($defaults as $default => $value) { // add defaults | |
| 31 | - if (!@array_key_exists($default, $atts)) { // hide warning with "@" when no params at all | |
| 30 | + foreach ( $defaults as $default => $value ) { // add defaults | |
| 31 | + if ( ! @array_key_exists( $default, $atts ) ) { // hide warning with "@" when no params at all | |
| 32 | 32 | $atts[$default] = $value; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -89,11 +89,11 @@ | ||
| 89 | 89 | </script> |
| 90 | 90 | '; |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | - $html .= "\n".'<!-- iframe plugin v.2.5 wordpress.org/extend/plugins/iframe/ -->'."\n"; | |
| 93 | + $html .= "\n".'<!-- iframe plugin v.2.6 wordpress.org/extend/plugins/iframe/ -->'."\n"; | |
| 94 | 94 | $html .= '<iframe'; |
| 95 | - foreach ($atts as $attr => $value) { | |
| 95 | + foreach( $atts as $attr => $value ) { | |
| 96 | 96 | if( $attr != 'same_height_as' ){ // remove some attributes |
| 97 | 97 | if( $value != '' ) { // adding all attributes |
| 98 | 98 | $html .= ' ' . $attr . '="' . $value . '"'; |
| 99 | 99 | } else { // adding empty attributes |
| @@ -103,17 +103,17 @@ | ||
| 103 | 103 | } |
| 104 | 104 | $html .= '></iframe>'; |
| 105 | 105 | return $html; |
| 106 | 106 | } |
| 107 | - add_shortcode('iframe', 'iframe_unqprfx_embed_shortcode'); | |
| 107 | + add_shortcode( 'iframe', 'iframe_unqprfx_embed_shortcode' ); | |
| 108 | 108 | |
| 109 | -endif; | |
| 110 | 109 | |
| 111 | - | |
| 112 | -function iframe_unqprfx_plugin_meta( $links, $file ) { // add 'Support' and 'Donate' links to plugin meta row | |
| 113 | - if ( strpos( $file, 'iframe.php' ) !== false ) { | |
| 114 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/iframe/" title="Need help?">' . __('Support') . '</a>' ) ); | |
| 115 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">' . __('Donate') . '</a>' ) ); | |
| 110 | + function iframe_unqprfx_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row | |
| 111 | + if ( strpos( $file, 'iframe.php' ) !== false ) { | |
| 112 | + $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/iframe/" title="Plugin page">' . __('Iframe') . '</a>' ) ); | |
| 113 | + $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">' . __('Donate') . '</a>' ) ); | |
| 114 | + } | |
| 115 | + return $links; | |
| 116 | 116 | } |
| 117 | - return $links; | |
| 118 | -} | |
| 119 | -add_filter( 'plugin_row_meta', 'iframe_unqprfx_plugin_meta', 10, 2 ); | |
| 117 | + add_filter( 'plugin_row_meta', 'iframe_unqprfx_plugin_meta', 10, 2 ); | |
| 118 | + | |
| 119 | +endif; // end of if(function_exists('iframe_unqprfx_embed_shortcode')) | |