iframe - Version 2.2

Version Description

  • fixed bug (Notice: Undefined index: same_height_as)
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin iframe
Version 2.2
Comparing to
See all releases

Code changes from version 2.1 to 2.2

Files changed (2) hide show
  1. iframe.php +11 -6
  2. readme.txt +38 -28
iframe.php CHANGED
@@ -1,9 +1,9 @@
1
<?php
2
/*
3
- Plugin Name: iframe
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.1
7
Author: webvitaly
8
Author Email: webvitaly(at)gmail.com
9
Author URI: http://web-profile.com.ua/wordpress/
@@ -15,7 +15,7 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) :
15
wp_enqueue_script( 'jquery' );
16
}
17
add_action('wp_enqueue_scripts', 'iframe_enqueue_script');
18
-
19
function iframe_embed_shortcode($atts, $content = null) {
20
$defaults = array(
21
'width' => '100%',
@@ -36,7 +36,12 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) :
36
$atts["src"] .= '&output=embed';
37
}
38
$html = '';
39
- $same_height_as = $atts["same_height_as"];
40
if( $same_height_as != '' ){
41
$atts["same_height_as"] = '';
42
if( $same_height_as != 'content' ){ // we are setting the height of the iframe like as target element
@@ -67,7 +72,7 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) :
67
';
68
}
69
}
70
- $html .= "\n".'<!-- Iframe plugin v.2.1 (wordpress.org/extend/plugins/iframe/) -->'."\n";
71
$html .= '<iframe';
72
foreach ($atts as $attr => $value) {
73
if( $attr != 'same_height_as' ){ // remove some attributes
1
<?php
2
/*
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
Author: webvitaly
8
Author Email: webvitaly(at)gmail.com
9
Author URI: http://web-profile.com.ua/wordpress/
15
wp_enqueue_script( 'jquery' );
16
}
17
add_action('wp_enqueue_scripts', 'iframe_enqueue_script');
18
+
19
function iframe_embed_shortcode($atts, $content = null) {
20
$defaults = array(
21
'width' => '100%',
36
$atts["src"] .= '&output=embed';
37
}
38
$html = '';
39
+ if( isset( $atts["same_height_as"] ) ){
40
+ $same_height_as = $atts["same_height_as"];
41
+ }else{
42
+ $same_height_as = '';
43
+ }
44
+
45
if( $same_height_as != '' ){
46
$atts["same_height_as"] = '';
47
if( $same_height_as != 'content' ){ // we are setting the height of the iframe like as target element
72
';
73
}
74
}
75
+ $html .= "\n".'<!-- Iframe plugin v.2.2 (wordpress.org/extend/plugins/iframe/) -->'."\n";
76
$html .= '<iframe';
77
foreach ($atts as $attr => $value) {
78
if( $attr != 'same_height_as' ){ // remove some attributes
readme.txt CHANGED
@@ -1,21 +1,32 @@
1
- === Iframe ===
2
Contributors: webvitaly
3
Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
4
Tags: iframe, embed, youtube, vimeo, google-map, google-maps
5
Author URI: http://web-profile.com.ua/wordpress/
6
Requires at least: 3.0
7
Tested up to: 3.3.1
8
- Stable tag: 2.1
9
10
- You can embed iframe with [iframe src="http://vimeo.com/123" width="100%" height="480"] shortcode.
11
12
== Description ==
13
14
Iframes are needed to embed video from youtube or to embed Google Map or just to embed content from external page.
15
- WordPress removes iframe when you switch from "HTML" to "Visual" tab because of the security reasons.
16
- So you can embed iframe code using this shortcode `[iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"]`.
17
18
- = Usage (allowed parameters) =
19
* **src** - source of the iframe `[iframe src="http://player.vimeo.com/video/3261363"]` (empty by default src="");
20
* **width** - width in pixels or in percents `[iframe width="100%" src="http://player.vimeo.com/video/3261363"]` or `[iframe width="640" src="http://player.vimeo.com/video/3261363"]` (by default width="100%");
21
* **height** - height in pixels `[iframe height="480" src="http://player.vimeo.com/video/3261363"]` (by default height="480");
@@ -27,54 +38,53 @@ So you can embed iframe code using this shortcode `[iframe src="http://player.vi
27
* **id** - allows to add the id of the iframe `[iframe id="my-id"]` (removed by default);
28
* **class** - allows to add the class of the iframe `[iframe class="my-class"]` (by default class="iframe-class");
29
* **style** - allows to add the css styles of the iframe `[iframe style="margin-left:-30px;"]` (removed by default);
30
- * **same_height_as** - allows to set the height of iframe same as target element `[iframe same_height_as="body"]`, `[iframe same_height_as="div.sidebar"]`, `[iframe same_height_as="div#content"]`, `[iframe same_height_as="window"]` - iframe will have the height of the viewport (visible area), `[iframe same_height_as="document"]` - iframe will have the height of the document, `[iframe same_height_as="content"]` - auto-height feature, so the height of the iframe will be the same as embedded content (works only with the same domain) (removed by default);
31
* **any_other_param** - allows to add new parameter of the iframe `[iframe any_other_param="any_value"]`;
32
* **any_other_empty_param** - allows to add new empty parameter of the iframe (like "allowfullscreen" on youtube) `[iframe any_other_empty_param=""]`;
33
34
- [Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
35
-
36
- [CMS WordPress](http://web-profile.com.ua/wordpress/)
37
-
38
== Changelog ==
39
40
= 2.1 =
41
- * added (frameborder="0") by default;
42
43
= 2.0 =
44
- * plugin core rebuild (thanks to Gregg Tavares);
45
- * remove not setted params except the defaults;
46
- * added support for all params, which user will set;
47
- * added support for empty params (like "allowfullscreen" on youtube);
48
49
= 1.8 =
50
- * Added style parameter;
51
52
= 1.7 =
53
- * Fixing minor bugs;
54
55
= 1.6.0 =
56
- * Added auto-height feature (thanks to Willem Veelenturf);
57
58
= 1.5.0 =
59
- * Using native jQuery from include directory;
60
- * Improved "same_height_as" parameter;
61
62
= 1.4.0 =
63
- * Added "same_height_as" parameter;
64
65
= 1.3.0 =
66
- * Added "id" and "class" parameters;
67
68
= 1.2.0 =
69
- * Added "output=embed" fix to Google Map;
70
71
= 1.1.0 =
72
- * Parameter allowtransparency added (thanks to Kent);
73
74
= 1.0.0 =
75
- * Initial release;
76
77
== Installation ==
78
79
- 1. Install and activate the plugin on the Plugins page;
80
- 2. Add shortcode `[iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"]` to page content;
1
+ === [iframe] ===
2
Contributors: webvitaly
3
Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
4
Tags: iframe, embed, youtube, vimeo, google-map, google-maps
5
Author URI: http://web-profile.com.ua/wordpress/
6
Requires at least: 3.0
7
Tested up to: 3.3.1
8
+ Stable tag: 2.2
9
10
+ [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode
11
12
== Description ==
13
14
Iframes are needed to embed video from youtube or to embed Google Map or just to embed content from external page.
15
16
+ Embed iframe using shortcode `[iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"]`
17
+
18
+ [All Iframe params](http://wordpress.org/extend/plugins/iframe/other_notes/)
19
+
20
+ [Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
21
+
22
+ = Try other useful plugins: =
23
+ * [Page-list](http://wordpress.org/extend/plugins/page-list/) - show list of pages with shortcodes
24
+ * [Login Logout](http://wordpress.org/extend/plugins/login-logout/) - default Meta widget replacement
25
+ * [Filenames to latin](http://wordpress.org/extend/plugins/filenames-to-latin/) - sanitize filenames to latin during upload
26
+
27
+ == Other Notes ==
28
+
29
+ = Iframe params: =
30
* **src** - source of the iframe `[iframe src="http://player.vimeo.com/video/3261363"]` (empty by default src="");
31
* **width** - width in pixels or in percents `[iframe width="100%" src="http://player.vimeo.com/video/3261363"]` or `[iframe width="640" src="http://player.vimeo.com/video/3261363"]` (by default width="100%");
32
* **height** - height in pixels `[iframe height="480" src="http://player.vimeo.com/video/3261363"]` (by default height="480");
38
* **id** - allows to add the id of the iframe `[iframe id="my-id"]` (removed by default);
39
* **class** - allows to add the class of the iframe `[iframe class="my-class"]` (by default class="iframe-class");
40
* **style** - allows to add the css styles of the iframe `[iframe style="margin-left:-30px;"]` (removed by default);
41
+ * **same_height_as** - allows to set the height of iframe same as target element `[iframe same_height_as="body"]`, `[iframe same_height_as="div.sidebar"]`, `[iframe same_height_as="div#content"]`, `[iframe same_height_as="window"]` - iframe will have the height of the viewport (visible area), `[iframe same_height_as="document"]` - iframe will have the height of the document, `[iframe same_height_as="content"]` - auto-height feature, so the height of the iframe will be the same as embedded content. [same_height_as="content"] works only with the same domain and subdomain. Will not work if you want to embed page "sub.site.com" on page "site.com". (removed by default);
42
* **any_other_param** - allows to add new parameter of the iframe `[iframe any_other_param="any_value"]`;
43
* **any_other_empty_param** - allows to add new empty parameter of the iframe (like "allowfullscreen" on youtube) `[iframe any_other_empty_param=""]`;
44
45
== Changelog ==
46
47
+ = 2.2 =
48
+ * fixed bug (Notice: Undefined index: same_height_as)
49
+
50
= 2.1 =
51
+ * added (frameborder="0") by default
52
53
= 2.0 =
54
+ * plugin core rebuild (thanks to Gregg Tavares)
55
+ * remove not setted params except the defaults
56
+ * added support for all params, which user will set
57
+ * added support for empty params (like "allowfullscreen" on youtube)
58
59
= 1.8 =
60
+ * Added style parameter
61
62
= 1.7 =
63
+ * Fixing minor bugs
64
65
= 1.6.0 =
66
+ * Added auto-height feature (thanks to Willem Veelenturf)
67
68
= 1.5.0 =
69
+ * Using native jQuery from include directory
70
+ * Improved "same_height_as" parameter
71
72
= 1.4.0 =
73
+ * Added "same_height_as" parameter
74
75
= 1.3.0 =
76
+ * Added "id" and "class" parameters
77
78
= 1.2.0 =
79
+ * Added "output=embed" fix to Google Map
80
81
= 1.1.0 =
82
+ * Parameter allowtransparency added (thanks to Kent)
83
84
= 1.0.0 =
85
+ * Initial release
86
87
== Installation ==
88
89
+ 1. Install and activate the plugin on the Plugins page
90
+ 2. Add shortcode `[iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"]` to page or post content