| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Advanced iframe |
| 4 |
Plugin URI: http://www.tinywebgallery.com/blog/advanced-iframe |
| 5 |
Version: 3.0 |
| 6 |
Author: Michael Dempfle |
| 7 |
Author URI: http://www.tinywebgallery.com |
| 8 |
Description: This plugin includes any webpage as shortcode in an advanced iframe or embeds the content directly |
| 9 |
This program is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 2 of the License, or |
| 12 |
(at your option) any later version. |
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
You should have received a copy of the GNU General Public License |
| 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 |
| 27 |
// |
| 28 |
function advancediFrame() { |
| 29 |
} |
| 30 |
|
| 31 |
function init() { |
| 32 |
$this->getAdminOptions(); |
| 33 |
} |
| 34 |
|
| 35 |
function activate() { |
| 36 |
$this->getAdminOptions(); |
| 37 |
} |
| 38 |
|
| 39 |
function iframe_defaults() { |
| 40 |
$iframeAdminOptions = array( |
| 41 |
'securitykey' => sha1(session_id()), |
| 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 |
'include_url'=> '','include_content'=> '','include_height'=> '','include_fade'=> '', |
| 52 |
'include_hide_page_until_loaded' => 'false', 'donation_bottom' => 'false' |
| 53 |
); |
| 54 |
return $iframeAdminOptions; |
| 55 |
} |
| 56 |
|
| 57 |
function getAdminOptions() { |
| 58 |
$iframeAdminOptions = advancediFrame::iframe_defaults(); |
| 59 |
$devOptions = get_option("advancediFrameAdminOptions"); |
| 60 |
if (!empty($devOptions)) { |
| 61 |
foreach ($devOptions as $key => $option) |
| 62 |
$iframeAdminOptions[$key] = $option; |
| 63 |
} |
| 64 |
update_option("advancediFrameAdminOptions", $iframeAdminOptions); |
| 65 |
return $iframeAdminOptions; |
| 66 |
} |
| 67 |
|
| 68 |
function loadLanguage() { |
| 69 |
load_plugin_textdomain('advanced-iframe', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
| 70 |
wp_enqueue_script('jquery'); |
| 71 |
} |
| 72 |
|
| 73 |
/* CSS for the admin area */ |
| 74 |
function addAdminHeaderCode() { |
| 75 |
echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/ai.css" />' . "\n"; |
| 76 |
echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/js/ai.js" ></script>' . "\n"; |
| 77 |
} |
| 78 |
|
| 79 |
/* additional CSS for wp area */ |
| 80 |
function addWpHeaderCode($atts) { |
| 81 |
$options = get_option('advancediFrameAdminOptions'); |
| 82 |
// defaults |
| 83 |
extract(array('additional_css' => $options['additional_css'], |
| 84 |
'additional_js' => $options['additional_js'], |
| 85 |
'version_counter' => $options['version_counter'], |
| 86 |
$atts)); |
| 87 |
// read the shortcode attributes |
| 88 |
if ($options['shortcode_attributes'] == 'true') { |
| 89 |
extract(shortcode_atts(array('additional_css' => $options['additional_css'], |
| 90 |
'additional_js' => $options['additional_js']), $atts)); |
| 91 |
} |
| 92 |
if ($additional_css != '') { |
| 93 |
wp_register_style( 'additional-advanced-iframe', $additional_css, false, $version_counter); |
| 94 |
wp_enqueue_style( 'additional-advanced-iframe' ); |
| 95 |
// wp_enqueue_style( 'additional-advanced-iframe', $additional_css , false ); |
| 96 |
} |
| 97 |
if ($additional_js != '' && version_compare(get_bloginfo('version'), '3.3') < 0 ) { // wp < 3.3 |
| 98 |
wp_register_script( 'additional-advanced-iframe', $additional_js, false, $version_counter); |
| 99 |
wp_enqueue_script( 'additional-advanced-iframe'); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
function param($param, $content = null) { |
| 104 |
$value = isset($_GET[$param]) ? $_GET[$param] : ''; |
| 105 |
return esc_html($value); |
| 106 |
} |
| 107 |
|
| 108 |
function do_iframe_script($atts) { |
| 109 |
$options = get_option('advancediFrameAdminOptions'); |
| 110 |
// defaults for new settings in 2.0 |
| 111 |
if (!isset ($options['id'])) { $options['id'] = ''; } |
| 112 |
if (!isset ($options['name'])) { $options['name'] = ''; } |
| 113 |
if (!isset ($options['onload'])) { $options['onload'] = ''; } |
| 114 |
if (!isset ($options['onload_resize'])) { $options['onload_resize'] = 'false'; } |
| 115 |
if (!isset ($options['onload_scroll_top'])) { $options['onload_scroll_top'] = 'false'; } |
| 116 |
if (!isset ($options['additional_js'])) { $options['additional_js'] = ''; } |
| 117 |
if (!isset ($options['additional_css'])) { $options['additional_css'] = ''; } |
| 118 |
if (!isset ($options['store_height_in_cookie'])) { $options['store_height_in_cookie'] = 'false'; } |
| 119 |
if (!isset ($options['additional_height'])) { $options['additional_height'] = 0; } |
| 120 |
if (!isset ($options['iframe_content_id'])) { $options['iframe_content_id'] = ''; } |
| 121 |
if (!isset ($options['iframe_content_styles'])) { $options['iframe_content_styles'] = ''; } |
| 122 |
if (!isset ($options['iframe_hide_elements'])) { $options['iframe_hide_elements'] = ''; } |
| 123 |
if (!isset ($options['version_counter'])) { $options['version_counter'] = '1'; } |
| 124 |
if (!isset ($options['onload_show_element_only'])) { $options['onload_show_element_only'] = ''; } |
| 125 |
// defaults for new settings in 3.0 |
| 126 |
if (!isset ($options['include_url'])) { $options['include_url'] = ''; } |
| 127 |
if (!isset ($options['include_content'])) { $options['include_content'] = ''; } |
| 128 |
if (!isset ($options['include_height'])) { $options['include_height'] = ''; } |
| 129 |
if (!isset ($options['include_fade'])) { $options['include_fade'] = '0'; } |
| 130 |
if (!isset ($options['include_hide_page_until_loaded'])) { $options['include_hide_page_until_loaded'] = 'false'; } |
| 131 |
if (!isset ($options['donation_bottom'])) { $options['donation_bottom'] = 'false'; } |
| 132 |
|
| 133 |
// defaults from main config |
| 134 |
extract(array('securitykey' => 'not set', |
| 135 |
'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'], |
| 136 |
'frameborder' => $options['frameborder'], 'scrolling' => $options['scrolling'], |
| 137 |
'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'], |
| 138 |
'transparency' => $options['transparency'], 'content_id' => $options['content_id'], |
| 139 |
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'], |
| 140 |
'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter'], |
| 141 |
'id' => $options['id'], 'name' => $options['name'], |
| 142 |
'onload' => $options['onload'], 'onload_resize' => $options['onload_resize'], |
| 143 |
'onload_scroll_top'=> $options['onload_scroll_top'], |
| 144 |
'additional_js'=> $options['additional_js'], |
| 145 |
'additional_css'=> $options['additional_css'], |
| 146 |
'store_height_in_cookie'=> $options['store_height_in_cookie'], |
| 147 |
'additional_height' => $options['additional_height'], |
| 148 |
'iframe_content_id' => $options['iframe_content_id'], |
| 149 |
'iframe_content_styles' => $options['iframe_content_styles'], |
| 150 |
'iframe_hide_elements' => $options['iframe_hide_elements'], |
| 151 |
'version_counter' => $options['version_counter'], |
| 152 |
'onload_show_element_only' => $options['onload_show_element_only'], |
| 153 |
'include_url' => $options['include_url'], |
| 154 |
'include_content' => $options['include_content'], |
| 155 |
'include_height' => $options['include_height'], |
| 156 |
'include_fade' => $options['include_fade'], |
| 157 |
'include_hide_page_until_loaded' => $options['include_hide_page_until_loaded'], |
| 158 |
$atts)); |
| 159 |
// read the shortcode attributes |
| 160 |
if ($options['shortcode_attributes'] == 'true') { |
| 161 |
// 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! |
| 162 |
if (!isset($atts['src'])) { |
| 163 |
if (isset($atts[0]) && (stristr($atts[0], 'src') !== FALSE)) { |
| 164 |
if (isset($atts[1])) { |
| 165 |
$input = '<a ' . $atts[1]; |
| 166 |
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
| 167 |
if(preg_match_all("/$regexp/siU", $input, $matches)) { |
| 168 |
if (isset($matches[2])) { |
| 169 |
$atts['src'] = $matches[2][0]; |
| 170 |
} |
| 171 |
} |
| 172 |
} |
| 173 |
} |
| 174 |
} |
| 175 |
extract(shortcode_atts(array('securitykey' => 'not set', |
| 176 |
'src' => $options['src'], 'height' => $options['height'], 'width' => $options['width'], |
| 177 |
'frameborder' => $options['frameborder'], 'scrolling' => $options['scrolling'], |
| 178 |
'marginheight' => $options['marginheight'], 'marginwidth' => $options['marginwidth'], |
| 179 |
'transparency' => $options['transparency'], 'content_id' => $options['content_id'], |
| 180 |
'content_styles' => $options['content_styles'], 'hide_elements' => $options['hide_elements'], |
| 181 |
'class' => $options['class'], 'url_forward_parameter' => $options['url_forward_parameter'], |
| 182 |
'id' => $options['id'], 'name' => $options['name'], |
| 183 |
'onload' => $options['onload'], |
| 184 |
'onload_resize' => $options['onload_resize'], |
| 185 |
'onload_scroll_top'=> $options['onload_scroll_top'], |
| 186 |
'additional_js'=> $options['additional_js'], |
| 187 |
'additional_css'=> $options['additional_css'], |
| 188 |
'store_height_in_cookie'=> $options['store_height_in_cookie'], |
| 189 |
'additional_height' => $options['additional_height'], |
| 190 |
'iframe_content_id' => $options['iframe_content_id'], |
| 191 |
'iframe_content_styles' => $options['iframe_content_styles'], |
| 192 |
'iframe_hide_elements' => $options['iframe_hide_elements'], |
| 193 |
'onload_show_element_only' => $options['onload_show_element_only'], |
| 194 |
'include_url' => $options['include_url'], |
| 195 |
'include_content' => $options['include_content'], |
| 196 |
'include_height' => $options['include_height'], |
| 197 |
'include_fade' => $options['include_fade'], |
| 198 |
'include_hide_page_until_loaded' => $options['include_hide_page_until_loaded'], |
| 199 |
) |
| 200 |
, $atts)); |
| 201 |
} else { |
| 202 |
// only the secrity key is read. |
| 203 |
extract(shortcode_atts(array('securitykey' => 'not set'), $atts)); |
| 204 |
} |
| 205 |
|
| 206 |
if (empty ($id)) { |
| 207 |
$id = 'advanced_iframe'; |
| 208 |
} |
| 209 |
if (empty ($name)) { |
| 210 |
$name = 'advanced_iframe'; |
| 211 |
} |
| 212 |
|
| 213 |
echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/css/ai.css" />' . "\n"; |
| 214 |
echo '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/advanced-iframe/js/ai.js" ></script>' . "\n"; |
| 215 |
|
| 216 |
if ($store_height_in_cookie == 'true') { |
| 217 |
echo '<script type="text/javascript">aiEnableCookie=true; aiId="' . $id . '";</script>'; |
| 218 |
} |
| 219 |
if ($additional_height != 0) { |
| 220 |
echo '<script type="text/javascript">aiExtraSpace=' . $additional_height . ';</script>'; |
| 221 |
} |
| 222 |
echo '<script type="text/javascript">function aiResizeIframeHeight(height) { aiResizeIframeHeightById("'.$id.'",height); }</script>' . "\n"; |
| 223 |
|
| 224 |
if ($options['securitykey'] != $securitykey) { |
| 225 |
echo '<div class="errordiv">' . __('An invalid security key was specified. Please use at least the following shortcode:<br>[advanced_iframe securitykey="<your security key - see settings>"]. Please also check in the html mode that your shortcode does only contain notmal spaces and not a &nbsp; instead.', 'advanced-iframe') . '</div>'; |
| 226 |
return; |
| 227 |
} else { |
| 228 |
// add parameters |
| 229 |
if ($url_forward_parameter != '') { |
| 230 |
$sep = "&"; |
| 231 |
if (strpos($src, '?') === false) { |
| 232 |
$sep = '?'; |
| 233 |
} |
| 234 |
$parameters = explode(",", $url_forward_parameter); |
| 235 |
foreach ($parameters as $parameter) { |
| 236 |
$read_param_esc = $this->param($parameter); |
| 237 |
if ($read_param_esc != '') { |
| 238 |
$src .= $sep . $parameter . "=" . $read_param_esc; |
| 239 |
$sep = "&"; |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
$html = ''; |
| 245 |
if (empty($include_url)) { |
| 246 |
if ((!empty($content_id) && !empty($content_styles)) || !empty($hide_elements)) { |
| 247 |
|
| 248 |
|
| 249 |
// hide elements is called directy in the page to hide elements as fast as quickly |
| 250 |
$hidehtml = ''; |
| 251 |
if (!empty($hide_elements)) { |
| 252 |
$hidehtml .= "jQuery('" . esc_html($hide_elements) . "').css('display', 'none');"; |
| 253 |
} |
| 254 |
if (!empty($content_id)) { |
| 255 |
$elements = esc_html($content_id); // this field should not have a problem if they are encoded. |
| 256 |
$values = esc_html($content_styles); // this field style should not have a problem if they are encoded. |
| 257 |
$elementArray = explode("|", $elements); |
| 258 |
$valuesArray = explode("|", $values); |
| 259 |
if (count($elementArray) != count($valuesArray)) { |
| 260 |
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>'; |
| 261 |
return; |
| 262 |
} else { |
| 263 |
for ($x = 0; $x < count($elementArray); ++$x) { |
| 264 |
$valuesArrayPairs = explode(";", trim($valuesArray[$x], " ;:")); |
| 265 |
for ($y = 0; $y < count($valuesArrayPairs); ++$y) { |
| 266 |
$elements = explode(":", $valuesArrayPairs[$y]); |
| 267 |
$hidehtml .= "jQuery('" . $elementArray[$x] . "').css('" . $elements[0] . "', '" . $elements[1] . "');"; |
| 268 |
} |
| 269 |
} |
| 270 |
} |
| 271 |
} |
| 272 |
$html .= '<script type="text/javascript">'; |
| 273 |
$html .= 'function aiModifyParent() { '; |
| 274 |
$html .= $hidehtml; |
| 275 |
$html .= '}'; |
| 276 |
$html .= 'jQuery(document).ready(function() { '; |
| 277 |
$html .= 'aiModifyParent();'; |
| 278 |
$html .= ' });'; |
| 279 |
$html .= 'aiModifyParent();'; |
| 280 |
$html .= '</script>'; |
| 281 |
} |
| 282 |
|
| 283 |
// jQuery("#advanced_iframe").contents().find("#iframe-div").css("border","4px solid blue"); |
| 284 |
$hideiframehtml = ''; |
| 285 |
if ((!empty($iframe_content_id) && !empty($iframe_content_styles))|| !empty($iframe_hide_elements)) { |
| 286 |
|
| 287 |
// hide elements is called directy in the page to hide elements as fast as quickly |
| 288 |
$hideiframehtml = ''; |
| 289 |
if (!empty($iframe_hide_elements)) { |
| 290 |
$hideiframehtml .= "jQuery('#".$id."').contents().find('" . |
| 291 |
esc_html($iframe_hide_elements) . "').css('display', 'none');"; |
| 292 |
} |
| 293 |
if (!empty($iframe_content_id)) { |
| 294 |
$elements = esc_html($iframe_content_id); // this field should not have a problem if they are encoded. |
| 295 |
$values = esc_html($iframe_content_styles); // this field style should not have a problem if they are encoded. |
| 296 |
$elementArray = explode("|", $elements); |
| 297 |
$valuesArray = explode("|", $values); |
| 298 |
if (count($elementArray) != count($valuesArray)) { |
| 299 |
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>'; |
| 300 |
return; |
| 301 |
} else { |
| 302 |
for ($x = 0; $x < count($elementArray); ++$x) { |
| 303 |
$valuesArrayPairs = explode(";", trim($valuesArray[$x], " ;:")); |
| 304 |
for ($y = 0; $y < count($valuesArrayPairs); ++$y) { |
| 305 |
$elements = explode(":", $valuesArrayPairs[$y]); |
| 306 |
$hideiframehtml .= "jQuery('#".$id."').contents().find('" . $elementArray[$x] |
| 307 |
. "').css('" . $elements[0] . "', '" . $elements[1] . "');"; |
| 308 |
} |
| 309 |
} |
| 310 |
} |
| 311 |
} |
| 312 |
if ($hideiframehtml != '') { |
| 313 |
$html .= '<script type="text/javascript">'; |
| 314 |
$html .= 'function aiModifyIframe() { '; |
| 315 |
$html .= $hideiframehtml; |
| 316 |
$html .= '}'; |
| 317 |
$html .= '</script>'; |
| 318 |
} |
| 319 |
} |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
$html .= "<iframe id='" . esc_html($id) . "' "; |
| 325 |
if (!empty ($name)) { |
| 326 |
$html .= " name='" . esc_html($name) . "' "; |
| 327 |
} |
| 328 |
$html .= " src='" . $src . "' width='" . esc_html($width) . "' height='" . esc_html($height) . |
| 329 |
"' scrolling='" . esc_html($scrolling) . "' "; |
| 330 |
|
| 331 |
if (!empty ($marginwidth)) { |
| 332 |
$html .= " marginwidth='" . esc_html($marginwidth) . "' "; |
| 333 |
} |
| 334 |
if (!empty ($marginheight)) { |
| 335 |
$html .= " marginheight='" . esc_html($marginheight) . "' "; |
| 336 |
} |
| 337 |
if ($frameborder != '') { |
| 338 |
$html .= " frameborder='" . esc_html($frameborder) . "' "; |
| 339 |
if ($frameborder == 0) { |
| 340 |
$html .= " border='0' "; |
| 341 |
} |
| 342 |
} |
| 343 |
if (!empty ($transparency)) { |
| 344 |
$html .= " allowtransparency='" . esc_html($transparency) . "' "; |
| 345 |
} |
| 346 |
if (!empty ($class)) { |
| 347 |
$html .= " class='" . esc_html($class) . "' "; |
| 348 |
} |
| 349 |
// create onload string |
| 350 |
$onload_str = ''; |
| 351 |
if ($hideiframehtml) { |
| 352 |
$onload_str .= ';aiModifyIframe();'; |
| 353 |
} |
| 354 |
|
| 355 |
if (!empty ($onload)) { |
| 356 |
$onload_str .= esc_html($onload); |
| 357 |
} |
| 358 |
if (!empty($onload_show_element_only)) { |
| 359 |
$onload_str .= ';aiShowElementOnly("#'.$id.'","'.$onload_show_element_only.'");'; |
| 360 |
} |
| 361 |
if ($onload_resize == 'true') { |
| 362 |
$onload_str .= ';aiResizeIframe(this);'; |
| 363 |
} |
| 364 |
if ($onload_scroll_top == 'true') { |
| 365 |
$onload_str .= ';aiScrollToTop();'; |
| 366 |
} |
| 367 |
if ($onload_str != '') { |
| 368 |
$html .= " onload='" . esc_js($onload_str) . "' "; |
| 369 |
} |
| 370 |
$html .= "></iframe>\n "; |
| 371 |
if ($store_height_in_cookie == 'true') { |
| 372 |
$html .= '<script type="text/javascript">aiUseCookie();</script>'; |
| 373 |
} |
| 374 |
} else { |
| 375 |
$ai_height = (empty ($include_height)) ? '' : (' style="height:'.$include_height.';" '); |
| 376 |
|
| 377 |
$html = '<div '.$ai_height.' id="ai_temp_'.$name.'"><!-- --></div>'; |
| 378 |
$html .= '<script type="text/javascript">'; |
| 379 |
if ($include_hide_page_until_loaded === 'true') { |
| 380 |
$html .= 'jQuery("body").css("display", "none");'; |
| 381 |
} |
| 382 |
$html .= 'jQuery("#ai_temp_'.$name.'").load("' . $include_url; |
| 383 |
if (!empty ($include_content)) { |
| 384 |
$html .= ' ' . $include_content; |
| 385 |
} |
| 386 |
$html .= '" , function() {'; |
| 387 |
if ($include_hide_page_until_loaded === 'true') { |
| 388 |
$html .= ' jQuery("body").css("display", "block"); '; |
| 389 |
} |
| 390 |
$html .= ' })'; |
| 391 |
if (!empty ($include_fade)) { |
| 392 |
$html .= '.hide().fadeIn('.$include_fade.');'; |
| 393 |
} |
| 394 |
$html .= '</script>'; |
| 395 |
} |
| 396 |
if ($additional_js != '' && version_compare(get_bloginfo('version'), '3.3') >= 0 ) { // wp >= 3.3 |
| 397 |
wp_register_script( 'additional-advanced-iframe', $additional_js, false, $version_counter); |
| 398 |
wp_enqueue_script( 'additional-advanced-iframe'); |
| 399 |
} |
| 400 |
|
| 401 |
// $html .= '<div style="clear:none" />'; |
| 402 |
return $html; |
| 403 |
} |
| 404 |
} |
| 405 |
|
| 406 |
function add_script_footer() { |
| 407 |
echo '<script type="text/javascript">if(window.aiModifyParent) {aiModifyParent();}</script>'; |
| 408 |
} |
| 409 |
|
| 410 |
|
| 411 |
function printAdminPage() { |
| 412 |
require_once('advanced-iframe-admin-page.php'); |
| 413 |
} |
| 414 |
} |
| 415 |
} |
| 416 |
// setup new instance of plugin |
| 417 |
if (class_exists("advancediFrame")) { |
| 418 |
$cons_advancediFrame = new advancediFrame(); |
| 419 |
} |
| 420 |
//Actions and Filters |
| 421 |
if (isset($cons_advancediFrame)) { |
| 422 |
//Initialize the admin panel |
| 423 |
if (!function_exists('advancediFrame_ap')) { |
| 424 |
function advancediFrame_ap() { |
| 425 |
global $cons_advancediFrame; |
| 426 |
if (!isset($cons_advancediFrame)) { |
| 427 |
return; |
| 428 |
} |
| 429 |
$options = $cons_advancediFrame->getAdminOptions(); |
| 430 |
if (function_exists('add_options_page')) { |
| 431 |
add_options_page('Advanced iFrame', 'Advanced iFrame', 'manage_options', basename(__FILE__), array(&$cons_advancediFrame, 'printAdminPage')); |
| 432 |
} |
| 433 |
} |
| 434 |
} |
| 435 |
add_action('admin_menu', 'advancediFrame_ap', 1); //admin page |
| 436 |
add_action('init', array(&$cons_advancediFrame, 'loadLanguage'), 1); // add languages |
| 437 |
add_action('admin_head', array(&$cons_advancediFrame, 'addAdminHeaderCode'), 99); // load css |
| 438 |
add_action('wp_enqueue_scripts', array(&$cons_advancediFrame, 'addWpHeaderCode'), 98); // load css |
| 439 |
add_action('wp_footer', array(&$cons_advancediFrame, 'add_script_footer'), 2); |
| 440 |
|
| 441 |
add_shortcode('advanced_iframe', array(&$cons_advancediFrame, 'do_iframe_script'), 1); // setup shortcode [twg] |
| 442 |
register_activation_hook(__FILE__, array(&$cons_advancediFrame, 'activate')); |
| 443 |
} |
| 444 |
?> |