96) $start = 1; $end = $start + 15; if ($end > 96) $end = 96; if (isset ($_POST ['ai-active-tab'])) { $active_tabs = json_decode ($_POST ['ai-active-tab']); if ($active_tabs == null) $active_tabs = array ($start, 0); } if (isset ($_GET ['settings'])) { $active_tab = $_GET ['settings']; if (isset ($_GET ['single'])) { $start = $active_tab; $end = $active_tab; } else { $start = intval (($active_tab - 1) / 16) * 16 + 1; $end = $start + 15; } } elseif (isset ($_GET ['tab'])) $active_tab = $_GET ['tab']; else $active_tab = isset ($active_tabs [0]) ? $active_tabs [0] : $start; if (!is_numeric ($active_tab)) $active_tab = 1; if ($active_tab != 0) if ($active_tab < $start || $active_tab > $end) $active_tab = $start; $active_tab_0 = isset ($active_tabs [1]) ? $active_tabs [1] : 0; $disable_block_insertions = get_disable_block_insertions (); $disable_php_processing = get_disable_php_processing (); $disable_css_code = get_disable_css_code (); $disable_js_code = get_disable_js_code (); $disable_footer_code = get_disable_footer_code (); $disable_header_code = get_disable_header_code (); $insertion_disabled = $disable_block_insertions || $disable_php_processing || $disable_css_code || $disable_js_code || $disable_footer_code || $disable_header_code; if ($insertion_disabled) { $insertion_statuses = 'H   '; $insertion_statuses .= 'F   '; $insertion_statuses .= 'JS   '; $insertion_statuses .= 'CSS   '; $insertion_statuses .= 'PHP   '; $insertion_statuses .= 'BLOCKS'; } else $insertion_statuses = ''; $adH = $block_object [AI_HEADER_OPTION_NAME]; $adF = $block_object [AI_FOOTER_OPTION_NAME]; if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { $adA = $block_object [AI_ADB_MESSAGE_OPTION_NAME]; } $syntax_highlighter_theme = get_syntax_highlighter_theme (); $block_class_name = get_block_class_name (); $block_class = get_block_class (); $block_number_class = get_block_number_class (); $inline_styles = get_inline_styles (); $default = $block_object [0]; $exceptions = false; $block_exceptions = array (); if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) { $args = array ( 'public' => true, '_builtin' => false ); $custom_post_types = get_post_types ($args, 'names', 'and'); $screens = array_values (array_merge (array ('post', 'page'), $custom_post_types)); $args = array ( 'posts_per_page' => 100, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'type', 'order' => 'ASC', 'include' => '', 'exclude' => '', 'meta_key' => '_adinserter_block_exceptions', 'meta_value' => '', 'post_type' => $screens, 'post_mime_type' => '', 'post_parent' => '', 'author' => '', 'author_name' => '', 'post_status' => '', 'suppress_filters' => true ); $posts_pages = get_posts ($args); $exceptions = array (); foreach ($posts_pages as $page) { $post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true); if ($post_meta == '') continue; $post_type_object = get_post_type_object ($page->post_type); $exceptions [$page->ID] = array ('type' => $page->post_type, 'name' => $post_type_object->labels->singular_name, 'title' => $page->post_title, 'blocks' => $post_meta); $selected_blocks = explode (",", $post_meta); foreach ($selected_blocks as $selected_block) { $block_exceptions [$selected_block][$page->ID] = array ('type' => $page->post_type, 'name' => $post_type_object->labels->singular_name, 'title' => $page->post_title); } } } $rating_string = ''; if ($rating_string = get_transient (AI_TRANSIENT_RATING)) { if ($rating_string < 1 && $rating_string > 5) $rating_string = ''; } $rating_css = $rating_string == '' ? 'width: 100%;' : 'width: '.number_format ($rating_string * 20, 4).'%;'; $rating_value = $rating_string == '' ? '' : number_format ($rating_string, 1); if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) $used_blocks = unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]); else $used_blocks = array (); if (!isset ($_GET ['settings'])): // start of code only for normal settings if (function_exists ('ai_admin_settings_notices')) ai_admin_settings_notices (); ?>
" ai-value="">

', ''); ?>

', $insertion_statuses, ''; ?>
number = $block; $default->wp_options [AI_OPTION_BLOCK_NAME] = DEFAULT_AD_NAME." ".$block; $tab_visible = $block == $active_tab || $generate_all; $obj = $block_object [$block]; } else { $block = 999; $sidebars [$block] = ""; $manual_widget [$block] = $obj->get_enable_widget() == AI_ENABLED; $manual_shortcode [$block] = $obj->get_enable_manual() == AI_ENABLED; $manual_php_function [$block] = $obj->get_enable_php_call() == AI_ENABLED; $manual [$block] = ($manual_widget [$block] && !empty ($sidebars_with_widget [$block])) || $manual_shortcode [$block] || $manual_php_function [$block]; $default->number = 0; $default->wp_options [AI_OPTION_BLOCK_NAME] = DEFAULT_AD_NAME." 0"; $tab_visible = false; $obj = $default; } $client_side_devices = $obj->get_detection_client_side () == AI_ENABLED; $server_side_devices = $obj->get_detection_server_side () == AI_ENABLED; if ($client_side_devices) $client_side_style = "font-weight: bold; color: #66f;"; else $client_side_style = ""; if ($server_side_devices) $server_side_style = "font-weight: bold; color: #66f;"; else $server_side_style = ""; $show_devices = $client_side_devices || $server_side_devices == AI_ENABLED; if ($show_devices) $devices_style = "font-weight: bold; color: #66f;"; else $devices_style = ""; $cat_list = $obj->get_ad_block_cat(); $tag_list = $obj->get_ad_block_tag(); $taxonomy_list = $obj->get_ad_block_taxonomy(); $id_list = $obj->get_id_list(); $url_list = $obj->get_ad_url_list(); $url_parameter_list = $obj->get_url_parameter_list(); $domain_list = $obj->get_ad_domain_list(); if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false; $show_lists = $cat_list != '' || $obj->get_ad_block_cat_type() == AI_WHITE_LIST || $tag_list != '' || $obj->get_ad_block_tag_type() == AI_WHITE_LIST || $taxonomy_list != '' || $obj->get_ad_block_taxonomy_type() == AI_WHITE_LIST || $id_list != '' || $obj->get_id_list_type() == AI_WHITE_LIST || $url_list != '' || $obj->get_ad_url_list_type() == AI_WHITE_LIST || $url_parameter_list != '' || $obj->get_url_parameter_list_type() == AI_WHITE_LIST || $domain_list != '' || $obj->get_ad_domain_list_type() == AI_WHITE_LIST || $lists; if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = ""; $show_manual = $manual [$block] ||!empty ($sidebars_with_widget [$block]); if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$block] || empty ($sidebars_with_widget [$block]) ? "#66f;" : "#e44;"); else $manual_style = ""; $insertion_options = $obj->get_maximum_insertions () || $obj->get_display_for_users() != AI_DISPLAY_ALL_USERS || $obj->get_enable_amp () == AI_ENABLED || $obj->get_enable_ajax () != AI_ENABLED || $obj->get_enable_404 () == AI_ENABLED || $obj->get_enable_feed () == AI_ENABLED || $obj->get_max_page_blocks_enabled () || $obj->get_only_in_the_loop () || $obj->get_disable_caching (); $word_count_options = intval ($obj->get_minimum_words()) != 0 || intval ($obj->get_maximum_words()) != 0; $automatic_insertion = $obj->get_automatic_insertion(); $paragraph_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; $image_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_IMAGE || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_IMAGE; $filter_insertions_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT || $automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS || $automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; $scheduling_active = $obj->get_scheduling() != AI_SCHEDULING_OFF; if ($filter_insertions_settings) { $filter_active = $obj->get_filter_type() != AI_FILTER_AUTO || $obj->get_inverted_filter() != 0; } else $filter_active = $obj->get_call_filter() || $obj->get_inverted_filter() != 0; $adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING; $display_options = $obj->get_show_label () || $obj->get_lazy_loading () || $obj->get_close_button () || $obj->get_iframe (); $show_misc = $insertion_options || $word_count_options || $scheduling_active || $filter_active || $adb_block_action_active || $display_options; if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = ""; if ($insertion_options) $insertion_style = "font-weight: bold; color: #66f;"; else $insertion_style = ""; if ($word_count_options) $word_count_style = "font-weight: bold; color: #66f;"; else $word_count_style = ""; if ($scheduling_active) $scheduling_style = "font-weight: bold; color: #66f;"; else $scheduling_style = ""; if ($filter_active) $filter_style = "font-weight: bold; color: #66f;"; else $filter_style = ""; if ($adb_block_action_active) $adb_style = "font-weight: bold; color: #66f;"; else $adb_style = ""; if ($display_options) $display_style = "font-weight: bold; color: #66f;"; else $display_style = ""; $general_style = ''; $paragraph_counting = $paragraph_settings && ( $obj->get_direction_type() != $default->get_direction_type() || $obj->get_paragraph_tags() != $default->get_paragraph_tags() || $obj->get_minimum_paragraph_words() != $default->get_minimum_paragraph_words() || $obj->get_maximum_paragraph_words() != $default->get_maximum_paragraph_words() || $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() || $obj->get_paragraph_text() != $default->get_paragraph_text() || $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() || $obj->get_minimum_words_above() != $default->get_minimum_words_above() || $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote() ); $paragraph_clearance = $paragraph_settings && ( ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) || ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0) ); $html_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT || $automatic_insertion == AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT; $html_element_insertion = $obj->get_html_element_insertion (); $server_side_insertion = $obj->get_server_side_insertion (); $inside_element = $obj->get_inside_element (); $filter_type = $obj->get_filter_type(); ?>
">
get_ad_name() ?> get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" /> get_disable_insertion () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>⚠
get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />   get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> /> get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />   get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> /> get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
"> ">
">
    
 
">
    " type="text" name="" default="get_paragraph_tags(); ?>" value="get_paragraph_tags(); ?>" size="12" maxlength="50"/>  
  
get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />   
">
 
 
get_ad_block_cat_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_ad_block_cat_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_ad_block_tag_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_ad_block_tag_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_ad_block_taxonomy_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_ad_block_taxonomy_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_id_list_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_id_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_ad_url_list_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_ad_url_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />
  " type="text" name="" default="get_url_parameter_list(); ?>" value="" size="54" maxlength="500"/> get_url_parameter_list_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_url_parameter_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_ad_domain_list_type() == AI_BLACK_LIST) echo 'checked '; ?> /> get_ad_domain_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />
get_enable_widget () == AI_ENABLED) echo 'checked '; ?> />
get_enable_manual () == AI_ENABLED) echo 'checked '; ?> />
[adinserter block=""]
or
[adinserter name="get_ad_name(); ?>"]
/>
<?php if (function_exists ('adinserter')) echo adinserter (); ?>
get_detection_client_side ()==AI_ENABLED) echo 'checked '; ?> />
$viewport_name) { if ($column % $columns == 0) { ?>
" value="1" default="get_detection_viewport ($viewport); ?>" get_detection_viewport ($viewport)==AI_ENABLED) echo 'checked '; ?> />
get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
get_enable_amp (true) == AI_ENABLED) echo 'checked '; ?> /> get_enable_ajax () == AI_ENABLED) echo 'checked '; ?> /> get_enable_feed () == AI_ENABLED) echo 'checked '; ?> /> get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
get_max_page_blocks_enabled () == AI_ENABLED) echo 'checked '; ?> />
get_only_in_the_loop () == AI_ENABLED) echo 'checked '; ?> /> get_disable_caching () == AI_ENABLED) echo 'checked '; ?> />
get_inverted_filter () == AI_ENABLED) echo 'checked '; ?> />
get_show_label () == AI_ENABLED) echo 'checked '; ?> />
  " />
">

' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>⚠
get_plugin_tracking () !== null) { $plugin_tracking = $ai_dst->get_tracking (); ?>
px
/> /> />

  
</div>
    " size="15" maxlength="40" /> ' ?>    " size="4" maxlength="4" /> px ' ?>
/>
get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" /> get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />

<head></head>'); ?> ', _x ('NOT ENABLED', 'code in the header', 'ad-inserter'), ''; ?>
get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> /> get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />

', _x ('NOT ENABLED', 'ad blocking detection', 'ad-inserter'), ''; ?>
0, 'child_of' => 0, 'selected' => get_redirection_page (true), 'echo' => 0, 'name' => AI_OPTION_ADB_REDIRECTION_PAGE, 'id' => 'redirection-page', 'class' => null, 'show_option_none' => __('Custom Url', 'ad-inserter'), 'show_option_no_change' => null, 'option_none_value' => '0', ); $dropdown_pages = wp_dropdown_pages ($args); $dropdown_title = __ ('Static page for redirection when ad blocking is detected. For other pages select Custom url and set it below.', 'ad-inserter'); $dropdown_pages = str_replace ('
get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
/>
style="display: none;" /> style="display: none;" /> style="display: none;" /> style="display: none;" /> style="display: none;" /> style="display: none;" />

<html>
<head>
  ...
  ><style>
    

  </style>
  >
</head>
<body>
  ...
  >

    ><?php  ?>
    

  </div>
  ...
  ><script>
    

  </script>
  >
</body>
</html>
/>
/>
/>
/>
/>
2) $sidebar = 1; if ($number_of_used_blocks >= 4 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 5 || $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 10) $sidebar = 2; if ($number_of_used_blocks >= 12 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 7 || $number_of_used_blocks >= 8 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 10 || $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 15) $sidebar = 3; if ($ai_wp_data [AI_DAYS_SINCE_INSTAL] > 20) $sidebar = 4; } else { if ($number_of_used_blocks >= 3) $sidebar = 4; } // $sidebar = 0; if (!function_exists ('ai_settings_side')) { switch ($sidebar) { case 0: break; case 1: break; case 2: sidebar_addense_alternative (); break; case 3: sidebar_support_review (); sidebar_addense_alternative (); break; case 4: sidebar_addense_alternative (); break; } } ?>
$sidebar_widget) { if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) { $sidebar_name = $GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name']; if ($sidebar_name != "") { foreach ($sidebar_widget as $widget) { if (preg_match ("/ai_widget-([\d]+)/", $widget, $widget_id)) { if (isset ($widget_id [1]) && is_numeric ($widget_id [1])) { $widget_option = $widget_options [$widget_id [1]]; $widget_block = $widget_option ['block']; // if ($widget_block >= $start && $widget_block <= $end && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) { if ($widget_block >= 1 && $widget_block <= 96 && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) { $sidebars_with_widget [$widget_block] []= $sidebar_name; } } } } } } } return $sidebars_with_widget; } function page_checker_container () { global $ai_custom_hooks; $current_theme = wp_get_theme(); ?> get_ad_data (); // data-ad-client="ca-pub-3118622027477755" if (preg_match_all ('#data-ad-client\s*=\s*"(.+?)"#', $block_code, $adsense_matches)) { foreach ($adsense_matches [1] as $adsense_match) { if (preg_match ('#(pub-[0-9]+)#', $adsense_match, $adsense_pub_id)) { $found = false; foreach ($block_ads as $block_ad) { if ($block_ad ['ads_data'][1] == $adsense_pub_id [1]) { $found = true; break; } } if (!$found) { $block_ads [] = array ('ads_data' => array ('google.com', $adsense_pub_id [1], 'DIRECT', 'f08c47fec0942fa0'), 'found' => false); } } } } // google_ad_client = "ca-pub-3118622027477755"; if (preg_match_all ('#google_ad_client\s*=\s*"(.+?)"#', $block_code, $adsense_matches)) { foreach ($adsense_matches [1] as $adsense_match) { if (preg_match ('#(pub-[0-9]+)#', $adsense_match, $adsense_pub_id)) { $found = false; foreach ($block_ads as $block_ad) { if ($block_ad ['ads_data'][1] == $adsense_pub_id [1]) { $found = true; break; } } if (!$found) { $block_ads [] = array ('ads_data' => array ('google.com', $adsense_pub_id [1], 'DIRECT', 'f08c47fec0942fa0'), 'found' => false); } } } } } $ads_txt_file = ABSPATH . 'ads.txt'; if (file_exists ($ads_txt_file)) { $ads = file_get_contents ($ads_txt_file); } else { $ads = ''; if ($action == 'table') { $action = 'text'; } } $ads_lines = explode ("\n", $ads); $rows = array (); foreach ($ads_lines as $ads_line) { if (trim ($ads_line) == '') continue; $ads_data = explode ('#', str_replace (array ("\r", ' '), '', $ads_line)); $ads_elements = explode (',', $ads_data [0]); if (count ($ads_elements) == 0) continue; $found = false; foreach ($block_ads as $index => $block_ad) { if (!isset ($ads_elements [1])) continue; if ($block_ad ['ads_data'][1] == $ads_elements [1]) { $found = true; $block_ads [$index]['found'] = true; break; } } $rows []= array ('ads_elements' => $ads_elements, 'status' => $found ? 'F' : ''); } $missing_lines = array (); foreach ($block_ads as $block_ad) { if (!$block_ad ['found']) { array_unshift ($rows, array ('ads_elements' => $block_ad ['ads_data'], 'status' => 'M')); $missing_lines []= implode (', ', $block_ad ['ads_data']); } } $search_text = isset ($_GET ["search"]) ? trim ($_GET ["search"]) : ''; if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array (); foreach ($rows as $index => $row) { $ads_line = implode (' ', $row ['ads_elements']); foreach ($search_array as $search_item) { if (stripos ($ads_line, trim ($search_item)) === false) { unset ($rows [$index]); continue 2; } } } if (site_url ('', 'relative') != '') { $right_ads_txt_url = str_replace (site_url ('', 'relative'), '', home_url ('/')) . 'ads.txt'; echo '
'; echo '
', __('Warning', 'ad-inserter'), ': ', __('ads.txt file must be placed on the root domain', 'ad-inserter'), ' ', $right_ads_txt_url, '
'; echo '
', /* translators: %s: file path */ sprintf (__('WordPress is installed in %s', 'ad-inserter'), '' . ABSPATH . ''), '
'; echo '
', __('Showing file', 'ad-inserter'), ' ', $ads_txt_file, '
'; echo '
'; } if (!file_exists ($ads_txt_file)) { echo '
'; echo '
', __('Warning', 'ad-inserter'), ': ', sprintf (__('File %s not found', 'ad-inserter'), $ads_txt_file), '
'; echo '
'; } switch ($action) { case 'text': if (count ($missing_lines)) { echo '
', __('Account IDs found in blocks but not present in the ads.txt file', 'ad-inserter'), '
'; echo ''; echo '
', $ads_txt_file, '
'; } echo ''; break; case 'table': ?> '.$ads_elements [3] .''; } else $element3 = $ads_elements [3]; } else $element3 = ''; ?>
>
$block) { $new_block = $blocks_new [$index]; if ($block >= 1 && $block <= 96 && $new_block >= 1 && $new_block <= 96) { $new_options [$block] = $current_options [$new_block]; } else $error = true; } if (!$error) { // Update AI_OPTION_FALLBACK and AI_OPTION_ADB_BLOCK_REPLACEMENT for ($block = 1; $block <= 96; $block ++) { if (isset ($new_options [$block][AI_OPTION_FALLBACK])) { $ai_option_fallback = $new_options [$block][AI_OPTION_FALLBACK]; if ($ai_option_fallback != '') foreach ($blocks_new as $index => $org_block) { if ($ai_option_fallback == $org_block) { $new_options [$block][AI_OPTION_FALLBACK] = $blocks_org [$index]; } } } if (isset ($new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT])) { $ai_option_adb_block_replacement = $new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT]; if ($ai_option_adb_block_replacement != '') foreach ($blocks_new as $index => $org_block) { if ($ai_option_adb_block_replacement == $org_block) { $new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT] = $blocks_org [$index]; } } } } update_option (AI_OPTION_NAME, $new_options); ai_load_settings (); $new_options [AI_OPTION_EXTRACT] = ai_generate_extract ($new_options); $ai_db_options_extract = $new_options [AI_OPTION_EXTRACT]; $new_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'] = generate_viewport_css (); $new_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS'] = generate_alignment_css (); $new_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time (); update_option (AI_OPTION_NAME, $new_options); update_option (AI_EXTRACT_NAME, $ai_db_options_extract); ai_load_settings (); $ai_widgets = get_option ('widget_ai_widget'); if (is_array ($ai_widgets)) foreach ($ai_widgets as $widget_index => $ai_widget) { if (isset ($ai_widget ['block'])) { $widget_block = $ai_widget ['block']; if ($widget_block >= 1 && $widget_block <= 96) { foreach ($blocks_new as $index => $org_block) { if ($widget_block == $org_block) { $ai_widgets [$widget_index]['block'] = $blocks_org [$index]; break; } } } } } update_option ('widget_ai_widget', $ai_widgets); if (defined ('AI_STATISTICS') && AI_STATISTICS) { // Update statistics - two passes to avoid duplicate entries $offset = 1000; // Lock table to prevent updates of old blocks $query = 'LOCK TABLES ' . AI_STATISTICS_DB_TABLE . ' WRITE;'; $update = $wpdb->query ($query); // Pass 1 - new blocks with offset $query = 'UPDATE ' . AI_STATISTICS_DB_TABLE . ' SET block= CASE '; foreach ($blocks_new as $index => $org_block) { $new_block = $blocks_org [$index] + $offset; $query .= "WHEN block= $org_block THEN $new_block "; } $query .= 'ELSE block END;'; $update = $wpdb->query ($query); // Pass 2 - remove offset $query = 'UPDATE ' . AI_STATISTICS_DB_TABLE . " SET block = block - $offset WHERE block >= $offset;"; $update = $wpdb->query ($query); // Unlock table $query = 'UNLOCK TABLES;'; $update = $wpdb->query ($query); } } } } $sidebars_with_widget = get_sidebar_widgets (); ob_start (); $search_text = trim ($_GET ["list"]); $show_all_blocks = isset ($_GET ["all"]) && $_GET ["all"]; $start = trim ($_GET ["start"]); $end = trim ($_GET ["end"]); if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array (); $blocks = array (); $row_counter = 0; for ($block = 1; $block <= 96; $block ++) { $obj = $block_object [$block]; $automatic_insertion = $obj->get_automatic_insertion () != AI_AUTOMATIC_INSERTION_DISABLED; $manual_widget = $obj->get_enable_widget() == AI_ENABLED; $manual_shortcode = $obj->get_enable_manual() == AI_ENABLED; $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED; $disabled = $obj->get_disable_insertion (); $block_used = !$disabled && ($automatic_insertion || $manual_php_function || $manual_shortcode || $manual_widget && !empty ($sidebars_with_widget [$block])); if (!$show_all_blocks && !$block_used) continue; $block_text = $block . ' '. $obj->get_ad_name () . ' ' . $obj->get_automatic_insertion_text() . ' ' . $obj->get_alignment_type_text () . ' ' . implode (', ', $sidebars_with_widget [$block]); if (!empty ($sidebars_with_widget [$block])) $block_text .= ' widget'; if ($manual_shortcode) $block_text .= ' shortcode'; if ($manual_php_function) $block_text .= ' php'; foreach ($search_array as $search_item) { if (stripos ($block_text, trim ($search_item)) === false) continue 2; } $blocks []= $block; $row_counter ++; $row_color = $row_counter % 2 == 0 ? '#eee' : '#fff'; if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block); else $url_parameters = ""; $edit_url = admin_url ('options-general.php?page=ad-inserter.php') . $url_parameters . '&tab=' . $block; $visible_tab = $block >= $start && $block <= $end; ?> get_ad_name(); ?> get_ad_name(); ?> get_automatic_insertion_text(); ?> get_alignment_type_text (); ?> ● ● ●
P S W
"; else echo "
"; } } if (defined ('AI_ADSENSE_API')) { function ai_adsense_data (&$error) { require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php'; $error = 'AdSense not authorized'; $ad_data = false; if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) { $error = ''; $update_ad_units = isset ($_GET ["update_ad_units"]) ? $_GET ["update_ad_units"] == 1 : false; $adsense = new adsense_api(); $ad_data = get_transient (AI_TRANSIENT_ADSENSE_ADS); if ($ad_data === false || $update_ad_units) { $ad_units = $adsense->getAdUnits(); $error = $adsense->getError (); if ($error == '' && is_array ($ad_units)) { $ad_data = array ($adsense->getAdSensePublisherID (), $ad_units); set_transient (AI_TRANSIENT_ADSENSE_ADS, $ad_data, AI_TRANSIENT_ADSENSE_ADS_EXPIRATION); } } } return $ad_data; } function adsense_list () { require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php'; if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) { $publisher_id = ''; $ad_units = array (); $error = ''; $ad_data = ai_adsense_data ($error); if ($error == '') { $publisher_id = $ad_data [0]; $ad_units = $ad_data [1]; $show_all_ad_units = isset ($_GET ["all"]) && $_GET ["all"]; ?>
$error"; if (strpos ($error, 'unauthorized_client') !== false) { echo '
', // translators: %s: HTML tags sprintf (__('Please %s clear authorization %s with the button %s above and once again authorize access to your AdSense account.', 'ad-inserter'), '', '', '' ), '
'; } } } elseif (defined ('AI_ADSENSE_CLIENT_ID')) { $adsense = new adsense_api(); $adsense_ids = defined ('AI_CI_STRING') && get_option (AI_ADSENSE_OWN_IDS) === false; ?>

', '', '', '' ); ?>

', ''); ?>

', '', '', '' ); ?>

', '', '', '' ); ?>

   

'.AD_INSERTER_NAME.'', AD_INSERTER_NAME ); ?>

  1. ', ''); ?>
  2. Ad Inserter', '', ''); ?>
  3. ', ''); ?>
  4. Ad Inserter', '', ''); ?>
  5. Ad Inserter'); ?>
  6. ', ''); ?>
  7. AdSense Management API'); ?>
  8. ', ''); ?>
  9. ', '', '', ''); ?>
  10. ', '', '', ''); ?>
  11. ', ''); ?>
  12. ', '', '', ''); ?>
  13. ', '', 'Ad Inserter'); ?>
  14. ', ''); ?>
  15. ', ''); ?>
  16. ', '', '', '', '', ''); ?>
   
getAdCode ($ad_slot_id); echo json_encode (array ('code' => $code, 'error-message' => $adsense->getError ())); } } } function adsense_ad_name ($adsense_data) { if (defined ('AI_ADSENSE_API')) { $publisher_id = ''; $ad_units = array (); $error = ''; $ad_data = ai_adsense_data ($error); if ($error == '') { $publisher_id = $ad_data [0]; $ad_units = $ad_data [1]; $ad_slot_names = array ('publisher_id' => $publisher_id); foreach ($ad_units as $ad_unit) { if ($ad_unit ['active']) $ad_slot_names [$ad_unit ['code']] = $ad_unit ['name']; } echo json_encode ($ad_slot_names); } } } function generate_list_options ($options) { $max_items = 2000; switch ($options) { case 'category': // $args = array("hide_empty" => 0); $args = array("hide_empty" => 0, 'number' => $max_items); $category_data = get_categories ($args); // $category_data = array_slice ($category_data, 0, $max_items); foreach ($category_data as $category) { echo " \n"; } break; case 'tag': $args = array ('number' => $max_items); // $tag_data = get_tags (); $tag_data = get_tags ($args); // $tag_data = array_slice ($tag_data, 0, $max_items); foreach ($tag_data as $tag) { echo " \n"; } break; case 'taxonomy': $term_data = get_terms (); $taxonomies = array (); foreach ($term_data as $term) { if ($term->taxonomy == 'category') continue; if ($term->taxonomy == 'post_tag') continue; $taxonomies [strtolower ($term->taxonomy) . ':' . strtolower ($term->slug)] = $term->name; if (count ($taxonomies) >= $max_items) break; } $args = array ( 'public' => true, // '_builtin' => false, ); $custom_post_types = get_post_types ($args, 'objects', 'and'); foreach ($custom_post_types as $custom_post_type => $custom_post_data) { $taxonomies ['post-type:' . strtolower ($custom_post_type)] = $custom_post_data->labels->singular_name; } $editable_roles = get_editable_roles (); foreach ($editable_roles as $editable_role_slug => $editable_role) { $taxonomies ['user-role:' . strtolower ($editable_role_slug)] = $editable_role ['name']; } $users = get_users (); foreach ($users as $user) { $taxonomies ['user:' . strtolower ($user->data->user_login)] = $user->data->display_name; $taxonomies ['author:' . strtolower ($user->data->user_login)] = $user->data->display_name; if (count ($taxonomies) >= $max_items) break; } ksort ($taxonomies); foreach ($taxonomies as $taxonomy => $taxonomy_name) { if ($taxonomy_name != '') echo " \n"; else echo " \n"; } break; case 'id': $args = array ( 'public' => true, '_builtin' => false ); $custom_post_types = get_post_types ($args, 'names', 'and'); $screens = array_values (array_merge (array ('post', 'page'), $custom_post_types)); $args = array ( 'posts_per_page' => 3 * $max_items, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'ID', 'order' => 'ASC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => $screens, 'post_mime_type' => '', 'post_parent' => '', 'author' => '', 'author_name' => '', 'post_status' => '', 'suppress_filters' => true, ); $posts_pages = get_posts ($args); $counter = 0; foreach ($posts_pages as $post_page) { if ($post_page->post_title == '') continue; echo " \n"; $counter ++; if ($counter >= $max_items) break; } break; default: if (function_exists ('ai_generate_list_options')) ai_generate_list_options ($options); break; } } function ai_check_page ($options) { $download_urls = array (); // echo '["1","2","3","4"]'; // return; switch ($_GET ["check-page"]) { case 'po': case 'pa': $args = array ( 'public' => true, '_builtin' => false ); $custom_post_types = get_post_types ($args, 'names', 'and'); $screens = array_values (array_merge (array ($_GET ["check-page"] == 'po' ? 'post' : 'page'), $custom_post_types)); $args = array ( 'posts_per_page' => 1, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'ID', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => $screens, 'post_mime_type' => '', 'post_parent' => '', 'author' => '', 'author_name' => '', 'post_status' => '', 'suppress_filters' => true, ); $posts_pages = get_posts ($args); if (isset ($posts_pages [0])) { $download_urls []= get_permalink ($posts_pages [0]->ID); } // Check also post/page with comments $args = array ('post_type' => $_GET ["check-page"] == 'po' ? 'post' : 'page', 'number' => 1); $comment_data = get_comments ($args); if (isset ($comment_data [0])) { $download_urls []= get_permalink ($comment_data [0]->comment_post_ID); } break; case 'hp': $download_urls []= home_url () . '/'; break; case 'cp': $args = array ('hide_empty' => 0, 'orderby' => 'count', 'order' => 'DESC', 'number' => 1); $category_data = get_categories ($args); if (isset ($category_data [0])) { $download_urls []= get_category_link ($category_data [0]->cat_ID) . '/'; } break; case 'ap': $args = array ('hide_empty' => 0, 'orderby' => 'count', 'order' => 'DESC', 'number' => 1); $tag_data = get_tags ($args); if (isset ($tag_data [0])) { $download_urls []= get_tag_link ($tag_data [0]->term_taxonomy_id) . '/'; } break; case 'sp': $download_urls []= home_url () . '/?s=a'; break; } if (!empty ($download_urls)) { $positions = array (); $secret_key = ai_secret_key (); foreach ($download_urls as $download_url) { $tmp_file = download_url (add_query_arg (array (AI_URL_DEBUG_POSITIONS => '0', 'ai-secret' => $secret_key), $download_url)); if (!is_wp_error ($tmp_file) && file_exists ($tmp_file)) { $page = file_get_contents ($tmp_file); preg_match_all ('#data-ai-position=[\'\"](.+?)[\'\"]#', $page, $matches); foreach (array_unique ($matches [1]) as $position) { $positions [] = (int) $position; } } @unlink ($tmp_file); } switch ($_GET ["check-page"]) { case 'po': case 'pa': if (in_array (AI_AUTOMATIC_INSERTION_BEFORE_CONTENT, $positions) && in_array (AI_AUTOMATIC_INSERTION_AFTER_CONTENT, $positions)) { $positions [] = AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; $positions [] = AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; $positions [] = AI_AUTOMATIC_INSERTION_BEFORE_IMAGE; $positions [] = AI_AUTOMATIC_INSERTION_AFTER_IMAGE; } if (in_array (AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS, $positions) && in_array (AI_AUTOMATIC_INSERTION_AFTER_COMMENTS, $positions)) { $positions [] = AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; } break; } $positions = array_unique ($positions); sort ($positions); foreach ($download_urls as $index => $download_url) { $download_urls [$index] = add_query_arg (array (AI_URL_DEBUG_POSITIONS => '0', 'no-cookie' => '1'), $download_url); } echo json_encode (array ('positions' => $positions, 'urls' => $download_urls)); } } function sidebar_addense_alternative () { ?>


Ad Inserter
', '', '', 'happy' ); ?>   Igor

<?php _e ('Ad Inserter on Twitter', 'ad-inserter'); ?> <?php _e ('Ad Inserter on Facebook', 'ad-inserter'); ?>

', '', '', '', '', '', '', '' ); ?>
', '', '', '', '', '', '', '', '', '', '', '', '', '' ); ?>

', '' ); ?>
', '' ); ?>

one year of free updates and support via email. If you find Ad Inserter useful and need ad statistics for impressions and clicks, A/B testing, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, to protect content or to serve different ads for users using ad blockers, multisite options to limit settings for ads, to block some IP addresses, to schedule ads, then you can simply upgrade to %s Ad Inserter Pro %s (existing settings will be preserved).', 'ad-inserter'), '', ''); ?>

', ''); ?>


  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
  • ', ''); ?>
generate_alignment_class ($block_class_name); if ($block_class_name != '' && $block_number_class) $classes []= $block_class_name . '-n'; $class = count ($classes) ? ' class="' . implode (' ', $classes) . '"' : ''; $style = $inline_styles || !defined ('AI_NORMAL_HEADER_STYLES') ? ' style="' . AI_ALIGNMENT_CSS_DEFAULT . '"' : ''; echo "<div$class$style>"; }