Advanced iFrame - Version 2.1

Version Description

Show only a specifiy part of the page in the iframe if the pages are on the same domain.

Download this release

Release Info

Developer mdempfle
Plugin Icon 128x128 Advanced iFrame
Version 2.1
Comparing to
See all releases

Code changes from version 1.3 to 2.1

advanced-iframe-admin-page.php CHANGED
@@ -3,13 +3,11 @@
3
Advanced iframe
4
http://www.tinywebgallery.com/blog/advanced-iframe
5
Michael Dempfle
6
-
7
Administration include
8
-
9
*/
10
- ?>
11
- <script>
12
- function checkInputNumber(intputField) {
13
intputField.value = intputField.value.split(' ').join('');
14
var f = intputField.value;
15
if (intputField.value == '') return;
@@ -17,63 +15,69 @@ Administration include
17
if (!match) {
18
alert("<?php _e("Please check the value you have entered. Only numbers with an optional px, %, em or pt are allowed", "advanced-iframe");?>");
19
}
20
- }
21
- </script>
22
<?php
23
if (is_user_logged_in() && is_admin()) {
24
-
25
$devOptions = $this->getAdminOptions();
26
// print_r($devOptions);
27
if (isset($_POST['update_iframe-loader'])) { //save option changes
28
$adminSettings = array('securitykey', 'src', 'width', 'height', 'scrolling',
29
'marginwidth', 'marginheight', 'frameborder', 'transparency',
30
'content_id', 'content_styles', 'hide_elements', 'class',
31
- 'shortcode_attributes', 'url_forward_parameter');
32
-
33
if (!wp_verify_nonce($_POST['twg-options'], 'twg-options')) die('Sorry, your nonce did not verify.');
34
-
35
foreach ($adminSettings as $item) {
36
- $devOptions[$item] = trim($_POST[$item]);
37
}
38
update_option($this->adminOptionsName, $devOptions);
39
- ?>
40
- <div class="updated">
41
- <p><strong><?php _e("Settings Updated.", "advanced-iframe");?></strong>
42
- </p>
43
- </div>
44
<?php
45
}
46
- ?>
47
- <style type="text/css">
48
- table th {
49
- text-align: left;
50
- }
51
- </style>
52
- <div class="wrap">
53
- <form method="post" action="options-general.php?page=advanced-iframe.php">
54
- <?php wp_nonce_field('twg-options', 'twg-options'); ?>
55
-
56
- <div id="icon-options-general" class="icon_jfu">
57
- <br>
58
- </div>
59
- <h2>
60
- <?php _e('Advanced iframe default settings', 'advanced-iframe'); ?></h2>
61
-
62
- <p>
63
- <?php _e('This plugin will include any content an advanced iframe. Please enter the url and the size you want to include your page. You have a couple of additional default options which help to integrate your site better into your template. You can overwrite all of these settings by specifying the parameter in the shortcode. Please read the documentation after each field about the parameter you have to use.', 'advanced-iframe'); ?>
64
- </p>
65
-
66
- <p>
67
- <?php _e('Please use the following shortcode to include a page to your page: ', 'advanced-iframe'); ?>
68
- <strong>[advanced_iframe securitykey="<?php echo $devOptions['securitykey']; ?>"]</strong>
69
- </p>
70
- <table class="form-table">
71
- <?php
72
printTextInput($devOptions, __('Security key', 'advanced-iframe'), 'securitykey', __('This is the security key which has to be used in the shorttag. This is mandatory because otherwise anyone who can create an article can insert a gallery as well. The default security key was randomly generated during installation. Please change the key if you like. You should use this in combination with e.g. Page security to make sure that only the users you define can modify pages.', 'advanced-iframe'));
73
printTrueFalse($devOptions, __('Allow shortcode attributes', 'advanced-iframe'), 'shortcode_attributes', __('Allow to set attributes in the shortcode. All of the attributes can be overwritten in the shortcode if you set \'Yes\'. Otherwise the settings you specify here are used.', 'advanced-iframe'));
74
printTextInput($devOptions, __('Url', 'advanced-iframe'), 'src', __('Enter the full URL to your page. e.g. http://www.tinywebgallery.com. Shortcode attribute: src=""', 'advanced-iframe'));
75
printNumberInput($devOptions, __('Width', 'advanced-iframe'), 'width', __('The width of the iframe. You can specify the value in px or in %. If you don\'t specify anything px is assumed. Shortcode attribute: width=""', 'advanced-iframe'));
76
- printNumberInput($devOptions, __('Height', 'advanced-iframe'), 'height', __('The height of the iframe. You can specify the value in px or in %. If you don\'t specify anything px is assumed. Shortcode attribute: height=""', 'advanced-iframe'));
77
printAutoNo($devOptions, __('Scrolling', 'advanced-iframe'), 'scrolling', __('Defines if scrollbars are shown if the page is too big for your iframe. Please note: If you select \'Yes\' IE does always show scrollbars on many pages! So only use this if needed. Shortcode attribute: scrolling="auto" or scrolling="no"', 'advanced-iframe'));
78
printNumberInput($devOptions, __('Margin width', 'advanced-iframe'), 'marginwidth', __('The margin width of the iframe. You can specify the value in px. If you don\'t specify anything px is assumed. Shortcode attribute: marginwidth=""', 'advanced-iframe'));
79
printNumberInput($devOptions, __('Margin height', 'advanced-iframe'), 'marginheight', __('The margin height of the iframe. You can specify the value in px. If you don\'t specify anything px is assumed. Shortcode attribute: marginheight=""', 'advanced-iframe'));
@@ -81,52 +85,144 @@ if (is_user_logged_in() && is_admin()) {
81
printTrueFalse($devOptions, __('Transparency', 'advanced-iframe'), 'transparency', __('If you like that the iframe is transparent and your background is shown you should set this to \'Yes\'. If this value is not set then the iframe is transparent in IE but transparent in e.g. Firefox. So by default you should leave this to \'Yes\'. Shortcode attribute: transparency="true" or transparency="false" ', 'advanced-iframe'));
82
printTextInput($devOptions, __('Class', 'advanced-iframe'), 'class', __('You can define a class for the iframe if you like. Shortcode attribute: class=""', 'advanced-iframe'));
83
printTextInput($devOptions, __('URL forward parameters', 'advanced-iframe'), 'url_forward_parameter', __('Define the parameters that should be passed from the browser url to the iframe url. Please separate the parameters by \',\'. In e.g. TinyWebGallery this enables you to jump directly to an album or image although TinyWebGallery is included in an iframe. Shortcode attribute: url_forward_parameter=""', 'advanced-iframe'));
84
- ?>
85
- </table>
86
- <p>
87
- <input class="button-primary" type="submit" name="update_iframe-loader"
88
- value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
89
- </p>
90
-
91
- <h3><?php _e('Advanced options', 'advanced-iframe') ?></h3>
92
-
93
- <p>
94
- <?php _e('With the following options you can modify your template on the fly to give the iframe more space! At most templates you would have to create a page template with a special css and this is quite complicated. By using the options below your template is modified on the fly by jQuery. Please look at the screenshots to make these options more clear. The options are very useful for templates that have a top navigation because otherwise your menu is gone! If you still want to do this you should add a back link to the page. The examples below are for Twenty Ten, iNove and the default Wordpress theme.', 'advanced-iframe'); ?>
95
- </p>
96
- <table class="form-table">
97
- <?php
98
- printTextInput($devOptions, __('Content id', 'advanced-iframe'), 'content_id', __('Some templates do not use the full width for their content and even most \'One column, no sidebar Page Template\' templates only remove the sidebar but do not change the content width. Please set the id of the div starting with a hash (#) that defines the content. In the field below you then define the style you want to overwrite. For Twenty Ten and WordPress Default the id is #content, for iNove it is #main. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: content_styles=""', 'advanced-iframe'));
99
- printTextInput($devOptions, __('Content styles', 'advanced-iframe'), 'content_styles', __('Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id) please separate the different style sets with |. The default values are: Wordpress default: \'width:450px;padding-left:45px;\'. Twenty Ten: \'margin-left:20px;margin-right:240px\'. iNove: \'width:605px\'. Please read the note below how to find this styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set \'width:650px;padding-left:25px;|padding-left:15px;\'. Shortcode attribute: content_styles=""', 'advanced-iframe'));
100
printTextInput($devOptions, __('Hide elements', 'advanced-iframe'), 'hide_elements', __('This setting allows to hide elements when the iframe is shown. This can be used to hide the sidebar or the heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #sidebar. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #sidebar,h2. This gives you a lot more space to show the content of the iframe. To get the id of the sidebar go to Appearance -> Editor -> Click on \'Sidebar\' on the right side. Then look for the first \'div\' you find. The id of this div is the one you need. For some common templates the id is e.g. #menu, #sidebar, or #primary. For Twenty Ten and iNove you can remove the sidebar directly: Page attributes -> Template -> no sidebar. Wordpress default: \'#sidebar\'. I recommend to use firebug (see below) to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: hide_elements=""', 'advanced-iframe'));
101
- ?>
102
- </table>
103
- <p>
104
- <?php _e('<strong>How to find the id and the attributes:</strong><ol><li>Manually: Go to Appearance -> Editor and select the page template. The you have to look with div elements are defined. e.g. container, content, main. Also classes can be defined here. Then you have to select the style sheet below and search for this ids and classes and look which one does define the width of you content.</li><li>Firebug: For Firefox you can use the plugin firebug to select the content element directly in the page. On the right side the styles are always shown. Look for the styles that set the width or any bigger margins. This are the values you can then overwrite by the settings above.</li></ol>', 'advanced-iframe'); ?>
105
- </p>
106
-
107
- <p>
108
- <input class="button-primary" type="submit" name="update_iframe-loader"
109
- value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
110
- </p>
111
112
- <div id="icon-options-general" class="icon_jfu">
113
- <br>
114
- </div>
115
-
116
- </form>
117
118
- <h2>
119
- <?php _e('Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader', 'advanced-iframe'); ?></h2>
120
- <p>
121
- <?php _e('This plugin is the extract for the iframe wrapper which was written for the TinyWebGallery. I needed an iframe wrapper that could do more then simply include a page. It needed to pass parameters to the iframe and modify the template on the fly to get more space for TWG. If you want to integrate TWG please use the "TinyWebGallery wrapper". It offers specific features only needed for the gallery. I hope this standalone wrapper is useful for other Wordpress users as well.', 'advanced-iframe'); ?>
122
- </p>
123
- <p>
124
- <?php _e('Please take a look at my other projects: Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader or TWG Flash Uploader. If you like TWG or one of my other projects like JFU, WFU or TFU you should consider to register because you can use all products with one single license and get all features of the gallery and a complete upload solution as well.', 'advanced-iframe'); ?>
125
- </p>
126
- <p>
127
- <?php _e('Please go <a href="http://www.tinywebgallery.com" target="_blank">www.tinywebgallery.com</a> for details.', 'advanced-iframe'); ?>
128
- </p>
129
<br>
130
<?php
131
}
132
function printTrueFalse($options, $label, $id, $description) {
@@ -148,7 +244,6 @@ function printTrueFalse($options, $label, $id, $description) {
148
</tr>
149
';
150
}
151
-
152
function printAutoNo($options, $label, $id, $description) {
153
echo '
154
<tr valign="top">
@@ -168,26 +263,69 @@ function printAutoNo($options, $label, $id, $description) {
168
</tr>
169
';
170
}
171
-
172
function printTextInput($options, $label, $id, $description, $type = 'text') {
173
echo '
174
<tr valign="top">
175
<th scope="row">' . $label . '</th>
176
<td>
177
- <input name="' . $id . '" type="' . $type . '" size="70" id="' . $id . '" value="' . $options[$id] . '" /><br>
178
<em>' . $description . '</em></td>
179
</tr>
180
';
181
}
182
-
183
function printNumberInput($options, $label, $id, $description, $type = 'text') {
184
echo '
185
<tr valign="top">
186
<th scope="row">' . $label . '</th>
187
<td>
188
- <input name="' . $id . '" type="' . $type . '" size="70" id="' . $id . '" onblur="checkInputNumber(this)" value="' . $options[$id] . '" /><br>
189
<em>' . $description . '</em></td>
190
</tr>
191
';
192
}
193
?>
3
Advanced iframe
4
http://www.tinywebgallery.com/blog/advanced-iframe
5
Michael Dempfle
6
Administration include
7
*/
8
+ ?>
9
+ <script type="text/javascript">
10
+ function aiCheckInputNumber(intputField) {
11
intputField.value = intputField.value.split(' ').join('');
12
var f = intputField.value;
13
if (intputField.value == '') return;
15
if (!match) {
16
alert("<?php _e("Please check the value you have entered. Only numbers with an optional px, %, em or pt are allowed", "advanced-iframe");?>");
17
}
18
+ }
19
+ </script>
20
<?php
21
if (is_user_logged_in() && is_admin()) {
22
$devOptions = $this->getAdminOptions();
23
// print_r($devOptions);
24
if (isset($_POST['update_iframe-loader'])) { //save option changes
25
$adminSettings = array('securitykey', 'src', 'width', 'height', 'scrolling',
26
'marginwidth', 'marginheight', 'frameborder', 'transparency',
27
'content_id', 'content_styles', 'hide_elements', 'class',
28
+ 'shortcode_attributes', 'url_forward_parameter', 'id', 'name',
29
+ 'onload', 'onload_resize', 'onload_scroll_top',
30
+ 'additional_js', 'additional_css', 'store_height_in_cookie', 'additional_height',
31
+ 'iframe_content_id', 'iframe_content_styles', 'iframe_hide_elements', 'version_counter',
32
+ 'onload_show_element_only'
33
+ );
34
if (!wp_verify_nonce($_POST['twg-options'], 'twg-options')) die('Sorry, your nonce did not verify.');
35
foreach ($adminSettings as $item) {
36
+ if ($item == 'version_counter') {
37
+ $text = rand(100000, 999999);
38
+ } else {
39
+ $text = trim($_POST[$item]);
40
+ }
41
+ // replace ' with "
42
+ $text = str_replace("'", '"' ,$text);
43
+ if (function_exists('sanitize_text_field')) {
44
+ $devOptions[$item] = stripslashes(sanitize_text_field($text));
45
+ } else {
46
+ $devOptions[$item] = stripslashes($text);
47
+ }
48
}
49
update_option($this->adminOptionsName, $devOptions);
50
+ ?>
51
+ <div class="updated">
52
+ <p><strong>
53
+ <?php _e("Settings Updated.", "advanced-iframe");?></strong>
54
+ </p>
55
+ </div>
56
<?php
57
}
58
+ ?>
59
+ <style type="text/css"> table th { text-align: left; }
60
+ </style>
61
+ <div class="wrap">
62
+ <form method="post" action="options-general.php?page=advanced-iframe.php">
63
+ <?php wp_nonce_field('twg-options', 'twg-options'); ?>
64
+ <div id="icon-options-general" class="icon_ai">
65
+ <br>
66
+ </div> <h2>
67
+ <?php _e('Advanced iframe default settings', 'advanced-iframe'); ?></h2>
68
+ <p>
69
+ <?php _e('This plugin will include any content an advanced iframe. Please enter the url and the size you want to include your page. You have a couple of additional default options which help to integrate your site better into your template. You can overwrite all of these settings by specifying the parameter in the shortcode. Please read the documentation after each field about the parameter you have to use.', 'advanced-iframe'); ?>
70
+ </p>
71
+ <p>
72
+ <?php _e('Please use the following shortcode to include a page to your page: ', 'advanced-iframe'); ?> <strong>[advanced_iframe securitykey="<?php echo $devOptions['securitykey']; ?>"]</strong>
73
+ </p>
74
+ <table class="form-table">
75
+ <?php
76
printTextInput($devOptions, __('Security key', 'advanced-iframe'), 'securitykey', __('This is the security key which has to be used in the shorttag. This is mandatory because otherwise anyone who can create an article can insert a gallery as well. The default security key was randomly generated during installation. Please change the key if you like. You should use this in combination with e.g. Page security to make sure that only the users you define can modify pages.', 'advanced-iframe'));
77
printTrueFalse($devOptions, __('Allow shortcode attributes', 'advanced-iframe'), 'shortcode_attributes', __('Allow to set attributes in the shortcode. All of the attributes can be overwritten in the shortcode if you set \'Yes\'. Otherwise the settings you specify here are used.', 'advanced-iframe'));
78
printTextInput($devOptions, __('Url', 'advanced-iframe'), 'src', __('Enter the full URL to your page. e.g. http://www.tinywebgallery.com. Shortcode attribute: src=""', 'advanced-iframe'));
79
printNumberInput($devOptions, __('Width', 'advanced-iframe'), 'width', __('The width of the iframe. You can specify the value in px or in %. If you don\'t specify anything px is assumed. Shortcode attribute: width=""', 'advanced-iframe'));
80
+ printNumberInput($devOptions, __('Height', 'advanced-iframe'), 'height', __('The height of the iframe. You can specify the value in px or in %. If you don\'t specify anything px is assumed. Please note that % does most of the time does NOT give the expected result (e.g. 100% is only 150px) because the % are not from the iframe page but from the parent element. If you like something like that the iframe is resized to the content please read the \'<a href="#onload">Javascript iframe onload options</a>\' section below! Shortcode attribute: height=""', 'advanced-iframe'));
81
printAutoNo($devOptions, __('Scrolling', 'advanced-iframe'), 'scrolling', __('Defines if scrollbars are shown if the page is too big for your iframe. Please note: If you select \'Yes\' IE does always show scrollbars on many pages! So only use this if needed. Shortcode attribute: scrolling="auto" or scrolling="no"', 'advanced-iframe'));
82
printNumberInput($devOptions, __('Margin width', 'advanced-iframe'), 'marginwidth', __('The margin width of the iframe. You can specify the value in px. If you don\'t specify anything px is assumed. Shortcode attribute: marginwidth=""', 'advanced-iframe'));
83
printNumberInput($devOptions, __('Margin height', 'advanced-iframe'), 'marginheight', __('The margin height of the iframe. You can specify the value in px. If you don\'t specify anything px is assumed. Shortcode attribute: marginheight=""', 'advanced-iframe'));
85
printTrueFalse($devOptions, __('Transparency', 'advanced-iframe'), 'transparency', __('If you like that the iframe is transparent and your background is shown you should set this to \'Yes\'. If this value is not set then the iframe is transparent in IE but transparent in e.g. Firefox. So by default you should leave this to \'Yes\'. Shortcode attribute: transparency="true" or transparency="false" ', 'advanced-iframe'));
86
printTextInput($devOptions, __('Class', 'advanced-iframe'), 'class', __('You can define a class for the iframe if you like. Shortcode attribute: class=""', 'advanced-iframe'));
87
printTextInput($devOptions, __('URL forward parameters', 'advanced-iframe'), 'url_forward_parameter', __('Define the parameters that should be passed from the browser url to the iframe url. Please separate the parameters by \',\'. In e.g. TinyWebGallery this enables you to jump directly to an album or image although TinyWebGallery is included in an iframe. Shortcode attribute: url_forward_parameter=""', 'advanced-iframe'));
88
+ // new 1.4
89
+ printTextInput($devOptions, __('Id', 'advanced-iframe'), 'id', __('Enter the \'id\' attribute of the iframe. Shortcode attribute: id=""', 'advanced-iframe'));
90
+ printTextInput($devOptions, __('Name', 'advanced-iframe'), 'name', __('Enter the \'name\' attribute of the iframe. Shortcode attribute: name=""', 'advanced-iframe'));
91
+ ?>
92
+ </table>
93
+ <p>
94
+ <input class="button-primary" type="submit" name="update_iframe-loader" value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
95
+ </p> <br /> <h3>
96
+ <?php _e('Advanced options', 'advanced-iframe') ?></h3>
97
+ <p>
98
+ <?php _e('With the following 3 options you can modify your template on the fly to give the iframe more space! At most templates you would have to create a page template with a special css and this is quite complicated. By using the options below your template is modified on the fly by jQuery. Please look at the screenshots to make these options more clear. The options are very useful for templates that have a top navigation because otherwise your menu is gone! If you still want to do this you should add a back link to the page. The examples below are for Twenty Ten, iNove and the default Wordpress theme.', 'advanced-iframe'); ?>
99
+ </p>
100
+ <table class="form-table">
101
+ <?php
102
printTextInput($devOptions, __('Hide elements', 'advanced-iframe'), 'hide_elements', __('This setting allows to hide elements when the iframe is shown. This can be used to hide the sidebar or the heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #sidebar. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #sidebar,h2. This gives you a lot more space to show the content of the iframe. To get the id of the sidebar go to Appearance -> Editor -> Click on \'Sidebar\' on the right side. Then look for the first \'div\' you find. The id of this div is the one you need. For some common templates the id is e.g. #menu, #sidebar, or #primary. For Twenty Ten and iNove you can remove the sidebar directly: Page attributes -> Template -> no sidebar. Wordpress default: \'#sidebar\'. I recommend to use firebug (see below) to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: hide_elements=""', 'advanced-iframe'));
103
104
+ echo '</table><p>';
105
+ _e('With the following 2 options you can modify the css of your parent page. The first option defines the id/class/element you want to modify and at the 2nd option you define the styles you want to change.', 'advanced-iframe');
106
+ echo '</p><table class="form-table">';
107
+
108
+ printTextInput($devOptions, __('Content id', 'advanced-iframe'), 'content_id', __('Some templates do not use the full width for their content and even most \'One column, no sidebar Page Template\' templates only remove the sidebar but do not change the content width. Set the e.g. id of the div starting with a hash (#) that defines the content. You can use any valid jQuery selector pattern here! In the field below you then define the style you want to overwrite. For Twenty Ten and WordPress Default the id is #content, for iNove it is #main. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: content_styles=""', 'advanced-iframe'));
109
+ printTextInput($devOptions, __('Content styles', 'advanced-iframe'), 'content_styles', __('Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id) please separate the different style sets with |. The default values are: Wordpress default: \'width:450px;padding-left:45px;\'. Twenty Ten: \'margin-left:20px;margin-right:240px\'. iNove: \'width:605px\'. Read the note below how to find these styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set \'width:650px;padding-left:25px;|padding-left:15px;\'. Shortcode attribute: content_styles=""', 'advanced-iframe'));
110
+ ?>
111
+ </table>
112
+ <br id="howtoid" />
113
+ <p>
114
+ <?php _e('<strong>How to find the id and the attributes:</strong><ol><li>Manually: Go to Appearance -> Editor and select the page template. The you have to look with div elements are defined. e.g. container, content, main. Also classes can be defined here. Then you have to select the style sheet below and search for this ids and classes and look which one does define the width of you content.</li><li>Firebug: For Firefox you can use the plugin firebug to select the content element directly in the page. On the right side the styles are always shown. Look for the styles that set the width or any bigger margins. These are the values you can then overwrite by the settings above.</li><li><strong>Small jquery help</strong><br>Above you have to use the jQuery syntax:<p><ul><li>- tags - if you want to hide/modify a tag directly (e.g. h1, h2) simply use it directly e.g. h1,h2</li><li>- id - if you want to hide/modify an element where you have the id use #id</li><li>- class - if you want to hide/modify an element where you have the class use .class</li></ul></p>For more complex selectors please read the jQuery documentation.</li></ol>', 'advanced-iframe'); ?>
115
+ </p>
116
+ <p>
117
+ <input id="onload" class="button-primary" type="submit" name="update_iframe-loader" value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
118
+ </p> <br /> <h3>
119
+ <?php _e('Javascript iframe onload options', 'advanced-iframe') ?></h3>
120
+ <p> PLEASE READ THIS FIRST:
121
+ </p>
122
+ <p>Only if the content from the iframe comes from the <strong>same domain</strong> it is possible that the onload attribute can execute Javascript directly which does e.g. resize the iframe to the height of the content or scroll the parent window to the top. <br /> If this is the case you can use the settings below. If you want to include an iframe from a different domain please read the how-to "Enabling cross-site scripting XSS via an iframe" below where I explain how this can be done if you can modify the web site that should be included. So if you are on a different domain and cannot edit the iframe page no interaction between parent and iframe is possible!
123
+ </p>
124
+ <table class="form-table">
125
+ <?php
126
+ printTextInput($devOptions, __('Onload', 'advanced-iframe'), 'onload', __('Enter the \'onload\' script of the iframe you want to execute. You can enter Javascript that is executed when the iframe is loaded. Please check the next 2 settings first! There you find a solution for iframe resize and one for scrolling the parent to the top. Please note that the output is escaped for security reasons with the Wordpress function esc_js. So please define your Javascript functions in your parent page, read all needed parameters inside the functions and call this function here. I recommend only to use the following characters: a-zA-Z_0-9();. Also note that the 2 settings below also use the onload event. So if you set them to true the code is appended to your onload function. If you like a different order of the predefined functions (aiShowElementOnly(id,element); aiResizeIframe(this); and aiScrollToTop();) please set the settings below to \'No\' and enter them here directly. Shortcode attribute: onload=""', 'advanced-iframe'));
127
+ printTextInput($devOptions, __('Show only one element', 'advanced-iframe'), 'onload_show_element_only', __('You can define which part of the page should be shown in the iframe. You can define the id (e.g. #id) or the class (.class) which should be shown. Be aware that all other elements below the body are removed! So if your css relies on a certain structure you have to add additional css by "Content id in iframe" below. Very often also a background is defined for the header which you should remove below. e.g. by setting background-image: none; in the body. This can be done at "Content id in iframe" and "Content styles in iframe" below. Shortcode attribute: onload_show_element_only=""', 'advanced-iframe'));
128
129
+ printTrueFalse($devOptions, __('Resize iframe to content height', 'advanced-iframe'), 'onload_resize', __('If you like that the iframe is resized to the height of the content you should set this to \'Yes\'. Please note that this is done by Javascript! So if a user has Javascript deactivated or a not supported browser the iframe does not get resized. Please set the height of the iframe to the minimum pixels the iframe should have! Some web pages use 100% of the height. Specifying a too big value as height does not gives you the expected result. This setting generates the code onload="aiResizeIframe(this);" to the iframe. Shortcode attribute: onload_resize="true" or onload_resize="false" ', 'advanced-iframe'));
130
+ printHeightTrueFalse($devOptions, __('Store height in cookie', 'advanced-iframe'), 'store_height_in_cookie', __('If you enable the dynamic resize the value is calculated each time when the page is loaded. So each time it took a little time until the resize of the iframe is done. And this is visible sometimes if the content page loads very slow or is on a different domain or depends on the browser. By enabling this option the last calculated height is stored in a cookie and available right away. The iframe is then first resized to this height and later on when the new height comes it is updated. By default this is disabled because when you have dynamic content in the iframe it is possible that the iframe does not shrink. So please try this setting with your destination page. If you use several iframes please specify a different id for each iframe because the name of the cookie is ai-last-height-<id>. Shortcode attribute: store_height_in_cookie="true" or store_height_in_cookie="false" ', 'advanced-iframe'));
131
+ printHeightNumberInput($devOptions, __('Additional height', 'advanced-iframe'), 'additional_height', __('If you like that the iframe is higher than the calculated value you can add some extra height here. This number is then added to the calculated one. This is e.g. needed if one of your tested browsers displays a scrollbar because of 1 or 2 pixel. Or you have an invisible area that is shown by the click on a button that can increases the size of the page. This option is NOT possible when "Store height in cookie" is enabled because this would cause that the height will increase at each reload of the parent page. Shortcode attribute: additional_height=""', 'advanced-iframe'));
132
+
133
+ printTrueFalse($devOptions, __('Scrolls the parent window to the top', 'advanced-iframe'), 'onload_scroll_top', __('If you like that if you click on a link in the iframe and the parent page should scroll to the top you should set this to \'Yes\'. Please note that this is done by Javascript! So if a user has Javascript deactivated no scrolling is done. This setting generates the code onload="aiScrollToTop();" to the iframe. If you select the resize iframe as well then onload="aiResizeIframe(this);aiScrollToTop();" is generated. If you like a different order please enter the javascript functions directly in the onload parameter in the order you like. Shortcode attribute: onload_scroll_top="true" or onload_scroll_top="false" ', 'advanced-iframe'));
134
+ ?>
135
+ </table>
136
+ <p>
137
+ <?php _e('With the following 3 options you can modify the content of the iframe. <strong>IMPORTANT</strong>: This is only possible if the iframe comes from the <strong>same domain</strong> because of the <a href="http://en.wikipedia.org/wiki/Same_origin_policy" target="_blank">same origin policy</a> of Javascript. Please read the section "<a href="#howtoid">How to find the id and the attributes</a>" above how to find the right styles. If the content comes from a different domain you have to modify the iframe page by e.g. adding a Javascript function that is then called by the onload function you can set above.', 'advanced-iframe'); ?>
138
+ </p>
139
+ <table class="form-table">
140
+ <?php
141
+ printTextInput($devOptions, __('Hide elements in iframe', 'advanced-iframe'), 'iframe_hide_elements', __('This setting allows to hide elements inside the iframe. This can be used to hide a border or a heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #header. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #header,h2. I recommend to use firebug to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: iframe_hide_elements=""', 'advanced-iframe'));
142
+
143
+ echo '</table><p>';
144
+ _e('With the following 2 options you can modify the css of your iframe if <strong>it is on the same domain</strong>. The first option defines the id/class/element you want to modify and at the 2nd option you define the styles you want to change.', 'advanced-iframe');
145
+ echo '</p><table class="form-table">';
146
+
147
+ printTextInput($devOptions, __('Content id in iframe', 'advanced-iframe'), 'iframe_content_id', __('Set the id of the element starting with a hash (#) that defines element you want to modify the css. You can use any valid jQuery selector pattern here! In the field below you then define the style you want to overwrite. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: iframe_content_styles=""', 'advanced-iframe'));
148
+ printTextInput($devOptions, __('Content styles in iframe', 'advanced-iframe'), 'iframe_content_styles', __('Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id in iframe) please separate the different style sets with |. The default values are: Wordpress default: \'width:450px;padding-left:45px;\'. Twenty Ten: \'margin-left:20px;margin-right:240px\'. iNove: \'width:605px\'. Please read the note below how to find these styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set \'width:650px;padding-left:25px;|padding-left:15px;\'. Shortcode attribute: iframe_content_styles=""', 'iframe_advanced-iframe'));
149
+ ?>
150
+ </table>
151
+ <p>
152
+ <input class="button-primary" type="submit" name="update_iframe-loader" value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
153
+ </p>
154
+ <p> <h4>
155
+ <?php _e('Enabling cross-site scripting XSS via an iframe', 'advanced-iframe') ?></h4> If the parent site and the iframe site are NOT on the same domain it is only possible to do the above stuff by including an additional iframe to the iframe page which runs again on the parent domain and can then access the functions there. A detailed documentation how this can be done is described here:
156
+ <p>
157
+ <a target="_blank" href="http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes/">http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes</a>
158
+ </p>The following steps are needed:
159
+ <ol>
160
+ <li>Don't use the onload options above (cookie and additional height does work).
161
+ </li>
162
+ <li>The parent page has a Javascript function that resized the iframe
163
+ </li>
164
+ <li>The iframe page has an additional hidden iframe, an onload attribute at the body and a javascript function
165
+ </li>
166
+ <li>A page on the parent domain does exist that is included by the hidden iframe that calls the function on the parent page
167
+ </li>
168
+ </ol>For that features 'resize' and 'scroll to top' I have already prepared everything that you need on the parent domain. Therefore 2. and 4. are already done :). For 3. you have to do the following changes in your page that is included in the iframe:
169
+ <br>
170
+ <ol>
171
+ <li> Add the following Javascript function to the header and <strong>check if the domain and wordpress root is correct</strong>!:
172
+ <p> &lt;script type="text/javascript"&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;function updateIframeHeight() {<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var iframe = document.getElementById('hiddenIframe');<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var newHeight = parseInt(document.body.scrollHeight,10);<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iframe.src = '
173
+ <?php echo site_url(); ?> /wp-content/plugins/advanced-iframe/js/iframe_height.html?height=' + newHeight;<br /> &nbsp;&nbsp;&nbsp;&nbsp;}<br /> &lt;/script&gt;
174
+ </p>
175
+ </li>
176
+ <li> Change &lt;body&gt; to &lt;body onload="updateIframeHeight()"&gt;:
177
+ </li>
178
+ <li> Add the hidden iframe at the bottom of your body:
179
+ <p> &lt;iframe id="hiddenIframe" style="visibility:hidden;" width="0" height="0" src="
180
+ <?php echo site_url(); ?> /wp-content/plugins/advanced-iframe/js/iframe_height.html"&gt;Iframes not supported.&lt;/iframe&gt;
181
+ </p>
182
+ </li>
183
+ </ol>
184
+ </p>
185
+ <p> For the 'scroll to top' functionality please replace <strong>iframe_height.html</strong> with <strong>iframe_scroll.html</strong> and remove the height variable. In the plugin folder is an example.html where both examples are shown. For "Show only one element" you also have to rewrite the Javscript because it would remove the hidden iframe as well. The example should point you to the right direction if you like to do something simelar.
186
+ </p> <h3>
187
+ <?php _e('Additional files', 'advanced-iframe') ?></h3>
188
+ <p>
189
+ <?php _e('For some features in iframes additional css or js files are needed in the parent page. E.g. for the newest version of lytebox this is needed. Each of the files do get a version number which is randomly changed each time you save the settings. So if you cange the ccs or the js file you should save the settings once to make sure your users to get the new version right away and not a chached one.', 'advanced-iframe'); ?>
190
+ </p>
191
+ <table class="form-table">
192
+ <?php
193
+ printTextInput($devOptions, __('Additional css', 'advanced-iframe'), 'additional_css', __('If you want to include an additional css into the parent page please specify the path to this file here. The css file will be added into the header of the page. You can specify a full or relative url. If you specify a relative one /style.css means that the style.css is located in the main directory of Wordpress. Start relative urls with /. Shortcode attribute: additional_css=""', 'advanced-iframe'));
194
+ printTextInput($devOptions, __('Additional js', 'advanced-iframe'), 'additional_js', __('If you want to include an additional Javascript into the parent page please specify the path to this file here. The Javascript will be added after the iframe or if you use Wordpress >= 3.3 in the footer section. You can specify a full or relative url. If you specify a relative one /javascript.js means that the javascript.js is located in the main directory of Wordpress. Start relative urls with /. Shortcode attribute: additional_js=""', 'advanced-iframe'));
195
+ ?>
196
+ </table>
197
+ <p>
198
+ <input id="onload" class="button-primary" type="submit" name="update_iframe-loader" value="<?php _e('Update Settings', 'advanced-iframe') ?>"/>
199
+ </p> <br />
200
+ </form>
201
+ <div id="icon-options-general" class="icon_ai">
202
+ <br>
203
+ </div> <h2>
204
+ <?php _e('Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader', 'advanced-iframe'); ?></h2>
205
+ <p>
206
+ <?php _e('This plugin is the extract for the iframe wrapper which was written for the TinyWebGallery. I needed an iframe wrapper that could do more than simply include a page. It needed to pass parameters to the iframe and modify the template on the fly to get more space for TWG. If you want to integrate TWG please use the "TinyWebGallery wrapper". It offers specific features only needed for the gallery. I hope this standalone wrapper is useful for other Wordpress users as well.', 'advanced-iframe'); ?>
207
+ </p>
208
+ <p>
209
+ <?php _e('Please take a look at my other projects: Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader or TWG Flash Uploader. If you like TWG or one of my other projects like JFU, WFU or TFU you should consider to register because you can use all products with one single license and get all features of the gallery and a complete upload solution as well.', 'advanced-iframe'); ?>
210
+ </p>
211
+ <p>
212
+ <?php _e('Please go <a href="http://www.tinywebgallery.com" target="_blank">www.tinywebgallery.com</a> for details.', 'advanced-iframe'); ?>
213
+ </p>
214
+ <br>
215
+ <div id="icon-options-general" class="icon_ai">
216
<br>
217
+ </div> <h2>Donate</h2>
218
+ <p>You like this plugin? Support the development with a small donation.
219
+ </p>
220
+ <p>
221
+ <A HREF="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40mdempfle%2ede&item_name=advanced%20iframe&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=EN&bn=PP%2dDonationsBF&charset=UTF%2d8">
222
+ <img src="../wp-content/plugins/wordpress-flash-uploader/img/btn_donate_LG.gif"></A>
223
+ </p>
224
+ </p>
225
+ </div>
226
<?php
227
}
228
function printTrueFalse($options, $label, $id, $description) {
244
</tr>
245
';
246
}
247
function printAutoNo($options, $label, $id, $description) {
248
echo '
249
<tr valign="top">
263
</tr>
264
';
265
}
266
function printTextInput($options, $label, $id, $description, $type = 'text') {
267
echo '
268
<tr valign="top">
269
<th scope="row">' . $label . '</th>
270
<td>
271
+ <input name="' . $id . '" type="' . $type . '" size="90" id="' . $id . '" value="' . esc_attr($options[$id]) . '" /><br>
272
<em>' . $description . '</em></td>
273
</tr>
274
';
275
}
276
function printNumberInput($options, $label, $id, $description, $type = 'text') {
277
+ if (!isset($options[$id])) {
278
+ $options[$id] = 'false';
279
+ }
280
+ echo '
281
+ <tr valign="top">
282
+ <th scope="row">' . $label . '</th>
283
+ <td>
284
+ <input name="' . $id . '" type="' . $type . '" size="90" id="' . $id . '" onblur="aiCheckInputNumber(this)" value="' . esc_attr($options[$id]) . '" /><br>
285
+ <em>' . $description . '</em></td>
286
+ </tr>
287
+ ';
288
+ }
289
+
290
+ function printHeightTrueFalse($options, $label, $id, $description) {
291
+ echo '
292
+ <tr valign="top">
293
+ <th scope="row">' . $label . '</th>
294
+ <td>
295
+ ';
296
+ echo '<input onclick="aiDisableHeight();" type="radio" id="' . $id . '" name="' . $id . '" value="true" ';
297
+ if ($options[$id] == "true") {
298
+ echo 'checked="checked"';
299
+ }
300
+ echo ' /> ' . __('Yes', 'advanced-iframe') . '&nbsp;&nbsp;<input onclick="aiEnableHeight();" type="radio" id="' . $id . '" name="' . $id . '" value="false" ';
301
+ if ($options[$id] == "false") {
302
+ echo 'checked="checked"';
303
+ }
304
+ echo '/> ' . __('No', 'advanced-iframe') . '<br>
305
+ <em>' . $description . '</em></td>
306
+ </tr>
307
+ ';
308
+ }
309
+
310
+ function printHeightNumberInput($options, $label, $id, $description, $type = 'text') {
311
+ if (!isset($options[$id])) {
312
+ $options[$id] = 'false';
313
+ }
314
+
315
+ $disabled = '';
316
+ if ($options['store_height_in_cookie'] == 'true') {
317
+ $disabled = ' readonly="readonly" ';
318
+ $options[$id] = '0';
319
+ }
320
+
321
echo '
322
<tr valign="top">
323
<th scope="row">' . $label . '</th>
324
<td>
325
+ <input ' . $disabled . ' name="' . $id . '" type="' . $type . '" size="90" id="' . $id . '" onblur="aiCheckInputNumber(this)" value="' . esc_attr($options[$id]) . '" /><br>
326
<em>' . $description . '</em></td>
327
</tr>
328
';
329
}
330
+
331
?>
advanced-iframe.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: Advanced iframe
4
Plugin URI: http://www.tinywebgallery.com/blog/advanced-iframe
5
- Version: 1.3
6
Author: Michael Dempfle
7
Author URI: http://www.tinywebgallery.com
8
Description: This plugin includes any webpage as shortcode in an advanced iframe.
@@ -18,9 +18,9 @@ Description: This plugin includes any webpage as shortcode in an advanced iframe
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*/
21
- if (!class_exists("advancediFrame")) {
22
class advancediFrame {
23
- var $adminOptionsName = "advancediFrameAdminOptions";
24
25
//
26
// class constructor
@@ -42,7 +42,13 @@ if (!class_exists("advancediFrame")) {
42
'src' => 'http://www.tinywebgallery.com', 'width' => '100%',
43
'height' => '600', 'scrolling' => 'no', 'marginwidth' => '0', 'marginheight' => '0',
44
'frameborder' => '0', 'transparency' => 'true', 'content_id' => '', 'content_styles' => '',
45
- 'hide_elements' => '', 'class' => '', 'shortcode_attributes' => 'true', 'url_forward_parameter' => '');
46
return $iframeAdminOptions;
47
}
48
@@ -64,8 +70,32 @@ if (!class_exists("advancediFrame")) {
64
65
/* CSS for the admin area */
66
function addAdminHeaderCode() {
67
- echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/twg.css" />' . "\n";
68
-
69
}
70
71
function param($param, $content = null) {
@@ -74,34 +104,108 @@ if (!class_exists("advancediFrame")) {
74
}
75
76
function do_iframe_script($atts) {
77
- $options = get_option("advancediFrameAdminOptions");
78
- // defaults
79
extract(array('securitykey' => 'not set',
80
- 'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'], 'frameborder' => $options['frameborder'],
81
- 'scrolling' => $options['scrolling'], 'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'],
82
'transparency' => $options['transparency'], 'content_id' => $options['content_id'],
83
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'],
84
- 'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter'], $atts));
85
// read the shortcode attributes
86
if ($options['shortcode_attributes'] == 'true') {
87
extract(shortcode_atts(array('securitykey' => 'not set',
88
- 'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'], 'frameborder' => $options['frameborder'],
89
- 'scrolling' => $options['scrolling'], 'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'],
90
'transparency' => $options['transparency'], 'content_id' => $options['content_id'],
91
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'],
92
- 'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter']), $atts));
93
- } else {
94
-
95
// only the secrity key is read.
96
extract(shortcode_atts(array('securitykey' => 'not set'), $atts));
97
}
98
-
99
echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/ai.css" />' . "\n";
100
if ($options['securitykey'] != $securitykey) {
101
- echo '<div class="errordiv">' . __('An invalid security key was specified. Please use at least the following shortcode:<br>[advanced_iframe securitykey="&lt;your security key - see settings&gt;"]', 'advanced-iframe') . '</div>';
102
return;
103
} else {
104
-
105
// add parameters
106
if ($url_forward_parameter != '') {
107
$sep = "&amp;";
@@ -118,14 +222,15 @@ if (!class_exists("advancediFrame")) {
118
}
119
}
120
121
- $html = '';
122
-
123
- if ((!empty($content_id) && !empty($content_styles))
124
- || !empty($hide_elements)) {
125
- $html .= "<script>
126
- jQuery(document).ready(function() {";
127
if (!empty($hide_elements)) {
128
- $html .= "jQuery('" . esc_html($hide_elements) . "').css('display', 'none');";
129
}
130
if (!empty($content_id)) {
131
$elements = esc_html($content_id); // this field should not have a problem if they are encoded.
@@ -133,23 +238,78 @@ if (!class_exists("advancediFrame")) {
133
$elementArray = explode("|", $elements);
134
$valuesArray = explode("|", $values);
135
if (count($elementArray) != count($valuesArray)) {
136
- echo '<div class="errordiv">' . __('Configuration error: The attributes content_id and content_styles have to have the amount of value sets separated by |.', 'advanced-iframe') . '</div>';
137
return;
138
} else {
139
for ($x = 0; $x < count($elementArray); ++$x) {
140
$valuesArrayPairs = explode(";", trim($valuesArray[$x], " ;:"));
141
for ($y = 0; $y < count($valuesArrayPairs); ++$y) {
142
$elements = explode(":", $valuesArrayPairs[$y]);
143
- $html .= "jQuery('" . $elementArray[$x] . "').css('" . $elements[0] . "', '" . $elements[1] . "');";
144
}
145
}
146
}
147
}
148
- $html .= " });
149
- </script>";
150
}
151
- $html .= "<iframe id='advanced_iframe' src='" . $src . "' width='" . esc_html($width) . "' height='" . esc_html($height) . "' scrolling='" . esc_html($scrolling) . "' ";
152
- if (!empty ($marginwidth)) {
153
$html .= " marginwidth='" . esc_html($marginwidth) . "' ";
154
}
155
if (!empty ($marginheight)) {
@@ -157,6 +317,9 @@ if (!class_exists("advancediFrame")) {
157
}
158
if ($frameborder != '') {
159
$html .= " frameborder='" . esc_html($frameborder) . "' ";
160
}
161
if (!empty ($transparency)) {
162
$html .= " allowtransparency='" . esc_html($transparency) . "' ";
@@ -164,12 +327,45 @@ if (!class_exists("advancediFrame")) {
164
if (!empty ($class)) {
165
$html .= " class='" . esc_html($class) . "' ";
166
}
167
-
168
$html .= "></iframe>\n ";
169
}
170
return $html;
171
}
172
-
173
function printAdminPage() {
174
require_once('advanced-iframe-admin-page.php');
175
}
@@ -182,7 +378,7 @@ if (class_exists("advancediFrame")) {
182
//Actions and Filters
183
if (isset($cons_advancediFrame)) {
184
//Initialize the admin panel
185
- if (!function_exists("advancediFrame_ap")) {
186
function advancediFrame_ap() {
187
global $cons_advancediFrame;
188
if (!isset($cons_advancediFrame)) {
@@ -197,6 +393,9 @@ if (isset($cons_advancediFrame)) {
197
add_action('admin_menu', 'advancediFrame_ap', 1); //admin page
198
add_action('init', array(&$cons_advancediFrame, 'loadLanguage'), 1); // add languages
199
add_action('admin_head', array(&$cons_advancediFrame, 'addAdminHeaderCode'), 99); // load css
200
add_shortcode('advanced_iframe', array(&$cons_advancediFrame, 'do_iframe_script'), 1); // setup shortcode [twg]
201
register_activation_hook(__FILE__, array(&$cons_advancediFrame, 'activate'));
202
}
2
/*
3
Plugin Name: Advanced iframe
4
Plugin URI: http://www.tinywebgallery.com/blog/advanced-iframe
5
+ Version: 2.1
6
Author: Michael Dempfle
7
Author URI: http://www.tinywebgallery.com
8
Description: This plugin includes any webpage as shortcode in an advanced iframe.
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*/
21
+ if (!class_exists('advancediFrame')) {
22
class advancediFrame {
23
+ var $adminOptionsName = 'advancediFrameAdminOptions';
24
25
//
26
// class constructor
42
'src' => 'http://www.tinywebgallery.com', 'width' => '100%',
43
'height' => '600', 'scrolling' => 'no', 'marginwidth' => '0', 'marginheight' => '0',
44
'frameborder' => '0', 'transparency' => 'true', 'content_id' => '', 'content_styles' => '',
45
+ 'hide_elements' => '', 'class' => '', 'shortcode_attributes' => 'true', 'url_forward_parameter' => '',
46
+ 'id' => 'advanced_iframe', 'name' => '',
47
+ 'onload' => '', 'onload_resize' => 'false', 'onload_scroll_top' => 'false',
48
+ 'additional_js' => '', 'additional_css' => '', 'store_height_in_cookie' => 'false',
49
+ 'additional_height' => '0', 'iframe_content_id' => '', 'iframe_content_styles' => '',
50
+ 'iframe_hide_elements' => '', 'version_counter' => '1', 'onload_show_element_only' => ''
51
+ );
52
return $iframeAdminOptions;
53
}
54
70
71
/* CSS for the admin area */
72
function addAdminHeaderCode() {
73
+ echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/ai.css" />' . "\n";
74
+ echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/js/ai.js" ></script>' . "\n";
75
+ }
76
+
77
+ /* additional CSS for wp area */
78
+ function addWpHeaderCode($atts) {
79
+ $options = get_option('advancediFrameAdminOptions');
80
+ // defaults
81
+ extract(array('additional_css' => $options['additional_css'],
82
+ 'additional_js' => $options['additional_js'],
83
+ 'version_counter' => $options['version_counter'],
84
+ $atts));
85
+ // read the shortcode attributes
86
+ if ($options['shortcode_attributes'] == 'true') {
87
+ extract(shortcode_atts(array('additional_css' => $options['additional_css'],
88
+ 'additional_js' => $options['additional_js']), $atts));
89
+ }
90
+ if ($additional_css != '') {
91
+ wp_register_style( 'additional-advanced-iframe', $additional_css, false, $version_counter);
92
+ wp_enqueue_style( 'additional-advanced-iframe' );
93
+ // wp_enqueue_style( 'additional-advanced-iframe', $additional_css , false );
94
+ }
95
+ if ($additional_js != '' && version_compare(get_bloginfo('version'), '3.3') < 0 ) { // wp < 3.3
96
+ wp_register_script( 'additional-advanced-iframe', $additional_js, false, $version_counter);
97
+ wp_enqueue_script( 'additional-advanced-iframe');
98
+ }
99
}
100
101
function param($param, $content = null) {
104
}
105
106
function do_iframe_script($atts) {
107
+ $options = get_option('advancediFrameAdminOptions');
108
+ // defaults for new settings in 2.0
109
+ if (!isset ($options['id'])) { $options['id'] = ''; }
110
+ if (!isset ($options['name'])) { $options['name'] = ''; }
111
+ if (!isset ($options['onload'])) { $options['onload'] = ''; }
112
+ if (!isset ($options['onload_resize'])) { $options['onload_resize'] = 'false'; }
113
+ if (!isset ($options['onload_scroll_top'])) { $options['onload_scroll_top'] = 'false'; }
114
+ if (!isset ($options['additional_js'])) { $options['additional_js'] = ''; }
115
+ if (!isset ($options['additional_css'])) { $options['additional_css'] = ''; }
116
+ if (!isset ($options['store_height_in_cookie'])) { $options['store_height_in_cookie'] = 'false'; }
117
+ if (!isset ($options['additional_height'])) { $options['additional_height'] = 0; }
118
+ if (!isset ($options['iframe_content_id'])) { $options['iframe_content_id'] = ''; }
119
+ if (!isset ($options['iframe_content_styles'])) { $options['iframe_content_styles'] = ''; }
120
+ if (!isset ($options['iframe_hide_elements'])) { $options['iframe_hide_elements'] = ''; }
121
+ if (!isset ($options['version_counter'])) { $options['version_counter'] = '1'; }
122
+ if (!isset ($options['onload_show_element_only'])) { $options['onload_show_element_only'] = ''; }
123
+
124
+ // defaults from main config
125
extract(array('securitykey' => 'not set',
126
+ 'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'],
127
+ 'frameborder' => $options['frameborder'], 'scrolling' => $options['scrolling'],
128
+ 'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'],
129
'transparency' => $options['transparency'], 'content_id' => $options['content_id'],
130
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'],
131
+ 'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter'],
132
+ 'id' => $options['id'], 'name' => $options['name'],
133
+ 'onload' => $options['onload'], 'onload_resize' => $options['onload_resize'],
134
+ 'onload_scroll_top'=> $options['onload_scroll_top'],
135
+ 'additional_js'=> $options['additional_js'],
136
+ 'additional_css'=> $options['additional_css'],
137
+ 'store_height_in_cookie'=> $options['store_height_in_cookie'],
138
+ 'additional_height' => $options['additional_height'],
139
+ 'iframe_content_id' => $options['iframe_content_id'],
140
+ 'iframe_content_styles' => $options['iframe_content_styles'],
141
+ 'iframe_hide_elements' => $options['iframe_hide_elements'],
142
+ 'version_counter' => $options['version_counter'],
143
+ 'onload_show_element_only' => $options['onload_show_element_only'],
144
+ $atts));
145
// read the shortcode attributes
146
if ($options['shortcode_attributes'] == 'true') {
147
+ // src value can be hidden in [0] and [1] if the editor does hotlink the url. Therefore I look in there if the src is not set!
148
+ if (!isset($atts['src'])) {
149
+ if (isset($atts[0]) && (stristr($atts[0], 'src') !== FALSE)) {
150
+ if (isset($atts[1])) {
151
+ $input = '<a ' . $atts[1];
152
+ $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
153
+ if(preg_match_all("/$regexp/siU", $input, $matches)) {
154
+ if (isset($matches[2])) {
155
+ $atts['src'] = $matches[2][0];
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
extract(shortcode_atts(array('securitykey' => 'not set',
162
+ 'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'],
163
+ 'frameborder' => $options['frameborder'], 'scrolling' => $options['scrolling'],
164
+ 'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'],
165
'transparency' => $options['transparency'], 'content_id' => $options['content_id'],
166
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'],
167
+ 'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter'],
168
+ 'id' => $options['id'], 'name' => $options['name'],
169
+ 'onload' => $options['onload'],
170
+ 'onload_resize' => $options['onload_resize'],
171
+ 'onload_scroll_top'=> $options['onload_scroll_top'],
172
+ 'additional_js'=> $options['additional_js'],
173
+ 'additional_css'=> $options['additional_css'],
174
+ 'store_height_in_cookie'=> $options['store_height_in_cookie'],
175
+ 'additional_height' => $options['additional_height'],
176
+ 'iframe_content_id' => $options['iframe_content_id'],
177
+ 'iframe_content_styles' => $options['iframe_content_styles'],
178
+ 'iframe_hide_elements' => $options['iframe_hide_elements'],
179
+ 'onload_show_element_only' => $options['onload_show_element_only'],
180
+ )
181
+ , $atts));
182
+ } else {
183
// only the secrity key is read.
184
extract(shortcode_atts(array('securitykey' => 'not set'), $atts));
185
}
186
+
187
+ if (empty ($id)) {
188
+ $id = 'advanced_iframe';
189
+ }
190
+ if (empty ($name)) {
191
+ $name = 'advanced_iframe';
192
+ }
193
+
194
echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/ai.css" />' . "\n";
195
+ echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/js/ai.js" ></script>' . "\n";
196
+
197
+ if ($store_height_in_cookie == 'true') {
198
+ echo '<script type="text/javascript">aiEnableCookie=true; aiId="' . $id . '";</script>';
199
+ }
200
+ if ($additional_height != 0) {
201
+ echo '<script type="text/javascript">aiExtraSpace=' . $additional_height . ';</script>';
202
+ }
203
+ echo '<script type="text/javascript">function aiResizeIframeHeight(height) { aiResizeIframeHeightById("'.$id.'",height); }</script>' . "\n";
204
+
205
if ($options['securitykey'] != $securitykey) {
206
+ echo '<div class="errordiv">' . __('An invalid security key was specified. Please use at least the following shortcode:<br>[advanced_iframe securitykey="&lt;your security key - see settings&gt;"]. Please also check in the html mode that your shortcode does only contain notmal spaces and not a &amp;nbsp; instead.', 'advanced-iframe') . '</div>';
207
return;
208
} else {
209
// add parameters
210
if ($url_forward_parameter != '') {
211
$sep = "&amp;";
222
}
223
}
224
225
+ $html = '';
226
+
227
+ if ((!empty($content_id) && !empty($content_styles)) || !empty($hide_elements)) {
228
+
229
+
230
+ // hide elements is called directy in the page to hide elements as fast as quickly
231
+ $hidehtml = '';
232
if (!empty($hide_elements)) {
233
+ $hidehtml .= "jQuery('" . esc_html($hide_elements) . "').css('display', 'none');";
234
}
235
if (!empty($content_id)) {
236
$elements = esc_html($content_id); // this field should not have a problem if they are encoded.
238
$elementArray = explode("|", $elements);
239
$valuesArray = explode("|", $values);
240
if (count($elementArray) != count($valuesArray)) {
241
+ echo '</script><div class="errordiv">' . __('Configuration error: The attributes content_id and content_styles have to have the amount of value sets separated by |.', 'advanced-iframe') . '</div>';
242
+ return;
243
+ } else {
244
+ for ($x = 0; $x < count($elementArray); ++$x) {
245
+ $valuesArrayPairs = explode(";", trim($valuesArray[$x], " ;:"));
246
+ for ($y = 0; $y < count($valuesArrayPairs); ++$y) {
247
+ $elements = explode(":", $valuesArrayPairs[$y]);
248
+ $hidehtml .= "jQuery('" . $elementArray[$x] . "').css('" . $elements[0] . "', '" . $elements[1] . "');";
249
+ }
250
+ }
251
+ }
252
+ }
253
+ $html .= '<script type="text/javascript">';
254
+ $html .= 'function aiModifyParent() { ';
255
+ $html .= $hidehtml;
256
+ $html .= '}';
257
+ $html .= 'jQuery(document).ready(function() { ';
258
+ $html .= 'aiModifyParent();';
259
+ $html .= ' });';
260
+ $html .= 'aiModifyParent();';
261
+ $html .= '</script>';
262
+ }
263
+
264
+ // jQuery("#advanced_iframe").contents().find("#iframe-div").css("border","4px solid blue");
265
+ $hideiframehtml = '';
266
+ if ((!empty($iframe_content_id) && !empty($iframe_content_styles))|| !empty($iframe_hide_elements)) {
267
+
268
+ // hide elements is called directy in the page to hide elements as fast as quickly
269
+ $hideiframehtml = '';
270
+ if (!empty($iframe_hide_elements)) {
271
+ $hideiframehtml .= "jQuery('#".$id."').contents().find('" .
272
+ esc_html($iframe_hide_elements) . "').css('display', 'none');";
273
+ }
274
+ if (!empty($iframe_content_id)) {
275
+ $elements = esc_html($iframe_content_id); // this field should not have a problem if they are encoded.
276
+ $values = esc_html($iframe_content_styles); // this field style should not have a problem if they are encoded.
277
+ $elementArray = explode("|", $elements);
278
+ $valuesArray = explode("|", $values);
279
+ if (count($elementArray) != count($valuesArray)) {
280
+ echo '</script><div class="errordiv">' . __('Configuration error: The attributes iframe_content_id and iframe_content_styles have to have the amount of value sets separated by |.', 'advanced-iframe') . '</div>';
281
return;
282
} else {
283
for ($x = 0; $x < count($elementArray); ++$x) {
284
$valuesArrayPairs = explode(";", trim($valuesArray[$x], " ;:"));
285
for ($y = 0; $y < count($valuesArrayPairs); ++$y) {
286
$elements = explode(":", $valuesArrayPairs[$y]);
287
+ $hideiframehtml .= "jQuery('#".$id."').contents().find('" . $elementArray[$x]
288
+ . "').css('" . $elements[0] . "', '" . $elements[1] . "');";
289
}
290
}
291
}
292
}
293
+ if ($hideiframehtml != '') {
294
+ $html .= '<script type="text/javascript">';
295
+ $html .= 'function aiModifyIframe() { ';
296
+ $html .= $hideiframehtml;
297
+ $html .= '}';
298
+ $html .= '</script>';
299
+ }
300
+ }
301
+
302
+
303
+
304
+
305
+ $html .= "<iframe id='" . esc_html($id) . "' ";
306
+ if (!empty ($name)) {
307
+ $html .= " name='" . esc_html($name) . "' ";
308
}
309
+ $html .= " src='" . $src . "' width='" . esc_html($width) . "' height='" . esc_html($height) .
310
+ "' scrolling='" . esc_html($scrolling) . "' ";
311
+
312
+ if (!empty ($marginwidth)) {
313
$html .= " marginwidth='" . esc_html($marginwidth) . "' ";
314
}
315
if (!empty ($marginheight)) {
317
}
318
if ($frameborder != '') {
319
$html .= " frameborder='" . esc_html($frameborder) . "' ";
320
+ if ($frameborder == 0) {
321
+ $html .= " border='0' ";
322
+ }
323
}
324
if (!empty ($transparency)) {
325
$html .= " allowtransparency='" . esc_html($transparency) . "' ";
327
if (!empty ($class)) {
328
$html .= " class='" . esc_html($class) . "' ";
329
}
330
+ // create onload string
331
+ $onload_str = '';
332
+ if ($hideiframehtml) {
333
+ $onload_str .= ';aiModifyIframe();';
334
+ }
335
+
336
+ if (!empty ($onload)) {
337
+ $onload_str .= esc_html($onload);
338
+ }
339
+ if (!empty($onload_show_element_only)) {
340
+ $onload_str .= ';aiShowElementOnly("#'.$id.'","'.$onload_show_element_only.'");';
341
+ }
342
+ if ($onload_resize == 'true') {
343
+ $onload_str .= ';aiResizeIframe(this);';
344
+ }
345
+ if ($onload_scroll_top == 'true') {
346
+ $onload_str .= ';aiScrollToTop();';
347
+ }
348
+ if ($onload_str != '') {
349
+ $html .= " onload='" . esc_js($onload_str) . "' ";
350
+ }
351
$html .= "></iframe>\n ";
352
+ if ($store_height_in_cookie == 'true') {
353
+ $html .= '<script type="text/javascript">aiUseCookie();</script>';
354
+ }
355
+ if ($additional_js != '' && version_compare(get_bloginfo('version'), '3.3') >= 0 ) { // wp >= 3.3
356
+ wp_register_script( 'additional-advanced-iframe', $additional_js, false, $version_counter);
357
+ wp_enqueue_script( 'additional-advanced-iframe');
358
+ }
359
+
360
}
361
return $html;
362
}
363
+
364
+ function add_script_footer() {
365
+ echo '<script type="text/javascript">if(window.aiModifyParent) {aiModifyParent();}</script>';
366
+ }
367
+
368
+
369
function printAdminPage() {
370
require_once('advanced-iframe-admin-page.php');
371
}
378
//Actions and Filters
379
if (isset($cons_advancediFrame)) {
380
//Initialize the admin panel
381
+ if (!function_exists('advancediFrame_ap')) {
382
function advancediFrame_ap() {
383
global $cons_advancediFrame;
384
if (!isset($cons_advancediFrame)) {
393
add_action('admin_menu', 'advancediFrame_ap', 1); //admin page
394
add_action('init', array(&$cons_advancediFrame, 'loadLanguage'), 1); // add languages
395
add_action('admin_head', array(&$cons_advancediFrame, 'addAdminHeaderCode'), 99); // load css
396
+ add_action('wp_enqueue_scripts', array(&$cons_advancediFrame, 'addWpHeaderCode'), 98); // load css
397
+ add_action('wp_footer', array(&$cons_advancediFrame, 'add_script_footer'), 2);
398
+
399
add_shortcode('advanced_iframe', array(&$cons_advancediFrame, 'do_iframe_script'), 1); // setup shortcode [twg]
400
register_activation_hook(__FILE__, array(&$cons_advancediFrame, 'activate'));
401
}
css/ai.css CHANGED
@@ -12,14 +12,15 @@ line-height: 1.3em;
12
line-height: 1.1;
13
}
14
15
- .icon_jfu {
16
float: left;
17
height: 36px;
18
- margin-top: 14px;
19
margin-right: 6px;
20
margin-bottom: 0pt;
21
margin-left: 0pt;
22
width: 36px;
23
background-image: url(../img/jfu_logo_32x32.png) !important;
24
background-position: -0px -0px !important;
25
}
12
line-height: 1.1;
13
}
14
15
+ .icon_ai {
16
float: left;
17
height: 36px;
18
+ margin-top: 8px;
19
margin-right: 6px;
20
margin-bottom: 0pt;
21
margin-left: 0pt;
22
width: 36px;
23
background-image: url(../img/jfu_logo_32x32.png) !important;
24
+ background-repeat: no-repeat;
25
background-position: -0px -0px !important;
26
}
example.html ADDED
@@ -0,0 +1,39 @@
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript">
4
+ function updateIframeHeight() {
5
+ var iframe = document.getElementById('hiddenIframe');
6
+ var newHeight = parseInt(document.body.scrollHeight,10);
7
+ iframe.src = 'http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/iframe_height.html?height=' + newHeight;
8
+ }
9
+ function scrollToTop() {
10
+ var iframe = document.getElementById('hiddenIframe2');
11
+ iframe.src = 'http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/iframe_scroll.html';
12
+ }
13
+ </script>
14
+ </head>
15
+ <body onload="updateIframeHeight();scrollToTop();">
16
+ <div id="iframe-first-div" style="height:400px;border:2px solid #f00;">
17
+
18
+ This is an example page where the scroll to top and automatic setting of the iframe height is implmented.<br/>
19
+ Please look at the source code to see how this works.
20
+
21
+ <p>
22
+ This is a simple div with a height of 600 px and a border of 2px. <br/>
23
+ </p>
24
+ If you click on the link below you come back to the same page but your parent page should scroll to the top.<br/>
25
+ Scroll down your page to see a result.
26
+ <p>
27
+ <a href="example.html">Link to this page </a>
28
+ </p>
29
+ </div>
30
+ <div id="iframe-second-div" style="height:100px;border:2px solid #00f;">
31
+ <p>
32
+ This a 2nd small div with id="iframe-second-div" I use as example how to hide an element in the iframe.
33
+ </p>
34
+ </div>
35
+ <iframe id="hiddenIframe" style="visibility:hidden;" frameborder="0" border="0" width="0" height="0" src="http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/iframe_height.html">
36
+ Iframes not supported.</iframe><iframe id="hiddenIframe2" style="visibility:hidden;" frameborder="0" border="0" width="0" height="0" src="http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/iframe_scroll.html">
37
+ Iframes not supported.</iframe>
38
+ </body>
39
+ </html>
js/ai.js ADDED
@@ -0,0 +1,111 @@
1
+ var aiEnableCookie=false;
2
+ var aiId='';
3
+ var aiExtraSpace = 0;
4
+
5
+ /**
6
+ * This function resizes the iframe after loading to the height
7
+ * of then content of the iframe.
8
+ *
9
+ * The extra space is not stored in the cookie! The height would
10
+ * be added every time otherwise and the iframe would grow,
11
+ */
12
+ function aiResizeIframe(obj) {
13
+ obj.height = obj.contentWindow.document.body.scrollHeight + aiExtraSpace; //IE6, IE7, IE9, Safari, FF and Chrome
14
+ if (aiEnableCookie && aiExtraSpace == 0 ) {
15
+ aiWriteCookie(obj.height);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Resizes an iframe to a given height.
21
+ * this is used for xss enabled iframes.
22
+ * Please read the documentation!
23
+ */
24
+ function aiResizeIframeHeightById(id, nHeight) {
25
+ height = parseInt(nHeight) + aiExtraSpace;
26
+ var iframe = document.getElementById(id);
27
+ iframe.setAttribute('height', height + 'px');
28
+ if (aiEnableCookie && aiExtraSpace == 0) {
29
+ aiWriteCookie(height);
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Scrolls the parent window to the top.
35
+ * This is e.g. wanted when you have a link in the iframe and you want that the
36
+ * page starts at the top and not that only the iframe changes.
37
+ */
38
+ function aiScrollToTop() {
39
+ window.parent.window.scrollTo(0,0);
40
+ }
41
+
42
+ /**
43
+ * Writes the last height to the cookie.
44
+ */
45
+ function aiWriteCookie(height) {
46
+ var cookieName = 'ai-last-height';
47
+ if (aiId != '') {
48
+ cookieName = cookieName + '-' + aiId ;
49
+ }
50
+ var cookieStr = cookieName + "=" + height;
51
+ document.cookie=cookieStr;
52
+ }
53
+
54
+ /**
55
+ * Reads the cookie and preset the height of the iframe
56
+ */
57
+ function aiUseCookie() {
58
+ var cookieName = 'ai-last-height';
59
+ if (aiId != '') {
60
+ cookieName = cookieName + '-' + aiId ;
61
+ }
62
+ var allcookies = document.cookie;
63
+ // Get all the cookies pairs in an array
64
+ cookiearray = allcookies.split(';');
65
+ // Now take key value pair out of this array
66
+ for(var i=0; i<cookiearray.length; i++){
67
+ name = cookiearray[i].split('=')[0];
68
+ value = cookiearray[i].split('=')[1];
69
+ // alert("Key is : " + name + " and Value is : " + value);
70
+ // cookie does exist and has a numeric value
71
+ if (name == cookieName && value != null && ai_is_numeric(value)) {
72
+ var iframe = document.getElementById(aiId);
73
+ iframe.setAttribute('height', (parseInt(value) + aiExtraSpace) + 'px');
74
+ }
75
+ }
76
+ }
77
+
78
+ /**
79
+ * check if we have a numeric input
80
+ */
81
+ function ai_is_numeric(input){
82
+ return !isNaN(input);
83
+ }
84
+
85
+ /**
86
+ * Disable the additional_height input field
87
+ */
88
+ function aiDisableHeight() {
89
+ jQuery("#additional_height").attr('readonly','readonly');
90
+ jQuery("#additional_height").val('0');
91
+ }
92
+
93
+ /**
94
+ * Enable the additional_height input field
95
+ */
96
+ function aiEnableHeight() {
97
+ jQuery("#additional_height").removeAttr('readonly');
98
+ }
99
+
100
+ /**
101
+ * Removes all elements from an iframe except the given one
102
+ *
103
+ * @param iframeId id of the iframe
104
+ * @param showElement the id, class (jQuery syntax) of the element that should be displayed.
105
+ */
106
+ function aiShowElementOnly( iframeId, showElement ) {
107
+ var iframe = jQuery(iframeId).contents().find("body");
108
+ var selectedBox = iframe.find(showElement).clone();
109
+ iframe.find("*").remove();
110
+ iframe.append(selectedBox);
111
+ }
js/iframe_height.html ADDED
@@ -0,0 +1,14 @@
1
+ <script type="text/javascript">
2
+ function getFirstParamFromLocation() {
3
+ var pair = window.location.search.substring(1);
4
+ var parts = pair.split('=');
5
+ return parts[1];
6
+ }
7
+ var nHeight = getFirstParamFromLocation();
8
+ if (nHeight != undefined) {
9
+ try {
10
+ window.top.aiResizeIframeHeight(nHeight);
11
+ } catch(e) {
12
+ }
13
+ }
14
+ </script>
js/iframe_scroll.html ADDED
@@ -0,0 +1,5 @@
1
+ <script type="text/javascript">
2
+ try {
3
+ window.top.aiScrollToTop();
4
+ } catch(e) {};
5
+ </script>
languages/default.mo CHANGED
Binary file
languages/default.po CHANGED
@@ -2,208 +2,347 @@ msgid ""
2
msgstr ""
3
"Project-Id-Version: Advanced iframe\n"
4
"Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-07-23 01:49+0100\n"
6
- "PO-Revision-Date: 2011-07-23 01:49+0100\n"
7
- "Last-Translator: Michael Dempfle <tinywebgallery@mdempfle.de>\n"
8
- "Language-Team: TinyWebGallery <tinywebgallery@mdempfle.de>\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"X-Poedit-KeywordsList: __;_e\n"
13
- "X-Poedit-Basepath: C:\\software\\xampp\\htdocs\\wordpress29\\wp-content\\plugins\n"
14
- "X-Poedit-Language: English\n"
15
- "X-Poedit-Country: UNITED STATES\n"
16
"X-Poedit-SourceCharset: utf-8\n"
17
"X-Poedit-SearchPath-0: advanced-iframe\n"
18
19
- #: advanced-iframe/advanced-iframe-admin-page.php:18
20
msgid "Please check the value you have entered. Only numbers with an optional px, %, em or pt are allowed"
21
msgstr ""
22
23
- #: advanced-iframe/advanced-iframe-admin-page.php:41
24
msgid "Settings Updated."
25
msgstr ""
26
27
- #: advanced-iframe/advanced-iframe-admin-page.php:60
28
msgid "Advanced iframe default settings"
29
msgstr ""
30
31
- #: advanced-iframe/advanced-iframe-admin-page.php:63
32
msgid "This plugin will include any content an advanced iframe. Please enter the url and the size you want to include your page. You have a couple of additional default options which help to integrate your site better into your template. You can overwrite all of these settings by specifying the parameter in the shortcode. Please read the documentation after each field about the parameter you have to use."
33
msgstr ""
34
35
- #: advanced-iframe/advanced-iframe-admin-page.php:67
36
msgid "Please use the following shortcode to include a page to your page: "
37
msgstr ""
38
39
- #: advanced-iframe/advanced-iframe-admin-page.php:72
40
msgid "Security key"
41
msgstr ""
42
43
- #: advanced-iframe/advanced-iframe-admin-page.php:72
44
msgid "This is the security key which has to be used in the shorttag. This is mandatory because otherwise anyone who can create an article can insert a gallery as well. The default security key was randomly generated during installation. Please change the key if you like. You should use this in combination with e.g. Page security to make sure that only the users you define can modify pages."
45
msgstr ""
46
47
- #: advanced-iframe/advanced-iframe-admin-page.php:73
48
msgid "Allow shortcode attributes"
49
msgstr ""
50
51
- #: advanced-iframe/advanced-iframe-admin-page.php:73
52
msgid "Allow to set attributes in the shortcode. All of the attributes can be overwritten in the shortcode if you set 'Yes'. Otherwise the settings you specify here are used."
53
msgstr ""
54
55
- #: advanced-iframe/advanced-iframe-admin-page.php:74
56
msgid "Url"
57
msgstr ""
58
59
- #: advanced-iframe/advanced-iframe-admin-page.php:74
60
msgid "Enter the full URL to your page. e.g. http://www.tinywebgallery.com. Shortcode attribute: src=\"\""
61
msgstr ""
62
63
- #: advanced-iframe/advanced-iframe-admin-page.php:75
64
msgid "Width"
65
msgstr ""
66
67
- #: advanced-iframe/advanced-iframe-admin-page.php:75
68
msgid "The width of the iframe. You can specify the value in px or in %. If you don't specify anything px is assumed. Shortcode attribute: width=\"\""
69
msgstr ""
70
71
- #: advanced-iframe/advanced-iframe-admin-page.php:76
72
msgid "Height"
73
msgstr ""
74
75
- #: advanced-iframe/advanced-iframe-admin-page.php:76
76
- msgid "The height of the iframe. You can specify the value in px or in %. If you don't specify anything px is assumed. Shortcode attribute: height=\"\""
77
msgstr ""
78
79
- #: advanced-iframe/advanced-iframe-admin-page.php:77
80
msgid "Scrolling"
81
msgstr ""
82
83
- #: advanced-iframe/advanced-iframe-admin-page.php:77
84
msgid "Defines if scrollbars are shown if the page is too big for your iframe. Please note: If you select 'Yes' IE does always show scrollbars on many pages! So only use this if needed. Shortcode attribute: scrolling=\"auto\" or scrolling=\"no\""
85
msgstr ""
86
87
- #: advanced-iframe/advanced-iframe-admin-page.php:78
88
msgid "Margin width"
89
msgstr ""
90
91
- #: advanced-iframe/advanced-iframe-admin-page.php:78
92
msgid "The margin width of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: marginwidth=\"\""
93
msgstr ""
94
95
- #: advanced-iframe/advanced-iframe-admin-page.php:79
96
msgid "Margin height"
97
msgstr ""
98
99
- #: advanced-iframe/advanced-iframe-admin-page.php:79
100
msgid "The margin height of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: marginheight=\"\""
101
msgstr ""
102
103
- #: advanced-iframe/advanced-iframe-admin-page.php:80
104
msgid "Frame border"
105
msgstr ""
106
107
- #: advanced-iframe/advanced-iframe-admin-page.php:80
108
msgid "The frame border of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: frameborder=\"\""
109
msgstr ""
110
111
- #: advanced-iframe/advanced-iframe-admin-page.php:81
112
msgid "Transparency"
113
msgstr ""
114
115
- #: advanced-iframe/advanced-iframe-admin-page.php:81
116
msgid "If you like that the iframe is transparent and your background is shown you should set this to 'Yes'. If this value is not set then the iframe is transparent in IE but transparent in e.g. Firefox. So by default you should leave this to 'Yes'. Shortcode attribute: transparency=\"true\" or transparency=\"false\" "
117
msgstr ""
118
119
- #: advanced-iframe/advanced-iframe-admin-page.php:82
120
msgid "Class"
121
msgstr ""
122
123
- #: advanced-iframe/advanced-iframe-admin-page.php:82
124
msgid "You can define a class for the iframe if you like. Shortcode attribute: class=\"\""
125
msgstr ""
126
127
- #: advanced-iframe/advanced-iframe-admin-page.php:83
128
msgid "URL forward parameters"
129
msgstr ""
130
131
- #: advanced-iframe/advanced-iframe-admin-page.php:83
132
msgid "Define the parameters that should be passed from the browser url to the iframe url. Please separate the parameters by ','. In e.g. TinyWebGallery this enables you to jump directly to an album or image although TinyWebGallery is included in an iframe. Shortcode attribute: url_forward_parameter=\"\""
133
msgstr ""
134
135
- #: advanced-iframe/advanced-iframe-admin-page.php:88
136
- #: advanced-iframe/advanced-iframe-admin-page.php:110
137
- msgid "Update Settings"
138
msgstr ""
139
140
- #: advanced-iframe/advanced-iframe-admin-page.php:91
141
- msgid "Advanced options"
142
msgstr ""
143
144
#: advanced-iframe/advanced-iframe-admin-page.php:94
145
- msgid "With the following options you can modify your template on the fly to give the iframe more space! At most templates you would have to create a page template with a special css and this is quite complicated. By using the options below your template is modified on the fly by jQuery. Please look at the screenshots to make these options more clear. The options are very useful for templates that have a top navigation because otherwise your menu is gone! If you still want to do this you should add a back link to the page. The examples below are for Twenty Ten, iNove and the default Wordpress theme."
146
msgstr ""
147
148
#: advanced-iframe/advanced-iframe-admin-page.php:98
149
msgid "Content id"
150
msgstr ""
151
152
- #: advanced-iframe/advanced-iframe-admin-page.php:98
153
- msgid "Some templates do not use the full width for their content and even most 'One column, no sidebar Page Template' templates only remove the sidebar but do not change the content width. Please set the id of the div starting with a hash (#) that defines the content. In the field below you then define the style you want to overwrite. For Twenty Ten and WordPress Default the id is #content, for iNove it is #main. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: content_styles=\"\""
154
msgstr ""
155
156
- #: advanced-iframe/advanced-iframe-admin-page.php:99
157
msgid "Content styles"
158
msgstr ""
159
160
- #: advanced-iframe/advanced-iframe-admin-page.php:99
161
- msgid "Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id) please separate the different style sets with |. The default values are: Wordpress default: 'width:450px;padding-left:45px;'. Twenty Ten: 'margin-left:20px;margin-right:240px'. iNove: 'width:605px'. Please read the note below how to find this styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set 'width:650px;padding-left:25px;|padding-left:15px;'. Shortcode attribute: content_styles=\"\""
162
msgstr ""
163
164
- #: advanced-iframe/advanced-iframe-admin-page.php:101
165
- msgid "Hide elements"
166
msgstr ""
167
168
- #: advanced-iframe/advanced-iframe-admin-page.php:101
169
- msgid "This setting allows to hide elements when the iframe is shown. This can be used to hide the sidebar or the heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #sidebar. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #sidebar,h2. This gives you a lot more space to show the content of the iframe. To get the id of the sidebar go to Appearance -> Editor -> Click on 'Sidebar' on the right side. Then look for the first 'div' you find. The id of this div is the one you need. For some common templates the id is e.g. #menu, #sidebar, or #primary. For Twenty Ten and iNove you can remove the sidebar directly: Page attributes -> Template -> no sidebar. Wordpress default: '#sidebar'. I recommend to use firebug (see below) to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: hide_sidebar=\"\""
170
msgstr ""
171
172
- #: advanced-iframe/advanced-iframe-admin-page.php:105
173
- msgid "<strong>How to find the id and the attributes:</strong><ol><li>Manually: Go to Appearance -> Editor and select the page template. The you have to look with div elements are defined. e.g. container, content, main. Also classes can be defined here. Then you have to select the style sheet below and search for this ids and classes and look which one does define the width of you content.</li><li>Firebug: For Firefox you can use the plugin firebug to select the content element directly in the page. On the right side the styles are always shown. Look for the styles that set the width or any bigger margins. This are the values you can then overwrite by the settings above.</li></ol>"
174
msgstr ""
175
176
- #: advanced-iframe/advanced-iframe-admin-page.php:120
177
msgid "Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader"
178
msgstr ""
179
180
- #: advanced-iframe/advanced-iframe-admin-page.php:122
181
- msgid "This plugin is the extract for the iframe wrapper which was written for the TinyWebGallery. I needed an iframe wrapper that could do more then simply include a page. It needed to pass parameters to the iframe and modify the template on the fly to get more space for TWG. If you want to integrate TWG please use the \"TinyWebGallery wrapper\". It offers specific features only needed for the gallery. I hope this standalone wrapper is useful for other Wordpress users as well."
182
msgstr ""
183
184
- #: advanced-iframe/advanced-iframe-admin-page.php:125
185
msgid "Please take a look at my other projects: Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader or TWG Flash Uploader. If you like TWG or one of my other projects like JFU, WFU or TFU you should consider to register because you can use all products with one single license and get all features of the gallery and a complete upload solution as well."
186
msgstr ""
187
188
- #: advanced-iframe/advanced-iframe-admin-page.php:128
189
msgid "Please go <a href=\"http://www.tinywebgallery.com\" target=\"_blank\">www.tinywebgallery.com</a> for details."
190
msgstr ""
191
192
- #: advanced-iframe/advanced-iframe-admin-page.php:143
193
- #: advanced-iframe/advanced-iframe-admin-page.php:163
194
msgid "Yes"
195
msgstr ""
196
197
- #: advanced-iframe/advanced-iframe-admin-page.php:147
198
- #: advanced-iframe/advanced-iframe-admin-page.php:167
199
msgid "No"
200
msgstr ""
201
202
- #: advanced-iframe/advanced-iframe.php:100
203
- msgid "An invalid security key was specified. Please use at least the following shortcode:<br>[advanced_iframe securitykey=\"&lt;your security key - see settings&gt;\"]"
204
msgstr ""
205
206
- #: advanced-iframe/advanced-iframe.php:135
207
msgid "Configuration error: The attributes content_id and content_styles have to have the amount of value sets separated by |."
208
msgstr ""
209
2
msgstr ""
3
"Project-Id-Version: Advanced iframe\n"
4
"Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-02-07 22:59+0100\n"
6
+ "PO-Revision-Date: 2013-02-07 23:00+0100\n"
7
+ "Last-Translator: TinyWebGallery <tinywebgallery@mdempfle.de>\n"
8
+ "Language-Team: \n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: C:\\software\\xampplite173\\htdocs\\wordpress32\\wp-content\\plugins\n"
14
"X-Poedit-SourceCharset: utf-8\n"
15
"X-Poedit-SearchPath-0: advanced-iframe\n"
16
17
+ #: advanced-iframe/advanced-iframe-admin-page.php:16
18
msgid "Please check the value you have entered. Only numbers with an optional px, %, em or pt are allowed"
19
msgstr ""
20
21
+ #: advanced-iframe/advanced-iframe-admin-page.php:53
22
msgid "Settings Updated."
23
msgstr ""
24
25
+ #: advanced-iframe/advanced-iframe-admin-page.php:67
26
msgid "Advanced iframe default settings"
27
msgstr ""
28
29
+ #: advanced-iframe/advanced-iframe-admin-page.php:69
30
msgid "This plugin will include any content an advanced iframe. Please enter the url and the size you want to include your page. You have a couple of additional default options which help to integrate your site better into your template. You can overwrite all of these settings by specifying the parameter in the shortcode. Please read the documentation after each field about the parameter you have to use."
31
msgstr ""
32
33
+ #: advanced-iframe/advanced-iframe-admin-page.php:72
34
msgid "Please use the following shortcode to include a page to your page: "
35
msgstr ""
36
37
+ #: advanced-iframe/advanced-iframe-admin-page.php:76
38
msgid "Security key"
39
msgstr ""
40
41
+ #: advanced-iframe/advanced-iframe-admin-page.php:76
42
msgid "This is the security key which has to be used in the shorttag. This is mandatory because otherwise anyone who can create an article can insert a gallery as well. The default security key was randomly generated during installation. Please change the key if you like. You should use this in combination with e.g. Page security to make sure that only the users you define can modify pages."
43
msgstr ""
44
45
+ #: advanced-iframe/advanced-iframe-admin-page.php:77
46
msgid "Allow shortcode attributes"
47
msgstr ""
48
49
+ #: advanced-iframe/advanced-iframe-admin-page.php:77
50
msgid "Allow to set attributes in the shortcode. All of the attributes can be overwritten in the shortcode if you set 'Yes'. Otherwise the settings you specify here are used."
51
msgstr ""
52
53
+ #: advanced-iframe/advanced-iframe-admin-page.php:78
54
msgid "Url"
55
msgstr ""
56
57
+ #: advanced-iframe/advanced-iframe-admin-page.php:78
58
msgid "Enter the full URL to your page. e.g. http://www.tinywebgallery.com. Shortcode attribute: src=\"\""
59
msgstr ""
60
61
+ #: advanced-iframe/advanced-iframe-admin-page.php:79
62
msgid "Width"
63
msgstr ""
64
65
+ #: advanced-iframe/advanced-iframe-admin-page.php:79
66
msgid "The width of the iframe. You can specify the value in px or in %. If you don't specify anything px is assumed. Shortcode attribute: width=\"\""
67
msgstr ""
68
69
+ #: advanced-iframe/advanced-iframe-admin-page.php:80
70
msgid "Height"
71
msgstr ""
72
73
+ #: advanced-iframe/advanced-iframe-admin-page.php:80
74
+ msgid "The height of the iframe. You can specify the value in px or in %. If you don't specify anything px is assumed. Please note that % does most of the time does NOT give the expected result (e.g. 100% is only 150px) because the % are not from the iframe page but from the parent element. If you like something like that the iframe is resized to the content please read the '<a href=\"#onload\">Javascript iframe onload options</a>' section below! Shortcode attribute: height=\"\""
75
msgstr ""
76
77
+ #: advanced-iframe/advanced-iframe-admin-page.php:81
78
msgid "Scrolling"
79
msgstr ""
80
81
+ #: advanced-iframe/advanced-iframe-admin-page.php:81
82
msgid "Defines if scrollbars are shown if the page is too big for your iframe. Please note: If you select 'Yes' IE does always show scrollbars on many pages! So only use this if needed. Shortcode attribute: scrolling=\"auto\" or scrolling=\"no\""
83
msgstr ""
84
85
+ #: advanced-iframe/advanced-iframe-admin-page.php:82
86
msgid "Margin width"
87
msgstr ""
88
89
+ #: advanced-iframe/advanced-iframe-admin-page.php:82
90
msgid "The margin width of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: marginwidth=\"\""
91
msgstr ""
92
93
+ #: advanced-iframe/advanced-iframe-admin-page.php:83
94
msgid "Margin height"
95
msgstr ""
96
97
+ #: advanced-iframe/advanced-iframe-admin-page.php:83
98
msgid "The margin height of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: marginheight=\"\""
99
msgstr ""
100
101
+ #: advanced-iframe/advanced-iframe-admin-page.php:84
102
msgid "Frame border"
103
msgstr ""
104
105
+ #: advanced-iframe/advanced-iframe-admin-page.php:84
106
msgid "The frame border of the iframe. You can specify the value in px. If you don't specify anything px is assumed. Shortcode attribute: frameborder=\"\""
107
msgstr ""
108
109
+ #: advanced-iframe/advanced-iframe-admin-page.php:85
110
msgid "Transparency"
111
msgstr ""
112
113
+ #: advanced-iframe/advanced-iframe-admin-page.php:85
114
msgid "If you like that the iframe is transparent and your background is shown you should set this to 'Yes'. If this value is not set then the iframe is transparent in IE but transparent in e.g. Firefox. So by default you should leave this to 'Yes'. Shortcode attribute: transparency=\"true\" or transparency=\"false\" "
115
msgstr ""
116
117
+ #: advanced-iframe/advanced-iframe-admin-page.php:86
118
msgid "Class"
119
msgstr ""
120
121
+ #: advanced-iframe/advanced-iframe-admin-page.php:86
122
msgid "You can define a class for the iframe if you like. Shortcode attribute: class=\"\""
123
msgstr ""
124
125
+ #: advanced-iframe/advanced-iframe-admin-page.php:87
126
msgid "URL forward parameters"
127
msgstr ""
128
129
+ #: advanced-iframe/advanced-iframe-admin-page.php:87
130
msgid "Define the parameters that should be passed from the browser url to the iframe url. Please separate the parameters by ','. In e.g. TinyWebGallery this enables you to jump directly to an album or image although TinyWebGallery is included in an iframe. Shortcode attribute: url_forward_parameter=\"\""
131
msgstr ""
132
133
+ #: advanced-iframe/advanced-iframe-admin-page.php:89
134
+ msgid "Id"
135
msgstr ""
136
137
+ #: advanced-iframe/advanced-iframe-admin-page.php:89
138
+ msgid "Enter the 'id' attribute of the iframe. Shortcode attribute: id=\"\""
139
+ msgstr ""
140
+
141
+ #: advanced-iframe/advanced-iframe-admin-page.php:90
142
+ msgid "Name"
143
+ msgstr ""
144
+
145
+ #: advanced-iframe/advanced-iframe-admin-page.php:90
146
+ msgid "Enter the 'name' attribute of the iframe. Shortcode attribute: name=\"\""
147
msgstr ""
148
149
#: advanced-iframe/advanced-iframe-admin-page.php:94
150
+ #: advanced-iframe/advanced-iframe-admin-page.php:117
151
+ #: advanced-iframe/advanced-iframe-admin-page.php:152
152
+ #: advanced-iframe/advanced-iframe-admin-page.php:198
153
+ msgid "Update Settings"
154
+ msgstr ""
155
+
156
+ #: advanced-iframe/advanced-iframe-admin-page.php:96
157
+ msgid "Advanced options"
158
msgstr ""
159
160
#: advanced-iframe/advanced-iframe-admin-page.php:98
161
+ msgid "With the following 3 options you can modify your template on the fly to give the iframe more space! At most templates you would have to create a page template with a special css and this is quite complicated. By using the options below your template is modified on the fly by jQuery. Please look at the screenshots to make these options more clear. The options are very useful for templates that have a top navigation because otherwise your menu is gone! If you still want to do this you should add a back link to the page. The examples below are for Twenty Ten, iNove and the default Wordpress theme."
162
+ msgstr ""
163
+
164
+ #: advanced-iframe/advanced-iframe-admin-page.php:102
165
+ msgid "Hide elements"
166
+ msgstr ""
167
+
168
+ #: advanced-iframe/advanced-iframe-admin-page.php:102
169
+ msgid "This setting allows to hide elements when the iframe is shown. This can be used to hide the sidebar or the heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #sidebar. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #sidebar,h2. This gives you a lot more space to show the content of the iframe. To get the id of the sidebar go to Appearance -> Editor -> Click on 'Sidebar' on the right side. Then look for the first 'div' you find. The id of this div is the one you need. For some common templates the id is e.g. #menu, #sidebar, or #primary. For Twenty Ten and iNove you can remove the sidebar directly: Page attributes -> Template -> no sidebar. Wordpress default: '#sidebar'. I recommend to use firebug (see below) to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: hide_elements=\"\""
170
+ msgstr ""
171
+
172
+ #: advanced-iframe/advanced-iframe-admin-page.php:105
173
+ msgid "With the following 2 options you can modify the css of your parent page. The first option defines the id/class/element you want to modify and at the 2nd option you define the styles you want to change."
174
+ msgstr ""
175
+
176
+ #: advanced-iframe/advanced-iframe-admin-page.php:108
177
msgid "Content id"
178
msgstr ""
179
180
+ #: advanced-iframe/advanced-iframe-admin-page.php:108
181
+ msgid "Some templates do not use the full width for their content and even most 'One column, no sidebar Page Template' templates only remove the sidebar but do not change the content width. Set the e.g. id of the div starting with a hash (#) that defines the content. You can use any valid jQuery selector pattern here! In the field below you then define the style you want to overwrite. For Twenty Ten and WordPress Default the id is #content, for iNove it is #main. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: content_styles=\"\""
182
msgstr ""
183
184
+ #: advanced-iframe/advanced-iframe-admin-page.php:109
185
msgid "Content styles"
186
msgstr ""
187
188
+ #: advanced-iframe/advanced-iframe-admin-page.php:109
189
+ msgid "Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id) please separate the different style sets with |. The default values are: Wordpress default: 'width:450px;padding-left:45px;'. Twenty Ten: 'margin-left:20px;margin-right:240px'. iNove: 'width:605px'. Read the note below how to find these styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set 'width:650px;padding-left:25px;|padding-left:15px;'. Shortcode attribute: content_styles=\"\""
190
msgstr ""
191
192
+ #: advanced-iframe/advanced-iframe-admin-page.php:114
193
+ msgid "<strong>How to find the id and the attributes:</strong><ol><li>Manually: Go to Appearance -> Editor and select the page template. The you have to look with div elements are defined. e.g. container, content, main. Also classes can be defined here. Then you have to select the style sheet below and search for this ids and classes and look which one does define the width of you content.</li><li>Firebug: For Firefox you can use the plugin firebug to select the content element directly in the page. On the right side the styles are always shown. Look for the styles that set the width or any bigger margins. These are the values you can then overwrite by the settings above.</li><li><strong>Small jquery help</strong><br>Above you have to use the jQuery syntax:<p><ul><li>- tags - if you want to hide/modify a tag directly (e.g. h1, h2) simply use it directly e.g. h1,h2</li><li>- id - if you want to hide/modify an element where you have the id use #id</li><li>- class - if you want to hide/modify an element where you have the class use .class</li></ul></p>For more complex selectors please read the jQuery documentation.</li></ol>"
194
msgstr ""
195
196
+ #: advanced-iframe/advanced-iframe-admin-page.php:119
197
+ msgid "Javascript iframe onload options"
198
msgstr ""
199
200
+ #: advanced-iframe/advanced-iframe-admin-page.php:126
201
+ msgid "Onload"
202
+ msgstr ""
203
+
204
+ #: advanced-iframe/advanced-iframe-admin-page.php:126
205
+ msgid "Enter the 'onload' script of the iframe you want to execute. You can enter Javascript that is executed when the iframe is loaded. Please check the next 2 settings first! There you find a solution for iframe resize and one for scrolling the parent to the top. Please note that the output is escaped for security reasons with the Wordpress function esc_js. So please define your Javascript functions in your parent page, read all needed parameters inside the functions and call this function here. I recommend only to use the following characters: a-zA-Z_0-9();. Also note that the 2 settings below also use the onload event. So if you set them to true the code is appended to your onload function. If you like a different order of the predefined functions (aiShowElementOnly(id,element); aiResizeIframe(this); and aiScrollToTop();) please set the settings below to 'No' and enter them here directly. Shortcode attribute: onload=\"\""
206
+ msgstr ""
207
+
208
+ #: advanced-iframe/advanced-iframe-admin-page.php:127
209
+ msgid "Show only one element"
210
+ msgstr ""
211
+
212
+ #: advanced-iframe/advanced-iframe-admin-page.php:127
213
+ msgid "You can define which part of the page should be shown in the iframe. You can define the id (e.g. #id) or the class (.class) which should be shown. Be aware that all other elements below the body are removed! So if your css relies on a certain structure you have to add additional css by \"Content id in iframe\" below. Very often also a background is defined for the header which you should remove below. e.g. by setting background-image: none; in the body. This can be done at \"Content id in iframe\" and \"Content styles in iframe\" below. Shortcode attribute: onload_show_element_only=\"\""
214
+ msgstr ""
215
+
216
+ #: advanced-iframe/advanced-iframe-admin-page.php:129
217
+ msgid "Resize iframe to content height"
218
+ msgstr ""
219
+
220
+ #: advanced-iframe/advanced-iframe-admin-page.php:129
221
+ #, php-format
222
+ msgid "If you like that the iframe is resized to the height of the content you should set this to 'Yes'. Please note that this is done by Javascript! So if a user has Javascript deactivated or a not supported browser the iframe does not get resized. Please set the height of the iframe to the minimum pixels the iframe should have! Some web pages use 100% of the height. Specifying a too big value as height does not gives you the expected result. This setting generates the code onload=\"aiResizeIframe(this);\" to the iframe. Shortcode attribute: onload_resize=\"true\" or onload_resize=\"false\" "
223
+ msgstr ""
224
+
225
+ #: advanced-iframe/advanced-iframe-admin-page.php:130
226
+ msgid "Store height in cookie"
227
+ msgstr ""
228
+
229
+ #: advanced-iframe/advanced-iframe-admin-page.php:130
230
+ msgid "If you enable the dynamic resize the value is calculated each time when the page is loaded. So each time it took a little time until the resize of the iframe is done. And this is visible sometimes if the content page loads very slow or is on a different domain or depends on the browser. By enabling this option the last calculated height is stored in a cookie and available right away. The iframe is then first resized to this height and later on when the new height comes it is updated. By default this is disabled because when you have dynamic content in the iframe it is possible that the iframe does not shrink. So please try this setting with your destination page. If you use several iframes please specify a different id for each iframe because the name of the cookie is ai-last-height-<id>. Shortcode attribute: store_height_in_cookie=\"true\" or store_height_in_cookie=\"false\" "
231
+ msgstr ""
232
+
233
+ #: advanced-iframe/advanced-iframe-admin-page.php:131
234
+ msgid "Additional height"
235
+ msgstr ""
236
+
237
+ #: advanced-iframe/advanced-iframe-admin-page.php:131
238
+ msgid "If you like that the iframe is higher than the calculated value you can add some extra height here. This number is then added to the calculated one. This is e.g. needed if one of your tested browsers displays a scrollbar because of 1 or 2 pixel. Or you have an invisible area that is shown by the click on a button that can increases the size of the page. This option is NOT possible when \"Store height in cookie\" is enabled because this would cause that the height will increase at each reload of the parent page. Shortcode attribute: additional_height=\"\""
239
+ msgstr ""
240
+
241
+ #: advanced-iframe/advanced-iframe-admin-page.php:133
242
+ msgid "Scrolls the parent window to the top"
243
+ msgstr ""
244
+
245
+ #: advanced-iframe/advanced-iframe-admin-page.php:133
246
+ msgid "If you like that if you click on a link in the iframe and the parent page should scroll to the top you should set this to 'Yes'. Please note that this is done by Javascript! So if a user has Javascript deactivated no scrolling is done. This setting generates the code onload=\"aiScrollToTop();\" to the iframe. If you select the resize iframe as well then onload=\"aiResizeIframe(this);aiScrollToTop();\" is generated. If you like a different order please enter the javascript functions directly in the onload parameter in the order you like. Shortcode attribute: onload_scroll_top=\"true\" or onload_scroll_top=\"false\" "
247
+ msgstr ""
248
+
249
+ #: advanced-iframe/advanced-iframe-admin-page.php:137
250
+ msgid "With the following 3 options you can modify the content of the iframe. <strong>IMPORTANT</strong>: This is only possible if the iframe comes from the <strong>same domain</strong> because of the <a href=\"http://en.wikipedia.org/wiki/Same_origin_policy\" target=\"_blank\">same origin policy</a> of Javascript. Please read the section \"<a href=\"#howtoid\">How to find the id and the attributes</a>\" above how to find the right styles. If the content comes from a different domain you have to modify the iframe page by e.g. adding a Javascript function that is then called by the onload function you can set above."
251
+ msgstr ""
252
+
253
+ #: advanced-iframe/advanced-iframe-admin-page.php:141
254
+ msgid "Hide elements in iframe"
255
+ msgstr ""
256
+
257
+ #: advanced-iframe/advanced-iframe-admin-page.php:141
258
+ msgid "This setting allows to hide elements inside the iframe. This can be used to hide a border or a heading. Usage: If you want to hide a div you have to enter a hash (#) followed by the id e.g. #header. If you want to hide a heading which is a &lt;h2&gt; you have to enter h2. You can define several elements separated by , e.g. #header,h2. I recommend to use firebug to find the elements and ids. You can use any valid jQuery selector pattern here! Shortcode attribute: iframe_hide_elements=\"\""
259
msgstr ""
260
261
+ #: advanced-iframe/advanced-iframe-admin-page.php:144
262
+ msgid "With the following 2 options you can modify the css of your iframe if <strong>it is on the same domain</strong>. The first option defines the id/class/element you want to modify and at the 2nd option you define the styles you want to change."
263
+ msgstr ""
264
+
265
+ #: advanced-iframe/advanced-iframe-admin-page.php:147
266
+ msgid "Content id in iframe"
267
+ msgstr ""
268
+
269
+ #: advanced-iframe/advanced-iframe-admin-page.php:147
270
+ msgid "Set the id of the element starting with a hash (#) that defines element you want to modify the css. You can use any valid jQuery selector pattern here! In the field below you then define the style you want to overwrite. You can also define more than one element. Please separate them by | and provide the styles below. Please read the note below how to find this id for other templates. #content|h2 means that you want to set a new style for the div content and the heading h2 below. Shortcode attribute: iframe_content_styles=\"\""
271
+ msgstr ""
272
+
273
+ #: advanced-iframe/advanced-iframe-admin-page.php:148
274
+ msgid "Content styles in iframe"
275
+ msgstr ""
276
+
277
+ #: advanced-iframe/advanced-iframe-admin-page.php:148
278
+ msgid "Define the styles that have to be overwritten to enable the full width. Most of the time have to modify some of the following attributes: width, margin-left, margin-right, padding-left. Please use ; as separator between styles. If you have defined more than one element above (Content id in iframe) please separate the different style sets with |. The default values are: Wordpress default: 'width:450px;padding-left:45px;'. Twenty Ten: 'margin-left:20px;margin-right:240px'. iNove: 'width:605px'. Please read the note below how to find these styles for other templates. If you have defined #content|h2 at the Content id you can e.g. set 'width:650px;padding-left:25px;|padding-left:15px;'. Shortcode attribute: iframe_content_styles=\"\""
279
+ msgstr ""
280
+
281
+ #: advanced-iframe/advanced-iframe-admin-page.php:155
282
+ msgid "Enabling cross-site scripting XSS via an iframe"
283
+ msgstr ""
284
+
285
+ #: advanced-iframe/advanced-iframe-admin-page.php:187
286
+ msgid "Additional files"
287
+ msgstr ""
288
+
289
+ #: advanced-iframe/advanced-iframe-admin-page.php:189
290
+ msgid "For some features in iframes additional css or js files are needed in the parent page. E.g. for the newest version of lytebox this is needed. Each of the files do get a version number which is randomly changed each time you save the settings. So if you cange the ccs or the js file you should save the settings once to make sure your users to get the new version right away and not a chached one."
291
+ msgstr ""
292
+
293
+ #: advanced-iframe/advanced-iframe-admin-page.php:193
294
+ msgid "Additional css"
295
+ msgstr ""
296
+
297
+ #: advanced-iframe/advanced-iframe-admin-page.php:193
298
+ msgid "If you want to include an additional css into the parent page please specify the path to this file here. The css file will be added into the header of the page. You can specify a full or relative url. If you specify a relative one /style.css means that the style.css is located in the main directory of Wordpress. Start relative urls with /. Shortcode attribute: additional_css=\"\""
299
+ msgstr ""
300
+
301
+ #: advanced-iframe/advanced-iframe-admin-page.php:194
302
+ msgid "Additional js"
303
+ msgstr ""
304
+
305
+ #: advanced-iframe/advanced-iframe-admin-page.php:194
306
+ msgid "If you want to include an additional Javascript into the parent page please specify the path to this file here. The Javascript will be added after the iframe or if you use Wordpress >= 3.3 in the footer section. You can specify a full or relative url. If you specify a relative one /javascript.js means that the javascript.js is located in the main directory of Wordpress. Start relative urls with /. Shortcode attribute: additional_js=\"\""
307
+ msgstr ""
308
+
309
+ #: advanced-iframe/advanced-iframe-admin-page.php:204
310
msgid "Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader"
311
msgstr ""
312
313
+ #: advanced-iframe/advanced-iframe-admin-page.php:206
314
+ msgid "This plugin is the extract for the iframe wrapper which was written for the TinyWebGallery. I needed an iframe wrapper that could do more than simply include a page. It needed to pass parameters to the iframe and modify the template on the fly to get more space for TWG. If you want to integrate TWG please use the \"TinyWebGallery wrapper\". It offers specific features only needed for the gallery. I hope this standalone wrapper is useful for other Wordpress users as well."
315
msgstr ""
316
317
+ #: advanced-iframe/advanced-iframe-admin-page.php:209
318
msgid "Please take a look at my other projects: Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader or TWG Flash Uploader. If you like TWG or one of my other projects like JFU, WFU or TFU you should consider to register because you can use all products with one single license and get all features of the gallery and a complete upload solution as well."
319
msgstr ""
320
321
+ #: advanced-iframe/advanced-iframe-admin-page.php:212
322
msgid "Please go <a href=\"http://www.tinywebgallery.com\" target=\"_blank\">www.tinywebgallery.com</a> for details."
323
msgstr ""
324
325
+ #: advanced-iframe/advanced-iframe-admin-page.php:238
326
+ #: advanced-iframe/advanced-iframe-admin-page.php:257
327
+ #: advanced-iframe/advanced-iframe-admin-page.php:300
328
msgid "Yes"
329
msgstr ""
330
331
+ #: advanced-iframe/advanced-iframe-admin-page.php:242
332
+ #: advanced-iframe/advanced-iframe-admin-page.php:261
333
+ #: advanced-iframe/advanced-iframe-admin-page.php:304
334
msgid "No"
335
msgstr ""
336
337
+ #: advanced-iframe/advanced-iframe.php:206
338
+ msgid "An invalid security key was specified. Please use at least the following shortcode:<br>[advanced_iframe securitykey=\"&lt;your security key - see settings&gt;\"]. Please also check in the html mode that your shortcode does only contain notmal spaces and not a &amp;nbsp; instead."
339
msgstr ""
340
341
+ #: advanced-iframe/advanced-iframe.php:241
342
msgid "Configuration error: The attributes content_id and content_styles have to have the amount of value sets separated by |."
343
msgstr ""
344
345
+ #: advanced-iframe/advanced-iframe.php:280
346
+ msgid "Configuration error: The attributes iframe_content_id and iframe_content_styles have to have the amount of value sets separated by |."
347
+ msgstr ""
348
+
readme.txt CHANGED
@@ -3,17 +3,17 @@ Contributors: mdempfle, Michael Dempfle
3
Donate link: http://www.tinywebgallery.com
4
Tags: iframe, advanced, shortcode, widget
5
Requires at least: 2.8.6
6
- Tested up to: 3.2.1
7
- Stable tag: 1.3
8
9
- This plugin includes any webpage as shortcode in an advanced iframe.
10
11
== Description ==
12
13
- This plugin includes any webpage as shortcode in an advanced iframe.
14
15
= Shortcode for advanced iframe =
16
- By entering the shortcode '[advanced_iframe secuitykey=""]' you can include any webpage to any page or article.
17
The following differences to a normal iframe are implemented:
18
19
- Security code: You can only insert the shortcode with a valid security code from the administration.
@@ -21,10 +21,21 @@ The following differences to a normal iframe are implemented:
21
- Hide areas of the layout to give the iframe more space (see screenshot)
22
- Modify css styles to e.g. change the width of the content area (see screenshot)
23
- Forward parameters to the iframe
24
25
The following shortcode attributes can be used. Please go to the administration for details:
26
- [twg secuitykey="" src="" width="" height="" scrolling="" marginwidth="" marginheight=""
27
- frameborder="" content_id="" content_styles="" hide_elements="" class="" url_forward_parameter=""]
28
29
= Aministration =
30
* See Settings -> Advanced iframe
@@ -38,28 +49,69 @@ There are 2 ways to install the advanced iframe
38
1. Click Plugins, Add New
39
1. Search for advanced iframe
40
1. Install and Activate it
41
- 1. Place '[advanced_iframe secuitykey=""]' in your pages or posts. the security key can be found at Settings -> Advanced iframe
42
43
*Using FTP*
44
45
1. Upload 'advanced-iframe' to the '/wp-content/plugins/' directory
46
1. Activate the plugin through the 'Plugins' menu in WordPress
47
- 1. Place '[advanced_iframe secuitykey=""]' in your pages or posts. the security key can be found at Settings -> Advanced iframe
48
49
== Screenshots ==
50
1. Comparison between normal iframe and advanced iframe wrapper. The red areas are modified by the advanced iframe to display the content better.
51
2. This image shows the difference with an url forward parameter. In the advanced iframe a sub album is shown while the normal iframe still shows the entry screen.
52
3. The basic admin screen to enable standard settings
53
4. The advanced admin screen to enable advanced settings like html and css changes
54
55
== Frequently Asked Questions ==
56
- Please read the instructions in the administration careful.
57
58
== Upgrade Notice ==
59
= 1.0 =
60
First version.
61
62
== Changelog ==
63
= 1.3 =
64
Fix: content_id,content_styles,hide_elements was always used from the config even when a shortcode was given. Now the shortcode is used as well.
65
3
Donate link: http://www.tinywebgallery.com
4
Tags: iframe, advanced, shortcode, widget
5
Requires at least: 2.8.6
6
+ Tested up to: 3.5.1
7
+ Stable tag: 2.1
8
9
+ This plugin includes any webpage as shortcode in an advanced iframe that can hide and modify elements and foreward parameters to the iframe.
10
11
== Description ==
12
13
+ This plugin includes any webpage as shortcode in an advanced iframe that can hide and modify elements and foreward parameters to the iframe.
14
15
= Shortcode for advanced iframe =
16
+ By entering the shortcode '[advanced_iframe securitykey=""]' you can include any webpage to any page or article.
17
The following differences to a normal iframe are implemented:
18
19
- Security code: You can only insert the shortcode with a valid security code from the administration.
21
- Hide areas of the layout to give the iframe more space (see screenshot)
22
- Modify css styles to e.g. change the width of the content area (see screenshot)
23
- Forward parameters to the iframe
24
+ - Resize the iframe to the content height (new 2.0)
25
+ - Scroll the parent to the top when the iframe is loaded (new 2.0)
26
+ - Hide areas inside iframe if the pages are on the same domain (new 2.0)
27
+ - Modify css styles inside iframe if the pages are on the same domain to e.g. change the width of the content area (new 2.0)
28
+ - Add a css and js file to the parent page (new 2.0)
29
+ - Show only a specifiy part of the page in the iframe if the pages are on the same domain (new 2.1)
30
31
The following shortcode attributes can be used. Please go to the administration for details:
32
+
33
+ [advanced_iframe securitykey="" src="" width="" height="" scrolling="" marginwidth=""
34
+ marginheight="" id="" name="" frameborder="" content_id="" content_styles="" hide_elements=""
35
+ class="" url_forward_parameter="" onload="" onload_resize="" onload_scroll_top=""
36
+ additional_js="" additional_css="" store_height_in_cookie="" additional_height=""
37
+ iframe_content_id="", iframe_content_styles="", iframe_hide_elements="",
38
+ onload_show_element_only=""]
39
40
= Aministration =
41
* See Settings -> Advanced iframe
49
1. Click Plugins, Add New
50
1. Search for advanced iframe
51
1. Install and Activate it
52
+ 1. Place '[advanced_iframe securitykey=""]' in your pages or posts. the security key can be found at Settings -> Advanced iframe
53
54
*Using FTP*
55
56
1. Upload 'advanced-iframe' to the '/wp-content/plugins/' directory
57
1. Activate the plugin through the 'Plugins' menu in WordPress
58
+ 1. Place '[advanced_iframe securitykey=""]' in your pages or posts. the security key can be found at Settings -> Advanced iframe
59
60
== Screenshots ==
61
1. Comparison between normal iframe and advanced iframe wrapper. The red areas are modified by the advanced iframe to display the content better.
62
2. This image shows the difference with an url forward parameter. In the advanced iframe a sub album is shown while the normal iframe still shows the entry screen.
63
3. The basic admin screen to enable standard settings
64
4. The advanced admin screen to enable advanced settings like html and css changes
65
+ 5. The advanced admin screen to enable Javascript scroll to top and autoresize resize
66
67
== Frequently Asked Questions ==
68
+ = Shortcodes =
69
+ Please read the instructions in the administration careful. The documentation there should explain all of your questions!
70
+
71
+ = Demo =
72
+ See the demo here:
73
+ http://www.tinywebgallery.com/blog/advanced-iframe/demo-advanced-iframe-2-0/
74
75
== Upgrade Notice ==
76
= 1.0 =
77
First version.
78
79
== Changelog ==
80
+ = 2.1 =
81
+ Show only a specifiy part of the page in the iframe if the pages are on the same domain.
82
+
83
+ = 2.0.2 =
84
+ Tested with Wordpress 3.5
85
+
86
+ = 2.0.1 =
87
+ Fix: The included footer was causing an Javascript error on non advanced iframe pages. Now I check if the function does exist.
88
+
89
+ = 2.0 =
90
+ New: onload attribute added
91
+ New: Javascript onload solution for scolling the parent page to the top.
92
+ New: Javascript onload solution for resizing the iframe dynamically to the height of the content.
93
+ New: Javascript solution for the scrolling and resizing that works cross domain as well.
94
+ New: Hide elements/modify css modify speed was dramatically improved. The function is now not called only in the ready event of JQuery but also directly before the footer. This causes that you don't see the changes most of the time anymore!
95
+ New: An additional css file can be added to the parent page.
96
+ New: An additional Javascript file can be added to the parent page.
97
+ New: Hide areas inside iframe if the pages are on the same domain.
98
+ New: Modify css styles inside iframe if the pages are on the same domain to e.g. change the width of the content area.
99
+
100
+ = 1.5 =
101
+ Support for src values that are hotlinked by the editor.
102
+ Fixed the typo in the doumentation. in securitykey sometimes the r was missing
103
+
104
+ = 1.4 =
105
+ Documentation updated
106
+ New: id and name attribute added
107
+
108
+ = 1.3.2 =
109
+ Improved the help
110
+ Fix: css was not loaded because old css name was used
111
+
112
+ = 1.3.1 =
113
+ Fix: Improved error message if a &nbsp; is in the shortcode instead of a normal space.
114
+
115
= 1.3 =
116
Fix: content_id,content_styles,hide_elements was always used from the config even when a shortcode was given. Now the shortcode is used as well.
117
screenshot-5.png ADDED
Binary file