can_use_premium_code__premium_only();
}
if (is_user_logged_in() && is_admin()) {
$scrollposition = 0;
$devOptions = $this->getAiAdminOptions();
if ($devOptions['admin_was_loaded'] === false) {
// we disable the check of the src.
$devOptions['check_iframe_url_when_load'] = 'false';
echo '
';
esc_html_e('The administration was not loaded until the end last time. It seems the integrated check of the "URL" field failed and therefore "Check URL on load" and "Check iframes on save" are now disabled. You can enable this again on the "Options" tab. Check the description of this options what maybe caused this problem.', 'advanced-iframe');
echo '
';
}
$devOptions['admin_was_loaded'] = false;
update_option($this->adminOptionsName, $devOptions);
if ($evanto) {
$devOptions['demo'] = 'false';
} else {
$devOptions['alternative_shortcode'] = '';
}
if (isset($_POST['scrollposition'])) {
$scrollposition = urlencode($_POST['scrollposition']);
}
$is_latest = true;
if ($evanto) {
$latest_version = $this->ai_getlatestVersion();
if ($latest_version != -1) {
if (version_compare($latest_version, $aiVersion) === 1) {
if (!(isset($devOptions['closed_messages']) && isset($devOptions['closed_messages']['show-version-message']))) {
echo '';
if ($isFreemius) {
echo __('Version ', 'advanced-iframe') . $latest_version . __(' of Advanced iFrame Pro is available. See the history for details. Update the plugin on the plugins page.', 'advanced-iframe');
} else {
echo __('Version ', 'advanced-iframe') . $latest_version . __(' of Advanced iFrame Pro is available. See the history for details. Download the latest version from your download page of codecanyon.', 'advanced-iframe');
}
echo '
';
}
$is_latest = false;
}
} else {
$is_latest = true;
}
} else {
$is_latest = false;
}
$current_tab = ($devOptions['donation_bottom'] === 'false') ? 0 : 1;
$tab_from_post = false;
if (isset($_POST['current_tab'])) {
$current_tab = urlencode($_POST['current_tab']);
$tab_from_post = true;
}
if (isset($_GET['current_tab'])) {
$current_tab = urlencode($_GET['current_tab']);
$tab_from_post = true;
}
$current_tab = aiProcessConfigActions($current_tab);
if (isset($_POST['update_iframe-loader'])) { //save option changes
$adminSettings = array('securitykey', 'src', 'width', 'height', 'scrolling',
'marginwidth', 'marginheight', 'frameborder', 'transparency',
'content_id', 'content_styles', 'hide_elements', 'class',
'shortcode_attributes', 'url_forward_parameter', 'id', 'name',
'onload', 'onload_resize', 'onload_scroll_top', 'loading',
'additional_js', 'additional_css', 'store_height_in_cookie', 'additional_height',
'iframe_content_id', 'iframe_content_styles', 'iframe_hide_elements', 'version_counter',
'onload_show_element_only', 'donation_bottom',
'include_url', 'include_content', 'include_height', 'include_fade', 'include_hide_page_until_loaded',
'onload_resize_width', 'resize_on_ajax', 'resize_on_ajax_jquery', 'resize_on_click',
'resize_on_click_elements', 'hide_page_until_loaded',
'show_part_of_iframe', 'show_part_of_iframe_x', 'show_part_of_iframe_y',
'show_part_of_iframe_width', 'show_part_of_iframe_height',
'show_part_of_iframe_new_window', 'show_part_of_iframe_new_url',
'show_part_of_iframe_next_viewports_hide', 'show_part_of_iframe_next_viewports',
'show_part_of_iframe_next_viewports_loop', 'style',
'use_shortcode_attributes_only', 'enable_external_height_workaround',
'keep_overflow_hidden', 'hide_page_until_loaded_external',
'onload_resize_delay', 'expert_mode', 'accordeon_menu',
'show_part_of_iframe_allow_scrollbar_vertical', 'show_part_of_iframe_allow_scrollbar_horizontal',
'hide_part_of_iframe', 'change_parent_links_target',
'change_iframe_links', 'change_iframe_links_target',
'iframe_redirect_url', 'show_part_of_iframe_style',
'map_parameter_to_url', 'iframe_zoom',
'tab_visible', 'tab_hidden', 'enable_responsive_iframe',
'allowfullscreen', 'iframe_height_ratio',
'show_iframe_loader', 'enable_lazy_load',
'enable_lazy_load_threshold', 'enable_lazy_load_fadetime',
'pass_id_by_url', 'include_scripts_in_footer',
'enable_lazy_load_manual', 'write_css_directly',
'resize_on_element_resize', 'resize_on_element_resize_delay',
'add_css_class_parent',
'auto_zoom', 'single_save_button', 'enable_lazy_load_manual_element',
'alternative_shortcode', 'load_jquery',
'show_iframe_as_layer', 'auto_zoom_by_ratio',
'add_iframe_url_as_param', 'add_iframe_url_as_param_prefix',
'add_iframe_url_as_param_direct', 'use_iframe_title_for_parent',
'reload_interval', 'iframe_content_css',
'additional_js_file_iframe', 'additional_css_file_iframe',
'add_css_class_iframe',
'enable_lazy_load_reserve_space', 'editorbutton',
'hide_content_until_iframe_color', 'include_html',
'enable_ios_mobile_scolling', 'sandbox',
'show_iframe_as_layer_header_file', 'show_iframe_as_layer_header_height',
'show_iframe_as_layer_header_position', 'show_iframe_as_layer_full',
'demo', 'show_part_of_iframe_zoom',
'external_height_workaround_delay',
'add_document_domain', 'document_domain',
'multi_domain_enabled', 'check_shortcode',
'use_post_message', 'element_to_measure_offset',
'data_post_message', 'element_to_measure',
'show_iframe_as_layer_keep_content', 'roles',
'parent_content_css', 'debug_js',
'check_iframe_cronjob', 'check_iframe_cronjob_email',
'enable_content_filter', 'add_ai_external_local', 'title',
'check_iframes_when_save', 'admin_was_loaded',
'check_iframe_url_when_load', 'modify_iframe_if_cookie',
'allow', 'safari_fix_url', 'external_scroll_top',
'change_iframe_links_href', 'delete_options_db',
'inline_config_file', 'replace_iframe_tags',
'check_iframe_batch_size', 'check_iframe_cronjob_email_always',
'remove_elements_from_height', 'add_ai_to_all_pages',
'show_part_of_iframe_media_query', 'remove_page_param_from_query',
'src_hide', 'purchase_code', 'cookie_samesite_filter',
'show_iframe_as_layer_autoclick_delay', 'show_iframe_as_layer_autoclick_hide_time',
'fullscreen_button', 'optimize_rendering',
'referrerpolicy', 'add_surrounding_p',
'custom', 'fullscreen_button_hide_elements',
'fullscreen_button_full', 'fullscreen_button_style',
'enable_ai_content_pages', 'show_support_message',
'replace_iframe_tags'
);
if (!wp_verify_nonce($_POST['twg-options'], 'twg-options')) {
die('Sorry, your nonce did not verify.');
}
if (!isset($_POST['action']) || $_POST['action'] !== 'reset') {
foreach ($adminSettings as $item) {
if ($item === 'version_counter') {
$text = rand(100000, 999999);
} elseif ($item === 'additional_height') {
$text = trim(trim($_POST[$item]), 'px%emt'); // remove px...
} else {
if (isset($_POST[$item])) {
$text = trim($_POST[$item], " \n\r\t\v\0,");
} else {
if ($item === 'show_part_of_iframe' || $item === 'show_part_of_iframe_next_viewports_loop'
|| $item === 'show_iframe_loader' || $item === 'enable_lazy_load_manual'
|| $item === 'show_part_of_iframe_next_viewports_hide' || $item === 'write_css_directly'
|| $item === 'enable_responsive_iframe' || $item === 'enable_lazy_load'
|| $item === 'accordeon_menu'
|| $item === 'show_iframe_as_layer' || $item === 'add_iframe_url_as_param'
|| $item === 'add_iframe_url_as_param_direct' || $item === 'use_iframe_title_for_parent'
|| $item === 'auto_zoom' || $item === 'show_part_of_iframe_zoom'
|| $item === 'demo' || $item === 'enable_ios_mobile_scolling'
|| $item === 'store_height_in_cookie' || $item === 'show_iframe_as_layer_full'
|| $item === 'use_post_message'
|| $item === 'enable_content_filter' || $item === 'add_ai_external_local'
|| $item === 'check_iframe_cronjob' || $item === 'modify_iframe_if_cookie'
|| $item === 'add_ai_to_all_pages' || $item === 'remove_page_param_from_query'
|| $item === 'hide_part_of_iframe' || $item === 'fullscreen_button') {
$text = 'false';
} elseif ($item === 'resize_on_ajax_jquery'
|| $item === 'show_iframe_as_layer_keep_content' || $item === 'admin_was_loaded'
|| $item === 'single_save_button' || $item === 'multi_domain_enabled') {
$text = 'true';
} elseif ($item === 'resize_on_element_resize_delay') {
$text = '250';
} elseif ($item === 'show_iframe_as_layer_header_height') {
$text = '100';
} elseif ($item === 'show_iframe_as_layer_header_position') {
$text = 'top';
} elseif ($item === 'external_height_workaround_delay' || $item === 'element_to_measure_offset' ||
$item === '$show_iframe_as_layer_autoclick_delay' || $item === 'show_iframe_as_layer_autoclick_hide_time') {
$text = '0';
} elseif ($item === 'element_to_measure') {
$text = 'default';
} elseif ($item === 'check_iframe_batch_size') {
$text = '100';
} elseif ($item === 'roles' || $item === 'inline_config_file') {
$text = 'none';
} else {
$text = '';
}
}
}
// Mixed single and double quotes are only allowed for the parameters below because they do support
// shortcodes as input where both quotes are used.
if ($item != 'src' && $item != 'onload') {
$text = str_replace('"', "'", $text);
} elseif ($devOptions['src'] !== $text) {
delete_transient('aip_cache_check_' . $devOptions['src']);
}
if ($item === 'purchase_code') {
if (!preg_match("/^([a-f0-9]{8})-(([a-f0-9]{4})-){3}([a-f0-9]{12})$/i", $text)) {
$text = '';
}
}
if ($item === 'enable_ai_content_pages' && $text === 'true') {
flush_rewrite_rules();
}
if ($item === 'roles') {
// roles can only be changed by administrators!
$user = wp_get_current_user();
if (in_array('administrator', (array)$user->roles)) {
$devOptions[$item] = stripslashes($text);
}
// replace ' with "
} elseif ($item === 'include_url' || $item === 'src') {
$searchBrackets = array('{', '}');
$replacePlaceholders = array('__BRACKETS_OPEN__', '__BRACKETS_CLOSE__');
$text = str_replace($searchBrackets, $replacePlaceholders, $text);
$text = esc_url($text);
$text = str_replace($replacePlaceholders, $searchBrackets, $text);
$devOptions[$item] = stripslashes($text);
} elseif ($item === 'include_html') {
$text = wp_kses($text, array(
'strong' => array(),
'br' => array(),
'em' => array(),
'p' => array(),
'div' => array('id' => array(), 'class' => array(), 'style' => array()),
'a' => array('href' => array(), 'target' => array(), 'class' => array(), 'style' => array()),
'img' => array('src' => array(), 'class' => array(), 'style' => array(), 'width' => array(), 'height')
));
$text = balanceTags($text, true);
$devOptions[$item] = stripslashes($text);
} elseif ($item === 'id') {
$newtext = preg_replace("/\W/", "_", $text);
// remove trailing numbers
$newtext = preg_replace('/^\d+/', '', $newtext);
if (!empty($newtext)) {
$devOptions[$item] = $newtext;
}
} elseif (function_exists('sanitize_text_field')) {
$devOptions[$item] = stripslashes(sanitize_text_field($text));
} else {
$devOptions[$item] = stripslashes($text);
}
// we check if we have an invalid configuration!
if ($devOptions['shortcode_attributes'] === 'false' && $devOptions['use_shortcode_attributes_only'] === 'true') {
$devOptions['shortcode_attributes'] = 'true';
AdvancedIframeHelper::aiPrintError(__('You have set "Allow shortcode attributes" to "No" and "Use shortcode attributes only" to "Yes". This combination is not valid. "Allow shortcode attributes" was set to "Yes". Please check if this is what you want. "Allow shortcode attributes" overrules "Use shortcode attributes only" if you set "Use shortcode attributes only" directly in the shortcode with use_shortcode_attributes_only="true".', "advanced-iframe"));
$scrollposition = 0;
}
}
} else {
$securitykey = $devOptions['securitykey'];
$it = $devOptions['install_date'];
$pc = $devOptions['purchase_code'];
$devOptions = advancediFrame::iframe_defaults();
$devOptions['securitykey'] = $securitykey;
$devOptions['install_date'] = $it;
$devOptions['purchase_code'] = $pc;
delete_transient('aip_discount');
delete_transient('aip_discount_message');
delete_transient('aip_version');
$this->resetMetaBoxes();
}
if ($evanto && empty($devOptions['install_date'])) {
$devOptions['install_date'] = time();
}
update_option($this->adminOptionsName, $devOptions);
// create the external js file with the url of the wordpress installation
$this->saveExternalJsFile();
$updated = true;
}
// read closed postboxes;
$current_user = wp_get_current_user();
$closedArray = get_user_meta($current_user->ID, 'closedpostboxes_toplevel_page_advanced-iframe', true);
$isRegistered = $isFreemiusMigration && $ai_fs->is_registered() && $ai_fs->is_tracking_allowed();
// only OPT-IN and pro users have postboxes that remembers their state
if (empty($closedArray) || (!$evanto && !$isRegistered && $isFreemiusMigration)) {
$closedArray = array();
}
// needs to be set after the save again.
if ($evanto) {
$devOptions['demo'] = 'false';
}
$isDemo = $devOptions['demo'] === 'true';
if ($evanto && clearstatscache($devOptions)) {
AdvancedIframeHelper::aiPrintError('Yo' . 'ur ver' . 'sion of Adv' . 'anced iFr' . 'ame Pro s' . 'eems to be an ill' . 'egal co' . 'py and is now wo' . 'rking in the fr' . 'eeware m' . 'ode ag' . 'ain.
Ple' . 'ase get the of' . 'fical v' . 'ersion from co' . 'decanyon or co' . 'ntact the au' . 'thor thr' . 'ough code' . 'canyon if you th' . 'ink this is a fa' . 'lse al' . 'arm.');
}
if (clearstatscache($devOptions)) {
$evanto = false;
}
?>
';
echo '';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-external-workaround.php';
echo '';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-add-files.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-include-directly.php';
echo '';
echo '
' . __('Help/FAQ/AI', 'advanced-iframe') . '
';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-ai-assistant.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-video.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-faq.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-forum.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-support.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-find-id.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-jquery.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-browser.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-help-post.php';
include_once dirname(__FILE__) . '/includes/advanced-iframe-admin-twg.php';
echo '';
if ($devOptions['donation_bottom'] === 'true') {
echo '';
printDonation($devOptions, $evanto, $closedArray);
echo "";
echo '';
}
?>
adminOptionsName, $devOptions);
}
?>