PluginProbe
iframe / 3.0
iframe v3.0
trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7 1.8 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 4.0 4.1 4.2 4.3 All 35 releases
← All changes | iframe.php +34 -23 4.33.0 View file →
@@ -2,17 +2,16 @@
2 2 /*
3 3 Plugin Name: iframe
4 4 Plugin URI: http://wordpress.org/plugins/iframe/
5 5 Description: [iframe src="http://www.youtube.com/embed/4qsGTXLnmKs" width="100%" height="500"] shortcode
6 -Version: 4.3
6 +Version: 3.0
7 7 Author: webvitaly
8 -Author URI: http://web-profile.net/wordpress/plugins/
8 +Author URI: http://web-profile.com.ua/wordpress/plugins/
9 9 License: GPLv3
10 10 */
11 11
12 -define('IFRAME_PLUGIN_VERSION', '4.3');
13 12
14 -function iframe_plugin_add_shortcode_cb( $atts ) {
13 +function iframe_unqprfx_embed_shortcode( $atts, $content = null ) {
15 14 $defaults = array(
16 15 'src' => 'http://www.youtube.com/embed/4qsGTXLnmKs',
17 16 'width' => '100%',
18 17 'height' => '500',
@@ -26,17 +25,33 @@
26 25 $atts[$default] = $value;
27 26 }
28 27 }
29 28
30 - $html = "\n".'<!-- iframe plugin v.'.IFRAME_PLUGIN_VERSION.' wordpress.org/plugins/iframe/ -->'."\n";
29 + // get_params_from_url
30 + if ( isset( $atts["get_params_from_url"] ) && ( $atts["get_params_from_url"] == '1' || $atts["get_params_from_url"] == 1 ) ) {
31 + $encode_string = '';
32 + if ( $_GET != NULL ) {
33 + if ( strpos( $atts["src"], '?' ) ) { // if we already have '?' and GET params
34 + $encode_string = '&';
35 + } else {
36 + $encode_string = '?';
37 + }
38 + foreach( $_GET as $key => $value ) {
39 + $encode_string .= $key.'='.$value.'&';
40 + }
41 + }
42 + $encode_string = rtrim($encode_string, '&'); // remove last '&'
43 + $atts["src"] .= $encode_string;
44 + }
45 +
46 + $html = "\n".'<!-- iframe plugin v.3.0 wordpress.org/plugins/iframe/ -->'."\n";
31 47 $html .= '<iframe';
32 48 foreach( $atts as $attr => $value ) {
33 - if ( strtolower($attr) != 'same_height_as' AND strtolower($attr) != 'onload'
34 - AND strtolower($attr) != 'onpageshow' AND strtolower($attr) != 'onclick') { // remove some attributes
49 + if ( $attr != 'same_height_as' ) { // remove some attributes
35 50 if ( $value != '' ) { // adding all attributes
36 - $html .= ' ' . esc_attr( $attr ) . '="' . esc_attr( $value ) . '"';
51 + $html .= ' ' . $attr . '="' . $value . '"';
37 52 } else { // adding empty attributes
38 - $html .= ' ' . esc_attr( $attr );
53 + $html .= ' ' . $attr;
39 54 }
40 55 }
41 56 }
42 57 $html .= '></iframe>'."\n";
@@ -45,10 +60,10 @@
45 60 $html .= '
46 61 <script>
47 62 document.addEventListener("DOMContentLoaded", function(){
48 63 var target_element, iframe_element;
49 - iframe_element = document.querySelector("iframe.' . esc_attr( $atts["class"] ) . '");
50 - target_element = document.querySelector("' . esc_attr( $atts["same_height_as"] ) . '");
64 + iframe_element = document.querySelector("iframe.' . $atts["class"] . '");
65 + target_element = document.querySelector("' . $atts["same_height_as"] . '");
51 66 iframe_element.style.height = target_element.offsetHeight + "px";
52 67 });
53 68 </script>
54 69 ';
@@ -55,20 +70,16 @@
55 70 }
56 71
57 72 return $html;
58 73 }
59 -add_shortcode( 'iframe', 'iframe_plugin_add_shortcode_cb' );
74 +add_shortcode( 'iframe', 'iframe_unqprfx_embed_shortcode' );
60 75
61 76
62 -function iframe_plugin_row_meta_cb( $links, $file ) {
63 - if ( $file == plugin_basename( __FILE__ ) ) {
64 - $row_meta = array(
65 - 'support' => '<a href="http://web-profile.net/wordpress/plugins/iframe/" target="_blank"><span class="dashicons dashicons-editor-help"></span> ' . __( 'Iframe', 'iframe' ) . '</a>',
66 - 'donate' => '<a href="http://web-profile.net/donate/" target="_blank"><span class="dashicons dashicons-heart"></span> ' . __( 'Donate', 'iframe' ) . '</a>',
67 - 'iframe_pro' => '<a href="http://codecanyon.net/item/advanced-iframe-pro/5344999?ref=webvitalii" target="_blank"><span class="dashicons dashicons-star-filled"></span> ' . __( 'Advanced iFrame Pro', 'iframe' ) . '</a>',
68 - 'pro' => '<a href="http://codecanyon.net/item/silver-bullet-pro/15171769?ref=webvitalii" target="_blank" title="Speedup and protect WordPress in a smart way"><span class="dashicons dashicons-star-filled"></span> ' . __( 'Silver Bullet Pro', 'iframe' ) . '</a>'
69 - );
70 - $links = array_merge( $links, $row_meta );
77 +function iframe_unqprfx_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row
78 + if ( strpos( $file, 'iframe.php' ) !== false ) {
79 + $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/iframe/" title="Plugin page">Iframe</a>' ) );
80 + $links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>' ) );
81 + $links = array_merge( $links, array( '<a href="http://codecanyon.net/item/advanced-iframe-pro/5344999?ref=webvitaly">Advanced iFrame Pro</a>' ) );
71 82 }
72 - return (array) $links;
83 + return $links;
73 84 }
74 -add_filter( 'plugin_row_meta', 'iframe_plugin_row_meta_cb', 10, 2 );
85 +add_filter( 'plugin_row_meta', 'iframe_unqprfx_plugin_meta', 10, 2 );