iframe - Version 1.4.0

Version Description

  • Adding "same_height_as" parameter;
Download this release

Release Info

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

Code changes from version 1.3.0 to 1.4.0

Files changed (2) hide show
  1. iframe.php +25 -6
  2. readme.txt +13 -9
iframe.php CHANGED
@@ -3,8 +3,8 @@
3
/*
4
Plugin Name: Iframe
5
Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
6
- Description: Plugin shows iframe with [iframe width="640" height="480" src="http://player.vimeo.com/video/3261363"] shortcode.
7
- Version: 1.3.0
8
Author: webvitaly
9
Author Email: webvitaly(at)gmail.com
10
Author URI: http://web-profile.com.ua/
@@ -13,7 +13,7 @@ Author URI: http://web-profile.com.ua/
13
if ( !function_exists( 'iframe_embed_shortcode' ) ) {
14
function iframe_embed_shortcode($atts, $content = null) {
15
extract(shortcode_atts(array(
16
- 'width' => '640',
17
'height' => '480',
18
'src' => '',
19
'frameborder' => '0',
@@ -21,8 +21,9 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) {
21
'marginheight' => '0',
22
'marginwidth' => '0',
23
'allowtransparency' => 'true',
24
- 'id' => 'iframe-id',
25
- 'class' => 'iframe-class'
26
), $atts));
27
$src_cut = substr($src, 0, 35);
28
if(strpos($src_cut, 'maps.google' )){
@@ -30,8 +31,26 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) {
30
}else{
31
$google_map_fix = '';
32
}
33
- return '<iframe id="'.$id.'" class="'.$class.'" width="'.$width.'" height="'.$height.'" frameborder="'.$frameborder.'" scrolling="'.$scrolling.'" marginheight="'.$marginheight.'" marginwidth="'.$marginwidth.'" allowtransparency="'.$allowtransparency.'" src="'.$src.$google_map_fix.'"></iframe>';
34
// &amp;output=embed
35
}
36
add_shortcode('iframe', 'iframe_embed_shortcode');
37
}
3
/*
4
Plugin Name: Iframe
5
Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
6
+ Description: Plugin shows iframe with [iframe width="100%" height="480" src="http://player.vimeo.com/video/3261363"] shortcode.
7
+ Version: 1.4.0
8
Author: webvitaly
9
Author Email: webvitaly(at)gmail.com
10
Author URI: http://web-profile.com.ua/
13
if ( !function_exists( 'iframe_embed_shortcode' ) ) {
14
function iframe_embed_shortcode($atts, $content = null) {
15
extract(shortcode_atts(array(
16
+ 'width' => '100%',
17
'height' => '480',
18
'src' => '',
19
'frameborder' => '0',
21
'marginheight' => '0',
22
'marginwidth' => '0',
23
'allowtransparency' => 'true',
24
+ 'id' => '',
25
+ 'class' => 'iframe-class',
26
+ 'same_height_as' => ''
27
), $atts));
28
$src_cut = substr($src, 0, 35);
29
if(strpos($src_cut, 'maps.google' )){
31
}else{
32
$google_map_fix = '';
33
}
34
+ $return = '';
35
+ if( $same_height_as != '' ){
36
+ $return .= '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>'; // including jQuery 1.6.x
37
+ $return .= '
38
+ <script type="text/javascript">
39
+ jQuery(document).ready(function() {
40
+ var target_height = jQuery("'.$same_height_as.'").height();
41
+ jQuery("iframe.'.$class.'").height(target_height);
42
+ });
43
+ </script>
44
+ ';
45
+ }
46
+ if( $id != '' ){
47
+ $id_text = 'id="'.$id.'" ';
48
+ }else{
49
+ $id_text = '';
50
+ }
51
+ $return .= '<iframe '.$id_text.'class="'.$class.'" width="'.$width.'" height="'.$height.'" src="'.$src.$google_map_fix.'" frameborder="'.$frameborder.'" scrolling="'.$scrolling.'" marginheight="'.$marginheight.'" marginwidth="'.$marginwidth.'" allowtransparency="'.$allowtransparency.'"></iframe>';
52
// &amp;output=embed
53
+ return $return;
54
}
55
add_shortcode('iframe', 'iframe_embed_shortcode');
56
}
readme.txt CHANGED
@@ -1,31 +1,32 @@
1
=== Iframe ===
2
Contributors: webvitaly
3
Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
4
- Tags: iframe, embed
5
Author URI: http://web-profile.com.ua/wordpress/
6
Requires at least: 3.0
7
Tested up to: 3.2
8
- Stable tag: 1.3.0
9
10
- You can embed iframe with [iframe width="640" height="480" src="http://vimeo.com/123"] 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 width="640" height="480" src="http://player.vimeo.com/video/3261363"]`.
17
18
= Usage (allowed parameters) =
19
- * width - width of the iframe in pixels `[iframe width="640" src="http://player.vimeo.com/video/3261363"]` (by default width="640");
20
* height - height of the iframe in pixels `[iframe height="480" src="http://player.vimeo.com/video/3261363"]` (by default height="480");
21
* src - source of the iframe `[iframe src="http://player.vimeo.com/video/3261363"]` (by default src="");
22
* frameborder - frameborder parameter of the iframe `[iframe frameborder="0" src="http://player.vimeo.com/video/3261363"]` (by default frameborder="0");
23
* scrolling - scrolling parameter of the iframe `[iframe scrolling="no" src="http://player.vimeo.com/video/3261363"]` (by default scrolling="no");
24
* marginheight - marginheight parameter of the iframe `[iframe marginheight="0" src="http://player.vimeo.com/video/3261363"]` (by default marginheight="0");
25
* marginwidth - marginwidth parameter of the iframe `[iframe marginwidth="0" src="http://player.vimeo.com/video/3261363"]` (by default marginwidth="0");
26
- * allowtransparency - allowing transparency of the iframe `[iframe allowtransparency="true" src="http://player.vimeo.com/video/3261363"]` (by default allowtransparency="true");
27
- * id - allowing to add the id of the iframe `[iframe id="my-id" src="http://player.vimeo.com/video/3261363"]` (by default id="iframe-id");
28
* class - allowing to add the class of the iframe `[iframe class="my-class" src="http://player.vimeo.com/video/3261363"]` (by default class="iframe-class");
29
30
[Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
31
@@ -33,11 +34,14 @@ So you can embed iframe code using this shortcode `[iframe width="640" height="4
33
34
== Changelog ==
35
36
= 1.3.0 =
37
* Adding "id" and "class" parameters;
38
39
= 1.2.0 =
40
- * Adding "output=embed" to Google Map;
41
42
= 1.1.0 =
43
* Parameter allowtransparency added (thanks to Kent);
@@ -48,4 +52,4 @@ So you can embed iframe code using this shortcode `[iframe width="640" height="4
48
== Installation ==
49
50
1. Install plugin and activate it on the Plugins page;
51
- 2. Add shortcode `[iframe width="640" height="480" src="http://player.vimeo.com/video/3261363"]` 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.2
8
+ Stable tag: 1.4.0
9
10
+ You can embed iframe with [iframe width="100%" height="480" src="http://vimeo.com/123"] 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 width="100%" height="480" src="http://player.vimeo.com/video/3261363"]`.
17
18
= Usage (allowed parameters) =
19
+ * width - width of the iframe in pixels `[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%");
20
* height - height of the iframe in pixels `[iframe height="480" src="http://player.vimeo.com/video/3261363"]` (by default height="480");
21
* src - source of the iframe `[iframe src="http://player.vimeo.com/video/3261363"]` (by default src="");
22
* frameborder - frameborder parameter of the iframe `[iframe frameborder="0" src="http://player.vimeo.com/video/3261363"]` (by default frameborder="0");
23
* scrolling - scrolling parameter of the iframe `[iframe scrolling="no" src="http://player.vimeo.com/video/3261363"]` (by default scrolling="no");
24
* marginheight - marginheight parameter of the iframe `[iframe marginheight="0" src="http://player.vimeo.com/video/3261363"]` (by default marginheight="0");
25
* marginwidth - marginwidth parameter of the iframe `[iframe marginwidth="0" src="http://player.vimeo.com/video/3261363"]` (by default marginwidth="0");
26
+ * allowtransparency - allows to set transparency of the iframe `[iframe allowtransparency="true" src="http://player.vimeo.com/video/3261363"]` (by default allowtransparency="true");
27
+ * id - allows to add the id of the iframe `[iframe id="my-id" src="http://player.vimeo.com/video/3261363"]` (by default id="");
28
* class - allowing to add the class of the iframe `[iframe class="my-class" src="http://player.vimeo.com/video/3261363"]` (by default class="iframe-class");
29
+ * same_height_as - allows to set the height of iframe same as target element `[iframe same_height_as="body" src="http://player.vimeo.com/video/3261363"]` or `[iframe same_height_as="div.sidebar"]` or `[iframe same_height_as="div#content"]` (by default same_height_as="");
30
31
[Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
32
34
35
== Changelog ==
36
37
+ = 1.4.0 =
38
+ * Adding "same_height_as" parameter;
39
+
40
= 1.3.0 =
41
* Adding "id" and "class" parameters;
42
43
= 1.2.0 =
44
+ * Adding "output=embed" fix to Google Map;
45
46
= 1.1.0 =
47
* Parameter allowtransparency added (thanks to Kent);
52
== Installation ==
53
54
1. Install plugin and activate it on the Plugins page;
55
+ 2. Add shortcode `[iframe width="100%" height="480" src="http://player.vimeo.com/video/3261363"]` to page content;