| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: iframe |
| 4 | -Plugin URI: http://wordpress.org/plugins/iframe/ | |
| 4 | +Plugin URI: http://wordpress.org/extend/plugins/iframe/ | |
| 5 | 5 | Description: [iframe src="http://www.youtube.com/embed/A3PDXmYoF5U" width="100%" height="480"] shortcode |
| 6 | -Version: 2.8 | |
| 6 | +Version: 2.6 | |
| 7 | 7 | Author: webvitaly |
| 8 | 8 | Author URI: http://web-profile.com.ua/wordpress/plugins/ |
| 9 | -License: GPLv3 | |
| 9 | +License: GPLv2 or later | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | if ( ! function_exists( 'iframe_unqprfx_embed_shortcode' ) ) : |
| @@ -16,9 +16,8 @@ | ||
| 16 | 16 | wp_enqueue_script( 'jquery' ); |
| 17 | 17 | } |
| 18 | 18 | add_action( 'wp_enqueue_scripts', 'iframe_unqprfx_enqueue_script' ); |
| 19 | 19 | |
| 20 | - | |
| 21 | 20 | function iframe_unqprfx_embed_shortcode( $atts, $content = null ) { |
| 22 | 21 | $defaults = array( |
| 23 | 22 | 'src' => 'http://www.youtube.com/embed/A3PDXmYoF5U', |
| 24 | 23 | 'width' => '100%', |
| @@ -33,8 +32,13 @@ | ||
| 33 | 32 | $atts[$default] = $value; |
| 34 | 33 | } |
| 35 | 34 | } |
| 36 | 35 | |
| 36 | + $src_cut = substr( $atts["src"], 0, 35 ); // special case for google maps | |
| 37 | + if( strpos( $src_cut, 'maps.google' ) ){ | |
| 38 | + $atts["src"] .= '&output=embed'; | |
| 39 | + } | |
| 40 | + | |
| 37 | 41 | // get_params_from_url |
| 38 | 42 | if( isset( $atts["get_params_from_url"] ) && ( $atts["get_params_from_url"] == '1' || $atts["get_params_from_url"] == 1 || $atts["get_params_from_url"] == 'true' ) ) { |
| 39 | 43 | if( $_GET != NULL ){ |
| 40 | 44 | if( strpos( $atts["src"], '?' ) ){ // if we already have '?' and GET params |
| @@ -68,8 +72,9 @@ | ||
| 68 | 72 | <script> |
| 69 | 73 | jQuery(function($){ |
| 70 | 74 | var target_height = $(' . $target_selector . ').height(); |
| 71 | 75 | $("iframe.' . $atts["class"] . '").height(target_height); |
| 76 | + //alert(target_height); | |
| 72 | 77 | }); |
| 73 | 78 | </script> |
| 74 | 79 | '; |
| 75 | 80 | }else{ // set the actual height of the iframe (show all content of the iframe without scroll) |
| @@ -84,9 +89,9 @@ | ||
| 84 | 89 | </script> |
| 85 | 90 | '; |
| 86 | 91 | } |
| 87 | 92 | } |
| 88 | - $html .= "\n".'<!-- iframe plugin v.2.8 wordpress.org/plugins/iframe/ -->'."\n"; | |
| 93 | + $html .= "\n".'<!-- iframe plugin v.2.6 wordpress.org/extend/plugins/iframe/ -->'."\n"; | |
| 89 | 94 | $html .= '<iframe'; |
| 90 | 95 | foreach( $atts as $attr => $value ) { |
| 91 | 96 | if( $attr != 'same_height_as' ){ // remove some attributes |
| 92 | 97 | if( $value != '' ) { // adding all attributes |
| @@ -95,9 +100,9 @@ | ||
| 95 | 100 | $html .= ' ' . $attr; |
| 96 | 101 | } |
| 97 | 102 | } |
| 98 | 103 | } |
| 99 | - $html .= '></iframe>'."\n"; | |
| 104 | + $html .= '></iframe>'; | |
| 100 | 105 | return $html; |
| 101 | 106 | } |
| 102 | 107 | add_shortcode( 'iframe', 'iframe_unqprfx_embed_shortcode' ); |
| 103 | 108 | |
| @@ -103,10 +108,10 @@ | ||
| 103 | 108 | |
| 104 | 109 | |
| 105 | 110 | function iframe_unqprfx_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row |
| 106 | 111 | if ( strpos( $file, 'iframe.php' ) !== false ) { |
| 107 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/iframe/" title="Plugin page">Iframe</a>' ) ); | |
| 108 | - $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>' ) ); | |
| 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>' ) ); | |
| 109 | 114 | } |
| 110 | 115 | return $links; |
| 111 | 116 | } |
| 112 | 117 | add_filter( 'plugin_row_meta', 'iframe_unqprfx_plugin_meta', 10, 2 ); |