';
include_once dirname(__FILE__) . '/advanced-iframe-admin-functions.php';
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$src_trim = trim($src);
$result_check_all = ai_checkUrlStatus( array($src_trim), $agent);
$result_check = $result_check_all[$src_trim];
$html .= 'User agent: ' . $agent;
$html .= '
Headers of ' . $src . ':
';
if (isset($result_check['header']) && is_array($result_check['header'])){
foreach ($result_check['header'] as $line) {
if (!empty($line)) {
$replace = array("\n", "\r");
$html .= str_replace($replace, '', $line) . '
';
}
}
}
$html .= ai_print_result($result_check);
$html .= '
';
$html .= '
';
$_REQUEST['debugRendered'] = true;
}
if (!empty($hide_content_until_iframe_color)) {
// we print the div to hide everything directly when the plugin is evaluated.
$hide_content_until_iframe_color_print = trim(str_replace('|keep','', strtolower($hide_content_until_iframe_color)));
$hide_content_until_content = '';
global $isAiGutenberg;
if ($isAiGutenberg || is_admin() || current_action() == "parse_request") {
// we do not render this in the editor mode as it can make the editor unusable.
} else {
echo $hide_content_until_content;
}
}
if ($add_surrounding_p === 'true') {
$html .= '';
}
if ($show_iframe_loader === 'true') {
// div around
$html .= '
';
$filenameloader = $filenamedir . '/loader.gif';
if (file_exists($filenameloader)) {
$loader_url = AIP_URL_CUSTOM . '/loader.gif';
list($widthLoader, $heightLoader) = @getimagesize($loader_url);
// get the size
$html .= '';
} else {
$loader_url = AIP_IMGURL . '/loader.gif';
}
// div for the loader
$html .= '
';
}
if (!empty($hide_part_of_iframe)) {
$html_hide = '';
$rectangles = explode('|' , $hide_part_of_iframe);
$div_width = $this->addPx($width);
if ($show_part_of_iframe === 'true') {
$div_width = $this->addPx($show_part_of_iframe_width);
}
$html .= '
';
for($hi=0;$hi
addPx($values[0]);
$r_y= $this->addPx($values[1]);
$r_width = $this->addPx($values[2]);
$r_height = $this->addPx($values[3]);
$display_type = 'div';
$hide_href = '';
if ($num_values === 7 || $num_values === 8 ) {
$display_type = 'a';
$hrefValue = esc_html(trim($values[6]));
if ($hrefValue === 'changeViewport') {
$hide_href = ' href="javascript:setNewViewPort'.$id.'(0); "';
} else {
$hide_href = ' href="'.$hrefValue.'"';
}
}
if ($num_values === 8) {
$hide_href .= ' target="'.esc_html(trim($values[7])).'"';
}
// bottom and right are extracted
$x_style='left';
$y_style='top';
if ($r_x[0] === 'r') {
$x_style='right';
$r_x = substr($r_x, 1);
}
if ($r_y[0] === 'b') {
$y_style='bottom';
$r_y = substr($r_y, 1);
}
// $values[4] does also support a html file which also includes a shortcode
// It is added with a $ after the color. html files needs to be in the custom folder.
// hide and hide1000 creade click events on close + automatic hide at a specific time.
$values_color = explode('$' , $values[4]);
$bg_color = $values_color[0];
// file or shortcode
$div_content = '';
if (count($values_color) >= 2) {
if (count($values_color) === 3) {
$element = $values_color[1];
$hide = $values_color[2];
} else {
if ($this->ai_startsWith($values_color[1], 'hide')) {
$hide = $values_color[1];
$element = "not_used";
} else {
$element = $values_color[1];
$hide = "not_used";
}
}
if ($element != 'not_used') {
$filename = $filenamedir . '/hide_'.esc_html(trim($element)).'.html';
// load file and show a message if it does not exist
if (file_exists($filename)) {
$div_content = trim(file_get_contents($filename));
// evaluate shortcodes
$div_content = do_shortcode($div_content);
$div_content = str_replace('{site}', site_url(), $div_content);
$div_content = str_replace('{x_style}', $x_style, $div_content);
$div_content = str_replace('{x_distance}', $r_x, $div_content);
$div_content = str_replace('{y_style}', $y_style, $div_content);
$div_content = str_replace('{y_distance}', $r_y, $div_content);
$div_content = str_replace('{width}', $r_width, $div_content);
$div_content = str_replace('{height}', $r_height, $div_content);
$div_content = str_replace('{id}', $id, $div_content);
if ($fullscreen_button_style !== 'black') {
switch($fullscreen_button_style) {
case 'black2':
$button_open = "fullscreen2_open.png";
$button_close = "fullscreen2_close.png";
break;
case 'white':
$button_open = "fullscreen_open-white.png";
$button_close = "fullscreen_close-white.png";
break;
case 'custom':
$button_open = "../../advanced-iframe-custom/fullscreen_open.png";
$button_close = "../../advanced-iframe-custom/fullscreen_close.png";
break;
}
$div_content = str_replace('fullscreen_open.png', $button_open, $div_content);
$div_content = str_replace('fullscreen_close.png', $button_close, $div_content);
}
} else {
$content = 'The file "' .$filename . '" cannot be found.';
}
}
if ($hide != 'not_used') {
$error = false;
if ($this->ai_startsWith($hide, 'hide')) {
$html_hide = '';
if ($hide === 'hide') {
$html_hide .= '';
}
} else {
$error = true;
}
if ($error) {
$html = $error_css . '' . __('ERROR: hide part of iframe only supports $hide or $hideXXX as last parameter.', 'advanced-iframe') . '
';
return $html;
}
}
}
$zIndex = $values[5];
$position = 'position:absolute';
if ($this->ai_startsWith($zIndex,'f')) {
$position = 'position:fixed';
$zIndex = substr($zIndex, 1);
}
// replace § with , for rbga !
$bg_color = str_replace('§',',',$bg_color );
$html .= '';
$html .= '<'.$display_type.$hide_href.' id="wrapper-div-element-'.$id.'-'.$hi.'">'.$div_content.''.$display_type.'>';
$html .= $html_hide;
} else {
if ($hide_part_of_iframe === 'false') {
$html = $error_css . '' . __('ERROR: hide part of iframe is set to "false". If do do not want to use this feature please remove this shortcode attribute and set it empty in the administration', 'advanced-iframe') . '
';
} else {
$html = $error_css . '' . __('ERROR: hide part of iframe does not have the required 6 parameters', 'advanced-iframe') . '
';
}
return $html;
}
}
}
if ($show_part_of_iframe === 'true') {
$html .= '';
if ($fixChrome65) {
$html .= '
';
}
}
if (!empty($iframe_zoom)) {
$html .= '
';
}
if ($enable_lazy_load === 'true') {
$html .= '
';
}
if (!empty($iframe_zoom)) {
$html .= '
';
}
if ($show_part_of_iframe === 'true') {
if ($fixChrome65) {
$html .= '
';
}
$html .= '
';
}
if (!empty($hide_part_of_iframe)) {
$html .= '';
}
if ($show_iframe_loader === 'true') {
$html .= '
';
}
if ($add_surrounding_p === 'true') {
$html .= '';
}
return "";
?>