具有许多高级广告功能的广告管理功能,可在最佳位置插入广告
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

5450 lines
357 KiB

  1. <?php
  2. /*
  3. - default insertion is hidden when excptions are disabled
  4. - block list keywords for all columns
  5. */
  6. require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
  7. function generate_settings_form (){
  8. if (defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode'])) {
  9. $url_safe_mode = '&ai-safe-mode';
  10. } else $url_safe_mode = '';
  11. if (defined ('AI_ADSENSE_API')) {
  12. require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
  13. }
  14. global $ai_db_options, $block_object, $ai_wp_data, $ai_db_options_extract;
  15. global $rating_value, $rating_string, $rating_css, $ai_custom_hooks;
  16. wp_enqueue_media();
  17. $save_url = $_SERVER ['REQUEST_URI'];
  18. if (isset ($_GET ['tab'])) {
  19. $save_url = preg_replace ("/&tab=\d+/", "", $save_url);
  20. }
  21. $generate_all = false;
  22. if (isset ($_GET ['generate-all']) && $_GET ['generate-all'] == 1) {
  23. $generate_all = true;
  24. }
  25. $subpage = 'main';
  26. $start = 1;
  27. $end = 16;
  28. if (isset ($_GET ['subpage'])) $subpage = $_GET ['subpage'];
  29. if (isset ($_GET ['start'])) $start = $_GET ['start']; else $start = 1;
  30. if (!is_numeric ($start)) $start = 1;
  31. if ($start < 1 || $start > 96) $start = 1;
  32. $end = $start + 15;
  33. if ($end > 96) $end = 96;
  34. if (isset ($_POST ['ai-active-tab'])) {
  35. $active_tabs = json_decode ($_POST ['ai-active-tab']);
  36. if ($active_tabs == null) $active_tabs = array ($start, 0);
  37. }
  38. if (isset ($_GET ['settings']) && is_numeric ($_GET ['settings'])) {
  39. $active_tab = $_GET ['settings'];
  40. if (isset ($_GET ['single'])) {
  41. $start = $active_tab;
  42. $end = $active_tab;
  43. } else {
  44. $start = intval (($active_tab - 1) / 16) * 16 + 1;
  45. $end = $start + 15;
  46. }
  47. }
  48. elseif (isset ($_GET ['tab']) && is_numeric ($_GET ['tab'])) {
  49. $active_tab = $_GET ['tab'];
  50. $start = intval (($active_tab - 1) / 16) * 16 + 1;
  51. $end = $start + 15;
  52. } else $active_tab = isset ($active_tabs [0]) ? $active_tabs [0] : $start;
  53. if (!is_numeric ($active_tab)) $active_tab = 1;
  54. if ($active_tab != 0) {
  55. if ($active_tab < $start || $active_tab > $end) $active_tab = $start;
  56. }
  57. $active_tab_0 = isset ($active_tabs [1]) ? $active_tabs [1] : 0;
  58. $disable_block_insertions = get_disable_block_insertions ();
  59. $disable_php_processing = get_disable_php_processing ();
  60. $disable_html_code = get_disable_html_code ();
  61. $disable_css_code = get_disable_css_code ();
  62. $disable_js_code = get_disable_js_code ();
  63. $disable_footer_code = get_disable_footer_code ();
  64. $disable_header_code = get_disable_header_code ();
  65. $insertion_disabled = $disable_block_insertions || $disable_php_processing || $disable_html_code || $disable_css_code || $disable_js_code || $disable_footer_code || $disable_header_code;
  66. if ($insertion_disabled) {
  67. $insertion_statuses = '<span class="ai-insertion-status"'. ($disable_header_code ? ' style="color: #f22"' : '') . '">H</span> &nbsp; ';
  68. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_footer_code ? ' style="color: #f22"' : '') . '">F</span> &nbsp; ';
  69. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_js_code ? ' style="color: #f22"' : '') . '">JS</span> &nbsp; ';
  70. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_css_code ? ' style="color: #f22"' : '') . '">CSS</span> &nbsp; ';
  71. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_html_code ? ' style="color: #f22"' : '') . '">HTML</span> &nbsp; ';
  72. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_php_processing ? ' style="color: #f22"' : '') . '">PHP</span> &nbsp; ';
  73. $insertion_statuses .= '<span class="ai-insertion-status"'. ($disable_block_insertions ? ' style="color: #f22"' : '') . '">BLOCKS</span>';
  74. } else $insertion_statuses = '';
  75. $adH = $block_object [AI_HEADER_OPTION_NAME];
  76. $adF = $block_object [AI_FOOTER_OPTION_NAME];
  77. if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
  78. $adA = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
  79. }
  80. $syntax_highlighter_theme = defined ('AI_SAFE_MODE') ? 'disabled' : get_syntax_highlighter_theme ();
  81. $block_class_name = get_block_class_name ();
  82. $block_class = get_block_class ();
  83. $block_number_class = get_block_number_class ();
  84. $block_name_class = get_block_name_class ();
  85. $inline_styles = get_inline_styles ();
  86. $default = $block_object [0];
  87. $exceptions = false;
  88. $block_exceptions = array ();
  89. if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) {
  90. $args = array (
  91. 'public' => true,
  92. '_builtin' => false
  93. );
  94. $custom_post_types = get_post_types ($args, 'names', 'and');
  95. $screens = array_unique (array_values (array_merge (array ('post', 'page'), $custom_post_types)));
  96. $args = array (
  97. 'posts_per_page' => AI_LIST_EXCEPTIONS_LIMIT,
  98. 'offset' => 0,
  99. 'category' => '',
  100. 'category_name' => '',
  101. 'orderby' => 'type',
  102. 'order' => 'ASC',
  103. 'include' => '',
  104. 'exclude' => '',
  105. 'meta_query' => array (
  106. array (
  107. 'key' => '_adinserter_block_exceptions',
  108. 'value' => '',
  109. 'compare' => '!='
  110. )
  111. ),
  112. 'post_type' => $screens,
  113. 'post_mime_type' => '',
  114. 'post_parent' => '',
  115. 'author' => '',
  116. 'author_name' => '',
  117. 'post_status' => '',
  118. 'suppress_filters' => true
  119. );
  120. $posts_pages = get_posts ($args);
  121. $exceptions = array ();
  122. foreach ($posts_pages as $page) {
  123. $post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
  124. if ($post_meta == '') continue;
  125. $post_type_object = get_post_type_object ($page->post_type);
  126. $exceptions [$page->ID] = array ('type' => $page->post_type, 'name' => $post_type_object->labels->singular_name, 'title' => $page->post_title, 'blocks' => $post_meta);
  127. $selected_blocks = explode (",", $post_meta);
  128. foreach ($selected_blocks as $selected_block) {
  129. $block_exceptions [$selected_block][$page->ID] = array ('type' => $page->post_type, 'name' => $post_type_object->labels->singular_name, 'title' => $page->post_title);
  130. }
  131. }
  132. if (isset ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
  133. if ($_POST [AI_FORM_CLEAR_EXCEPTIONS] == "\xe2\x9d\x8c" && !empty ($exceptions)) {
  134. echo '<div class="notice notice-warning is-dismissible" style="margin: 5px 15px 2px 0px;"><p>' . sprintf (__('Warning: only exceptions for %d posts cleared, %d posts still have exceptions', 'ad-inserter'), AI_LIST_EXCEPTIONS_LIMIT, count ($exceptions)) . '</p></div>';
  135. }
  136. elseif (is_numeric ($_POST [AI_FORM_CLEAR_EXCEPTIONS]) && !empty ($block_exceptions [$_POST [AI_FORM_CLEAR_EXCEPTIONS]])) {
  137. echo '<div class="notice notice-warning is-dismissible" style="margin: 5px 15px 2px 0px;"><p>' . sprintf (__('Warning: only exceptions for %d posts cleared, %d posts still have exceptions', 'ad-inserter'), AI_LIST_EXCEPTIONS_LIMIT, count ($block_exceptions [$_POST [AI_FORM_CLEAR_EXCEPTIONS]])) . '</p></div>';
  138. }
  139. }
  140. }
  141. $rating_string = '';
  142. if ($rating_string = get_transient (AI_TRANSIENT_RATING)) {
  143. if ($rating_string < 1 && $rating_string > 5) $rating_string = '';
  144. }
  145. $rating_css = $rating_string == '' ? 'width: 100%;' : 'width: '.number_format ($rating_string * 20, 4).'%;';
  146. $rating_value = $rating_string == '' ? '' : number_format ($rating_string, 1);
  147. if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]) && is_string ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]) && strlen ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]) != 0) {
  148. $used_blocks = unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]);
  149. } else $used_blocks = array ();
  150. if (!isset ($_GET ['settings'])): // start of code only for normal settings
  151. $default_sidebar = isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL]) && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 19 && count ($used_blocks) >= 4 && function_exists ('ai_settings_side') && function_exists ('ai_admin_settings_notices') ? '1' : '0';
  152. if (is_multisite () && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
  153. $saved_options = get_blog_option (BLOG_ID_CURRENT_SITE, AI_OPTION_NAME);
  154. if (is_string ($saved_options) && substr ($saved_options, 0, 4) === ':AI:') {
  155. $saved_options = unserialize (base64_decode (substr ($saved_options, 4), true));
  156. }
  157. } else $saved_options = ai_get_option (AI_OPTION_NAME);
  158. $warning = false;
  159. if (!empty ($saved_options))
  160. foreach ($saved_options as $block => $block_settings) {
  161. if ($block >= $start && $block <= $end) {
  162. if (isset ($saved_options [$block]) && strpos (serialize ($saved_options [$block]), '_on_which_') !== false) {
  163. $warning = true;
  164. break;
  165. }
  166. }
  167. }
  168. if ($warning) {
  169. echo '<div class="notice notice-warning is-dismissible" style="margin: 5px 15px 2px 0px;"><p>' . __('Settings for individual exceptions have been updated. Please check all blocks that have exceptions and and then save settings.', 'ad-inserter') . '</p></div>';
  170. }
  171. if (function_exists ('ai_admin_settings_notices')) ai_admin_settings_notices ();
  172. ?>
  173. <div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" tab-setup-delay="<?php echo get_tab_setup_delay (); ?>" safe-mode="<?php echo defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode']) ? '1' : '0'; ?>" js_debugging="<?php echo $ai_wp_data [AI_BACKEND_JS_DEBUGGING] ? '1' : '0'; ?>" api_debugging="<?php echo strlen ($api = get_option ('ad_inserter' . '_' . base64_decode ('cHJvX2xpY2Vuc2U='), '')); ?>" <?php if ($default_sidebar && strlen ($api) != 0) echo 'api_string="', base64_encode ($api), '"'; ?>></div>
  174. <?php
  175. if (function_exists ('ai_data_2')) ai_data_2 ();
  176. ?>
  177. <div id="ai-clipboard" style="display: none;"></div>
  178. <div style="clear: both;"></div>
  179. <div id="ai-settings" style="float: left;" data-home-url="<?php echo home_url (); ?>/" data-home-relative-url="<?php echo wp_make_link_relative (get_site_url ()); ?>/">
  180. <form id="ai-form" class="no-select rounded" style="float: left;" action="<?php echo $save_url; ?>" method="post" name="ai_form" start="<?php echo $start; ?>" end="<?php echo $end; ?>" gmt="<?php echo get_option ('gmt_offset') * 3600 * 1000; ?>" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" ai-value="<?php echo base64_encode (wp_create_nonce ("adinserter_data")); ?>">
  181. <div id="header" class="ai-form header rounded">
  182. <div id= "ai-settings-header" style="float: left;">
  183. <h2 id="plugin_name" style="margin: 5px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
  184. <div id="block-ranges">
  185. <?php
  186. for ($range = 1; $range <= intval ((96 + 15) / 16); $range ++){
  187. $range_start = ($range - 1) * 16 + 1;
  188. $range_end = $range_start + 16 - 1;
  189. if ($range_end > 96) $range_end = 96;
  190. if (($active_tab >= $range_start && $active_tab <= $range_end) || ($start == $range_start && $active_tab == 0)) $style = "font-weight: bold; color: #44e; "; else $style = "";
  191. ?>
  192. <button type="button" class="ai-top-button" id="button-range-<?php echo $range; ?>" style="margin-right: 0px; outline: none;" onclick="window.location.href='<?php echo admin_url('options-general.php?page=ad-inserter.php&start='.$range_start.$url_safe_mode); ?>'">
  193. <span style="<?php echo $style; ?>"><?php echo $range_start, " - ", $range_end; ?></span>
  194. </button>
  195. <?php } ?>
  196. </div>
  197. </div>
  198. <div id="header-buttons">
  199. <img id="ai-loading" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>loading.gif" style="width: 24px; height: 24px; vertical-align: middle; margin-right: 10px; display: none;" />
  200. <span class="checkbox-button dashicons dashicons-book-alt" onclick="window.open('https://adinserter.pro/documentation')" title="<?php _e ('Online documentation', 'ad-inserter'); ?>"></span>
  201. <?php if (defined ('AI_ADSENSE_API')) : ?>
  202. <?php if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) : ?>
  203. <label id="adsense-list" class="checkbox-button" title="<?php _e ('Show AdSense ad units', 'ad-inserter'); ?>" ><span class="checkbox-icon icon-adsense"></span></label>
  204. <?php endif; ?>
  205. <?php endif; ?>
  206. <?php if (!is_multisite() || is_main_site () ) : ?>
  207. <?php if (!function_exists ('ai_data_2') && file_exists (AD_INSERTER_PLUGIN_DIR.'includes/js/ai-load.js')) : ?>
  208. <span class="checkbox-button dashicons dashicons-buddicons-forums" onclick="window.open('https://adinserter.pro/about')" ></span>
  209. <?php endif; ?>
  210. <label id="ai-ads-txt" class="checkbox-button iab-ads-txt" title="<?php _e ('Edit ads.txt file', 'ad-inserter'); ?>" ><span class="checkbox-icon icon-ads-txt"></span></label>
  211. <?php endif; ?>
  212. <span id="page-checker-button" class="checkbox-button dashicons dashicons-editor-justify" title="<?php _e ('Check theme for available positions for automatic insertion', 'ad-inserter'); ?>"></span>
  213. <span id="ai-list" class="checkbox-button dashicons dashicons-screenoptions" title="<?php _e ('List all blocks', 'ad-inserter'); ?>"></span>
  214. </div>
  215. <div style="clear: both;"></div>
  216. </div>
  217. <div id="javascript-warning" class="ai-form rounded" style="display: none;">
  218. <h2 id="javascript-version" style="float: left; margin: 0; max-width: 85px; color: red;" title="<?php _e ('Loaded plugin JavaScript file version', 'ad-inserter'); ?>">&nbsp;</h2>
  219. <div style="float: right; max-width: 640px; text-align: right;">
  220. <span id="javascript-version-parameter" style="display: none;"><?php /* translators: %s: HTML tags */ printf (__ ('Wrong or %s missing version parameter %s of the JavaScript file, probably due to inappropriate caching.', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/troubleshooting#missing-version-parameter" class="simple-link" target="_blank">', '</a>'); ?><br /></span>
  221. <span id="javascript-version-parameter-missing" style="display: none;"><?php _e ('Missing version parameter of the JavaScript file, probably due to inappropriate caching.', 'ad-inserter'); ?><br /></span>
  222. <?php _e ('Incompatible (old) JavaScript file loaded, probably due to inappropriate caching.', 'ad-inserter'); ?><br />
  223. <?php _e ("Please delete browser's cache and all other caches used and then reload this page.", 'ad-inserter'); ?>
  224. </div>
  225. <div style="clear: both;"></div>
  226. </div>
  227. <div id="css-warning" class="ai-form rounded" style="display: none;">
  228. <h2 id="css-version" style="float: left; margin: 0; max-width: 85px; color: red;" title="<?php _e ('Loaded plugin CSS file version', 'ad-inserter'); ?>">&nbsp;</h2>
  229. <div style="float: right; max-width: 640px; text-align: right;">
  230. <span id="css-version-parameter" style="display: none;"><?php /* translators: %s: HTML tags */ printf (__ ('Wrong or %s missing version parameter %s of the CSS file, probably due to inappropriate caching.', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/troubleshooting#missing-version-parameter" class="simple-link" target="_blank">', '</a>'); ?><br /></span>
  231. <span id="css-version-parameter-missing" style="display: none;"><?php _e ('Missing version parameter of the CSS file, probably due to inappropriate caching.', 'ad-inserter'); ?><br /></span>
  232. <?php _e ('Incompatible (old) CSS file loaded, probably due to inappropriate caching.', 'ad-inserter'); ?><br />
  233. <?php _e ("Please delete browser's cache and all other caches used and then reload this page.", 'ad-inserter'); ?>
  234. </div>
  235. <div style="clear: both;"></div>
  236. </div>
  237. <div id="blocked-warning" class="ai-form warning-enabled rounded">
  238. <h2 class="blocked-warning-text" style="float: left; color: red; margin: 7px 0;" title="<?php _e ('Error loading page', 'ad-inserter'); ?>"><?php _e ('WARNING', 'ad-inserter'); ?></h2>
  239. <div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
  240. <?php /* translators: %s: HTML tags */ printf (__ ('Page may %s not be loaded properly. %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/troubleshooting#page-blocked" class="simple-link" target="_blank">', '</a>'); ?>
  241. <?php _e ('Check ad blocking software that may block CSS, JavaScript or image files.', 'ad-inserter'); ?>
  242. </div>
  243. <div style="clear: both;"></div>
  244. </div>
  245. <?php
  246. if (defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode'])) {
  247. ?>
  248. <div class="ai-form warning-enabled rounded">
  249. <h2 class="blocked-warning-text" style="float: left; color: blue; margin: 7px 0;"><?php _e ('SAFE MODE', 'ad-inserter'); ?></h2>
  250. <div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
  251. <?php /* translators: %s: HTML tags */ printf (__ ('Page is loaded in %s safe mode. %s Not all scripts are loaded.', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/troubleshooting#safe-mode" class="simple-link" target="_blank">', '</a>'); ?>
  252. </div>
  253. <div style="clear: both;"></div>
  254. </div>
  255. <?php
  256. }
  257. ?>
  258. <?php
  259. if ($insertion_disabled):
  260. ?>
  261. <div id="debugging-warning" class="ai-form warning-enabled rounded">
  262. <h2 class="blocked-warning-text" style="float: left; color: red; margin: 7px 0;" title="<?php _e ('To disable debugging functions and to enable insertions go to tab [*] / tab Debugging', 'ad-inserter'); ?>"><?php _e ('WARNING', 'ad-inserter'); ?></h2>
  263. <div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
  264. <?php _e ('Debugging functions enabled - some code is not inserted', 'ad-inserter'); echo ': &nbsp; &nbsp;<span style="font-weight: bold;">', $insertion_statuses, '</span>'; ?>
  265. </div>
  266. <div style="clear: both;"></div>
  267. </div>
  268. <?php
  269. endif;
  270. ?>
  271. <div id="rotation-tabs" style="display: none;">
  272. <ul>
  273. <li class="ai-rotate-option"><a></a></li>
  274. </ul>
  275. <div class="responsive-table rounded">
  276. <table class="ai-settings-table" style="">
  277. <tr>
  278. <td style="padding-right: 7px; min-width: 72px">
  279. <span class="group-name-label" style="display: none;"><?php _e ('Group name', 'ad-inserter'); ?></span>
  280. <span class="option-name-label"><?php _e ('Option name', 'ad-inserter'); ?></span>
  281. </td>
  282. <td style="width: 100%;">
  283. <input class="option-name" style="width: 100%;" type="text" size="50" maxlength="200" />
  284. </td>
  285. <td class="option-parameters" style="padding-left: 7px;">
  286. <?php _e ('Share', 'ad-inserter'); ?>
  287. </td>
  288. <td class="option-parameters">
  289. <input class="option-share" style="width: 42px;" type="text" maxlength="2" title="<?php _e ('Option share in percents - 0 means option is disabled, if share for one option is not defined it will be calculated automatically. Leave all share fields empty for equal option shares.', 'ad-inserter'); ?>" /> %
  290. </td>
  291. <td class="option-parameters" style="padding-left: 7px;">
  292. <?php _e ('Time', 'ad-inserter'); ?>
  293. </td>
  294. <td class="option-parameters">
  295. <input class="option-time" style="width: 42px;" type="text" maxlength="3" title="<?php _e ('Option time in seconds - 0 means option is disabled and will be skipped. Leave all time fields empty for no timed rotation.', 'ad-inserter'); ?>" /> s
  296. </td>
  297. </tr>
  298. </table>
  299. <div style="clear: both;"></div>
  300. </div>
  301. </div>
  302. <div id="ai-error-container" class="rounded" style="border-color: red; display: none;"></div>
  303. <div id="ai-container">
  304. <?php endif; // of code only for normal settings ?>
  305. <div id="ai-tab-container" class="ai-form rounded" style="padding-bottom: 1px;">
  306. <div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
  307. <div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
  308. <?php
  309. for ($block = $start; $block <= $end; $block ++){
  310. echo " <span id='ai-scroll-tab-$block' rel='$block'>$block</span>";
  311. }
  312. ?>
  313. <span rel='0'>0</span>
  314. </div>
  315. <ul id="ai-tabs" style="display: none;">
  316. <?php
  317. $sidebars_with_widget = get_sidebar_widgets ();
  318. // $sidebar_widgets = wp_get_sidebars_widgets();
  319. // $widget_options = get_option ('widget_ai_widget');
  320. // $sidebars_with_widgets = array ();
  321. //// for ($block = $start; $block <= $end; $block ++){
  322. // for ($block = 1; $block <= 96; $block ++){
  323. // $sidebars_with_widget [$block]= array ();
  324. // }
  325. // foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
  326. // if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
  327. // $sidebar_name = $GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'];
  328. // if ($sidebar_name != "") {
  329. // foreach ($sidebar_widget as $widget) {
  330. // if (preg_match ("/ai_widget-([\d]+)/", $widget, $widget_id)) {
  331. // if (isset ($widget_id [1]) && is_numeric ($widget_id [1])) {
  332. // $widget_option = $widget_options [$widget_id [1]];
  333. // $widget_block = $widget_option ['block'];
  334. //// if ($widget_block >= $start && $widget_block <= $end && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) {
  335. // if ($widget_block >= 1 && $widget_block <= 96 && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) {
  336. // $sidebars_with_widget [$widget_block] []= $sidebar_name;
  337. // }
  338. // }
  339. // }
  340. // }
  341. // }
  342. // }
  343. // }
  344. $manual_widget = array ();
  345. $manual_shortcode = array ();
  346. $manual_php_function = array ();
  347. $manual = array ();
  348. $sidebars = array ();
  349. $scheduling_period_inactive = array ();
  350. for ($block = $start; $block <= $end; $block ++) {
  351. $obj = $block_object [$block];
  352. $automatic = $obj->get_automatic_insertion() != AI_AUTOMATIC_INSERTION_DISABLED;
  353. $manual_widget [$block] = $obj->get_enable_widget() == AI_ENABLED;
  354. $manual_shortcode [$block] = $obj->get_enable_manual() == AI_ENABLED;
  355. $manual_php_function [$block] = $obj->get_enable_php_call() == AI_ENABLED;
  356. $manual [$block] = ($manual_widget [$block] && !empty ($sidebars_with_widget [$block])) || $manual_shortcode [$block] || $manual_php_function [$block];
  357. $disabled = $obj->get_disable_insertion ();
  358. switch ($obj->get_scheduling ()) {
  359. case AI_SCHEDULING_BETWEEN_DATES:
  360. case AI_SCHEDULING_OUTSIDE_DATES:
  361. $scheduling_period_inactive [$block] = !check_scheduling_time (
  362. $obj->get_schedule_start_date () . ' ' . $obj->get_schedule_start_time (),
  363. $obj->get_schedule_end_date () . ' ' . $obj->get_schedule_end_time (),
  364. $obj->get_schedule_weekdays (),
  365. $obj->get_scheduling () == AI_SCHEDULING_BETWEEN_DATES
  366. );
  367. break;
  368. default:
  369. $scheduling_period_inactive [$block] = false;
  370. break;
  371. }
  372. $style = "";
  373. $ad_name = "";
  374. $sidebars [$block] = "";
  375. if (!$disabled && !$scheduling_period_inactive [$block]) {
  376. if ($automatic && $manual [$block]) $style = "font-weight: bold; color: #c4f;";
  377. elseif ($automatic) $style = "font-weight: bold; color: #e44;";
  378. elseif ($manual [$block]) $style = "font-weight: bold; color: #66f;";
  379. }
  380. if (!empty ($sidebars_with_widget [$block])) $sidebars [$block] = implode (", ", $sidebars_with_widget [$block]);
  381. // if (!wp_is_mobile ()) {
  382. // $ad_name = $obj->get_ad_name();
  383. // $ad_name_functions = false;
  384. // if ($automatic) {
  385. // $ad_name .= ": ".$obj->get_automatic_insertion_text ();
  386. // $ad_name_functions = true;
  387. // }
  388. // //if (!empty ($sidebars_with_widget [$block])) $sidebars [$block] = implode (", ", $sidebars_with_widget [$block]);
  389. // if ($manual_widget [$block]) {
  390. // if ($sidebars [$block] != "") {
  391. // $ad_name .= $ad_name_functions ? ", " : ": ";
  392. // $ad_name .= "Widget used in: [".$sidebars [$block]."]";
  393. // $ad_name_functions = true;
  394. // }
  395. // } else {
  396. // if (!empty ($sidebars_with_widget [$block])) {
  397. // $ad_name .= $ad_name_functions ? ", " : ": ";
  398. // $ad_name .= "Widget DISABLED but used in: [".$sidebars [$block]."]";
  399. // $ad_name_functions = true;
  400. // }
  401. // }
  402. // if ($manual_shortcode [$block]) {
  403. // $ad_name .= $ad_name_functions ? ", " : ": ";
  404. // $ad_name .= "Shortcode";
  405. // $ad_name_functions = true;
  406. // }
  407. // if ($manual_php_function [$block]) {
  408. // $ad_name .= $ad_name_functions ? ", " : ": ";
  409. // $ad_name .= "PHP function";
  410. // $ad_name_functions = true;
  411. // }
  412. // }
  413. echo "
  414. <li id=\"ai-tab$block\" class=\"ai-tab\" title=\"$ad_name\"><a href=\"#tab-$block\"><span style=\"", $style, "\">$block</span></a></li>";
  415. }
  416. $enabled_k = count ($ai_custom_hooks) != 0;
  417. $enabled_h = $adH->get_enable_manual () && $adH->get_ad_data() != "";
  418. $enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
  419. if ($enabled_h || $enabled_f) $settings_tab_class = " on"; else $settings_tab_class = "";
  420. $title_hfa = "";
  421. // if ($enabled_h) $title_hfa .= ", Header code";
  422. // if ($enabled_f) $title_hfa .= ", Footer code";
  423. $header_code_disabled = !$adH->get_enable_manual () && $adH->get_ad_data() != "";
  424. $footer_code_disabled = !$adF->get_enable_manual () && $adF->get_ad_data() != "";
  425. if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
  426. $enabled_a = $ai_wp_data [AI_ADB_DETECTION];
  427. // if ($enabled_a) $title_hfa .= ", Ad blocking detection code";
  428. if ($enabled_a) $settings_tab_class = " on";
  429. }
  430. if ($insertion_disabled) $settings_tab_class = " red";
  431. ?>
  432. <li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME, ' ', _e ('General Settings', 'ad-inserter'); ?><?php echo $title_hfa ?>" style=" margin: 1px 0 0 0;"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $settings_tab_class ?>"></div></a></li>
  433. </ul>
  434. <?php
  435. for ($block = $start; $block <= $end + 1; $block ++){
  436. if ($block <= $end) {
  437. $default->number = $block;
  438. $default->wp_options [AI_OPTION_BLOCK_NAME] = DEFAULT_AD_NAME." ".$block;
  439. $tab_visible = $block == $active_tab || $generate_all;
  440. $obj = $block_object [$block];
  441. } else {
  442. $block = 999;
  443. $sidebars [$block] = "";
  444. $manual_widget [$block] = $obj->get_enable_widget() == AI_ENABLED;
  445. $manual_shortcode [$block] = $obj->get_enable_manual() == AI_ENABLED;
  446. $manual_php_function [$block] = $obj->get_enable_php_call() == AI_ENABLED;
  447. $manual [$block] = ($manual_widget [$block] && !empty ($sidebars_with_widget [$block])) || $manual_shortcode [$block] || $manual_php_function [$block];
  448. $default->number = 0;
  449. $default->wp_options [AI_OPTION_BLOCK_NAME] = DEFAULT_AD_NAME." 0";
  450. $tab_visible = false;
  451. $obj = $default;
  452. }
  453. $client_side_devices = $obj->get_detection_client_side () == AI_ENABLED;
  454. $server_side_devices = $obj->get_detection_server_side () == AI_ENABLED;
  455. if ($client_side_devices) $client_side_style = "font-weight: bold; color: #66f;"; else $client_side_style = "";
  456. if ($server_side_devices) $server_side_style = "font-weight: bold; color: #66f;"; else $server_side_style = "";
  457. $show_devices = $client_side_devices || $server_side_devices == AI_ENABLED;
  458. if ($show_devices) $devices_style = "font-weight: bold; color: #66f;"; else $devices_style = "";
  459. $cat_list = $obj->get_ad_block_cat();
  460. $tag_list = $obj->get_ad_block_tag();
  461. $taxonomy_list = $obj->get_ad_block_taxonomy();
  462. $id_list = $obj->get_id_list();
  463. $url_list = $obj->get_ad_url_list();
  464. $url_parameter_list = $obj->get_url_parameter_list();
  465. $domain_list = $obj->get_ad_domain_list();
  466. $client_list = $obj->get_client_list();
  467. if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
  468. $show_cat_list = $cat_list != '';
  469. $show_tag_list = $tag_list != '';
  470. $show_taxonomy_list = $taxonomy_list != '';
  471. $show_id_list = $id_list != '';
  472. $show_url_list = $url_list != '';
  473. $show_url_parameter_list = $url_parameter_list != '';
  474. $show_domain_list = $domain_list != '';
  475. $show_client_list = $client_list != '';
  476. $show_lists =
  477. $show_cat_list ||
  478. $show_tag_list ||
  479. $show_taxonomy_list ||
  480. $show_id_list ||
  481. $show_url_list ||
  482. $show_url_parameter_list ||
  483. $show_domain_list ||
  484. $show_client_list ||
  485. $lists;
  486. if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
  487. $show_manual = $manual [$block] ||!empty ($sidebars_with_widget [$block]);
  488. if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$block] || empty ($sidebars_with_widget [$block]) ? "#66f;" : "#e44;"); else $manual_style = "";
  489. $insertion_options =
  490. $obj->get_maximum_insertions () ||
  491. $obj->get_display_for_users() != AI_DISPLAY_ALL_USERS ||
  492. $obj->get_enable_amp () == AI_ENABLED ||
  493. $obj->get_enable_ajax () != AI_ENABLED ||
  494. $obj->get_enable_404 () == AI_ENABLED ||
  495. $obj->get_enable_feed () == AI_ENABLED ||
  496. $obj->get_max_page_blocks_enabled () ||
  497. $obj->get_only_in_the_loop () ||
  498. $obj->get_embed_js_code () ||
  499. $obj->get_disable_caching ();
  500. $word_count_options =
  501. intval ($obj->get_minimum_words()) != 0 ||
  502. intval ($obj->get_maximum_words()) != 0;
  503. $automatic_insertion = $obj->get_automatic_insertion();
  504. $paragraph_settings =
  505. $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
  506. $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH;
  507. $image_settings =
  508. $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_IMAGE ||
  509. $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_IMAGE;
  510. $filter_insertions_settings =
  511. $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT ||
  512. $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT ||
  513. $automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS ||
  514. $automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS;
  515. if ($filter_insertions_settings) {
  516. $filter_active = $obj->get_filter_type() != AI_FILTER_AUTO || $obj->get_inverted_filter() != 0;
  517. } else $filter_active = $obj->get_call_filter() || $obj->get_inverted_filter() != 0;
  518. $adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING;
  519. $display_options =
  520. $obj->get_block_width () != '' || $obj->get_block_height () != '' || $obj->get_show_label () ||
  521. $obj->get_lazy_loading () || $obj->get_protected () || $obj->get_manual_loading () != AI_MANUAL_LOADING_DISABLED ||
  522. $obj->get_close_button () || $obj->get_auto_close_time () || $obj->get_stay_closed_time () ||
  523. $obj->get_delay_showing () || $obj->get_show_every () ||
  524. $obj->get_iframe ();
  525. $limits_options =
  526. $obj->get_max_impressions () || ($obj->get_limit_impressions_per_time_period () && $obj->get_limit_impressions_time_period ()) ||
  527. $obj->get_max_clicks () || ($obj->get_limit_clicks_per_time_period () && $obj->get_limit_clicks_time_period ()) ||
  528. $obj->get_visitor_max_impressions () || ($obj->get_visitor_limit_impressions_per_time_period () && $obj->get_visitor_limit_impressions_time_period ()) ||
  529. $obj->get_visitor_max_clicks () || ($obj->get_visitor_limit_clicks_per_time_period () && $obj->get_visitor_limit_clicks_time_period ()) || $obj->get_trigger_click_fraud_protection ();
  530. $scheduling_active = $obj->get_scheduling () != AI_SCHEDULING_OFF;
  531. $show_misc =
  532. $insertion_options ||
  533. $word_count_options ||
  534. $scheduling_active ||
  535. $filter_active ||
  536. $adb_block_action_active ||
  537. $display_options ||
  538. $limits_options;
  539. if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
  540. if ($insertion_options) $insertion_style = "font-weight: bold; color: #66f;"; else $insertion_style = "";
  541. if ($word_count_options) $word_count_style = "font-weight: bold; color: #66f;"; else $word_count_style = "";
  542. if ($scheduling_active) $scheduling_style = ($scheduling_period_inactive [$block] ? 'font-weight: bold; color: #e44;' : "font-weight: bold; color: #66f;"); else $scheduling_style = "";
  543. if ($filter_active) $filter_style = "font-weight: bold; color: #66f;"; else $filter_style = "";
  544. if ($adb_block_action_active) $adb_style = "font-weight: bold; color: #66f;"; else $adb_style = "";
  545. if ($display_options) $display_style = "font-weight: bold; color: #66f;"; else $display_style = "";
  546. if ($limits_options) $limits_style = "font-weight: bold; color: #66f;"; else $limits_style = "";
  547. $general_style = '';
  548. $paragraph_counting = $paragraph_settings && (
  549. $obj->get_direction_type() != $default->get_direction_type() ||
  550. $obj->get_paragraph_tags() != $default->get_paragraph_tags() ||
  551. $obj->get_minimum_paragraph_words() != $default->get_minimum_paragraph_words() ||
  552. $obj->get_maximum_paragraph_words() != $default->get_maximum_paragraph_words() ||
  553. $obj->get_paragraph_text_type() != $default->get_paragraph_text_type() ||
  554. $obj->get_paragraph_text() != $default->get_paragraph_text() ||
  555. $obj->get_count_inside_blockquote() != $default->get_count_inside_blockquote() ||
  556. $obj->get_count_inside() != $default->get_count_inside() ||
  557. $obj->get_count_inside_elements() != $default->get_count_inside_elements() ||
  558. $obj->get_count_inside_elements_contain() != $default->get_count_inside_elements_contain() ||
  559. $obj->get_count_inside_elements_text() != $default->get_count_inside_elements_text() ||
  560. $obj->get_paragraph_number_minimum() != $default->get_paragraph_number_minimum() ||
  561. $obj->get_paragraph_number_maximum() != $default->get_paragraph_number_maximum() ||
  562. $obj->get_skip_first_paragraphs() != $default->get_skip_first_paragraphs() ||
  563. $obj->get_skip_last_paragraphs() != $default->get_skip_last_paragraphs() ||
  564. $obj->get_minimum_words_above() != $default->get_minimum_words_above()
  565. );
  566. $paragraph_clearance = $paragraph_settings && (
  567. ($obj->get_avoid_text_above() != $default->get_avoid_text_above() && intval ($obj->get_avoid_paragraphs_above()) != 0) ||
  568. ($obj->get_avoid_text_below() != $default->get_avoid_text_below() && intval ($obj->get_avoid_paragraphs_below()) != 0)
  569. );
  570. $html_settings =
  571. $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT ||
  572. $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT ||
  573. $automatic_insertion == AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT;
  574. $html_element_insertion = $obj->get_html_element_insertion ();
  575. $server_side_insertion = $obj->get_server_side_insertion ();
  576. $inside_element = $obj->get_inside_element ();
  577. $filter_type = $obj->get_filter_type();
  578. $page_exceptions = array ();
  579. $post_exceptions = array ();
  580. if (!empty ($block_exceptions [$block])) {
  581. $page_index = 0;
  582. $post_index = 0;
  583. foreach ($block_exceptions [$block] as $id => $exception) {
  584. if ($exception ['type'] == 'page') {
  585. $row_class = $page_index % 2 == 0 ? 'even' : 'odd';
  586. } else {
  587. $row_class = $post_index % 2 == 0 ? 'even' : 'odd';
  588. }
  589. $exception_line = '<tr class="' . $row_class . '">
  590. <td class="id" title="View"><a href="' . get_permalink ($id) . '" target="_blank" style="color: #222;">' . $id .'</a></td>
  591. <td class="type" title="View"><a href="' . get_permalink ($id) . '" target="_blank" style="color: #222;">' . $exception ['name'] . '</a></td>
  592. <td class="page-title page-only" title="Edit"><a href="' . get_edit_post_link ($id) . '" target="_blank" style="margin-left: 2px; color: #222;">' . $exception ['title'] . '</a></td>
  593. <td></td>
  594. </tr>' . "\n";
  595. if ($exception ['type'] == 'page') {
  596. $page_exceptions []= $exception_line;
  597. $page_index ++;
  598. } else {
  599. $post_exceptions []= $exception_line;
  600. $post_index ++;
  601. }
  602. }
  603. }
  604. $exceptions_needs_check = false;
  605. $option = $obj->import_old_exception_settings ($exceptions_needs_check);
  606. $exceptions_error =
  607. $obj->get_exceptions_enabled () && $obj->get_exceptions_function () == AI_DEFAULT_INSERTION_DISABLED && empty ($block_exceptions [$block]);
  608. $exceptions_shown =
  609. $exceptions_needs_check ||
  610. $exceptions_error;
  611. $exception_button_on =
  612. $obj->get_exceptions_enabled () && !empty ($block_exceptions [$block]) ||
  613. $exceptions_shown;
  614. ?>
  615. <div id="tab-<?php echo $block; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
  616. <input id="block-parameters-<?php echo $block; ?>" style="display: none;" type="text" value="" />
  617. <div class="ai-toolbars">
  618. <div id="ai-main-toolbar-<?php echo $block; ?>" class="max-input" style="margin: 8px 0 0 2px; height: 28px; width: 731px;">
  619. <span id="name-label-container-<?php echo $block; ?>" style="display: table-cell; width: 100%; padding: 0; font-weight: bold; cursor: pointer;">
  620. <input id="name-edit-<?php echo $block; ?>" style="width: 100%; height: 20px; padding-left: 5px; vertical-align: middle; font-size: 14px; display: none;" type="text" name="<?php echo AI_OPTION_BLOCK_NAME, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
  621. <span id="name-label-<?php echo $block; ?>" class="no-select" style="width: 100%; max-width: 490px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top: 4px; margin-left: 7px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name() ?></span>
  622. </span>
  623. <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
  624. <span class="ai-toolbar-button ai-settings">
  625. <input type="checkbox" value="0" id="simple-editor-<?php echo $block; ?>" class="simple-editor-button" style="display: none;" />
  626. <label class="checkbox-button" for="simple-editor-<?php echo $block; ?>" title="<?php _e ('Toggle Syntax Highlighting / Simple editor for mobile devices', 'ad-inserter'); ?>"><span class="checkbox-icon icon-tablet"></span></label>
  627. </span>
  628. <?php endif; ?>
  629. <?php if (defined ('AI_CODE_GENERATOR')) : ?>
  630. <span class="ai-toolbar-button ai-settings">
  631. <input type="checkbox" id="tools-button-<?php echo $block; ?>" style="display: none;" />
  632. <label class="checkbox-button tools-button" for="tools-button-<?php echo $block; ?>" title="<?php _e ('Toggle tools', 'ad-inserter'); ?>"><span class="checkbox-icon icon-tools"></span></label>
  633. </span>
  634. <?php endif; ?>
  635. <?php if (!is_multisite() || is_main_site () || multisite_php_processing ()) : ?>
  636. <span class="ai-toolbar-button ai-settings">
  637. <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  638. <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_process_php (); ?>" id="process-php-<?php echo $block; ?>" <?php if ($obj->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  639. <label class="checkbox-button" for="process-php-<?php echo $block; ?>" title="<?php _e ('Process PHP code in block', 'ad-inserter'); ?>"><span class="checkbox-icon icon-php<?php if ($obj->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
  640. </span>
  641. <?php endif; ?>
  642. <span class="ai-toolbar-button ai-settings">
  643. <input type="hidden" name="<?php echo AI_OPTION_DISABLE_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  644. <input type="checkbox" name="<?php echo AI_OPTION_DISABLE_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" id="disable-insertion-<?php echo $block; ?>" default="<?php echo $default->get_disable_insertion (); ?>" <?php if ($obj->get_disable_insertion () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  645. <label class="checkbox-button" for="disable-insertion-<?php echo $block; ?>" title="<?php _e ('Disable insertion of this block', 'ad-inserter'); ?>"><span class="checkbox-icon icon-pause<?php if ($obj->get_disable_insertion () == AI_ENABLED) echo ' on'; ?>"></span></label>
  646. </span>
  647. <?php if (function_exists ('ai_settings_top_buttons_2')) ai_settings_top_buttons_2 ($block, $obj, $default); ?>
  648. </div>
  649. <div class="ai-settings">
  650. <div id="ai-tools-toolbar-<?php echo $block; ?>" class="ai-tools-toolbar max-input" style="margin: 8px 0 0 2px; height: 28px; width: 729px; padding: 0 0 0 2px; display: none;">
  651. <?php if (function_exists ('ai_settings_top_buttons_1')) ai_settings_top_buttons_1 ($block, $obj, $default); ?>
  652. <?php if (defined ('AI_CODE_GENERATOR')) : ?>
  653. <span class="ai-toolbar-button ai-button-left">
  654. <input type="checkbox" id="code-generator-<?php echo $block; ?>" style="display: none;" />
  655. <label class="checkbox-button code-generator-button" for="code-generator-<?php echo $block; ?>" title="<?php _e ('Toggle code generator', 'ad-inserter'); ?>"><span class="checkbox-icon icon-code"></span></label>
  656. </span>
  657. <span class="ai-toolbar-button ai-button-left">
  658. <input type="checkbox" id="rotation-<?php echo $block; ?>" style="display: none;" />
  659. <label class="checkbox-button rotation-button" for="rotation-<?php echo $block; ?>" title="<?php _e ('Toggle rotation editor', 'ad-inserter'); ?>"><span class="checkbox-icon icon-rotation"></span></label>
  660. </span>
  661. <span class="ai-toolbar-button ai-button-left">
  662. <input type="checkbox" id="visual-editor-<?php echo $block; ?>" style="display: none;" />
  663. <label class="checkbox-button" for="visual-editor-<?php echo $block; ?>" title="<?php _e ('Open visual HTML editor', 'ad-inserter'); ?>"><span class="checkbox-icon icon-edit"></span></label>
  664. </span>
  665. <?php if (defined ('AI_ADSENSE_API')) : ?>
  666. <?php if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) : ?>
  667. <span style="display: table-cell; width: 6%;"></span>
  668. <span class="ai-toolbar-button ai-button-left">
  669. <input type="checkbox" id="ga-<?php echo $block; ?>" style="display: none;" />
  670. <label class="checkbox-button adsense-list" for="ga-<?php echo $block; ?>" title="<?php _e ('Show AdSense ad units', 'ad-inserter'); ?>" ><span class="checkbox-icon icon-adsense"></span></label>
  671. </span>
  672. <?php endif; ?>
  673. <?php endif; ?>
  674. <span style="display: table-cell; width: 100%;"></span>
  675. <span class="ai-toolbar-button" style="padding-right: 15px;">
  676. <input type="checkbox" id="clear-block-<?php echo $block; ?>" style="display: none;" />
  677. <label class="checkbox-button" for="clear-block-<?php echo $block; ?>" title="<?php _e ('Clear block', 'ad-inserter'); ?>"><span class="checkbox-icon icon-clear"></span></label>
  678. </span>
  679. <span class="ai-toolbar-button">
  680. <input type="checkbox" id="copy-block-<?php echo $block; ?>" class="ai-copy" style="display: none;" />
  681. <label class="checkbox-button" for="copy-block-<?php echo $block; ?>" title="<?php _e ('Copy block', 'ad-inserter'); ?>"><span class="checkbox-icon icon-copy"></span></label>
  682. </span>
  683. <span class="ai-toolbar-button">
  684. <input type="checkbox" id="paste-name-<?php echo $block; ?>" style="display: none;" />
  685. <label class="checkbox-button" for="paste-name-<?php echo $block; ?>" title="<?php _e ('Paste name', 'ad-inserter'); ?>"><span class="checkbox-icon icon-paste-name"></span></label>
  686. </span>
  687. <span class="ai-toolbar-button">
  688. <input type="checkbox" id="paste-code-<?php echo $block; ?>" style="display: none;" />
  689. <label class="checkbox-button" for="paste-code-<?php echo $block; ?>" title="<?php _e ('Paste code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-paste-code"></span></label>
  690. </span>
  691. <span class="ai-toolbar-button">
  692. <input type="checkbox" id="paste-settings-<?php echo $block; ?>" style="display: none;" />
  693. <label class="checkbox-button" for="paste-settings-<?php echo $block; ?>" title="<?php _e ('Paste settings', 'ad-inserter'); ?>"><span class="checkbox-icon icon-paste-settings"></span></label>
  694. </span>
  695. <span class="ai-toolbar-button">
  696. <input type="checkbox" id="paste-block-<?php echo $block; ?>" style="display: none;" />
  697. <label class="checkbox-button" for="paste-block-<?php echo $block; ?>" title="<?php _e ('Paste block (name, code and settings)', 'ad-inserter'); ?>"><span class="checkbox-icon icon-paste"></span></label>
  698. </span>
  699. <?php endif; ?>
  700. </div>
  701. </div>
  702. </div>
  703. <?php if (function_exists ('ai_settings_container')) ai_settings_container ($block, $obj); ?>
  704. <div id="settings-<?php echo $block; ?>">
  705. <?php if (defined ('AI_CODE_GENERATOR')) : ?>
  706. <div id="ai-rotation-container-<?php echo $block; ?>" class='ai-rotate' style="padding: 0; margin: 8px 0; border: 0; display: none;">
  707. <div class="max-input" style="height: 28px; position: absolute; top: 4px; left: -6px;">
  708. <span style="display: table-cell; width: 100%;"></span>
  709. <span class="ai-toolbar-button">
  710. <input type="checkbox" id="rotation-groups-<?php echo $block; ?>" style="display: none;" />
  711. <label for="rotation-groups-<?php echo $block; ?>" title="<?php _e ('Rotation groups', 'ad-inserter'); ?>"><span class="checkbox-button dashicons dashicons-groups"></span></label>
  712. </span>
  713. <span class="ai-toolbar-button">
  714. <input type="checkbox" id="remove-option-<?php echo $block; ?>" style="display: none;" />
  715. <label class="checkbox-button" for="remove-option-<?php echo $block; ?>" title="<?php _e ('Remove option', 'ad-inserter'); ?>"><span class="checkbox-icon icon-minus"></span></label>
  716. </span>
  717. <span class="ai-toolbar-button">
  718. <input type="checkbox" id="add-option-<?php echo $block; ?>" style="display: none;" />
  719. <label class="checkbox-button" for="add-option-<?php echo $block; ?>" title="<?php _e ('Add option', 'ad-inserter'); ?>"><span class="checkbox-icon icon-plus"></span></label>
  720. </span>
  721. </div>
  722. <ul>
  723. </ul>
  724. </div>
  725. <div id="ai-code-generator-container-<?php echo $block; ?>" style="padding: 0; margin: 8px 0; border: 0; display: none;">
  726. <div class="max-input" style="height: 28px; position: absolute; top: 4px; left: -6px;">
  727. <span style="display: table-cell; width: 100%;"></span>
  728. <span class="ai-toolbar-button">
  729. <input type="checkbox" id="import-code-<?php echo $block; ?>" style="display: none;" />
  730. <label class="checkbox-button" for="import-code-<?php echo $block; ?>" title="<?php _e ('Import code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-import"></span></label>
  731. </span>
  732. <span class="ai-toolbar-button">
  733. <input type="checkbox" id="generate-code-<?php echo $block; ?>" style="display: none;" />
  734. <label class="checkbox-button" for="generate-code-<?php echo $block; ?>" title="<?php _e ('Generate code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-generate"></span></label>
  735. </span>
  736. </div>
  737. <ul>
  738. <li id="ai-banner-<?php echo $block; ?>"><a href="#tab-banner-<?php echo $block; ?>"><?php _e ('Banner', 'ad-inserter'); ?></a></li>
  739. <li id="ai-adsense-pub-id-<?php echo $block; ?>"><a href="#tab-adsense-<?php echo $block; ?>">AdSense</a></li>
  740. <li id="ai-amazon-<?php echo $block; ?>"><a href="#tab-amazon-<?php echo $block; ?>">Amazon</a></li>
  741. </ul>
  742. <div id="tab-banner-<?php echo $block; ?>" class="ai-banner ai-banner-top responsive-table rounded">
  743. <div class="banner-preview">
  744. <a id="banner-link-<?php echo $block; ?>" class="clear-link" target="_blank"><img id="banner-image-<?php echo $block; ?>" src="" style="display: none;" /></a>
  745. </div>
  746. <table class="ai-settings-table">
  747. <tr>
  748. <td style="padding-right: 7px;">
  749. <?php _e ('Image', 'ad-inserter'); ?>
  750. </td>
  751. <td style="width: 98%;">
  752. <input id="banner-image-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
  753. </td>
  754. </tr>
  755. <tr>
  756. <td>
  757. <?php _e ('Link', 'ad-inserter'); ?>
  758. </td>
  759. <td>
  760. <input id="banner-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
  761. </td>
  762. </tr>
  763. <tr>
  764. <td>
  765. <input type="checkbox" id="open-new-tab-<?php echo $block; ?>" />
  766. </td>
  767. <td>
  768. <label for="open-new-tab-<?php echo $block; ?>" style="display: inline-block; margin-top: 8px;"><?php _e ('Open link in a new tab', 'ad-inserter'); ?></label>
  769. <button id="select-image-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 0 0 0;"><?php _e ('Select Image', 'ad-inserter'); ?></button>
  770. <button id="select-placeholder-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 10px 0 0;"><?php _e ('Select Placeholder', 'ad-inserter'); ?></button>
  771. </td>
  772. </tr>
  773. </table>
  774. <div style="clear: both;"></div>
  775. </div>
  776. <div id="tab-adsense-<?php echo $block; ?>" class="responsive-table rounded">
  777. <table class="ai-settings-table left">
  778. <tr>
  779. <td class="label">
  780. <?php _e ('Comment', 'ad-inserter'); ?>
  781. </td>
  782. <td style="width: 100%; padding-left: 7px;">
  783. <input id="adsense-comment-<?php echo $block; ?>" style="width: 100%;" type="text" size="30" maxlength="50" />
  784. </td>
  785. </tr>
  786. <tr>
  787. <td class="label" title="Publisher ID">
  788. <?php _ex ('Publisher ID', 'AdSense', 'ad-inserter'); ?>
  789. </td>
  790. <td style="width: 100%; padding-left: 7px;">
  791. <input id="adsense-publisher-id-<?php echo $block; ?>" style="width: 100%;" type="text" size="30" maxlength="30" title="Publisher ID" />
  792. </td>
  793. </tr>
  794. <tr>
  795. <td class="label" title="Ad Slot ID">
  796. <?php _ex ('Ad Slot ID', 'AdSense', 'ad-inserter'); ?>
  797. </td>
  798. <td style="padding-left: 7px;">
  799. <input id="adsense-ad-slot-id-<?php echo $block; ?>" style="width: 100%;" type="text" size="30" maxlength="30" title="Ad Slot ID" />
  800. </td>
  801. </tr>
  802. <tr>
  803. <td class="label">
  804. <?php _e ('Ad Type', 'ad-inserter'); ?>
  805. </td>
  806. <td style="padding-left: 7px;">
  807. <select id="adsense-type-<?php echo $block; ?>">
  808. <option value="<?php echo AI_ADSENSE_STANDARD; ?>" selected><?php echo AI_TEXT_ADSENSE_STANDARD; ?></option>
  809. <option value="<?php echo AI_ADSENSE_LINK; ?>"><?php echo AI_TEXT_LINK; ?></option>
  810. <option value="<?php echo AI_ADSENSE_IN_ARTICLE; ?>"><?php echo AI_TEXT_IN_ARTICLE; ?></option>
  811. <option value="<?php echo AI_ADSENSE_IN_FEED; ?>"><?php echo AI_TEXT_IN_FEED; ?></option>
  812. <option value="<?php echo AI_ADSENSE_MATCHED_CONTENT; ?>"><?php echo AI_TEXT_MATCHED_CONTENT; ?></option>
  813. <option value="<?php echo AI_ADSENSE_AUTO; ?>"><?php echo AI_TEXT_ADSENSE_AUTO; ?></option>
  814. <option value="<?php echo AI_ADSENSE_AMP_ONLY; ?>"><?php echo AI_TEXT_ADSENSE_AMP_ONLY; ?></option>
  815. </select>
  816. <div class="adsense-size" style="float: right;">
  817. <?php _e ('Size', 'ad-inserter'); ?>
  818. <select id="adsense-size-<?php echo $block; ?>">
  819. <option value="<?php echo AI_ADSENSE_SIZE_FIXED; ?>" selected><?php echo AI_TEXT_FIXED; ?></option>
  820. <option value="<?php echo AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT; ?>"><?php echo AI_TEXT_FIXED_BY_VIEWPORT; ?></option>
  821. <option value="<?php echo AI_ADSENSE_SIZE_RESPONSIVE; ?>"><?php echo AI_TEXT_RESPONSIVE; ?></option>
  822. </select>
  823. </div>
  824. </td>
  825. </tr>
  826. <tr>
  827. <td class="label">
  828. <?php _e ('AMP Ad', 'ad-inserter'); ?>
  829. </td>
  830. <td style="padding-left: 7px;">
  831. <select id="adsense-amp-<?php echo $block; ?>">
  832. <option value="<?php echo AI_ADSENSE_AMP_DISABLED; ?>" selected><?php echo AI_TEXT_ADSENSE_DISABLED; ?></option>
  833. <option value="<?php echo AI_ADSENSE_AMP_ABOVE_THE_FOLD; ?>"><?php echo AI_TEXT_ABOVE_THE_FOLD; ?></option>
  834. <option value="<?php echo AI_ADSENSE_AMP_BELOW_THE_FOLD; ?>"><?php echo AI_TEXT_BELOW_THE_FOLD; ?></option>
  835. <option value="<?php echo AI_ADSENSE_AMP_STICKY; ?>"><?php echo AI_TEXT_STICKY_AMP; ?></option>
  836. </select>
  837. </td>
  838. </tr>
  839. <tr>
  840. <td>
  841. </td>
  842. <td>
  843. <?php if (defined ('AI_ADSENSE_API')) : ?>
  844. <?php if (!defined ('AI_ADSENSE_AUTHORIZATION_CODE')) : ?>
  845. <button type="button" class='ai-button adsense-list' style="display: none; margin: 2px 0px 0px 7px;" title="<?php _e ('Show ad units from your AdSense account', 'ad-inserter'); ?>"><?php _e ('AdSense ad units', 'ad-inserter'); ?></button>
  846. <?php endif; ?>
  847. <?php endif; ?>
  848. </td>
  849. </tr>
  850. </table>
  851. <table id="adsense-layout-<?php echo $block; ?>" class="ai-settings-table right">
  852. <tr>
  853. <td></td>
  854. <td>
  855. <input style="visibility: hidden;" type="text" size="1" maxlength="1" />
  856. </td>
  857. </tr>
  858. <tr>
  859. <td class="adsense-layout" style="padding-left: 7px;" title="Layout">
  860. <?php _ex ('Layout', 'AdSense', 'ad-inserter'); ?>
  861. </td>
  862. <td class="adsense-layout" style="width: 100%; padding-left: 7px;">
  863. <input id="adsense-layout-<?php echo $block; ?>" style="width: 100%;" type="text" size="80" maxlength="100" title="Layout" />
  864. </td>
  865. </tr>
  866. <tr>
  867. <td class="adsense-layout" style="padding-left: 7px;" title="Layout Key">
  868. <?php _ex ('Layout Key', 'AdSense', 'ad-inserter'); ?>
  869. </td>
  870. <td class="adsense-layout" style="padding-left: 7px;">
  871. <input id="adsense-layout-key-<?php echo $block; ?>" style="width: 100%;" type="text" size="80" maxlength="100" title="Layout Key" />
  872. </td>
  873. </tr>
  874. <tr>
  875. <td style="padding-left: 7px; float: left;">
  876. <span class="adsense-full-width-responsive">
  877. <?php _e ('Full width', 'ad-inserter'); ?>
  878. <select class="adsense-full-width" style="margin-top: 1px;">
  879. <option value="enabled"><?php _ex ('Enabled', 'Full width', 'ad-inserter'); ?></option>
  880. <option value="disabled" selected><?php _ex ('Disabled', 'Full width', 'ad-inserter'); ?></option>
  881. </select>
  882. </span>
  883. <span class="adsense-fixed-size ad-size">
  884. <select class="adsense-ad-size fixed" style="padding-top: 1px;">
  885. <option value="&nbsp;" selected></option>
  886. <option value="300x250">300x250</option>
  887. <option value="336x280">336x280</option>
  888. <option value="728x90" >728x90</option>
  889. <option value="300x600">300x600</option>
  890. <option value="320x100">320x100</option>
  891. <option value="468x60" >468x60</option>
  892. <option value="234x60" >234x60</option>
  893. <option value="125x125">125x125</option>
  894. <option value="250x250">250x250</option>
  895. <option value="200x200">200x200</option>
  896. <option value="120x600">120x600</option>
  897. <option value="160x600">160x600</option>
  898. <option value="300x1050">300x1050</option>
  899. <option value="320x50">320x50</option>
  900. <option value="970x90">970x90</option>
  901. <option value="970x250">970x250</option>
  902. </select>
  903. </span>
  904. </td>
  905. <td>
  906. </td>
  907. </tr>
  908. </table>
  909. <table id="adsense-viewports-<?php echo $block; ?>" class="ai-settings-table right" style="display: none; width: auto;">
  910. <?php
  911. for ($viewport = 1; $viewport <= 6; $viewport ++) {
  912. $viewport_name = get_viewport_name ($viewport);
  913. $viewport_width = get_viewport_width ($viewport);
  914. if ($viewport_name != '') { ?>
  915. <tr class="adsense-viewport ad-size">
  916. <td style="max-width: 210px; padding-left: 10px; overflow: hidden;">
  917. <?php echo $viewport_name; ?>
  918. </td>
  919. <td style="padding-left: 7px;">
  920. <select class="adsense-ad-size">
  921. <option value="&nbsp;" selected></option>
  922. <option value="300x250">300x250</option>
  923. <option value="336x280">336x280</option>
  924. <option value="728x90" >728x90</option>
  925. <option value="300x600">300x600</option>
  926. <option value="320x100">320x100</option>
  927. <option value="468x60" >468x60</option>
  928. <option value="234x60" >234x60</option>
  929. <option value="125x125">125x125</option>
  930. <option value="250x250">250x250</option>
  931. <option value="200x200">200x200</option>
  932. <option value="120x600">120x600</option>
  933. <option value="160x600">160x600</option>
  934. <option value="300x1050">300x1050</option>
  935. <option value="320x50">320x50</option>
  936. <option value="970x90">970x90</option>
  937. <option value="970x250">970x250</option>
  938. </select>
  939. </td>
  940. </tr>
  941. <?php }
  942. }
  943. ?>
  944. </table>
  945. <div style="clear: both;"></div>
  946. </div>
  947. <div id="tab-amazon-<?php echo $block; ?>" class="responsive-table rounded">
  948. <textarea id="amazon-data-<?php echo $block; ?>" style="background-color:#F9F9F9; font-family: monospace, Courier, 'Courier New'; font-weight: bold; width: 100%; height: 240px;"></textarea>
  949. <table class="ai-settings-table">
  950. <tr>
  951. <td class="label" style="padding-right: 10px;">
  952. <?php _e ('AMP Ad', 'ad-inserter'); ?>
  953. </td>
  954. <td>
  955. <select id="amazon-amp-<?php echo $block; ?>">
  956. <option value="<?php echo AI_AMAZON_AMP_DISABLED; ?>" selected><?php echo AI_TEXT_DISABLED; ?></option>
  957. <option value="<?php echo AI_AMAZON_AMP_ENABLED; ?>"><?php echo AI_TEXT_ENABLED; ?></option>
  958. </select>
  959. </td>
  960. <td class="label amazon-amp-data" style="padding-left: 10px;">
  961. <?php _e ('Width', 'ad-inserter'); ?>
  962. </td>
  963. <td class="amazon-amp-data" style="width: 10%;">
  964. <input id="amazon-width-<?php echo $block; ?>" style="width: 100%;" type="text" size="8" maxlength="8" title="Amazon AMP ad width" />
  965. </td>
  966. <td class="label amazon-amp-data" style="padding-left: 10px;">
  967. <?php _e ('Height', 'ad-inserter'); ?>
  968. </td>
  969. <td class="amazon-amp-data" style="width: 10%;">
  970. <input id="amazon-height-<?php echo $block; ?>" style="width: 100%;" type="text" size="8" maxlength="8" title="Amazon AMP ad height" />
  971. </td>
  972. <td style="width: 60%;">
  973. &nbsp;
  974. </td>
  975. </tr>
  976. </table>
  977. </div>
  978. </div>
  979. <?php endif; ?>
  980. <div style="margin: 8px 0;">
  981. <textarea id="block-<?php echo $block; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: monospace, Courier, 'Courier New'; font-weight: bold;" name="<?php echo AI_OPTION_CODE, WP_FORM_FIELD_POSTFIX, $block; ?>" default=""><?php echo esc_textarea ($obj->get_ad_data()); ?></textarea>
  982. </div>
  983. <div style="padding: 0; min-height: 28px;">
  984. <div style="float: left;">
  985. <button id="lists-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="<?php _e ('White/Black-list Category, Tag, Taxonomy, Post ID, Url, Url parameter, Cookie or Referer (domain)', 'ad-inserter'); ?>"><span style="<?php echo $lists_style; ?>"><?php _e ('Lists', 'ad-inserter'); ?></span></button>
  986. <button id="manual-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="<?php _e ('Widget, Shortcode and PHP function call', 'ad-inserter'); ?>"><span style="<?php echo $manual_style; ?>"><?php _e ('Manual', 'ad-inserter'); ?></span></button>
  987. <button id="device-detection-button-<?php echo $block; ?>" class='ai-button2' type="button" style="display: none; margin-right: 4px;" title="<?php _e ('Client/Server-side Device Detection (Desktop, Tablet, Phone,...)', 'ad-inserter'); ?>"><span style="<?php echo $devices_style; ?>"><?php _e ('Devices', 'ad-inserter'); ?></span></button>
  988. <button id="misc-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="<?php _e ('Check for user status, Limit insertions (error 404 page, Ajax requests, RSS feeds), Filter, Scheduling, General tag', 'ad-inserter'); ?>"><span style="<?php echo $misc_style; ?>"><?php _e ('Misc', 'ad-inserter'); ?></span></button>
  989. <button id="preview-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="<?php _e ('Preview code and alignment', 'ad-inserter'); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>"><?php _e ('Preview', 'ad-inserter'); ?></button>
  990. </div>
  991. <div style="float: right;">
  992. <div title='<?php _e ('Rotation editor active - rotation code not generated! Make sure no rotation editor is active before saving settings.', 'ad-inserter'); ?>' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>&#x26A0;</div>
  993. <?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
  994. <input style="display: none; font-weight: bold;" name="<?php echo AI_FORM_SAVE; ?>" value="<?php echo __('Save Settings', 'ad-inserter'), ' ', $start, ' - ', $end; ?>" type="submit" />
  995. <?php } ?>
  996. </div>
  997. <div style="clear: both;"></div>
  998. </div>
  999. <div class="responsive-table small-button rounded">
  1000. <table id="page-types-<?php echo $block; ?>" class="ai-page-types">
  1001. <tr style="height: 27px;">
  1002. <td class="ai-page-type ai-po" style="width: 30%;">
  1003. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1004. <input id="display-posts-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_display_settings_post(); ?>" title="<?php _e ('Enable insertion on posts', 'ad-inserter'); ?>" <?php if ($obj->get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />
  1005. <label for="display-posts-<?php echo $block; ?>" title="<?php _e ('Enable insertion on posts', 'ad-inserter'); ?>"><?php _e ('Posts', 'ad-inserter'); ?></label>
  1006. </td>
  1007. <td class="ai-page-type ai-hp" style="width: 30%; padding-left: 4px;">
  1008. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1009. <input id= "display-homepage-<?php echo $block; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $block; ?>" title="<?php _e ('Enable insertion on homepage: latest posts (including on sub-pages), static page or theme homepage (available positions may depend on hooks used by the theme)', 'ad-inserter'); ?>" value="1" default="<?php echo $default->get_display_settings_home(); ?>" <?php if ($obj->get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> />
  1010. <label for="display-homepage-<?php echo $block; ?>" title="<?php _e ('Enable insertion on homepage: latest posts (including on sub-pages), static page or theme homepage (available positions may depend on hooks used by the theme)', 'ad-inserter'); ?>"><?php _e ('Homepage', 'ad-inserter'); ?></label>
  1011. </td>
  1012. <td class="ai-page-type ai-cp" style="width: 30%; padding-left: 4px;">
  1013. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1014. <input id= "display-category-<?php echo $block; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" title="<?php _e ('Enable insertion on category blog pages (including sub-pages)', 'ad-inserter'); ?>" value="1" default="<?php echo $default->get_display_settings_category(); ?>" <?php if ($obj->get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
  1015. <label for="display-category-<?php echo $block; ?>" title="<?php _e ('Enable insertion on category blog pages (including sub-pages)', 'ad-inserter'); ?>"><?php _e ('Category pages', 'ad-inserter'); ?></label>
  1016. </td>
  1017. <td style="padding-left: 6px; text-align: right;">
  1018. <span class="page-checker-button checkbox-button dashicons dashicons-editor-justify" title="<?php _e ('Check theme for available positions for automatic insertion', 'ad-inserter'); ?>"></span>
  1019. </td>
  1020. </tr>
  1021. <tr style="height: 27px;">
  1022. <td class="ai-page-type ai-pa">
  1023. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1024. <input id="display-pages-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_display_settings_page(); ?>" title="<?php _e ('Enable insertion on static pages', 'ad-inserter'); ?>" <?php if ($obj->get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />
  1025. <label for="display-pages-<?php echo $block; ?>" title="<?php _e ('Enable insertion on static pages', 'ad-inserter'); ?>"><?php _e ('Static pages', 'ad-inserter'); ?></label>
  1026. </td>
  1027. <td class="ai-page-type ai-sp" style="padding-left: 4px;">
  1028. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1029. <input id= "display-search-<?php echo $block; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" title="<?php _e ('Enable insertion on search blog pages', 'ad-inserter'); ?>" value="1" default="<?php echo $default->get_display_settings_search(); ?>" <?php if ($obj->get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> />
  1030. <label for="display-search-<?php echo $block; ?>" title="<?php _e ('Enable insertion on search blog pages', 'ad-inserter'); ?>"><?php _e ('Search pages', 'ad-inserter'); ?></label>
  1031. </td>
  1032. <td class="ai-page-type ai-ap" style="padding-left: 4px;">
  1033. <input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1034. <input id= "display-archive-<?php echo $block; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" title="<?php _e ('Enable insertion on tag or archive blog pages', 'ad-inserter'); ?>" value="1" default="<?php echo $default->get_display_settings_archive(); ?>" <?php if ($obj->get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
  1035. <label for="display-archive-<?php echo $block; ?>" title="<?php _e ('Enable insertion on tag or archive blog pages', 'ad-inserter'); ?>"><?php _e ('Tag / Archive pages', 'ad-inserter'); ?></label>
  1036. </td>
  1037. <td id="exceptions-button-container-<?php echo $block; ?>" style="padding-left: 6px; text-align: right;">
  1038. <span id="exceptions-button-<?php echo $block; ?>" class="checkbox-button dashicons dashicons-forms<?php echo $exception_button_on ? ' on' : ''; ?>" title="<?php _e ('Toggle settings for default insertion and list of individual exceptions', 'ad-inserter'); ?>"></span>
  1039. </td>
  1040. </tr>
  1041. </table>
  1042. </div>
  1043. <div id="block-exceptions-<?php echo $block; ?>" class="responsive-table rounded" style="<?php echo $exceptions_shown ? '' : 'display: none;'; ?>">
  1044. <div style="min-height: 25px;">
  1045. <div style="float: left">
  1046. <span style="display: table-cell;">
  1047. <input type="hidden" name="<?php echo AI_OPTION_EXCEPTIONS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1048. <input id="exceptions-enabled-<?php echo $block; ?>" style="margin-top: -2px;" type="checkbox" name="<?php echo AI_OPTION_EXCEPTIONS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_exceptions_enabled (); ?>" title="<?php _e ('Enable individual post/page exceptions for insertion of this block. They can be configured on the individual post/page editor page (in the settings below the editor).', 'ad-inserter'); ?>" <?php if ($obj->get_exceptions_enabled () == AI_ENABLED) echo 'checked '; ?> />
  1049. <label for="exceptions-enabled-<?php echo $block; ?>" title="<?php _e ('Enable individual post/page exceptions for insertion of this block. When enabled they can be configured on the individual post/page editor page (in the settings below the editor).', 'ad-inserter'); ?>"><?php _e ('Use exceptions for individual posts or pages to change insertion', 'ad-inserter'); ?></label>
  1050. &nbsp;
  1051. </span>
  1052. </div>
  1053. <div id="default-insertion-<?php echo $block; ?>" style="float: right; display: <?php echo $obj->get_exceptions_enabled () == AI_ENABLED ? 'block' : 'none'; ?>;">
  1054. <span style="display: table-cell;">
  1055. <?php echo __('Default insertion', 'ad-inserter'); ?>
  1056. <select id="exceptions-function-<?php echo $block; ?>" style="margin: 0px 0 -1px 0;" name="<?php echo AI_OPTION_EXCEPTIONS_FUNCTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_exceptions_function (); ?>" title="<?php echo
  1057. '[[', AI_TEXT_ENABLED, ']] ', ' ', /* Translators: Enabled means...*/ __('means the insertion for this block is enabled by default and disabled for exceptions.', 'ad-inserter'),
  1058. '[BR] [[', AI_TEXT_DISABLED, ']] ', ' ', /* Translators: Disabled means...*/ __('means the insertion for this block is disabled by default and enabled for exceptions.', 'ad-inserter'),
  1059. '[BR][HR]', _e ('When individual post/page exceptions are enabled they can be configured on the individual post/page editor page (in the settings below the editor).', 'ad-inserter'); ?>">
  1060. <option value="<?php echo AI_DEFAULT_INSERTION_ENABLED; ?>" <?php echo ($obj->get_exceptions_function () == AI_DEFAULT_INSERTION_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
  1061. <option value="<?php echo AI_DEFAULT_INSERTION_DISABLED; ?>" <?php echo ($obj->get_exceptions_function () == AI_DEFAULT_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  1062. </select>
  1063. </span>
  1064. <?php
  1065. if ($exceptions_error) {
  1066. ?>
  1067. <span title='<?php _e ('No exception for post or static page defined. Block will not be inserted.', 'ad-inserter'); ?>' style='display: table-cell; font-size: 20px; vertical-align: middle; padding: 0;'>&#x26A0;</span>
  1068. <?php
  1069. }
  1070. if ($exceptions_needs_check) {
  1071. ?>
  1072. <span title='<?php _e ('Settings for individual exceptions have been updated. Please check all blocks that have exceptions and and then save settings.', 'ad-inserter'); ?>' style='display: table-cell; font-size: 20px; vertical-align: middle; padding: 0;'>&#x26A0;</span>
  1073. <?php
  1074. }
  1075. ?>
  1076. </div>
  1077. <div style="clear: both;"></div>
  1078. </div>
  1079. <?php
  1080. if (!empty ($block_exceptions [$block])) {
  1081. ?>
  1082. <table class="exceptions" style="margin-top: 10px;" cellspacing=0 cellpadding=0><tbody>
  1083. <tr>
  1084. <th class="id">ID</th><th class="type"><?php _ex ('Type', 'post', 'ad-inserter'); ?></th><th class="page page-only"><?php _e ('Title', 'ad-inserter'); ?></th><th>
  1085. <input id="clear-block-exceptions-<?php echo $block; ?>"
  1086. onclick="if (confirm('<?php /* translators: %d: block number */ printf (__('Are you sure you want to clear listed exceptions for block %d?', 'ad-inserter'), $block); ?>')) {document.getElementById ('clear-block-exceptions-<?php echo $block; ?>').style.visibility = 'hidden'; document.getElementById ('clear-block-exceptions-<?php echo $block; ?>').style.fontSize = '1px'; document.getElementById ('clear-block-exceptions-<?php echo $block; ?>').value = '<?php echo $block; ?>'; return true;} return false"
  1087. title="<?php _e ('Clear listed exceptions for block', 'ad-inserter'); echo ' ', $block; ?>"
  1088. name="<?php echo AI_FORM_CLEAR_EXCEPTIONS; ?>"
  1089. value="&#x274C;"
  1090. type="submit"
  1091. style="padding: 1px 3px; border: 0; background: transparent; font-size: 8px; color: #e44; box-shadow: none; vertical-align: baseline;" /></th>
  1092. </tr>
  1093. <?php
  1094. foreach ($post_exceptions as $exception) {
  1095. echo $exception;
  1096. }
  1097. foreach ($page_exceptions as $exception) {
  1098. echo $exception;
  1099. }
  1100. ?>
  1101. </tbody></table>
  1102. <?php
  1103. }
  1104. ?>
  1105. </div>
  1106. <div class="responsive-table rounded">
  1107. <table>
  1108. <tbody>
  1109. <tr>
  1110. <td style="width: 5%; overflow: hidden;">
  1111. <?php _e('Insertion', 'ad-inserter'); ?>
  1112. <select class="ai-image-selection" style="margin-bottom: 3px;" id="insertion-type-<?php echo $block; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_automatic_insertion(); ?>">
  1113. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-disabled" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" data-title="<?php echo AI_TEXT_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  1114. <?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
  1115. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-above-header" value="<?php echo AI_AUTOMATIC_INSERTION_ABOVE_HEADER; ?>" data-title="<?php echo AI_TEXT_ABOVE_HEADER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_ABOVE_HEADER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE_HEADER; ?></option>
  1116. <?php endif; ?>
  1117. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-post" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" data-title="<?php echo AI_TEXT_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
  1118. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-content" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
  1119. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_BEFORE_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_PARAGRAPH; ?></option>
  1120. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; ?>" data-title="<?php echo AI_TEXT_AFTER_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_PARAGRAPH; ?></option>
  1121. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-image" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_IMAGE; ?>" data-title="<?php echo AI_TEXT_BEFORE_IMAGE; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_IMAGE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_IMAGE; ?></option>
  1122. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-image" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_IMAGE; ?>" data-title="<?php echo AI_TEXT_AFTER_IMAGE; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_IMAGE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_IMAGE; ?></option>
  1123. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-content" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_CONTENT; ?>" data-title="<?php echo AI_TEXT_AFTER_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_CONTENT; ?></option>
  1124. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-post" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" data-title="<?php echo AI_TEXT_AFTER_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
  1125. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" data-title="<?php echo AI_TEXT_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
  1126. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" data-title="<?php echo AI_TEXT_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
  1127. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-between-posts" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
  1128. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BEFORE_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_COMMENTS; ?></option>
  1129. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-between-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; ?>" data-title="<?php echo AI_TEXT_BETWEEN_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_COMMENTS; ?></option>
  1130. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-comments" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_COMMENTS; ?>" data-title="<?php echo AI_TEXT_AFTER_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_COMMENTS; ?></option>
  1131. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-footer" value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" data-title="<?php echo AI_TEXT_FOOTER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
  1132. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-before-html" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_HTML_ELEMENT; ?></option>
  1133. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-inside-html" value="<?php echo AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_INSIDE_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INSIDE_HTML_ELEMENT; ?></option>
  1134. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-after-html" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT; ?>" data-title="<?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_HTML_ELEMENT; ?></option>
  1135. <?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
  1136. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-custom-hook" value="<?php echo AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1; ?>" data-title="<?php echo $custom_hook ['name']; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo $custom_hook ['name']; ?></option>
  1137. <?php } ?>
  1138. </select>
  1139. </td>
  1140. <td style="width: 50%;">
  1141. <span id="paragraph-settings-<?php echo $block; ?>" style="<?php echo $paragraph_settings ? "" : " display: none;" ?>">
  1142. <input
  1143. type="text"
  1144. id="paragraph-numbers-<?php echo $block; ?>"
  1145. style="width: 100%;"
  1146. name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1147. default="<?php echo $default->get_paragraph_number(); ?>"
  1148. value="<?php echo $obj->get_paragraph_number(); ?>"
  1149. data-title-paragraphs="<?php _e('Paragraph number or comma separated paragraph numbers: 1 to N means paragraph number, %N means every N paragraphs, empty means all paragraphs, 0 means random paragraph, value between 0 and 1 means relative position on the page (0.2 means paragraph at 20% of page paragraphs, 0.5 means paragraph halfway down the page, 0.9 means paragraph at 90% of page paragraphs, etc.), negative number means counting from the opposite direction', 'ad-inserter'); ?>"
  1150. data-title-images="<?php _e('Image number or comma separated image numbers: 1 to N means image number, %N means every N images, empty means all images, 0 means random image, value between 0 and 1 means relative position on the page (0.2 means paragraph at 20% of page images, 0.5 means middle image, 0.9 means paragraph at 90% of page images, etc.), negative number means counting from the opposite direction', 'ad-inserter'); ?>"
  1151. size="8"
  1152. maxlength="70" />
  1153. </span>
  1154. <span id="filter-settings-<?php echo $block; ?>" style="<?php echo $filter_insertions_settings ? "" : " display: none;" ?>">
  1155. <input
  1156. type="text"
  1157. id="filter-numbers-insertions-<?php echo $block; ?>"
  1158. style="width: 100%;"
  1159. name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1160. default="<?php echo $default->get_call_filter(); ?>"
  1161. value="<?php echo $obj->get_call_filter(); ?>"
  1162. data-title-excerpts="<?php _e('Insertion Filter Mirror Setting | Excerpt number or comma separated excerpt numbers, %N means every N excerpts, empty means all excerpts', 'ad-inserter'); ?>"
  1163. data-title-posts="<?php _e('Insertion Filter Mirror Setting | Post number or comma separated post numbers, %N means every N posts, empty means all posts', 'ad-inserter'); ?>"
  1164. data-title-comments="<?php _e('Insertion Filter Mirror Setting | Comment number or comma separated comment numbers, %N means every N comments, empty means all comments', 'ad-inserter'); ?>"
  1165. size="8"
  1166. maxlength="70" />
  1167. </span>
  1168. </td>
  1169. <td style="width: 2%; overflow: hidden;">
  1170. <span id="paragraph-buttons-<?php echo $block; ?>" style="padding-left: 10px; display: none;">
  1171. <span id="counting-button-<?php echo $block; ?>" class="checkbox-button dashicons dashicons-editor-paragraph" title="<?php _e ('Toggle paragraph counting settings', 'ad-inserter'); ?>"></span>
  1172. <span id="clearance-button-<?php echo $block; ?>" class="checkbox-button dashicons dashicons-align-right" title="<?php _e ('Toggle paragraph clearance settings', 'ad-inserter'); ?>"></span>
  1173. </span>
  1174. <span id="filter-buttons-<?php echo $block; ?>" style="padding-left: 10px; display: none;">
  1175. <span id="filter-button-<?php echo $block; ?>" class="checkbox-button dashicons dashicons-filter" title="<?php _e ('Toggle insertion filter settings', 'ad-inserter'); ?>"></span>
  1176. </span>
  1177. </td>
  1178. <td style="width: 5%; overflow: hidden; padding-left: 10px;">
  1179. <?php _e('Alignment', 'ad-inserter'); ?>
  1180. <select id="block-alignment-<?php echo $block; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_alignment_type(); ?>">
  1181. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-default" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
  1182. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-align-left" value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
  1183. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-center" value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
  1184. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-align-right" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
  1185. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-float-left" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
  1186. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-float-right" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
  1187. <?php if (function_exists ('ai_style_options')) ai_style_options ($obj); ?>
  1188. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
  1189. <option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion im-no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
  1190. </select>
  1191. </td>
  1192. <td style="width: 2%; overflow: hidden; padding-left: 10px;">
  1193. <span id="show-css-button-<?php echo $block; ?>" class="checkbox-button dashicons dashicons-editor-kitchensink" title="<?php _e ('Toggle insertion and alignment icons', 'ad-inserter'); ?>"></span>
  1194. </td>
  1195. </tr>
  1196. </tbody>
  1197. </table>
  1198. <div id="icons-css-code-<?php echo $block; ?>" style="margin: 4px 0 0; display: none;">
  1199. <div id="automatic-insertion-<?php echo $block; ?>"></div>
  1200. <div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
  1201. <?php if (function_exists ('ai_sticky_positions')) ai_sticky_positions ($block, $obj, $default); ?>
  1202. <div class="max-input" style="min-height: 27px;">
  1203. <span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
  1204. <input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: monospace, Courier, 'Courier New'; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="500" title="<?php _e ('Custom CSS code for the wrapping div', 'ad-inserter'); ?>" />
  1205. <span style="display: table-cell; vertical-align: middle; font-family: monospace, Courier, 'Courier New'; font-size: 12px; font-weight: bold; cursor: pointer; padding-left: 10px;">
  1206. <span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 26px; padding-left: 0px; display: none;"></span>
  1207. <span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
  1208. <span id="css-left-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_LEFT); ?></span>
  1209. <span id="css-right-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_RIGHT); ?></span>
  1210. <span id="css-center-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_CENTER); ?></span>
  1211. <span id="css-float-left-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT); ?></span>
  1212. <span id="css-float-right-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-right: 0px; display: none;" title="<?php _e ('CSS code for the wrapping div, click to edit', 'ad-inserter'); ?>"><?php echo $obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT); ?></span>
  1213. <?php if (function_exists ('ai_style_css')) ai_style_css ($block, $obj); ?>
  1214. </span>
  1215. <span style="display:table-cell; width: 46px; padding-top: 1px;" ><button id="edit-css-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: table-cell; margin: 0 0 0 8px;"><?php _e ('Edit', 'ad-inserter'); ?></button></span>
  1216. </div>
  1217. </div>
  1218. </div>
  1219. <?php if (function_exists ('ai_sticky_animation')) ai_sticky_animation ($block, $obj, $default); ?>
  1220. <div id="html-element-settings-<?php echo $block; ?>" class="rounded" style="<?php echo $html_settings ? "" : " display: none;" ?>">
  1221. <div class="max-input" style="margin: 0 0 8px 0; height: 28px;">
  1222. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1223. <?php _e ('HTML element', 'ad-inserter'); ?>
  1224. &nbsp;&nbsp;
  1225. </span>
  1226. <span style="display: table-cell; width: 20px; vertical-align: middle; padding: 0 2px 2px 0;">
  1227. <button id="html-elements-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' style="display: none; outline: transparent; float: right; margin-top: 1px; width: 15px; height: 15px;" title="<?php _e ('Open HTML element selector', 'ad-inserter'); ?>"></button>
  1228. </span>
  1229. <span style="display: table-cell;">
  1230. <input
  1231. type="text"
  1232. id="html-elements-<?php echo $block; ?>"
  1233. name="<?php echo AI_OPTION_HTML_SELECTOR, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1234. default="<?php echo $default->get_html_selector (); ?>"
  1235. value="<?php echo $obj->get_html_selector (); ?>"
  1236. title="<?php _e ('HTML element selector or comma separated list of selectors', 'ad-inserter'); ?> (.class, #id)"
  1237. style="width: 100%;"
  1238. maxlength="80" />
  1239. </span>
  1240. <span id="inside-element-<?php echo $block; ?>" style="display: table-cell; white-space: nowrap; width: 20%;<?php if ($automatic_insertion != AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT) echo ' display: none;'; ?>">
  1241. &nbsp;
  1242. <?php _e ('Action', 'ad-inserter'); ?>
  1243. <select style="margin: 0 0 2px 0;" name="<?php echo AI_OPTION_INSIDE_ELEMENT, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_inside_element (); ?>">
  1244. <option value="<?php echo AI_HTML_PREPEND_CONTENT; ?>" <?php echo ($inside_element == AI_HTML_PREPEND_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PREPEND_CONTENT; ?></option>
  1245. <option value="<?php echo AI_HTML_APPEND_CONTENT; ?>" <?php echo ($inside_element == AI_HTML_APPEND_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_APPEND_CONTENT; ?></option>
  1246. <option value="<?php echo AI_HTML_REPLACE_CONTENT; ?>" <?php echo ($inside_element == AI_HTML_REPLACE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_REPLACE_CONTENT; ?></option>
  1247. <option value="<?php echo AI_HTML_REPLACE_ELEMENT; ?>" <?php echo ($inside_element == AI_HTML_REPLACE_ELEMENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_REPLACE_ELEMENT; ?></option>
  1248. </select>
  1249. </span>
  1250. </div>
  1251. <div class="max-input" style="margin: 8px 0 0 0;">
  1252. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1253. <?php _e ('Insertion', 'ad-inserter'); ?>
  1254. <select id="html-element-insertion-<?php echo $block; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_HTML_ELEMENT_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_html_element_insertion (); ?>" title="<?php _e ('Client-side insertion uses JavaScript to insert block when the page loads. Server-side insertion inserts block when the page is generated but needs Output buffering enabled.', 'ad-inserter'); ?>">
  1255. <option value="<?php echo AI_HTML_INSERTION_CLIENT_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
  1256. <?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
  1257. <option value="<?php echo AI_HTML_INSERTION_SEREVR_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
  1258. <?php endif; ?>
  1259. </select>
  1260. </span>
  1261. <span id="server-side-insertion-<?php echo $block; ?>" style="display: table-cell;<?php if ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) echo ' display: none;'; ?>">
  1262. <span style="display: table-cell; white-space: nowrap; width: 5%; padding-left: 10px;">
  1263. <?php _e ('Wait for', 'ad-inserter'); ?>
  1264. </span>
  1265. <span style="display: table-cell; white-space: nowrap; width: 5%; vertical-align: middle;">
  1266. <button id="wait-for-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' style="display: none; outline: transparent; float: right; margin-top: 1px; width: 15px; height: 15px;" title="<?php _e ('Open HTML element selector', 'ad-inserter'); ?>"></button>
  1267. </span>
  1268. <span style="display: table-cell; white-space: nowrap; width: 50%;">
  1269. <input
  1270. type="text"
  1271. id="wait-for-<?php echo $block; ?>"
  1272. name="<?php echo AI_OPTION_WAIT_FOR, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1273. default="<?php echo $default->get_wait_for (); ?>"
  1274. value="<?php echo $obj->get_wait_for (); ?>"
  1275. title="<?php _e ('Wait for HTML element to be loaded', 'ad-inserter'); ?> (.class, #id)"
  1276. style="width: 100%;"
  1277. maxlength="40" />
  1278. </span>
  1279. <span style="display: table-cell; white-space: nowrap; width: 20%; padding-left: 10px;">
  1280. <?php _e ('Delay', 'ad-inserter'); ?>
  1281. <input type="text" name="<?php echo AI_OPTION_WAIT_FOR_DELAY, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_wait_for_delay (); ?>" value="<?php echo $obj->get_wait_for_delay (); ?>" title="<?php _e ('Time in ms to delay insertion', 'ad-inserter'); ?>" size="3" maxlength="5" />
  1282. ms
  1283. </span>
  1284. <span style="display: table-cell; white-space: nowrap; width: 20%; padding-left: 10px;">
  1285. <?php _e ('Code position', 'ad-inserter'); ?>
  1286. <select style="max-width: 140px; margin-bottom: 3px;" name="<?php echo AI_OPTION_SERVER_SIDE_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_server_side_insertion (); ?>" title="<?php _e ('Page position where the code for client-side insertion will be inserted.', 'ad-inserter'); ?>">
  1287. <option value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
  1288. <option value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
  1289. <option value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
  1290. <?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
  1291. <option value="<?php echo AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo $custom_hook ['name']; ?></option>
  1292. <?php } ?>
  1293. </select>
  1294. </span>
  1295. <span style="clear: both;"></span>
  1296. </span>
  1297. </div>
  1298. </div>
  1299. <div id="paragraph-counting-<?php echo $block; ?>" class="rounded" style="<?php echo $paragraph_counting ? "" : "display: none;" ?>">
  1300. <div class="max-input" style="margin: 0 0 8px 0;">
  1301. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1302. <?php _e ('Count', 'ad-inserter'); ?>
  1303. &nbsp;
  1304. <select name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_direction_type(); ?>">
  1305. <option value="<?php echo AI_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AI_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DIRECTION_FROM_TOP; ?></option>
  1306. <option value="<?php echo AI_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AI_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DIRECTION_FROM_BOTTOM; ?></option>
  1307. </select>
  1308. <?php _e ('paragraphs with tags', 'ad-inserter'); ?>
  1309. &nbsp;
  1310. </span>
  1311. <span style="display: table-cell;">
  1312. <input
  1313. style="width: 100%;"
  1314. title="<?php _e ("Comma separated HTML tag names, usually only 'p' tags are used", 'ad-inserter'); ?>"
  1315. type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1316. default="<?php echo $default->get_paragraph_tags(); ?>"
  1317. value="<?php echo $obj->get_paragraph_tags(); ?>"
  1318. size="12"
  1319. maxlength="50"/>
  1320. </span>
  1321. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1322. &nbsp;
  1323. <?php _e ('that have between', 'ad-inserter'); ?>
  1324. <input
  1325. type="text"
  1326. name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1327. default="<?php echo $default->get_minimum_paragraph_words(); ?>"
  1328. value="<?php echo $obj->get_minimum_paragraph_words(); ?>"
  1329. title="<?php _e ('Minimum number of paragraph words, leave empty for no limit', 'ad-inserter'); ?>"
  1330. size="4"
  1331. maxlength="5" />
  1332. <?php _e ('and', 'ad-inserter'); ?>
  1333. <input
  1334. type="text"
  1335. name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1336. default="<?php echo $default->get_maximum_paragraph_words(); ?>"
  1337. value="<?php echo $obj->get_maximum_paragraph_words(); ?>"
  1338. title="<?php _e ('Maximum number of paragraph words, leave empty for no limit', 'ad-inserter'); ?>"
  1339. size="4"
  1340. maxlength="5" />
  1341. <?php _e ('words', 'ad-inserter'); ?>
  1342. </span>
  1343. </div>
  1344. <div class="max-input" style="margin: 8px 0 8px 0;">
  1345. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1346. <?php _e ('and', 'ad-inserter'); ?>
  1347. <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_PARAGRAPH_TEXT_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_paragraph_text_type(); ?>">
  1348. <option value="<?php echo AI_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AI_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CONTAIN; ?></option>
  1349. <option value="<?php echo AI_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AI_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DO_NOT_CONTAIN; ?></option>
  1350. </select>
  1351. </span>
  1352. <span style="display: table-cell;">
  1353. <input
  1354. style="width: 100%;"
  1355. title="<?php _e ('Comma separated texts', 'ad-inserter'); ?>"
  1356. type="text"
  1357. name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1358. default="<?php echo $default->get_paragraph_text(); ?>"
  1359. value="<?php echo $obj->get_paragraph_text(); ?>"
  1360. maxlength="200" />
  1361. </span>
  1362. </div>
  1363. <hr style="margin: 0 -8px;" />
  1364. <div class="max-input" style="margin: 8px 0 0 0;">
  1365. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1366. <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_COUNT_INSIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_count_inside (); ?>">
  1367. <option value="<?php echo AI_DO_NOT_COUNT; ?>" <?php echo ($obj->get_count_inside () == AI_DO_NOT_COUNT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DO_NOT_COUNT; ?></option>
  1368. <option value="<?php echo AI_COUNT_ONLY; ?>" <?php echo ($obj->get_count_inside () == AI_COUNT_ONLY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_COUNT_ONLY; ?></option>
  1369. </select>
  1370. </span>
  1371. <span style="display: table-cell; width: 1px; white-space: nowrap; padding: 0 4px">
  1372. <?php /* translators: inside [HTML tags] elements that contain */ _e ('inside', 'ad-inserter'); ?>
  1373. </span>
  1374. <span style="display: table-cell;">
  1375. <input
  1376. style="width: 100%;"
  1377. title="<?php _e ("Comma separated HTML tag names of container elements", 'ad-inserter'); ?>"
  1378. type="text" name="<?php echo AI_OPTION_COUNT_INSIDE_ELEMENTS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1379. default="<?php echo $default->get_count_inside_elements (); ?>"
  1380. value="<?php echo $obj->get_count_inside_elements (); ?>"
  1381. size="4"
  1382. maxlength="50"/>
  1383. </span>
  1384. <span style="display: table-cell; width: 1px; white-space: nowrap; padding: 0 4px">
  1385. <?php /* translators: inside [HTML tags] elements that contain */ _e ('elements that', 'ad-inserter'); ?>
  1386. </span>
  1387. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1388. <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_COUNT_INSIDE_ELEMENTS_CONTAIN, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_count_inside_elements_contain (); ?>">
  1389. <option value="<?php echo AI_CONTAIN; ?>" <?php echo ($obj->get_count_inside_elements_contain () == AI_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CONTAIN; ?></option>
  1390. <option value="<?php echo AI_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_count_inside_elements_contain () == AI_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DO_NOT_CONTAIN; ?></option>
  1391. </select>
  1392. </span>
  1393. <span class="small-input-tags" style="display: table-cell;">
  1394. <input
  1395. style="width: 100%;"
  1396. title="<?php _e ('Comma separated texts', 'ad-inserter'); ?>"
  1397. type="text"
  1398. name="<?php echo AI_OPTION_COUNT_INSIDE_ELEMENTS_TEXT, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1399. default="<?php echo $default->get_count_inside_elements_text (); ?>"
  1400. value="<?php echo $obj->get_count_inside_elements_text (); ?>"
  1401. maxlength="200" />
  1402. </span>
  1403. </div>
  1404. <?php
  1405. $title = __('Count also paragraphs inside these elements - defined on general plugin settings page - tab [*] / tab General', 'ad-inserter');
  1406. $elements = get_no_paragraph_counting_inside ();
  1407. ?>
  1408. <div class="max-input" style="margin: 8px 0 8px 0;">
  1409. <span style="display: table-cell; width: 80%; white-space: nowrap; padding-right: 8px;">
  1410. <input type="hidden" name="<?php echo AI_OPTION_CHECK_ONLY_TAG_ATTRIBUTES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1411. <input id="check-only-tag-attr-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_CHECK_ONLY_TAG_ATTRIBUTES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" title="<?php _e('If checked it will search for the text only in tag attributes like [[id]], [[class]], [[style]], etc. Otherwise the whole tag including its content will be searched.', 'ad-inserter'); ?>" default="<?php echo $default->get_check_only_tag_attributes (); ?>" <?php if ($obj->get_check_only_tag_attributes ()==AI_ENABLED) echo 'checked '; ?> />
  1412. <label for="check-only-tag-attr-<?php echo $block; ?>" style="vertical-align: top;" title="<?php _e('If checked it will search for the text only in tag attributes like [[id]], [[class]], [[style]], etc. Otherwise the whole tag including its content will be searched.', 'ad-inserter'); ?>"><?php _e('Check only tag attributes', 'ad-inserter'); ?></label>
  1413. </span>
  1414. <span style="display: <?php echo $elements == '' ? 'none' : 'table-cell'; ?>; width: 1px; white-space: nowrap;">
  1415. <input type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1416. <input id="ignore_blockquote-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" title="<?php echo $title; ?>" default="<?php echo $default->get_count_inside_blockquote(); ?>" <?php if ($obj->get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />
  1417. <label for="ignore_blockquote-<?php echo $block; ?>" style="vertical-align: top;" title="<?php echo $title; ?>"><?php /* Translators: %s: HTML tags */ echo sprintf (__('Count inside %s elements', 'ad-inserter'), '<strong><pre style="display: inline;"> '.$elements.' </pre></strong>'); ?></label>
  1418. </span>
  1419. </div>
  1420. <hr style="margin: 0 -8px;" />
  1421. <div class="max-input" style="margin: 8px 0 8px 0;">
  1422. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1423. <?php /* Translators: Do not insert for first X and last Y paragraphs */ echo _n ('Do not insert for first', 'Do not insert for first', $obj->get_skip_first_paragraphs(),'ad-inserter'); ?>
  1424. <input
  1425. type="text"
  1426. name="<?php echo AI_OPTION_SKIP_FIRST_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1427. default="<?php echo $default->get_skip_first_paragraphs(); ?>"
  1428. value="<?php echo $obj->get_skip_first_paragraphs() ?>"
  1429. title="<?php _e ('Excludes first paragraphs from insertion, leave empty for no exclusion of first paragraphs', 'ad-inserter'); ?>"
  1430. size="2"
  1431. maxlength="3" />
  1432. <?php /* Translators: Do not insert for first X and last Y paragraphs */ echo _n ('and last', 'and last', $obj->get_skip_last_paragraphs(),'ad-inserter'); ?>
  1433. <input
  1434. type="text"
  1435. name="<?php echo AI_OPTION_SKIP_LAST_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1436. default="<?php echo $default->get_skip_last_paragraphs(); ?>"
  1437. value="<?php echo $obj->get_skip_last_paragraphs() ?>"
  1438. title="<?php _e ('Excludes last paragraphs from insertion, leave empty for no exclusion of last paragraphs', 'ad-inserter'); ?>"
  1439. size="2"
  1440. maxlength="3" />
  1441. <?php /* Translators: Do not insert for first X and last Y paragraphs */ echo _n ('paragraph', 'paragraphs', $obj->get_skip_last_paragraphs(), 'ad-inserter'); ?>
  1442. </span>
  1443. </div>
  1444. <hr style="margin: 0 -8px;" />
  1445. <div class="max-input" style="margin: 8px 0 8px 0;">
  1446. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1447. <?php _e ('Post/Static page must have between', 'ad-inserter'); ?>
  1448. <input
  1449. type="text"
  1450. name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1451. default="<?php echo $default->get_paragraph_number_minimum(); ?>"
  1452. value="<?php echo $obj->get_paragraph_number_minimum() ?>"
  1453. title="<?php _e ('Minimum number of paragraphs, leave empty for no limit', 'ad-inserter'); ?>"
  1454. size="2"
  1455. maxlength="3" />
  1456. <?php _e ('and', 'ad-inserter'); ?>
  1457. <input
  1458. type="text"
  1459. name="<?php echo AI_OPTION_MAX_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1460. default="<?php echo $default->get_paragraph_number_maximum(); ?>"
  1461. value="<?php echo $obj->get_paragraph_number_maximum() ?>"
  1462. title="<?php _e ('Maximum number of paragraphs, leave empty for no limit', 'ad-inserter'); ?>"
  1463. size="2"
  1464. maxlength="3" />
  1465. <?php /* Translators: Post/Static page must have between X and Y paragraphs */ echo _n ('paragraph', 'paragraphs', $obj->get_paragraph_number_maximum(), 'ad-inserter'); ?>
  1466. </span>
  1467. </div>
  1468. <hr style="margin: 0 -8px;" />
  1469. <div class="max-input" style="margin: 8px 0 0 0;">
  1470. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1471. <?php _e ('Minimum number of words in paragraphs above', 'ad-inserter'); ?>
  1472. <input
  1473. type="text"
  1474. name="<?php echo AI_OPTION_MIN_WORDS_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1475. default="<?php echo $default->get_minimum_words_above(); ?>"
  1476. value="<?php echo $obj->get_minimum_words_above() ?>"
  1477. title="<?php _e ('Used only with automatic insertion After paragraph and empty paragraph numbers', 'ad-inserter'); ?>"
  1478. size="2"
  1479. maxlength="4" />
  1480. </span>
  1481. </div>
  1482. </div>
  1483. <div id="paragraph-clearance-<?php echo $block; ?>" class="rounded" style="<?php echo $paragraph_clearance ? "" : "display: none;" ?>">
  1484. <div class="max-input" style="margin: 0 0 8px 0">
  1485. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1486. <?php _e ('In', 'ad-inserter'); ?>
  1487. <input
  1488. type="text"
  1489. name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1490. default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
  1491. value="<?php echo $obj->get_avoid_paragraphs_above(); ?>"
  1492. title="<?php _e ('Number of paragraphs above to check, leave empty to disable checking', 'ad-inserter'); ?>"
  1493. size="2"
  1494. maxlength="3" />
  1495. <?php _e ('paragraphs above avoid', 'ad-inserter'); ?>
  1496. &nbsp;
  1497. </span>
  1498. <span style="display: table-cell;">
  1499. <input
  1500. style="width: 100%;"
  1501. title="<?php _e ('Comma separated texts', 'ad-inserter'); ?>"
  1502. type="text"
  1503. name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1504. default="<?php echo $default->get_avoid_text_above(); ?>"
  1505. value="<?php echo $obj->get_avoid_text_above(); ?>"
  1506. maxlength="100" />
  1507. </span>
  1508. </div>
  1509. <div class="max-input" style="margin: 8px 0">
  1510. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  1511. <?php _e ('In', 'ad-inserter'); ?>
  1512. <input
  1513. type="text"
  1514. name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1515. default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
  1516. value="<?php echo $obj->get_avoid_paragraphs_below(); ?>"
  1517. title="<?php _e ('Number of paragraphs below to check, leave empty to disable checking', 'ad-inserter'); ?>"
  1518. size="2"
  1519. maxlength="3" />
  1520. <?php _e ('paragraphs below avoid', 'ad-inserter'); ?>
  1521. &nbsp;
  1522. </span>
  1523. <span style="display: table-cell;">
  1524. <input
  1525. style="width: 100%;"
  1526. title="<?php _e ('Comma separated texts', 'ad-inserter'); ?>"
  1527. type="text"
  1528. name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1529. default="<?php echo $default->get_avoid_text_below(); ?>"
  1530. value="<?php echo $obj->get_avoid_text_below(); ?>"
  1531. maxlength="100" />
  1532. </span>
  1533. </div>
  1534. <div style="margin: 8px 0 0 0;">
  1535. <?php _e ('If text is found', 'ad-inserter'); ?>
  1536. <select id="avoid-action-<?php echo $block; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_ACTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_avoid_action(); ?>">
  1537. <option value="<?php echo AI_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AI_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DO_NOT_INSERT; ?></option>
  1538. <option value="<?php echo AI_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AI_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_TRY_TO_SHIFT_POSITION; ?></option>
  1539. </select>
  1540. <span id="check-up-to-<?php echo $block; ?>">
  1541. &mdash;
  1542. <?php _e ('check up to', 'ad-inserter'); ?>
  1543. <input
  1544. type="text"
  1545. name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $block; ?>"
  1546. default="<?php echo $default->get_avoid_try_limit(); ?>"
  1547. value="<?php echo $obj->get_avoid_try_limit(); ?>"
  1548. size="2"
  1549. maxlength="3" />
  1550. <?php _ex ('paragraphs', 'check up to', 'ad-inserter'); ?>
  1551. <select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_avoid_direction(); ?>">
  1552. <option value="<?php echo AI_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AI_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE; ?></option>
  1553. <option value="<?php echo AI_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AI_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BELOW; ?></option>
  1554. <option value="<?php echo AI_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AI_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE_AND_THEN_BELOW; ?></option>
  1555. <option value="<?php echo AI_BELOW_AND_THEN_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AI_BELOW_AND_THEN_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BELOW_AND_THEN_ABOVE; ?></option>
  1556. </select>
  1557. </span>
  1558. </div>
  1559. </div>
  1560. <div class="responsive-table rounded" id="list-settings-<?php echo $block; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
  1561. <table class="ai-lists" style="border-spacing: 0;">
  1562. <tbody>
  1563. <tr class="<?php if ($show_cat_list) echo 'list-items'; ?>" style="<?php if (!$show_cat_list) echo ' display: none;'; ?>">
  1564. <td>
  1565. <?php _e ('Categories', 'ad-inserter'); ?>
  1566. </td>
  1567. <td>
  1568. <button id="category-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle category editor', 'ad-inserter'); ?>"></button>
  1569. </td>
  1570. <td style="padding-right: 7px; width: 92%;">
  1571. <input id="category-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter-cat ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated category slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="1500" />
  1572. </td>
  1573. <td>
  1574. <input type="hidden" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1575. <input type="checkbox" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="category-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_cat_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1576. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_cat_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1577. </td>
  1578. </tr>
  1579. <tr class="<?php if ($show_cat_list) echo 'list-items'; ?>" style="<?php if (!$show_cat_list) echo ' display: none;'; ?>">
  1580. <td colspan="5">
  1581. <select id="category-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
  1582. </select>
  1583. </td>
  1584. </tr>
  1585. <tr class="<?php if ($show_tag_list) echo 'list-items'; ?>" style="<?php if (!$show_tag_list) echo ' display: none;'; ?>">
  1586. <td>
  1587. <?php _e ('Tags', 'ad-inserter'); ?>
  1588. </td>
  1589. <td>
  1590. <button id="tag-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle tag editor', 'ad-inserter'); ?>"></button>
  1591. </td>
  1592. <td style="padding-right: 7px; width: 92%;">
  1593. <input id="tag-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated tag slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="1500"/>
  1594. </td>
  1595. <td>
  1596. <input type="hidden" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1597. <input type="checkbox" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_tag_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1598. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_tag_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1599. </td>
  1600. </tr>
  1601. <tr class="<?php if ($show_tag_list) echo 'list-items'; ?>" style="<?php if (!$show_tag_list) echo ' display: none;'; ?>">
  1602. <td colspan="5">
  1603. <select id="tag-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
  1604. </select>
  1605. </td>
  1606. </tr>
  1607. <tr class="<?php if ($show_taxonomy_list) echo 'list-items'; ?>" style="<?php if (!$show_taxonomy_list) echo ' display: none;'; ?>">
  1608. <td>
  1609. <?php _e ('Taxonomies', 'ad-inserter'); ?>
  1610. </td>
  1611. <td>
  1612. <button id="taxonomy-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle taxonomy editor', 'ad-inserter'); ?>"></button>
  1613. </td>
  1614. <td style="padding-right: 7px; width: 92%;">
  1615. <input id="taxonomy-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated slugs: taxonomy, term or taxonomy:term', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_taxonomy(); ?>" value="<?php echo $taxonomy_list; ?>" size="54" maxlength="500" />
  1616. </td>
  1617. <td>
  1618. <input type="hidden" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1619. <input type="checkbox" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="taxonomy-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1620. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_taxonomy_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1621. </td>
  1622. </tr>
  1623. <tr class="<?php if ($show_taxonomy_list) echo 'list-items'; ?>" style="<?php if (!$show_taxonomy_list) echo ' display: none;'; ?>">
  1624. <td colspan="5">
  1625. <select id="taxonomy-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
  1626. </select>
  1627. </td>
  1628. </tr>
  1629. <tr class="<?php if ($show_id_list) echo 'list-items'; ?>" style="<?php if (!$show_id_list) echo ' display: none;'; ?>">
  1630. <td>
  1631. <?php _e ('Post IDs', 'ad-inserter'); ?>
  1632. </td>
  1633. <td>
  1634. <button id="id-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle post/page ID editor', 'ad-inserter'); ?>"></button>
  1635. </td>
  1636. <td style="padding-right: 7px; width: 92%;">
  1637. <input id="id-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated post/page IDs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_id_list(); ?>" value="<?php echo $id_list; ?>" size="54" maxlength="2500"/>
  1638. </td>
  1639. <td>
  1640. <input type="hidden" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1641. <input type="checkbox" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="id-list-input-<?php echo $block; ?>" <?php if ($obj->get_id_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1642. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_id_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1643. </td>
  1644. </tr>
  1645. <tr class="<?php if ($show_id_list) echo 'list-items'; ?>" style="<?php if (!$show_id_list) echo ' display: none;'; ?>">
  1646. <td colspan="5">
  1647. <select id="id-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
  1648. </select>
  1649. </td>
  1650. </tr>
  1651. <tr class="<?php if ($show_url_list) echo 'list-items'; ?>" style="<?php if (!$show_url_list) echo ' display: none;'; ?>">
  1652. <td>
  1653. <?php _e ('Urls', 'ad-inserter'); ?>
  1654. </td>
  1655. <td>
  1656. <button id="url-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle url editor', 'ad-inserter'); ?>"></button>
  1657. </td>
  1658. <td style="padding-right: 7px; width: 92%;">
  1659. <input id="url-list-<?php echo $block; ?>" class="ai-list-space ai-clean-protocol ai-clean-domain" style="width: 100%;" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="2500" title="<?php _e ('Comma separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)', 'ad-inserter'); ?>" />
  1660. </td>
  1661. <td>
  1662. <input type="hidden" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1663. <input type="checkbox" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="url-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_url_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1664. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_url_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1665. </td>
  1666. </tr>
  1667. <tr class="<?php if ($show_url_list) echo 'list-items'; ?>" style="<?php if (!$show_url_list) echo ' display: none;'; ?>">
  1668. <td colspan="5">
  1669. <textarea id="url-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
  1670. </td>
  1671. </tr>
  1672. <tr class="<?php if ($show_url_parameter_list) echo 'list-items'; ?>" style="<?php if (!$show_url_parameter_list) echo ' display: none;'; ?>">
  1673. <td>
  1674. <?php _e ('Url parameters', 'ad-inserter'); ?>
  1675. &nbsp;
  1676. </td>
  1677. <td>
  1678. <button id="url-parameter-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle url parameter and cookie editor', 'ad-inserter'); ?>"></button>
  1679. </td>
  1680. <td style="padding-right: 7px; width: 92%;">
  1681. <input id="url-parameter-list-<?php echo $block; ?>" style="width: 100%;" title="<?php _e ("Comma separated url query parameters or cookies with optional values (use 'prameter', 'prameter=value', 'cookie' or 'cookie=value')", 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="1500"/>
  1682. </td>
  1683. <td>
  1684. <input type="hidden" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1685. <input type="checkbox" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="url-parameter-list-input-<?php echo $block; ?>" <?php if ($obj->get_url_parameter_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1686. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_url_parameter_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1687. </td>
  1688. </tr>
  1689. <tr class="<?php if ($show_url_parameter_list) echo 'list-items'; ?>" style="<?php if (!$show_url_parameter_list) echo ' display: none;'; ?>">
  1690. <td colspan="5">
  1691. <textarea id="url-parameter-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
  1692. </td>
  1693. </tr>
  1694. <tr class="<?php if ($show_domain_list) echo 'list-items'; ?>" style="<?php if (!$show_domain_list) echo ' display: none;'; ?>">
  1695. <td>
  1696. <?php _e ('Referrers', 'ad-inserter'); ?>
  1697. </td>
  1698. <td>
  1699. <button id="referer-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle referer editor', 'ad-inserter'); ?>"></button>
  1700. </td>
  1701. <td style="padding-right: 7px; width: 92%;">
  1702. <input id="referer-list-<?php echo $block; ?>" class="ai-clean-protocol ai-only-domain ai-list-sort" style="width: 100%;" title="<?php _e ('Comma separated domains, use # for no referrer, you can also use partial domains with * (domain-start*. *domain-pattern*, *domain-end)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="1500"/>
  1703. </td>
  1704. <td>
  1705. <input type="hidden" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1706. <input type="checkbox" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="referer-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_domain_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1707. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_domain_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1708. </td>
  1709. </tr>
  1710. <tr class="<?php if ($show_domain_list) echo 'list-items'; ?>" style="<?php if (!$show_domain_list) echo ' display: none;'; ?>">
  1711. <td colspan="5">
  1712. <textarea id="referer-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
  1713. </td>
  1714. </tr>
  1715. <tr class="<?php if ($show_client_list) echo 'list-items'; ?>" style="<?php if (!$show_client_list) echo ' display: none;'; ?>">
  1716. <td>
  1717. <?php _e ('Clients', 'ad-inserter'); ?>
  1718. </td>
  1719. <td>
  1720. <button id="client-button-<?php echo $block; ?>" type="button" class='ai-button ai-button-small' title="<?php _e ('Toggle client editor', 'ad-inserter'); ?>"></button>
  1721. </td>
  1722. <td style="padding-right: 7px; width: 92%;">
  1723. <input id="client-list-<?php echo $block; ?>" class="ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated names (operating systems, browsers, devices). You can also list partial user agent strings with * (user-agent-start*. *user-agent-pattern*, *user-agent-end)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CLIENT_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_client_list(); ?>" value="<?php echo $client_list; ?>" size="54" maxlength="1500"/>
  1724. </td>
  1725. <td>
  1726. <input type="hidden" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1727. <input type="checkbox" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="client-list-input-<?php echo $block; ?>" <?php if ($obj->get_client_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
  1728. <span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_client_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
  1729. </td>
  1730. </tr>
  1731. <tr class="<?php if ($show_client_list) echo 'list-items'; ?>" style="<?php if (!$show_client_list) echo ' display: none;'; ?>">
  1732. <td colspan="5">
  1733. <select id="client-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
  1734. </select>
  1735. </td>
  1736. </tr>
  1737. <?php if (function_exists ('ai_list_rows_2')) ai_list_rows_2 ($block, $default, $obj); ?>
  1738. </tbody>
  1739. </table>
  1740. </div>
  1741. <div id="manual-settings-<?php echo $block; ?>" class="small-button rounded" style="text-align: left;<?php if (!$show_manual) echo ' display: none;'; ?>">
  1742. <table>
  1743. <tr>
  1744. <td style="padding: 4px 10px 4px 0;">
  1745. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1746. <input id="enable-widget-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_widget(); ?>" <?php if ($obj->get_enable_widget () == AI_ENABLED) echo 'checked '; ?> />
  1747. <label for="enable-widget-<?php echo $block; ?>" title="<?php _e ('Enable widget for this block', 'ad-inserter'); ?>">
  1748. <?php _e ('Widget', 'ad-inserter'); ?>
  1749. </label>
  1750. </td>
  1751. <td>
  1752. <pre class="ai-sidebars" style= "margin: 0; display: inline; color: blue; white-space: pre-wrap; word-wrap: break-word;" title="Sidebars (or widget positions) where this widged is used"><?php echo $sidebars [$block], !empty ($sidebars [$block]) ? " &nbsp;" : ""; ?></pre>
  1753. </td>
  1754. </tr>
  1755. <tr>
  1756. <td style="padding: 4px 10px 4px 0;">
  1757. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1758. <input type="checkbox" id="enable-shortcode-<?php echo $block; ?>" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($obj->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> />
  1759. <label for="enable-shortcode-<?php echo $block; ?>" title="<?php _e ('Enable shortcode for manual insertion of this block in posts and pages', 'ad-inserter'); ?>">
  1760. <?php _e ('Shortcode', 'ad-inserter'); ?>
  1761. </label>
  1762. </td>
  1763. <td>
  1764. <pre class="select ai-block-number" style="margin: 0 5px 0 0; display: inline; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;">[adinserter block="<?php echo $block; ?>"]</pre>
  1765. <div class="copy-blocker"></div>
  1766. <span class="copy-blocker">or</span>
  1767. <pre class="select ai-block-name" style="margin: 0 0 0 20px; display: inline; color: blue; white-space: pre-wrap; word-wrap: break-word;">[adinserter name="<?php echo $obj->get_ad_name(); ?>"]</pre>
  1768. <div class="copy-blocker"></div>
  1769. </td>
  1770. </tr>
  1771. <tr>
  1772. <td style="padding: 4px 10px 4px 0;">
  1773. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1774. <input id="enable-php-call-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_php_call(); ?>" <?php if ($manual_php_function [$block] == AI_ENABLED) echo 'checked '; ?> />
  1775. <label for="enable-php-call-<?php echo $block; ?>" title="<?php _e ('Enable PHP function call to insert this block at any position in theme file. If function is disabled for block it will return empty string.', 'ad-inserter'); ?>">
  1776. <?php _e ('PHP function', 'ad-inserter'); ?>
  1777. </label>
  1778. </td>
  1779. <td class="select">
  1780. <pre class="ai-block-number" style="margin: 0; display: inline; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;">&lt;?php if (function_exists ('adinserter')) echo adinserter (<?php echo $block; ?>); ?&gt;</pre>
  1781. <div class="copy-blocker"></div>
  1782. </td>
  1783. </tr>
  1784. </table>
  1785. </div>
  1786. <div id="device-detection-settings-<?php echo $block; ?>" style="<?php if (!$show_devices) echo 'display: none;'; ?>">
  1787. <div id="ai-devices-container-<?php echo $block; ?>" style="padding: 0; margin: 8px 0 0 0; border: 0;">
  1788. <ul id="ai-devices-tabs-<?php echo $block; ?>" style="display: none;">
  1789. <li id="ai-client-side-detection-<?php echo $block; ?>"><a href="#tab-client-side-<?php echo $block; ?>"><span style="<?php echo $client_side_style; ?>"><?php _e ('Client-side device detection', 'ad-inserter'); ?></span></a></li>
  1790. <li id="ai-server-side-detection<?php echo $block; ?>"><a href="#tab-server-side-<?php echo $block; ?>"><span style="<?php echo $server_side_style; ?>"><?php _e ('Server-side device detection', 'ad-inserter'); ?></span></a></li>
  1791. </ul>
  1792. <div id="tab-client-side-<?php echo $block; ?>" class="rounded" style="padding-top: 0;">
  1793. <div style="float: left; margin-top: 10px;">
  1794. <input type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1795. <input id="client-side-detection-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_detection_client_side(); ?>" <?php if ($obj->get_detection_client_side ()==AI_ENABLED) echo 'checked '; ?> />
  1796. <label for="client-side-detection-<?php echo $block; ?>" style="vertical-align: baseline;"><?php _e ('Use client-side detection to', 'ad-inserter'); ?> </label>
  1797. <select id="client-side-action-<?php echo $block; ?>" name="<?php echo AI_OPTION_CLIENT_SIDE_ACTION, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: -4px 1px -2px 1px;" default="<?php echo $default->get_client_side_action (); ?>" title="<?php _e ('Either show/hide or insert when the page is loaded on wanted viewports', 'ad-inserter'); ?>">
  1798. <option value="<?php echo AI_CLIENT_SIDE_ACTION_SHOW; ?>" <?php echo ($obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_SHOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo strtolower (AI_TEXT_SHOW); ?></option>
  1799. <option value="<?php echo AI_CLIENT_SIDE_ACTION_INSERT; ?>" <?php echo ($obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo strtolower (AI_TEXT_INSERT); ?></option>
  1800. </select>
  1801. <label style="vertical-align: baseline;"> <?php /* Translators: only on (the following devices): viewport names (devices) listed */ _e ('only on', 'ad-inserter'); ?></label>
  1802. </div>
  1803. <div style="float: left; margin: 7px 0 -2px 0;">
  1804. <?php
  1805. $viewports = array ();
  1806. for ($viewport = 1; $viewport <= 6; $viewport ++) {
  1807. $viewport_name = get_viewport_name ($viewport);
  1808. if ($viewport_name != '') $viewports [$viewport] = $viewport_name;
  1809. }
  1810. $columns = 3;
  1811. ?>
  1812. <table>
  1813. <tbody>
  1814. <?php
  1815. $column = 0;
  1816. foreach ($viewports as $viewport => $viewport_name) {
  1817. if ($column % $columns == 0) {
  1818. ?>
  1819. <tr>
  1820. <?php
  1821. }
  1822. ?>
  1823. <td style='padding: 0 0 0 20px;'>
  1824. <input type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1825. <input type="checkbox" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $block; ?>" id="viewport-<?php echo $viewport, "-", $block; ?>" value="1" default="<?php echo $default->get_detection_viewport ($viewport); ?>" <?php if ($obj->get_detection_viewport ($viewport)==AI_ENABLED) echo 'checked '; ?> />
  1826. <label for="viewport-<?php echo $viewport, "-", $block; ?>" title="<?php printf (__('Device min width %s px', 'ad-inserter'), get_viewport_width ($viewport)); ?>"><?php echo $viewport_name; ?></label>
  1827. </td>
  1828. <?php
  1829. $column ++;
  1830. }
  1831. if ($column % $columns != 0) {
  1832. for ($fill = 1; $fill <= $columns - $column % $columns; $fill++) {
  1833. ?>
  1834. <td> </td>
  1835. <?php
  1836. }
  1837. ?>
  1838. </tr>
  1839. <?php
  1840. }
  1841. ?>
  1842. </tbody>
  1843. </table>
  1844. </div>
  1845. <div style="clear: both"></div>
  1846. </div>
  1847. <div id="tab-server-side-<?php echo $block; ?>" class="rounded">
  1848. <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1849. <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="server-side-detection-<?php echo $block; ?>" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($obj->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
  1850. <label for="server-side-detection-<?php echo $block; ?>" style="vertical-align: baseline;"><?php _e ('Use server-side detection to insert block only for', 'ad-inserter'); ?> </label>
  1851. <select id="display-for-devices-<?php echo $block; ?>" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: -4px 1px -2px 1px;" default="<?php echo $default->get_display_for_devices(); ?>">
  1852. <option value="<?php echo AI_INSERT_FOR_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_DEVICES; ?></option>
  1853. <option value="<?php echo AI_INSERT_FOR_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MOBILE_DEVICES; ?></option>
  1854. <option value="<?php echo AI_INSERT_FOR_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_TABLET_DEVICES; ?></option>
  1855. <option value="<?php echo AI_INSERT_FOR_PHONE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHONE_DEVICES; ?></option>
  1856. <option value="<?php echo AI_INSERT_FOR_DESKTOP_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_TABLET_DEVICES; ?></option>
  1857. <option value="<?php echo AI_INSERT_FOR_DESKTOP_PHONE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_PHONE_DEVICES; ?></option>
  1858. </select>
  1859. </div>
  1860. </div>
  1861. </div>
  1862. <div id="misc-settings-<?php echo $block; ?>" style="<?php if (!$show_misc) echo 'display: none;'; ?>">
  1863. <div id="ai-misc-container-<?php echo $block; ?>" style="padding: 0; margin: 8px 0 0 0; border: 0;">
  1864. <ul id="ai-misc-tabs-<?php echo $block; ?>" style="display: none;">
  1865. <li id="ai-misc-insertion-<?php echo $block; ?>"><a href="#tab-insertion-<?php echo $block; ?>"><span style="<?php echo $insertion_style; ?>"><?php _e ('Insertion', 'ad-inserter'); ?></span></a></li>
  1866. <li id="ai-misc-filter-<?php echo $block; ?>"><a href="#tab-filter-<?php echo $block; ?>"><span style="<?php echo $filter_style; ?>"><?php _e ('Filter', 'ad-inserter'); ?></span></a></li>
  1867. <li id="ai-misc-word-count-<?php echo $block; ?>"><a href="#tab-word-count-<?php echo $block; ?>"><span style="<?php echo $word_count_style; ?>"><?php _e ('Word Count', 'ad-inserter'); ?></span></a></li>
  1868. <li id="ai-misc-scheduling-<?php echo $block; ?>"><a href="#tab-scheduling-<?php echo $block; ?>"><span style="<?php echo $scheduling_style; ?>"><?php _e ('Scheduling', 'ad-inserter'); ?></span></a></li>
  1869. <li id="ai-misc-display-<?php echo $block; ?>"><a href="#tab-display-<?php echo $block; ?>"><span style="<?php echo $display_style; ?>"><?php _e ('Display', 'ad-inserter'); ?></span></a></li>
  1870. <?php if (function_exists ('ai_limits_adb_action_0')) ai_limits_adb_action_0 ($block, $adb_style, $limits_style); ?>
  1871. <li id="ai-misc-general-<?php echo $block; ?>"><a href="#tab-general-<?php echo $block; ?>"><span style="<?php echo $general_style; ?>"><?php _e ('General', 'ad-inserter'); ?></span></a></li>
  1872. </ul>
  1873. <div id="tab-insertion-<?php echo $block; ?>" class="max-input" style="padding: 0;">
  1874. <div class="rounded">
  1875. <table class="responsive-table" style="width: 70%">
  1876. <tbody>
  1877. <tr>
  1878. <td>
  1879. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_AMP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1880. <input style="" id="enable-amp-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_AMP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_amp(true); ?>" <?php if ($obj->get_enable_amp (true) == AI_ENABLED) echo 'checked '; ?> />
  1881. <label for="enable-amp-<?php echo $block; ?>" style="<?php if (!$obj->get_enable_amp (true) && $obj->get_enable_amp ()) echo ' color: red;' ?>"
  1882. title="<?php if (!$obj->get_enable_amp (true) && $obj->get_enable_amp ()) {_e ('Old settings for AMP pages detected', 'ad-inserter'); echo ". ";} _e ('To insert different codes on normal and AMP pages separate them with [ADINSERTER AMP] separator. Here you can enable insertion on AMP pages only when you need to insert THE SAME CODE also on AMP pages (no AMP separator).', 'ad-inserter'); ?>"><?php _e ('AMP pages', 'ad-inserter'); ?></label>
  1883. </td>
  1884. <td>
  1885. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1886. <input style="margin-left: 10px;" id="enable-ajax-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_ajax(); ?>" <?php if ($obj->get_enable_ajax () == AI_ENABLED) echo 'checked '; ?> />
  1887. <label for="enable-ajax-<?php echo $block; ?>" title="<?php _e ('Enable insertion for Ajax requests', 'ad-inserter'); ?>"><?php _e ('Ajax requests', 'ad-inserter'); ?></label>
  1888. </td>
  1889. <td>
  1890. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1891. <input style="margin-left: 10px;" id="enable-feed-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_feed(); ?>" <?php if ($obj->get_enable_feed () == AI_ENABLED) echo 'checked '; ?> />
  1892. <label for="enable-feed-<?php echo $block; ?>" title="<?php _e ('Enable insertion in RSS feeds', 'ad-inserter'); ?>"><?php _e ('RSS Feed', 'ad-inserter'); ?></label>
  1893. </td>
  1894. <td>
  1895. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1896. <input style="margin-left: 10px;" id="enable-404-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($obj->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
  1897. <label for="enable-404-<?php echo $block; ?>" title="<?php _e ('Enable insertion on page for Error 404: Page not found', 'ad-inserter'); ?>"><?php _e ('Error 404 page', 'ad-inserter'); ?></label>
  1898. </td>
  1899. <td>
  1900. </tr>
  1901. </tbody>
  1902. </table>
  1903. </div>
  1904. <div class="rounded">
  1905. <table class="responsive-table" style="width: 100%">
  1906. <tbody>
  1907. <tr>
  1908. <td style="width: 20%; padding-right: 10px;" title="<?php _e ('Maximum number of insertions of this block. Empty or 0 means no limit.', 'ad-inserter'); ?>">
  1909. <?php _e ('Max', 'ad-inserter'); ?> <input type="text" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="1" maxlength="3" /> <?php _e ('insertions', 'ad-inserter'); ?>
  1910. </td>
  1911. <td title="<?php _e ('Count this block for Max blocks per page limit (defined on the tab [*] / tab General)', 'ad-inserter'); ?>">
  1912. <input type="hidden" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1913. <input id="max-page-blocks-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_max_page_blocks_enabled (); ?>" <?php if ($obj->get_max_page_blocks_enabled () == AI_ENABLED) echo 'checked '; ?> />
  1914. <label for="max-page-blocks-<?php echo $block; ?>"><?php _e ('Max blocks per page', 'ad-inserter'); ?></label>
  1915. </td>
  1916. </tr>
  1917. </tbody>
  1918. </table>
  1919. </div>
  1920. <div class="rounded">
  1921. <table class="responsive-table" style="width: 100%">
  1922. <tbody>
  1923. <tr>
  1924. <td>
  1925. <?php _e ('Insert for', 'ad-inserter'); ?>
  1926. <select id="display-for-users-<?php echo $block; ?>" style="margin: 0 1px; width:160px" name="<?php echo AI_OPTION_DISPLAY_FOR_USERS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_display_for_users(); ?>">
  1927. <option value="<?php echo AI_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AI_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_ALL_USERS; ?></option>
  1928. <option value="<?php echo AI_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AI_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_LOGGED_IN_USERS; ?></option>
  1929. <option value="<?php echo AI_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AI_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
  1930. <option value="<?php echo AI_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AI_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_ADMINISTRATORS; ?></option>
  1931. </select>
  1932. </td>
  1933. <td title="<?php _e ('Insert block only when WP function [[in_the_loop ()]] returns true (WP loop is currently active). Might speed up insertion on content pages when [[the_content]] filter hook is called multiple times.', 'ad-inserter'); ?>" >
  1934. <span style="margin-left: 10px;">
  1935. <input type="hidden" name="<?php echo AI_OPTION_ONLY_IN_THE_LOOP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1936. <input id="only-in-the-loop-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ONLY_IN_THE_LOOP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_only_in_the_loop (); ?>" <?php if ($obj->get_only_in_the_loop () == AI_ENABLED) echo 'checked '; ?> />
  1937. <label for="only-in-the-loop-<?php echo $block; ?>"><?php _e ('Insert only in the loop', 'ad-inserter'); ?></label>
  1938. </span>
  1939. </td>
  1940. <td title="<?php _e ('When enabled, Javascript code (if needed for the blok) will be inserted next to the block HTML code. Otherwise, the Javascript code will be inserted in the page footer. Plugin Javascript functions will still be inserted in the footer.', 'ad-inserter'); ?>">
  1941. <span style="margin-left: 10px;">
  1942. <input type="hidden" name="<?php echo AI_OPTION_EMBED_JS_CODE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1943. <input id="embed-js-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_EMBED_JS_CODE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_embed_js_code (); ?>" <?php if ($obj->get_embed_js_code () == AI_ENABLED) echo 'checked '; ?> />
  1944. <label for="embed-js-<?php echo $block; ?>"><?php _e ('Embed JS code', 'ad-inserter'); ?></label>
  1945. </span>
  1946. </td>
  1947. <td style="width: 35%" title="<?php _e ('Disable caching for WP Super Cache, W3 Total Cache and WP Rocket plugins', 'ad-inserter'); ?>">
  1948. <span style="float: right;">
  1949. <input type="hidden" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1950. <input id="disable-caching-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_disable_caching (); ?>" <?php if ($obj->get_disable_caching () == AI_ENABLED) echo 'checked '; ?> />
  1951. <label for="disable-caching-<?php echo $block; ?>"><?php _e ('Disable caching', 'ad-inserter'); ?></label>
  1952. </span>
  1953. </td>
  1954. </tr>
  1955. </tbody>
  1956. </table>
  1957. </div>
  1958. </div>
  1959. <div id="tab-filter-<?php echo $block; ?>" class="rounded">
  1960. <div class="max-input">
  1961. <span style="display: table-cell; width: 1px; white-space: nowrap; padding-right: 10px;">
  1962. <?php _e('Filter insertions', 'ad-inserter'); ?>
  1963. </span>
  1964. <span style="display: table-cell;">
  1965. <input id="filter-numbers-<?php echo $block; ?>" style="width: 100%;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_call_filter(); ?>" value="<?php echo $obj->get_call_filter(); ?>" title= "<?php _e ('Filter multiple insertions by specifying wanted insertions for this block - single number, comma separated numbers or %N for every N insertions - empty means all insertions / no filter. Set Counter for filter to Auto if you are using only one insertion type.', 'ad-inserter'); ?>" size="12" maxlength="36" />
  1966. </span>
  1967. <span style="display: table-cell; padding-left: 10px;">
  1968. <?php _e('using', 'ad-inserter'); ?>
  1969. <select id="filter-type-<?php echo $block; ?>" class="filter-type-select" style="padding-left: 10px; margin: 0 1px;" name="<?php echo AI_OPTION_FILTER_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_filter_type(); ?>">
  1970. <option value="<?php echo AI_FILTER_AUTO; ?>" <?php echo ($filter_type == AI_FILTER_AUTO) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AUTO_COUNTER; ?></option>
  1971. <option value="<?php echo AI_FILTER_PHP_FUNCTION_CALLS; ?>" <?php echo ($filter_type == AI_FILTER_PHP_FUNCTION_CALLS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHP_FUNCTION_CALLS_COUNTER; ?></option>
  1972. <option value="<?php echo AI_FILTER_CONTENT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_CONTENT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CONTENT_PROCESSING_COUNTER; ?></option>
  1973. <option value="<?php echo AI_FILTER_EXCERPT_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_EXCERPT_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_EXCERPT_PROCESSING_COUNTER; ?></option>
  1974. <option value="<?php echo AI_FILTER_BEFORE_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_BEFORE_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST_PROCESSING_COUNTER; ?></option>
  1975. <option value="<?php echo AI_FILTER_AFTER_POST_PROCESSING; ?>" <?php echo ($filter_type == AI_FILTER_AFTER_POST_PROCESSING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST_PROCESSING_COUNTER; ?></option>
  1976. <option value="<?php echo AI_FILTER_WIDGET_DRAWING; ?>" <?php echo ($filter_type == AI_FILTER_WIDGET_DRAWING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_WIDGET_DRAWING_COUNTER; ?></option>
  1977. <option value="<?php echo AI_FILTER_SUBPAGES; ?>" <?php echo ($filter_type == AI_FILTER_SUBPAGES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SUBPAGES_COUNTER; ?></option>
  1978. <option value="<?php echo AI_FILTER_POSTS; ?>" <?php echo ($filter_type == AI_FILTER_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_POSTS_COUNTER; ?></option>
  1979. <option value="<?php echo AI_FILTER_PARAGRAPHS; ?>" <?php echo ($filter_type == AI_FILTER_PARAGRAPHS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PARAGRAPHS_COUNTER; ?></option>
  1980. <option value="<?php echo AI_FILTER_IMAGES; ?>" <?php echo ($filter_type == AI_FILTER_IMAGES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_IMAGES_COUNTER; ?></option>
  1981. <option value="<?php echo AI_FILTER_COMMENTS; ?>" <?php echo ($filter_type == AI_FILTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_COMMENTS_COUNTER; ?></option>
  1982. </select>
  1983. </span>
  1984. <span style="display: table-cell; text-align: right;">
  1985. <input type="hidden" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  1986. <input id="invert-filter-<?php echo $block; ?>" style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_inverted_filter(); ?>" <?php if ($obj->get_inverted_filter () == AI_ENABLED) echo 'checked '; ?> />
  1987. <label for="invert-filter-<?php echo $block; ?>" style="vertical-align: top;" title="<?php _e ('Checked means specified calls are unwanted', 'ad-inserter'); ?>"><?php _e ('Invert filter', 'ad-inserter'); ?></label>
  1988. </span>
  1989. </div>
  1990. </div>
  1991. <div id="tab-word-count-<?php echo $block; ?>" class="rounded">
  1992. <?php _e ('Post/Static page must have between', 'ad-inserter'); ?>
  1993. <input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: 0 1px;" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words(); ?>" title="<?php _e ('Minimum number of post/static page words, leave empty for no limit', 'ad-inserter'); ?>" size="4" maxlength="6" />
  1994. <?php _e ('and', 'ad-inserter'); ?>
  1995. <input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" style="margin: 0 1px;" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words(); ?>" title="<?php _e ('Maximum number of post/static page words, leave empty for no limit', 'ad-inserter'); ?>" size="4" maxlength="6" />
  1996. <?php /* Translators: Post/Static page must have between X and Y words */ echo _n ('word', 'words', $obj->get_maximum_words(), 'ad-inserter'); ?>
  1997. </div>
  1998. <div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
  1999. <select id="scheduling-<?php echo $block; ?>" style="margin: 2px 1px; max-width: 340px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
  2000. <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INSERT_IMMEDIATELY; ?></option>
  2001. <option value="<?php echo AI_SCHEDULING_DELAY_FOR; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY_FOR) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
  2002. <option value="<?php echo AI_SCHEDULING_INSERT_ONLY_FOR; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_INSERT_ONLY_FOR) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INSERT_ONLY; ?></option>
  2003. <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
  2004. </select>
  2005. <span id="scheduling-delay-<?php echo $block; ?>">
  2006. <?php _e ('for', 'ad-inserter'); ?> <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_after_day(); ?>" value="<?php echo $obj->get_ad_after_day(); ?>" title="Time period in days. Use decimal value (with decimal point) for shorter periods." size="3" maxlength="6" /> <?php _e ('days after publishing', 'ad-inserter'); ?>
  2007. </span>
  2008. <!-- <span id="scheduling-delay-warning-<?php echo $block; ?>" style="color: #d00; display: none;">&nbsp;&nbsp; <?php _e ('Not available', 'ad-inserter'); ?></span>-->
  2009. <?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($block, $obj, $default); ?>
  2010. </div>
  2011. <div id="tab-display-<?php echo $block; ?>" style="padding: 0;">
  2012. <div class="rounded">
  2013. <table class="responsive-table" style="width: 100%;" cellspacing=0 cellpadding=0 >
  2014. <tbody>
  2015. <tr>
  2016. <td style="width: 10%;">
  2017. <?php _e ('Width', 'ad-inserter'); ?>
  2018. <input type="text" name="<?php echo AI_OPTION_BLOCK_WIDTH, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_block_width (); ?>" value="<?php echo $obj->get_block_width (); ?>" title= "<?php /* Translators: do not translate [[width]] - it is a CSS property */ _e ('Block width: empty means width not defined, number means width in pixels, any other value mens CSS [[width]] property', 'ad-inserter'); ?>" size="3" maxlength="8" />
  2019. </td>
  2020. <td style="padding-left: 20px; width: 80%;">
  2021. <?php _e ('Height', 'ad-inserter'); ?>
  2022. <input type="text" name="<?php echo AI_OPTION_BLOCK_HEIGHT, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_block_height (); ?>" value="<?php echo $obj->get_block_height (); ?>" title= "<?php /* Translators: do not translate [[height]] - it is a CSS property */ _e ('Block height: empty means height not defined, number means height in pixels, any other value mens CSS [[height]] property', 'ad-inserter'); ?>" size="3" maxlength="8" />
  2023. </td>
  2024. <td style="padding-left: 20px; width: 10%;">
  2025. <input type="hidden" name="<?php echo AI_OPTION_SHOW_LABEL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
  2026. <input id="show-label-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_SHOW_LABEL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_show_label (); ?>" <?php if ($obj->get_show_label () == AI_ENABLED) echo 'checked '; ?> />
  2027. <label for="show-label-<?php echo $block; ?>"><?php _e ('Ad label', 'ad-inserter'); ?></label>
  2028. </td>
  2029. </tr>
  2030. </tbody>
  2031. </table>
  2032. </div>
  2033. <?php if (function_exists ('ai_display_loading')) ai_display_loading ($block, $obj, $default); ?>
  2034. <?php if (function_exists ('ai_close_button')) ai_close_button ($block, $obj, $default); ?>
  2035. <?php if (function_exists ('ai_delay_showing')) ai_delay_showing ($block, $obj, $default); ?>
  2036. <?php if (function_exists ('ai_iframes')) ai_iframes ($block, $obj, $default); ?>
  2037. </div>
  2038. <?php if (function_exists ('ai_limits_adb_action')) ai_limits_adb_action ($block, $obj, $default); ?>
  2039. <div id="tab-general-<?php echo $block; ?>" class="rounded">
  2040. <div class="max-input">
  2041. <span style="display: table-cell; width: 1px; white-space: nowrap;">
  2042. <?php _e ('General tag', 'ad-inserter'); ?>
  2043. &nbsp;
  2044. </span>
  2045. <span style="display: table-cell;">
  2046. <input style="width: 100%; max-width: 140px;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_general_tag(); ?>" value="<?php echo $obj->get_ad_general_tag(); ?>" size="12" maxlength="40" title="<?php _e ("Used for [adinserter data=''] shortcodes when no data is found", 'ad-inserter'); ?>" />
  2047. </span>
  2048. </div>
  2049. </div>
  2050. </div>
  2051. </div>
  2052. <div id="no-wrapping-warning-<?php echo $block; ?>" class="rounded" style="display: none;">
  2053. <span style="margin-top: 5px;"><?php /* translators: %s: HTML tags */ printf (__('%s WARNING: %s %s No Wrapping %s style has no wrapping code needed for client-side device detection!', 'ad-inserter'), '<span style="color: red;">', '</span>', '<strong>', '</strong>'); ?></span>
  2054. </div>
  2055. <?php
  2056. $client_side_insertion_warning = (
  2057. $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT ||
  2058. $automatic_insertion == AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT ||
  2059. $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT) &&
  2060. ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE) &&
  2061. ($obj->get_call_filter() != '' || $obj->get_maximum_insertions () != '');
  2062. ?>
  2063. <div id="client-side-insertion-warning-<?php echo $block; ?>" class="rounded" style="<?php echo $client_side_insertion_warning ? '' : 'display: none;'; ?>">
  2064. <span style="margin-top: 5px;"><?php /* translators: %s: HTML tags for text and link */ printf (__('%s WARNING: %s Settings Filter or Max insertions can\'t work with %s Client-side %s insertion. Use %s Server-side %s insertion.', 'ad-inserter'),
  2065. '<span style="color: red;">', '</span>', '<strong>', '</strong>',
  2066. '<a href="https://adinserter.pro/documentation/insertion-before-inside-after-html-element#insertion" class="simple-link" target="_blank">',
  2067. '</a>'
  2068. ); ?></span>
  2069. </div>
  2070. <?php if (function_exists ('ai_warnings')) ai_warnings ($block); ?>
  2071. </div>
  2072. </div>
  2073. <?php
  2074. }
  2075. ?>
  2076. <div id="tab-0" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
  2077. <div style="margin: 16px 0 16px 4px;">
  2078. <h3 style="margin: 0; float: left;"><?php echo AD_INSERTER_NAME, ' ', __('Settings', 'ad-inserter'); ?> <?php if (isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) echo (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][0].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][1]), '.',
  2079. (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][2].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][3]), '.',
  2080. (int) ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'][4].$ai_db_options [AI_OPTION_GLOBAL]['VERSION'][5]); ?></h3>
  2081. <h4 style="margin: 0px; float: right;<?php if (defined ('AI_EXTRACT_GENERATED')) echo ' color: #00f;'; ?>" title="<?php _e ('Settings timestamp', 'ad-inserter'); ?>"><?php echo isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "";?></h4>
  2082. <div style="clear: both;"></div>
  2083. </div>
  2084. <div style="margin: 16px 0;">
  2085. <div style="float: right;">
  2086. <div title='<?php _e ('Rotation editor active - rotation code not generated! Make sure no rotation editor is active before saving settings.', 'ad-inserter'); ?>' class="ai-rotation-warning" style='float: left; font-size: 18px; font-weight: bold; margin: 5px 5px 0 0; display: none;'>&#x26A0;</div>
  2087. <input style="display: none; font-weight: bold; margin-left: 5px;" name="<?php echo AI_FORM_SAVE; ?>" value="<?php _e ('Save Settings', 'ad-inserter'); ?>" type="submit" style="width:120px; font-weight: bold;" />
  2088. </div>
  2089. <div style="float: left;">
  2090. <div style="min-width: 130px; display: inline-block;">
  2091. <input onclick="if (confirm('<?php _e ('Are you sure you want to reset all settings?', 'ad-inserter'); ?>')) return true; return false;" name="<?php echo AI_FORM_CLEAR; ?>" value="<?php _e ('Reset All Settings', 'ad-inserter'); ?>" type="submit" style="display: none; min-width:125px; font-weight: bold; color: #e44;" />
  2092. </div>
  2093. <?php if (function_exists ('ai_settings_global_actions')) ai_settings_global_actions (); ?>
  2094. <?php if (function_exists ('ai_settings_global_buttons')) ai_settings_global_buttons (); ?>
  2095. <?php if (defined ('AI_ADSENSE_API')) : ?>
  2096. <?php if (!defined ('AI_ADSENSE_AUTHORIZATION_CODE')) : ?>
  2097. <span style="vertical-align: top; margin-left: 5px;">
  2098. <label id="ga-0" class="checkbox-button adsense-list" title="<?php _e ('Show AdSense ad units', 'ad-inserter'); ?>" ><span class="checkbox-icon image icon-adsense"></span></label>
  2099. </span>
  2100. <?php endif; ?>
  2101. <?php endif; ?>
  2102. </div>
  2103. <div style="clear: both;"></div>
  2104. </div>
  2105. <?php
  2106. if (function_exists ('ai_global_settings')) ai_global_settings ();
  2107. if ($enabled_k) $style_k = "font-weight: bold; color: #66f;"; else $style_k = "";
  2108. if ($enabled_h) $style_h = "font-weight: bold; color: #66f;"; else if ($header_code_disabled) $style_h = "font-weight: bold; color: #f66;"; else $style_h = "";
  2109. if ($enabled_f) $style_f = "font-weight: bold; color: #66f;"; else if ($footer_code_disabled) $style_f = "font-weight: bold; color: #f66;"; else $style_f = "";
  2110. if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
  2111. $adb_action = get_adb_action (true);
  2112. $adb_no_action = get_adb_no_action (true);
  2113. $no_undismissible_message = get_no_undismissible_message (true);
  2114. if ($enabled_a) $style_a = "font-weight: bold; color: " . ($adb_action == AI_ADB_ACTION_NONE ? "#66f;" : "#c0f;"); else $style_a = "";
  2115. }
  2116. if ($insertion_disabled) $style_d = "font-weight: bold; color: #e44;"; else $style_d = "";
  2117. ?>
  2118. <div id="ai-plugin-settings-tab-container" style="padding: 0; margin: 8px 0 0 0; border: 0;">
  2119. <ul id="ai-plugin-settings-tabs" style="display: none;">
  2120. <li id="ai-g" class="ai-plugin-tab"><a href="#tab-general"><?php _e ('General', 'ad-inserter'); ?></a></li>
  2121. <li id="ai-v" class="ai-plugin-tab"><a href="#tab-viewports"><?php _e ('Viewports', 'ad-inserter'); ?></a></li>
  2122. <li id="ai-k" class="ai-plugin-tab"><a href="#tab-hooks"><span style="<?php echo $style_k ?>"><?php _e ('Hooks', 'ad-inserter'); ?></span></a></li>
  2123. <li id="ai-h" class="ai-plugin-tab"><a href="#tab-header"><span style="<?php echo $style_h ?>"><?php _e ('Header', 'ad-inserter'); ?></span></a></li>
  2124. <li id="ai-f" class="ai-plugin-tab"><a href="#tab-footer"><span style="<?php echo $style_f ?>"><?php _e ('Footer', 'ad-inserter'); ?></span></a></li>
  2125. <?php if (function_exists ('ai_plugin_settings_tab')) ai_plugin_settings_tab ($exceptions); ?>
  2126. <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
  2127. <li id="ai-a" class="ai-plugin-tab"><a href="#tab-adblocking"><span style="<?php echo $style_a ?>"><?php _e ('Ad Blocking', 'ad-inserter'); ?></span></a></li>
  2128. <?php } ?>
  2129. <li id="ai-d" class="ai-plugin-tab"><a href="#tab-debugging"><span style="<?php echo $style_d ?>"><?php _e ('Debugging', 'ad-inserter'); ?></span></a></li>
  2130. </ul>
  2131. <div id="tab-general" style="padding: 0;">
  2132. <div class="rounded">
  2133. <table class="ai-settings-table ai-values" style="width: 100%;">
  2134. <?php if (function_exists ('ai_general_settings')) ai_general_settings (); ?>
  2135. <tr>
  2136. <td>
  2137. <?php _e ('Plugin priority', 'ad-inserter'); ?>
  2138. </td>
  2139. <td>
  2140. <input type="text" name="plugin_priority" value="<?php echo get_plugin_priority (); ?>" default="<?php echo DEFAULT_PLUGIN_PRIORITY; ?>" size="6" maxlength="6" />
  2141. </td>
  2142. </tr>
  2143. <tr>
  2144. <td>
  2145. <?php _e ('Output buffering', 'ad-inserter'); ?>
  2146. </td>
  2147. <td>
  2148. <select id="output-buffering" name="output-buffering" default="<?php echo DEFAULT_OUTPUT_BUFFERING; ?>" title="<?php _e ('Needed for position Above header but may not work with all themes', 'ad-inserter'); ?>">
  2149. <option value="<?php echo AI_OUTPUT_BUFFERING_DISABLED; ?>" <?php echo get_output_buffering() == AI_OUTPUT_BUFFERING_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  2150. <option value="<?php echo AI_OUTPUT_BUFFERING_ENABLED; ?>" <?php echo get_output_buffering() == AI_OUTPUT_BUFFERING_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
  2151. </select>
  2152. </td>
  2153. </tr>
  2154. <tr>
  2155. <td>
  2156. <?php _e ('Syntax highlighting theme', 'ad-inserter'); ?>
  2157. </td>
  2158. <td>
  2159. <select
  2160. id="syntax-highlighter-theme"
  2161. name="syntax-highlighter-theme"
  2162. value="Value">
  2163. <optgroup label="<?php _ex ('None', 'no syntax highlighting themes', 'ad-inserter'); ?>">
  2164. <option value="<?php echo AI_OPTION_DISABLED; ?>" <?php echo ($syntax_highlighter_theme == AI_OPTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php _e ('No Syntax Highlighting', 'ad-inserter'); ?></option>
  2165. </optgroup>
  2166. <optgroup label="<?php _ex ('Light', 'syntax highlighting themes', 'ad-inserter'); ?>">
  2167. <option value="chrome" <?php echo ($syntax_highlighter_theme == 'chrome') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Chrome</option>
  2168. <option value="clouds" <?php echo ($syntax_highlighter_theme == 'clouds') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Clouds</option>
  2169. <option value="crimson_editor" <?php echo ($syntax_highlighter_theme == 'crimson_editor') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Crimson Editor</option>
  2170. <option value="dawn" <?php echo ($syntax_highlighter_theme == 'dawn') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Dawn</option>
  2171. <option value="dreamweaver" <?php echo ($syntax_highlighter_theme == 'dreamweaver') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Dreamweaver</option>
  2172. <option value="eclipse" <?php echo ($syntax_highlighter_theme == 'eclipse') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Eclipse</option>
  2173. <option value="github" <?php echo ($syntax_highlighter_theme == 'github') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>GitHub</option>
  2174. <option value="katzenmilch" <?php echo ($syntax_highlighter_theme == 'katzenmilch') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Katzenmilch</option>
  2175. <option value="kuroir" <?php echo ($syntax_highlighter_theme == 'kuroir') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Kuroir</option>
  2176. <option value="solarized_light" <?php echo ($syntax_highlighter_theme == 'solarized_light') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Solarized Light</option>
  2177. <option value="textmate" <?php echo ($syntax_highlighter_theme == 'textmate') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Textmate</option>
  2178. <option value="tomorrow" <?php echo ($syntax_highlighter_theme == 'tomorrow') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Tomorrow</option>
  2179. <option value="xcode" <?php echo ($syntax_highlighter_theme == 'xcode') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>XCode</option>
  2180. </optgroup>
  2181. <optgroup label="<?php _ex ('Dark', 'syntax highlighting themes', 'ad-inserter'); ?>">
  2182. <option value="ad_inserter" <?php echo ($syntax_highlighter_theme == 'ad_inserter') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Ad Inserter</option>
  2183. <option value="chaos" <?php echo ($syntax_highlighter_theme == 'chaos') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Chaos</option>
  2184. <option value="clouds_midnight" <?php echo ($syntax_highlighter_theme == 'clouds_midnight') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Clouds Midnight</option>
  2185. <option value="cobalt" <?php echo ($syntax_highlighter_theme == 'cobalt') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Cobalt</option>
  2186. <option value="idle_fingers" <?php echo ($syntax_highlighter_theme == 'idle_fingers') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Idle Fingers</option>
  2187. <option value="kr_theme" <?php echo ($syntax_highlighter_theme == 'kr_theme') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>krTheme</option>
  2188. <option value="merbivore" <?php echo ($syntax_highlighter_theme == 'merbivore') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Merbivore</option>
  2189. <option value="merbivore_soft" <?php echo ($syntax_highlighter_theme == 'merbivore_soft') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Merbivore Soft</option>
  2190. <option value="mono_industrial" <?php echo ($syntax_highlighter_theme == 'mono_industrial') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Mono Industrial</option>
  2191. <option value="monokai" <?php echo ($syntax_highlighter_theme == 'monokai') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Monokai</option>
  2192. <option value="pastel_on_dark" <?php echo ($syntax_highlighter_theme == 'pastel_on_dark') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Pastel on Dark</option>
  2193. <option value="solarized_dark" <?php echo ($syntax_highlighter_theme == 'solarized_dark') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Solarized Dark</option>
  2194. <option value="terminal" <?php echo ($syntax_highlighter_theme == 'terminal') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Terminal</option>
  2195. <option value="tomorrow_night" <?php echo ($syntax_highlighter_theme == 'tomorrow_night') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Tomorrow Night</option>
  2196. <option value="tomorrow_night_blue" <?php echo ($syntax_highlighter_theme == 'tomorrow_night_blue') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Tomorrow Night Blue</option>
  2197. <option value="tomorrow_night_bright" <?php echo ($syntax_highlighter_theme == 'tomorrow_night_bright') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Tomorrow Night Bright</option>
  2198. <option value="tomorrow_night_eighties" <?php echo ($syntax_highlighter_theme == 'tomorrow_night_eighties') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Tomorrow Night 80s</option>
  2199. <option value="twilight" <?php echo ($syntax_highlighter_theme == 'twilight') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Twilight</option>
  2200. <option value="vibrant_ink" <?php echo ($syntax_highlighter_theme == 'vibrant_ink') ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>>Vibrant Ink</option>
  2201. </optgroup>
  2202. </select>
  2203. </td>
  2204. </tr>
  2205. <tr>
  2206. <td>
  2207. <?php _e ('Tab setup delay', 'ad-inserter'); ?>
  2208. </td>
  2209. <td>
  2210. <input type="text" name="tab-setup-delay" value="<?php echo get_tab_setup_delay (); ?>" default="<?php echo DEFAULT_TAB_SETUP_DELAY; ?>" size="6" maxlength="6" />
  2211. </td>
  2212. </tr>
  2213. <tr>
  2214. <td>
  2215. <?php _e ('Min. user role for ind. exceptions editing', 'ad-inserter'); ?>
  2216. </td>
  2217. <td>
  2218. <select style="margin-bottom: 3px;" id="minimum-user-role" name="minimum-user-role" selected-value="1" data="<?php echo get_minimum_user_role (); ?>" default="<?php echo DEFAULT_MINIMUM_USER_ROLE; ?>" style="width:300px">
  2219. <?php wp_dropdown_roles (get_minimum_user_role ()); ?>
  2220. </select>
  2221. </td>
  2222. </tr>
  2223. <tr>
  2224. <td>
  2225. <?php _e ('Disable caching for logged in administrators', 'ad-inserter'); ?>
  2226. </td>
  2227. <td>
  2228. <select id="disable-caching-admin" name="disable-caching-admin" default="<?php echo DEFAULT_DISABLE_CACHING; ?>" title="<?php _e ('Enabled means that logged in administrators will see non-cached (live) pages (applies to WP Super Cache, W3 Total Cache and WP Rocket plugins)', 'ad-inserter'); ?>">
  2229. <option value="<?php echo AI_DISABLE_CACHING_DISABLED; ?>" <?php echo get_disable_caching () == AI_DISABLE_CACHING_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  2230. <option value="<?php echo AI_DISABLE_CACHING_ENABLED; ?>" <?php echo get_disable_caching () == AI_DISABLE_CACHING_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
  2231. </select>
  2232. </td>
  2233. </tr>
  2234. <tr>
  2235. <td>
  2236. <?php _e ('Wait for jQuery', 'ad-inserter'); ?>
  2237. </td>
  2238. <td>
  2239. <select id="wait-for-jquery" name="wait-for-jquery" default="<?php echo DEFAULT_WAIT_FOR_JQUERY; ?>" title="<?php _e ('When enabled, Ad Inserter will wait for jQuery library to be loaded before it will run the scripts that may need it', 'ad-inserter'); ?>">
  2240. <option value="<?php echo AI_WAIT_FOR_JQUERY_DISABLED; ?>" <?php echo get_wait_for_jquery () == AI_WAIT_FOR_JQUERY_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  2241. <option value="<?php echo AI_WAIT_FOR_JQUERY_ENABLED; ?>" <?php echo get_wait_for_jquery () == AI_WAIT_FOR_JQUERY_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
  2242. </select>
  2243. </td>
  2244. </tr>
  2245. <tr>
  2246. <td>
  2247. <?php _e ('Sticky widget mode', 'ad-inserter'); ?>
  2248. </td>
  2249. <td>
  2250. <select name="sticky-widget-mode" default="<?php echo DEFAULT_STICKY_WIDGET_MODE; ?>" title="<?php _e ('CSS mode is the best approach but may not work with all themes. JavaScript mode works with most themes but may reload ads on page load.', 'ad-inserter'); ?>">
  2251. <option value="<?php echo AI_STICKY_WIDGET_MODE_CSS; ?>" <?php echo get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_CSS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CSS; ?></option>
  2252. <option value="<?php echo AI_STICKY_WIDGET_MODE_JS; ?>" <?php echo get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_JS; ?></option>
  2253. </select>
  2254. </td>
  2255. </tr>
  2256. <tr>
  2257. <td>
  2258. <?php _e ('Sticky widget top margin', 'ad-inserter'); ?>
  2259. </td>
  2260. <td>
  2261. <input type="text" name="sticky-widget-margin" value="<?php echo get_sticky_widget_margin (); ?>" default="<?php echo DEFAULT_STICKY_WIDGET_MARGIN; ?>" size="6" maxlength="4" /> px
  2262. </td>
  2263. </tr>
  2264. <tr>
  2265. <td>
  2266. <?php _e ('Dynamic blocks', 'ad-inserter'); ?>
  2267. </td>
  2268. <td>
  2269. <select id="dynamic_blocks" name="dynamic_blocks" default="<?php echo DEFAULT_DYNAMIC_BLOCKS; ?>">
  2270. <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
  2271. <option value="<?php echo AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE_W3TC; ?></option>
  2272. <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_SHOW; ?></option>
  2273. <option value="<?php echo AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT; ?>" <?php echo get_dynamic_blocks() == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_INSERT; ?></option>
  2274. </select>
  2275. </td>
  2276. </tr>
  2277. <tr>
  2278. <td>
  2279. <?php _e ('Functions for paragraph counting', 'ad-inserter'); ?>
  2280. </td>
  2281. <td>
  2282. <select id="paragraph_counting_functions" name="paragraph_counting_functions" default="<?php echo DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS; ?>" title="<?php _e ('Standard PHP functions are faster and work in most cases, use Multibyte functions if paragraphs are not counted properly on non-english pages.', 'ad-inserter'); ?>">
  2283. <option value="<?php echo AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_STANDARD_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FUNCTIONS_STANDARD; ?></option>
  2284. <option value="<?php echo AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS; ?>" <?php echo get_paragraph_counting_functions() == AI_MULTIBYTE_PARAGRAPH_COUNTING_FUNCTIONS ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MULTIBYTE; ?></option>
  2285. </select>
  2286. </td>
  2287. </tr>
  2288. <tr>
  2289. <td>
  2290. <?php _e ('No paragraph counting inside', 'ad-inserter'); ?>
  2291. </td>
  2292. <td>
  2293. <input type="text" name="no-paragraph-counting-inside" style="width: 100%;" value="<?php echo get_no_paragraph_counting_inside (); ?>" default="<?php echo DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE; ?>" size="60" maxlength="80" />
  2294. </td>
  2295. </tr>
  2296. <tr>
  2297. <td>
  2298. <?php _e ('Ad label', 'ad-inserter'); ?>
  2299. </td>
  2300. <td>
  2301. <input id="ad-label-text" type="text" name="ad-label" style="width: 100%;" value="<?php echo get_ad_label (); ?>" default="<?php echo DEFAULT_AD_TITLE; ?>" title="<?php _e ('Label text or HTML code', 'ad-inserter'); ?>" size="60" maxlength="500" />
  2302. </td>
  2303. </tr>
  2304. <tr>
  2305. <td>
  2306. <?php _e ('Max blocks per page', 'ad-inserter'); ?>
  2307. </td>
  2308. <td>
  2309. <input type="text" name="max-page-blocks" value="<?php echo get_max_page_blocks (); ?>" default="<?php echo DEFAULT_MAX_PAGE_BLOCKS; ?>" title="<?php _e ('Maximum number of inserted blocks per page. You need to enable Max page insertions (button Misc / tab Insertion) to count block for this limit.', 'ad-inserter'); ?>" size="6" maxlength="4" />
  2310. </td>
  2311. </tr>
  2312. <?php if (function_exists ('ai_general_settings_2')) ai_general_settings_2 ();
  2313. if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
  2314. if (!function_exists ('ai_general_settings_2')) {
  2315. global $ai_dst;
  2316. if (isset ($ai_dst) && is_object ($ai_dst) && $ai_dst->get_plugin_tracking () !== null) {
  2317. $plugin_tracking = $ai_dst->get_tracking ();
  2318. ?>
  2319. <tr>
  2320. <td>
  2321. <?php _e ('Plugin usage tracking', 'ad-inserter'); ?>
  2322. </td>
  2323. <td>
  2324. <select id="plugin-usage-tracking" name="plugin-usage-tracking" default="#" title="<?php /* translators: %s: Ad Inserter */ printf (__ ('Enable tracking of %s usage and help us to make improvements to the plugin. Only information regarding the WordPress environment and %s usage is recorded (once per month and on events like plugin activation/deactivation).', 'ad-inserter'), AD_INSERTER_NAME, AD_INSERTER_NAME); ?>">
  2325. <option value="<?php echo AI_PLUGIN_TRACKING_DISABLED; ?>" <?php echo $plugin_tracking == AI_PLUGIN_TRACKING_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
  2326. <option value="<?php echo AI_PLUGIN_TRACKING_ENABLED; ?>" <?php echo $plugin_tracking == AI_PLUGIN_TRACKING_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
  2327. </select>
  2328. </td>
  2329. </tr>
  2330. <?php
  2331. }
  2332. }
  2333. }
  2334. ?>
  2335. </table>
  2336. </div>
  2337. <div class="rounded">
  2338. <table class="ai-settings-table" style="width: 100%;">
  2339. <tr>
  2340. <td>
  2341. <span title="<?php _e ('CSS class name for the wrapping div', 'ad-inserter'); ?>"><?php _e ('Block class name', 'ad-inserter'); ?></span>
  2342. <input id="block-class-name" class="ai-block-code-demo" style="margin-left: 5px;" type="text" name="block-class-name" value="<?php echo $block_class_name; ?>" default="<?php echo DEFAULT_BLOCK_CLASS_NAME; ?>" size="12" maxlength="40" />
  2343. <input type="hidden" name="block-class" value="0" />
  2344. <input id="block-class" class="ai-block-code-demo" style="margin-left: 5px;" type="checkbox" name="block-class" value="1" default="<?php echo DEFAULT_BLOCK_CLASS; ?>" <?php if ($block_class == AI_ENABLED) echo 'checked '; ?> />
  2345. </td>
  2346. <td>
  2347. <span title="<?php _e ('Include block number class', 'ad-inserter'); ?>"><?php _e ('Block number class', 'ad-inserter'); ?></span>
  2348. <input type="hidden" name="block-number-class" value="0" />
  2349. <input id="block-number-class" class="ai-block-code-demo" style="margin-left: 5px;" type="checkbox" name="block-number-class" value="1" default="<?php echo DEFAULT_BLOCK_NUMBER_CLASS; ?>" <?php if ($block_number_class == AI_ENABLED) echo 'checked '; ?> />
  2350. </td>
  2351. <td>
  2352. <span title="<?php _e ('Include block name class', 'ad-inserter'); ?>"><?php _e ('Block name class', 'ad-inserter'); ?></span>
  2353. <input type="hidden" name="block-name-class" value="0" />
  2354. <input id="block-name-class" class="ai-block-code-demo" style="margin-left: 5px;" type="checkbox" name="block-name-class" value="1" default="<?php echo DEFAULT_BLOCK_NAME_CLASS; ?>" <?php if ($block_name_class == AI_ENABLED) echo 'checked '; ?> />
  2355. </td>
  2356. <td>
  2357. <span title="<?php _e ('Instead of alignment classes generate inline alignment styles for blocks', 'ad-inserter'); ?>"><?php _e ('Inline styles', 'ad-inserter'); ?></span>
  2358. <input type="hidden" name="inline-styles" value="0" />
  2359. <input id="inline-styles" class="ai-block-code-demo" style="margin-left: 5px;" type="checkbox" name="inline-styles" value="1" default="<?php echo DEFAULT_INLINE_STYLES; ?>" <?php if ($inline_styles == AI_ENABLED) echo 'checked '; ?> />
  2360. </td>
  2361. </tr>
  2362. </table>
  2363. <div style="margin-top: 8px;"><?php _e ('Preview of the block wrapping code', 'ad-inserter'); ?></div>
  2364. <pre class="ai-page-code" title="<?php _e ('Wrapping div', 'ad-inserter'); ?>"><span id="ai-block-code-demo" ><?php echo ai_block_code_demo ($block_class_name, $block_class, $block_number_class, $block_name_class, $inline_styles); ?></span>
  2365. <span style="color: #222;"><?php _e ('BLOCK CODE', 'ad-inserter'); ?></span>
  2366. &lt;/div&gt;</pre>
  2367. </div>
  2368. </div>
  2369. <div id="tab-viewports" class="rounded">
  2370. <div style="margin: 0 0 8px 0;">
  2371. <strong><?php _e ('Viewport Settings used for client-side device detection', 'ad-inserter'); ?></strong>
  2372. </div>
  2373. <?php
  2374. for ($viewport = 1; $viewport <= 6; $viewport ++) {
  2375. $bottom_margin = $viewport == 6 ? 0 : 4;
  2376. ?>
  2377. <div style="margin: 4px 0 <?php echo $bottom_margin; ?>px 0;">
  2378. <?php /* Translators: %d: viewport number */ printf (__('Viewport %d name', 'ad-inserter'), $viewport); ?>&nbsp;&nbsp;&nbsp;
  2379. <input style="margin-left: 0px;" type="text" name="viewport-name-<?php echo $viewport; ?>" value="<?php echo get_viewport_name ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_NAME_" . $viewport) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport) : ""; ?>" size="15" maxlength="40" />
  2380. <?php if ($viewport == 6) echo '<span style="display: none;">' ?>
  2381. &nbsp;&nbsp; <?php _e ('min width', 'ad-inserter'); ?>
  2382. <input type="text" id="option-length-<?php echo $viewport; ?>" name="viewport-width-<?php echo $viewport; ?>" value="<?php echo get_viewport_width ($viewport); ?>" default="<?php echo defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport) : ""; ?>" size="4" maxlength="4" /> px
  2383. <?php if ($viewport == 6) echo '</span>' ?>
  2384. </div>
  2385. <?php
  2386. }
  2387. ?>
  2388. </div>
  2389. <div id="tab-hooks" class="rounded">
  2390. <div style="margin: 0 0 8px 0;">
  2391. <strong><?php _e ('Custom Hooks', 'ad-inserter'); ?></strong>
  2392. </div>
  2393. <table>
  2394. <tbody>
  2395. <?php
  2396. for ($hook = 1; $hook <= 20; $hook ++) {
  2397. ?>
  2398. <tr>
  2399. <td style="padding: 0 0 2px 0;">
  2400. <input type="hidden" name="hook-enabled-<?php echo $hook; ?>" value="0" />
  2401. <input type="checkbox" name="hook-enabled-<?php echo $hook; ?>" value="1" default="<?php echo AI_DISABLED; ?>" id="hook-enabled-<?php echo $hook; ?>" title="<?php _e ('Enable hook', 'ad-inserter'); ?>" <?php if (get_hook_enabled ($hook) == AI_ENABLED) echo 'checked '; ?> />
  2402. </td>
  2403. <td style="white-space: nowrap;">
  2404. <label for="hook-enabled-<?php echo $hook; ?>" title="<?php _e ('Enable hook', 'ad-inserter'); ?>"><?php /* translators: %d: hook number */ printf (__('Hook %d name', 'ad-inserter'), $hook); ?></label>
  2405. </td>
  2406. <td style="width: 25%;">
  2407. <input style="width: 100%;" title="<?php _e ('Hook name for automatic insertion selection', 'ad-inserter'); ?>" type="text" name="hook-name-<?php echo $hook; ?>" default="" value="<?php echo get_hook_name ($hook); ?>" size="30" maxlength="80" />
  2408. </td>
  2409. <td style="padding-left: 7px;">
  2410. <?php _e ('action', 'ad-inserter'); ?>
  2411. </td>
  2412. <td style="">
  2413. <input style="width: 100%;" title="<?php _e ('Action name as used in the do_action () function', 'ad-inserter'); ?>" type="text" name="hook-action-<?php echo $hook; ?>" default="" value="<?php echo get_hook_action ($hook); ?>" size="30" maxlength="80" />
  2414. </td>
  2415. <td style="padding-left: 7px;">
  2416. <?php _e ('priority', 'ad-inserter'); ?>
  2417. </td>
  2418. <td>
  2419. <input title="<?php _e ('Priority for the hook (default is 10)', 'ad-inserter'); ?>" type="text" name="hook-priority-<?php echo $hook; ?>" default="<?php echo DEFAULT_CUSTOM_HOOK_PRIORITY; ?>" value="<?php echo get_hook_priority ($hook); ?>" size="5" maxlength="9" />
  2420. </td>
  2421. </tr>
  2422. <?php
  2423. }
  2424. ?>
  2425. </tbody>
  2426. </table>
  2427. </div>
  2428. <div id="tab-header" style="margin: 0px 0; padding: 0; ">
  2429. <div style="margin: 8px 0 0; line-height: 24px;">
  2430. <div style="float: right;">
  2431. <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
  2432. <input type="checkbox" value="0" id="simple-editor-h" class="simple-editor-button" style="display: none;" />
  2433. <label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-h" title="<?php _e ('Toggle Syntax Highlighting / Simple editor for mobile devices', 'ad-inserter'); ?>"><span class="checkbox-icon icon-tablet"></span></label>
  2434. <?php endif; ?>
  2435. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" value="0" />
  2436. <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_h'; ?>" id="enable-header" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adH->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2437. <label class="checkbox-button" style="margin-left: 10px;" for="enable-header" title="<?php _e ('Enable insertion of this code into HTML page header', 'ad-inserter'); ?>"><span class="checkbox-icon icon-enabled<?php if ($adH->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2438. <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="0" />
  2439. <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_h'; ?>" value="1" id="process-php-h" default="<?php echo $default->get_process_php (); ?>" <?php if ($adH->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2440. <label class="checkbox-button" style="margin-left: 10px;" for="process-php-h" title="<?php _e ('Process PHP code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-php<?php if ($adH->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2441. </div>
  2442. <div style="vertical-align: sub; display: inline-block;">
  2443. <h3 style="margin: 0;"><?php _e ('HTML Page Header Code', 'ad-inserter'); ?></h3>
  2444. </div>
  2445. <div style="clear: both;"></div>
  2446. </div>
  2447. <div style="width: 100%;">
  2448. <div style="float: left;">
  2449. <?php printf (__('Code in the %s section of the HTML page', 'ad-inserter'), '<pre style="display: inline; color: blue;">&lt;head&gt;&lt;/head&gt;</pre>'); ?>
  2450. <?php if ($header_code_disabled) echo '<span style="color: #f00;">', _x ('NOT ENABLED', 'code in the header', 'ad-inserter'), '</span>'; ?>
  2451. </div>
  2452. <div style="clear: both;"></div>
  2453. </div>
  2454. <div style="margin: 8px 0;">
  2455. <textarea id="block-h" name="<?php echo AI_OPTION_CODE, '_block_h'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: monospace, Courier, 'Courier New'; font-weight: bold;" default=""><?php echo esc_textarea ($adH->get_ad_data()); ?></textarea>
  2456. </div>
  2457. <div id="device-detection-settings-h" class="rounded">
  2458. <table>
  2459. <tbody>
  2460. <tr>
  2461. <td>
  2462. <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" value="0" />
  2463. <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" id="server-side-detection-h" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adH->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
  2464. <label for="server-side-detection-h"><?php _e ('Use server-side detection to insert code only for', 'ad-inserter'); ?> </label>
  2465. <select id="display-for-devices-h" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_HEADER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
  2466. <option value="<?php echo AI_INSERT_FOR_DESKTOP_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_DEVICES; ?></option>
  2467. <option value="<?php echo AI_INSERT_FOR_MOBILE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MOBILE_DEVICES; ?></option>
  2468. <option value="<?php echo AI_INSERT_FOR_TABLET_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_TABLET_DEVICES; ?></option>
  2469. <option value="<?php echo AI_INSERT_FOR_PHONE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHONE_DEVICES; ?></option>
  2470. <option value="<?php echo AI_INSERT_FOR_DESKTOP_TABLET_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_TABLET_DEVICES; ?></option>
  2471. <option value="<?php echo AI_INSERT_FOR_DESKTOP_PHONE_DEVICES; ?>" <?php echo ($adH->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_PHONE_DEVICES; ?></option>
  2472. </select>
  2473. </td>
  2474. </tr>
  2475. <tr>
  2476. <td>
  2477. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" value="0" />
  2478. <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_h'; ?>" id="enable-header-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adH->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
  2479. <label for="enable-header-404" title="<?php _e ('Enable insertion of this code into HTML page header on page for Error 404: Page not found', 'ad-inserter'); ?>"><?php _e ('Insert on Error 404 page', 'ad-inserter'); ?></label>
  2480. </td>
  2481. </tr>
  2482. </tbody>
  2483. </table>
  2484. </div>
  2485. </div>
  2486. <div id="tab-footer" style="margin: 0px 0; padding: 0; ">
  2487. <div style="margin: 8px 0 0; line-height: 24px;">
  2488. <div style="float: right;">
  2489. <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
  2490. <input type="checkbox" value="0" id="simple-editor-f" class="simple-editor-button" style="display: none;" />
  2491. <label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-f" title="<?php _e ('Toggle Syntax Highlighting / Simple editor for mobile devices', 'ad-inserter'); ?>"><span class="checkbox-icon icon-tablet"></span></label>
  2492. <?php endif; ?>
  2493. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" value="0" />
  2494. <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_f'; ?>" id="enable-footer" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adF->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2495. <label class="checkbox-button" style="margin-left: 10px;" for="enable-footer" title="<?php _e ('Enable insertion of this code into HTML page footer', 'ad-inserter'); ?>"><span class="checkbox-icon icon-enabled<?php if ($adF->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2496. <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="0" />
  2497. <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_f'; ?>" value="1" id="process-php-f" default="<?php echo $default->get_process_php (); ?>" <?php if ($adF->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2498. <label class="checkbox-button" style="margin-left: 10px;" for="process-php-f" title="<?php _e ('Process PHP code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-php<?php if ($adF->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2499. </div>
  2500. <div style="vertical-align: sub; display: inline-block;">
  2501. <h3 style="margin: 0;"><?php _e ('HTML Page Footer Code', 'ad-inserter'); ?></h3>
  2502. </div>
  2503. <div style="clear: both;"></div>
  2504. </div>
  2505. <div style="width: 100%;">
  2506. <div style="float: left;">
  2507. <?php /* translators: %s: HTML tags */ printf (__('Code before the %s tag of the the HTML page', 'ad-inserter'), '<pre style="display: inline; color: blue;">&lt;/body&gt;</pre>'); ?>
  2508. <?php if ($footer_code_disabled) echo '<span style="color: #f00;">', _x ('NOT ENABLED', 'code in the footer', 'ad-inserter'), '</span>'; ?>
  2509. </div>
  2510. <div style="clear: both;"></div>
  2511. </div>
  2512. <div style="margin: 8px 0;">
  2513. <textarea id="block-f" name="<?php echo AI_OPTION_CODE, '_block_f'; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: monospace, Courier, 'Courier New'; font-weight: bold;" default=""><?php echo esc_textarea ($adF->get_ad_data()); ?></textarea>
  2514. </div>
  2515. <div id="device-detection-settings-f" class="rounded">
  2516. <table>
  2517. <tbody>
  2518. <tr>
  2519. <td>
  2520. <input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" value="0" />
  2521. <input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" id="server-side-detection-f" value="1" default="<?php echo $default->get_detection_server_side(); ?>" <?php if ($adF->get_detection_server_side ()==AI_ENABLED) echo 'checked '; ?> />
  2522. <label for="server-side-detection-f"><?php _e ('Use server-side detection to insert code only for', 'ad-inserter'); ?> </label>
  2523. <select id="display-for-devices-f" name="<?php echo AI_OPTION_DISPLAY_FOR_DEVICES, WP_FORM_FIELD_POSTFIX, AI_FOOTER_OPTION_NAME; ?>" default="<?php echo $default->get_display_for_devices(); ?>" >
  2524. <option value="<?php echo AI_INSERT_FOR_DESKTOP_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_DEVICES; ?></option>
  2525. <option value="<?php echo AI_INSERT_FOR_MOBILE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_MOBILE_DEVICES; ?></option>
  2526. <option value="<?php echo AI_INSERT_FOR_TABLET_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_TABLET_DEVICES; ?></option>
  2527. <option value="<?php echo AI_INSERT_FOR_PHONE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_PHONE_DEVICES; ?></option>
  2528. <option value="<?php echo AI_INSERT_FOR_DESKTOP_TABLET_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_TABLET_DEVICES; ?></option>
  2529. <option value="<?php echo AI_INSERT_FOR_DESKTOP_PHONE_DEVICES; ?>" <?php echo ($adF->get_display_for_devices() == AI_INSERT_FOR_DESKTOP_PHONE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DESKTOP_PHONE_DEVICES; ?></option>
  2530. </select>
  2531. </td>
  2532. </tr>
  2533. <tr>
  2534. <td>
  2535. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" value="0" />
  2536. <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_404, '_block_f'; ?>" id="enable-footer-404" value="1" default="<?php echo $default->get_enable_404(); ?>" <?php if ($adF->get_enable_404 () == AI_ENABLED) echo 'checked '; ?> />
  2537. <label for="enable-footer-404" title="<?php _e ('Enable insertion of this code into HTML page footer on page for Error 404: Page not found', 'ad-inserter'); ?>"><?php _e ('Insert on Error 404 page', 'ad-inserter'); ?></label>
  2538. </td>
  2539. </tr>
  2540. </tbody>
  2541. </table>
  2542. </div>
  2543. </div>
  2544. <?php if (function_exists ('ai_plugin_settings')) ai_plugin_settings ($start, $end, $exceptions); ?>
  2545. <?php if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) { ?>
  2546. <div id="tab-adblocking" style="margin: 0; padding: 0;">
  2547. <div style="margin: 8px 0; line-height: 24px;">
  2548. <div style="float: right;">
  2549. <?php if ($adA->get_enable_manual () == AI_ENABLED): ?>
  2550. <span class="ai-toolbar-button text" title='<?php _e ('Code for ad blocking detection inserted. Click for details.', 'ad-inserter'); ?>' style='display: inline-block; font-size: 20px; vertical-align: bottom; padding: 0;'><a href="https://adinserter.pro/documentation/ad-blocking-detection#detection" class="clear-link" target="_blank">&#x26A0;</a></span>
  2551. <?php endif; ?>
  2552. <input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" value="0" />
  2553. <input type="checkbox" name="<?php echo AI_OPTION_ENABLE_MANUAL, '_block_a'; ?>" id="enable-adb-detection" value="1" default="<?php echo $default->get_enable_manual(); ?>" <?php if ($adA->get_enable_manual () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2554. <label class="checkbox-button" style="margin-left: 10px;" for="enable-adb-detection" title="<?php _e ('Enable detection of ad blocking', 'ad-inserter'); ?>"><span class="checkbox-icon icon-enabled<?php if ($adA->get_enable_manual () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2555. </div>
  2556. <div style="vertical-align: sub; display: inline-block;">
  2557. <h3 style="margin: 0; display: inline-block;"><?php _e ('Ad Blocking Detection', 'ad-inserter'); ?></h3>
  2558. <?php if (!$enabled_a && $adb_action != AI_ADB_ACTION_NONE) echo '<span style="color: #f00;"> &nbsp; ', _x ('NOT ENABLED', 'ad blocking detection', 'ad-inserter'), '</span>'; ?>
  2559. </div>
  2560. <div style="clear: both;"></div>
  2561. </div>
  2562. <div class="rounded" style="margin: 8px 0 8px;">
  2563. <table class="ai-settings-table" style="width: 100%;" cellpadding="0">
  2564. <tr>
  2565. <td style="width: 25%;">
  2566. <label for="adb-action"><?php _e ('Action', 'ad-inserter'); ?></label>
  2567. </td>
  2568. <td>
  2569. <select id="adb-action" name="<?php echo AI_OPTION_ADB_ACTION; ?>" title="<?php _e ('Global action when ad blocking is detected', 'ad-inserter'); ?>" default="<?php echo AI_DEFAULT_ADB_ACTION; ?>" >
  2570. <option value="<?php echo AI_ADB_ACTION_NONE; ?>" <?php echo ($adb_action == AI_ADB_ACTION_NONE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NONE; ?></option>
  2571. <option value="<?php echo AI_ADB_ACTION_MESSAGE; ?>" <?php echo ($adb_action == AI_ADB_ACTION_MESSAGE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_POPUP_MESSAGE; ?></option>
  2572. <option value="<?php echo AI_ADB_ACTION_REDIRECTION; ?>" <?php echo ($adb_action == AI_ADB_ACTION_REDIRECTION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_REDIRECTION; ?></option>
  2573. </select>
  2574. <span style="float: right">
  2575. <span style="vertical-align: middle;"><?php _e ('No action for', 'ad-inserter'); ?></span>
  2576. <select id="adb-no-action" name="<?php echo AI_OPTION_ADB_NO_ACTION; ?>" title="<?php _e ('Exceptions for global action when ad blocking is detected.', 'ad-inserter'); ?>" default="<?php echo AI_DEFAULT_ADB_NO_ACTION; ?>" >
  2577. <option value="<?php echo AI_ADB_NO_ACTION_NONE; ?>" <?php echo ($adb_no_action == AI_ADB_NO_ACTION_NONE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>> </option>
  2578. <option value="<?php echo AI_ADB_NO_ACTION_LOGGED_IN; ?>" <?php echo ($adb_no_action == AI_ADB_NO_ACTION_LOGGED_IN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_LOGGED_IN_USERS; ?></option>
  2579. <option value="<?php echo AI_ADB_NO_ACTION_ADMINISTRATORS; ?>" <?php echo ($adb_no_action == AI_ADB_NO_ACTION_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_ADMINISTRATORS; ?></option>
  2580. </select>
  2581. </span>
  2582. </td>
  2583. </tr>
  2584. <tr>
  2585. <td>
  2586. <?php _e ('Delay Action', 'ad-inserter'); ?>
  2587. </td>
  2588. <td>
  2589. <input style="width: 60px;" type="text" name="<?php echo AI_OPTION_ADB_DELAY_ACTION; ?>" title="<?php _e ('Number of page views to delay action when ad blocking is detected. Leave empty for no delay (action fires on first page view). Sets cookie.', 'ad-inserter'); ?>" value="<?php echo get_delay_action (); ?>" default="" size="3" maxlength="8" /> <?php _ex ('page views', 'Delay Action for x ', 'ad-inserter'); ?>
  2590. </td>
  2591. </tr>
  2592. <tr>
  2593. <td>
  2594. <?php _e ('No Action Period', 'ad-inserter'); ?>
  2595. </td>
  2596. <td>
  2597. <input style="width: 60px;" type="text" name="<?php echo AI_OPTION_ADB_NO_ACTION_PERIOD; ?>" title="<?php _e ('Number of days to supress action when ad blocking is detected. Leave empty for no no-action period (action fires always after defined page view delay). Sets cookie.', 'ad-inserter'); ?>" value="<?php echo get_no_action_period (); ?>" default="<?php echo AI_DEFAULT_ADB_NO_ACTION_PERIOD; ?>" size="3" maxlength="5" /> <?php _ex ('days', 'no action period', 'ad-inserter'); ?>
  2598. </td>
  2599. </tr>
  2600. <tr>
  2601. <td>
  2602. <?php _e ('Custom Selectors', 'ad-inserter'); ?>
  2603. </td>
  2604. <td>
  2605. <input id="custom-selectors" style="width: 95%;" type="text" name="<?php echo AI_OPTION_ADB_SELECTORS; ?>" title="<?php _e ('Comma seprarated list of selectors (.class, #id) used for additional ad blocking detection. Invisible element or element with zero height means ad blocking is present.', 'ad-inserter'); ?>" value="<?php echo get_adb_selectors (); ?>" default="" size="50" maxlength="200" />
  2606. <button id="custom-selectors-button" type="button" class='ai-button ai-button-small' style="display: none; outline: transparent; float: right; margin-top: 4px; width: 15px; height: 15px;" title="<?php _e ('Open HTML element selector', 'ad-inserter'); ?>"></button>
  2607. </td>
  2608. </tr>
  2609. <?php if (function_exists ('ai_adb_settings')) ai_adb_settings (); ?>
  2610. </table>
  2611. </div>
  2612. <div id="adb-page-redirection" class="rounded">
  2613. <table class="ai-settings-table" style="width: 100%;">
  2614. <tr>
  2615. <td style="width: 25%;">
  2616. <label for="redirection-page"><?php _e ('Redirection Page', 'ad-inserter'); ?></label>
  2617. </td>
  2618. <td>
  2619. <?php
  2620. $args = array(
  2621. 'depth' => 0,
  2622. 'child_of' => 0,
  2623. 'selected' => get_redirection_page (true),
  2624. 'echo' => 0,
  2625. 'name' => AI_OPTION_ADB_REDIRECTION_PAGE,
  2626. 'id' => 'redirection-page',
  2627. 'class' => null,
  2628. 'show_option_none' => __('Custom Url', 'ad-inserter'),
  2629. 'show_option_no_change' => null,
  2630. 'option_none_value' => '0',
  2631. );
  2632. $dropdown_pages = wp_dropdown_pages ($args);
  2633. $dropdown_title = __ ('Static page for redirection when ad blocking is detected. For other pages select Custom url and set it below.', 'ad-inserter');
  2634. $dropdown_pages = str_replace ('<select ', '<select default="'.AI_DEFAULT_ADB_REDIRECTION_PAGE.'" title="'.$dropdown_title.'" ', $dropdown_pages);
  2635. echo $dropdown_pages;
  2636. ?>
  2637. </td>
  2638. </tr>
  2639. <tr>
  2640. <td>
  2641. <?php _e ('Custom Redirection Url', 'ad-inserter'); ?>
  2642. </td>
  2643. <td>
  2644. <input id="custom-redirection-url" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_CUSTOM_REDIRECTION_URL; ?>" value="<?php echo get_custom_redirection_url (); ?>" default="" size="50" maxlength="200" />
  2645. </td>
  2646. </tr>
  2647. </table>
  2648. </div>
  2649. <div id="adb-message">
  2650. <div style="padding: 0; min-height: 28px;">
  2651. <div style="float: left; margin: 10px 0 0 3px;">
  2652. <?php _e ('Message HTML code', 'ad-inserter'); ?>
  2653. </div>
  2654. <div style="float: right;">
  2655. <?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
  2656. <input type="checkbox" value="0" id="simple-editor-a" class="simple-editor-button" style="display: none;" />
  2657. <label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-a" title="<?php _e ('Toggle Syntax Highlighting / Simple editor for mobile devices', 'ad-inserter'); ?>"><span class="checkbox-icon icon-tablet"></span></label>
  2658. <?php endif; ?>
  2659. <input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="0" />
  2660. <input type="checkbox" name="<?php echo AI_OPTION_PROCESS_PHP, '_block_a'; ?>" value="1" id="process-php-a" default="<?php echo $default->get_process_php (); ?>" <?php if ($adA->get_process_php () == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2661. <label class="checkbox-button" style="margin-left: 10px;" for="process-php-a" title="<?php _e ('Process PHP code', 'ad-inserter'); ?>"><span class="checkbox-icon icon-php<?php if ($adA->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
  2662. <button id="preview-button-adb" type="button" class='ai-button' style="display: none; margin: 0 4px 0 10px;" title="<?php _e ('Preview message when ad blocking is detected', 'ad-inserter'); ?>" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>"><?php _e ('Preview', 'ad-inserter'); ?></button>
  2663. </div>
  2664. <div style="clear: both;"></div>
  2665. </div>
  2666. <div style="margin: 8px 0;">
  2667. <textarea id="block-a" name="<?php echo AI_OPTION_CODE, '_block_a'; ?>" class="simple-editor small" style="background-color:#F9F9F9; font-family: monospace, Courier, 'Courier New'; font-weight: bold;" default="<?php echo esc_textarea (AI_DEFAULT_ADB_MESSAGE); ?>"><?php echo esc_textarea ($adA->get_ad_data()); ?></textarea>
  2668. </div>
  2669. <div class="rounded">
  2670. <table class="ai-settings-table" style="width: 100%;">
  2671. <tr>
  2672. <td style="width: 20%;">
  2673. <?php _e ('Message CSS', 'ad-inserter'); ?>
  2674. </td>
  2675. <td>
  2676. <input id="message-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_MESSAGE_CSS; ?>" value="<?php echo get_message_css (); ?>" default="<?php echo AI_DEFAULT_ADB_MESSAGE_CSS; ?>" size="50" maxlength="200" />
  2677. </td>
  2678. </tr>
  2679. <tr>
  2680. <td>
  2681. <?php _e ('Overlay CSS', 'ad-inserter'); ?>
  2682. </td>
  2683. <td>
  2684. <input id="overlay-css" style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_OVERLAY_CSS; ?>" value="<?php echo get_overlay_css (); ?>" default="<?php echo AI_DEFAULT_ADB_OVERLAY_CSS; ?>" size="50" maxlength="200" />
  2685. </td>
  2686. </tr>
  2687. <tr>
  2688. <td>
  2689. <label for="undismissible-message" title="<?php _e ('Prevent visitors from closing the warning message', 'ad-inserter'); ?>"><?php _e ('Undismissible Message', 'ad-inserter'); ?></label>
  2690. </td>
  2691. <td>
  2692. <input type="hidden" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" value="0" />
  2693. <input type="checkbox" name="<?php echo AI_OPTION_ADB_UNDISMISSIBLE_MESSAGE; ?>" id="undismissible-message" value="1" default="<?php echo AI_DEFAULT_ADB_UNDISMISSIBLE_MESSAGE; ?>" <?php if (get_undismissible_message (true) == AI_ENABLED) echo 'checked '; ?> />
  2694. <span style="float: right">
  2695. <span style="vertical-align: middle;"><?php _e ('Not undismissible for', 'ad-inserter'); ?></span>
  2696. <select id="not-undismissible" name="<?php echo AI_OPTION_ADB_NO_UNDISMISSIBLE_MESSAGE; ?>" title="<?php _e ('Users which can close the warning message.', 'ad-inserter'); ?>" default="<?php echo AI_DEFAULT_ADB_NO_UNDISMISSIBLE_MESSAGE; ?>" >
  2697. <option value="<?php echo AI_ADB_NO_ACTION_NONE; ?>" <?php echo ($no_undismissible_message == AI_ADB_NO_ACTION_NONE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>> </option>
  2698. <option value="<?php echo AI_ADB_NO_ACTION_LOGGED_IN; ?>" <?php echo ($no_undismissible_message == AI_ADB_NO_ACTION_LOGGED_IN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_LOGGED_IN_USERS; ?></option>
  2699. <option value="<?php echo AI_ADB_NO_ACTION_ADMINISTRATORS; ?>" <?php echo ($no_undismissible_message == AI_ADB_NO_ACTION_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISPLAY_ADMINISTRATORS; ?></option>
  2700. </select>
  2701. </span>
  2702. </td>
  2703. </tr>
  2704. </table>
  2705. </div>
  2706. </div>
  2707. </div>
  2708. <?php }
  2709. $d1 = __ ("Force showing admin toolbar for administrators when viewing site. Enable this option when you are logged in as admin and you don't see admin toolbar.", 'ad-inserter');
  2710. // Preview of client-side dynamic blocks
  2711. ?>
  2712. <div id="tab-debugging" style="margin: 0; padding: 0;">
  2713. <div style="margin: 8px 0; line-height: 24px;">
  2714. <div style="float: right;">
  2715. <input type="hidden" name="disable-header-code" value="0" />
  2716. <input type="checkbox" name="disable-header-code" value="1" id="disable-header-code" default="<?php echo DEFAULT_DISABLE_HEADER_CODE; ?>" <?php if ($disable_header_code == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2717. <label class="checkbox-button" style="margin-left: 10px;" for="disable-header-code" title="<?php _e ('Disable header code (Header tab)', 'ad-inserter'); ?>"><span class="checkbox-icon icon-h<?php if ($disable_header_code == AI_ENABLED) echo ' on'; ?>"></span></label>
  2718. <input type="hidden" name="disable-footer-code" value="0" />
  2719. <input type="checkbox" name="disable-footer-code" value="1" id="disable-footer-code" default="<?php echo DEFAULT_DISABLE_FOOTER_CODE; ?>" <?php if ($disable_footer_code == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2720. <label class="checkbox-button" style="margin-left: 10px;" for="disable-footer-code" title="<?php _e ('Disable footer code (Footer tab)', 'ad-inserter'); ?>"><span class="checkbox-icon icon-f<?php if ($disable_footer_code == AI_ENABLED) echo ' on'; ?>"></span></label>
  2721. <input type="hidden" name="disable-js-code" value="0" />
  2722. <input type="checkbox" name="disable-js-code" value="1" id="disable-js-code" default="<?php echo DEFAULT_DISABLE_JS_CODE; ?>" <?php if ($disable_js_code == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2723. <label class="checkbox-button" style="margin-left: 10px;" for="disable-js-code" title="<?php /* translators: %s: Ad Inserter */ printf (__ ('Disable %s JavaScript code', 'ad-inserter'), AD_INSERTER_NAME); ?>"><span class="checkbox-icon icon-js<?php if ($disable_js_code == AI_ENABLED) echo ' on'; ?>"></span></label>
  2724. <input type="hidden" name="disable-css-code" value="0" />
  2725. <input type="checkbox" name="disable-css-code" value="1" id="disable-css-code" default="<?php echo DEFAULT_DISABLE_CSS_CODE; ?>" <?php if ($disable_css_code == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2726. <label class="checkbox-button" style="margin-left: 10px;" for="disable-css-code" title="<?php /* translators: %s: Ad Inserter */ printf (__ ('Disable %s CSS code', 'ad-inserter'), AD_INSERTER_NAME); ?>"><span class="checkbox-icon icon-css<?php if ($disable_css_code == AI_ENABLED) echo ' on'; ?>"></span></label>
  2727. <input type="hidden" name="disable-html-code" value="0" />
  2728. <input type="checkbox" name="disable-html-code" value="1" id="disable-html-code" default="<?php echo DEFAULT_DISABLE_HTML_CODE; ?>" <?php if ($disable_html_code == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2729. <label class="checkbox-button" style="margin-left: 10px;" for="disable-html-code" title="<?php /* translators: %s: Ad Inserter */ printf (__ ('Disable %s HTML code', 'ad-inserter'), AD_INSERTER_NAME); ?>"><span class="checkbox-icon icon-html<?php if ($disable_html_code == AI_ENABLED) echo ' on'; ?>"></span></label>
  2730. <input type="hidden" name="disable-php-processing" value="0" />
  2731. <input type="checkbox" name="disable-php-processing" value="1" id="disable-php-processing" default="<?php echo DEFAULT_DISABLE_PHP_PROCESSING; ?>" <?php if ($disable_php_processing == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2732. <label class="checkbox-button" style="margin-left: 10px;" for="disable-php-processing" title="<?php _e ('Disable PHP code processing (in all blocks including header and footer code)', 'ad-inserter'); ?>"><span class="checkbox-icon icon-php-red<?php if ($disable_php_processing == AI_ENABLED) echo ' on'; ?>"></span></label>
  2733. <input type="hidden" name="disable-blocks" value="0" />
  2734. <input type="checkbox" name="disable-blocks" value="1" id="disable-blocks" default="<?php echo DEFAULT_DISABLE_BLOCK_INSERTIONS; ?>" <?php if ($disable_block_insertions == AI_ENABLED) echo 'checked '; ?> style="display: none;" />
  2735. <label class="checkbox-button" style="margin-left: 10px;" for="disable-blocks" title="<?php _e ('Disable insertion of all blocks', 'ad-inserter'); ?>"><span class="checkbox-icon icon-pause<?php if ($disable_block_insertions == AI_ENABLED) echo ' on'; ?>"></span></label>
  2736. </div>
  2737. <div style="vertical-align: sub; display: inline-block;">
  2738. <h3 style="margin: 0"><?php _e ('Disable insertions', 'ad-inserter'); ?></h3>
  2739. </div>
  2740. <div style="clear: both;"></div>
  2741. </div>
  2742. <div class="rounded" style="margin: 8px 0 8px;">
  2743. <pre class="ai-page-code">
  2744. &lt;html&gt;
  2745. &lt;head&gt;
  2746. ...
  2747. <span id="ai-page-css"<?php if ($disable_css_code) echo ' class="ai-page-code-disabled"'; ?>>&lt;style&gt;
  2748. <?php /* translators: %s: Ad Inserter */ printf (__ ('%s CSS CODE', 'ad-inserter'), strtoupper (AD_INSERTER_NAME)); ?>
  2749. &lt;/style&gt;</span>
  2750. <span id="ai-page-header"<?php if ($disable_header_code) echo ' class="ai-page-code-disabled"'; ?>><?php _e ('HEADER CODE', 'ad-inserter'); ?></span>
  2751. &lt;/head&gt;
  2752. &lt;body&gt;
  2753. ...
  2754. <span id="ai-page-block"<?php if ($disable_block_insertions) echo ' class="ai-page-code-disabled"'; ?>><?php echo ai_block_code_demo ($block_class_name, $block_class, $block_number_class, $block_name_class, $inline_styles); ?>
  2755. <span id="ai-page-php"<?php if ($disable_php_processing) echo ' class="ai-page-code-disabled"'; ?>>&lt;?php <?php /* translators: %s: PHP tags */ printf (__ ('BLOCK PHP CODE', 'ad-inserter'), '', ''); ?> ?&gt;</span>
  2756. <?php _e ('BLOCK CODE', 'ad-inserter'); ?>
  2757. &lt;/div&gt;</span>
  2758. ...
  2759. <span id="ai-page-html"<?php if ($disable_html_code) echo ' class="ai-page-code-disabled"'; ?>>&lt;span&gt;<?php /* translators: %s: Ad Inserter */ printf (__ ('%s HTML CODE', 'ad-inserter'), strtoupper (AD_INSERTER_NAME)); ?>&lt;/span&gt;</span>
  2760. <span id="ai-page-js"<?php if ($disable_js_code) echo ' class="ai-page-code-disabled"'; ?>>&lt;script&gt;
  2761. <?php /* translators: %s: Ad Inserter */ printf (__ ('%s JS CODE', 'ad-inserter'), strtoupper (AD_INSERTER_NAME)); ?>
  2762. &lt;/script&gt;</span>
  2763. <span id="ai-page-footer"<?php if ($disable_footer_code) echo ' class="ai-page-code-disabled"'; ?>><?php _e ('FOOTER CODE', 'ad-inserter'); ?></span>
  2764. &lt;/body&gt;
  2765. &lt;/html&gt;</pre>
  2766. </div>
  2767. <div class="rounded" style="margin: 8px 0 8px;">
  2768. <table class="ai-settings-table" style="width: 100%;">
  2769. <tr title="<?php echo $d1; ?>">
  2770. <td style="width: 45%;">
  2771. <label for="force-admin-toolbar"><?php _e ('Force showing admin toolbar when viewing site', 'ad-inserter'); ?></label>
  2772. </td>
  2773. <td>
  2774. <input type="hidden" name="force_admin_toolbar" value="0" />
  2775. <input type="checkbox" name="force_admin_toolbar" id="force-admin-toolbar" value="1" default="<?php echo DEFAULT_FORCE_ADMIN_TOOLBAR; ?>" <?php if (get_force_admin_toolbar () == AI_ENABLED) echo 'checked '; ?> />
  2776. </td>
  2777. </tr>
  2778. <tr title="<?php _e ('Enable debugging functions in admin toolbar', 'ad-inserter'); ?>">
  2779. <td>
  2780. <label for="admin-toolbar-debugging"><?php _e ('Debugging functions in admin toolbar', 'ad-inserter'); ?></label>
  2781. </td>
  2782. <td>
  2783. <input type="hidden" name="admin_toolbar_debugging" value="0" />
  2784. <input type="checkbox" name="admin_toolbar_debugging" id="admin-toolbar-debugging" value="1" default="<?php echo DEFAULT_ADMIN_TOOLBAR_DEBUGGING; ?>" <?php if (get_admin_toolbar_debugging ()==AI_ENABLED) echo 'checked '; ?> />
  2785. </td>
  2786. </tr>
  2787. <tr title="<?php _e ('Enable debugging functions in admin toolbar on mobile screens', 'ad-inserter'); ?>">
  2788. <td>
  2789. <label for="admin-toolbar-mobile"><?php _e ('Debugging functions on mobile screens', 'ad-inserter'); ?></label>
  2790. </td>
  2791. <td>
  2792. <input type="hidden" name="admin_toolbar_mobile" value="0" />
  2793. <input type="checkbox" name="admin_toolbar_mobile" id="admin-toolbar-mobile" value="1" default="<?php echo DEFAULT_ADMIN_TOOLBAR_MOBILE; ?>" <?php if (get_admin_toolbar_mobile ()==AI_ENABLED) echo 'checked '; ?> />
  2794. </td>
  2795. </tr>
  2796. <tr title="<?php _e ('Enable Debugger widget and code insertion debugging (blocks, positions, tags, processing) by url parameters for non-logged in users. Enable this option to allow other users to see Debugger widget, labeled blocks and positions in order to help you to diagnose problems. For logged in administrators debugging is always enabled.', 'ad-inserter'); ?>">
  2797. <td>
  2798. <label for="remote-debugging"><?php _e ('Remote debugging', 'ad-inserter'); ?></label>
  2799. </td>
  2800. <td>
  2801. <input type="hidden" name="remote_debugging" value="0" />
  2802. <input type="checkbox" name="remote_debugging" id="remote-debugging" value="1" default="<?php echo DEFAULT_REMOTE_DEBUGGING; ?>" <?php if (get_remote_debugging ()==AI_ENABLED) echo 'checked '; ?> />
  2803. </td>
  2804. </tr>
  2805. <tr title="Disable translation - <?php _e ('Disable translation to see original texts for the settings and messages in English', 'ad-inserter'); ?>">
  2806. <td>
  2807. <label for="disable-translation"><?php _e ('Disable translation', 'ad-inserter'); ?></label>
  2808. </td>
  2809. <td>
  2810. <input type="hidden" name="disable_translation" value="0" />
  2811. <input type="checkbox" name="disable_translation" id="disable-translation" value="1" default="<?php echo DEFAULT_DISABLE_TRANSLATION; ?>" <?php if (get_disable_translation ()==AI_ENABLED) echo 'checked '; ?> />
  2812. </td>
  2813. </tr>
  2814. <tr class="system-debugging" style="display: none;">
  2815. <td>
  2816. <label for="backend-js-debugging" title="Enable backend javascript console output">Backend javascript debugging</label>
  2817. </td>
  2818. <td>
  2819. <input type="hidden" name="backend_js_debugging" value="0" />
  2820. <input type="checkbox" name="backend_js_debugging" id="backend-js-debugging" value="1" default="<?php echo DEFAULT_BACKEND_JS_DEBUGGING; ?>" <?php if (get_backend_javascript_debugging ()==AI_ENABLED) echo 'checked '; ?> />
  2821. </td>
  2822. </tr>
  2823. <tr class="system-debugging" style="display: none;">
  2824. <td>
  2825. <label for="frontend-js-debugging" title="Enable frontend javascript console output">Frontend javascript debugging</label>
  2826. </td>
  2827. <td>
  2828. <input type="hidden" name="frontend_js_debugging" value="0" />
  2829. <input type="checkbox" name="frontend_js_debugging" id="frontend-js-debugging" value="1" default="<?php echo DEFAULT_FRONTEND_JS_DEBUGGING; ?>" <?php if (get_frontend_javascript_debugging ()==AI_ENABLED) echo 'checked '; ?> />
  2830. </td>
  2831. </tr>
  2832. <tr class="system-debugging" style="display: none;">
  2833. <td>
  2834. Installation
  2835. </td>
  2836. <td>
  2837. <?php echo ($install_timestamp = get_option (AI_INSTALL_NAME)) !== false ? date ("Y-m-d H:i:s", $install_timestamp + get_option ('gmt_offset') * 3600) : ""; ?>
  2838. </td>
  2839. </tr>
  2840. <tr class="system-debugging" style="display: none;">
  2841. <td>
  2842. Age
  2843. </td>
  2844. <td>
  2845. <?php if (isset ($ai_wp_data [AI_INSTALL_TIME_DIFFERENCE])) printf ('%04d-%02d-%02d %02d:%02d:%02d (%d days)',
  2846. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->y,
  2847. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->m,
  2848. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->d,
  2849. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->h,
  2850. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->i,
  2851. $ai_wp_data [AI_INSTALL_TIME_DIFFERENCE]->s,
  2852. isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL]) ? $ai_wp_data [AI_DAYS_SINCE_INSTAL] : null); ?>
  2853. </td>
  2854. </tr>
  2855. <!-- <tr class="system-debugging" style="display: none;">-->
  2856. <!-- <td>-->
  2857. <!-- Used blocks-->
  2858. <!-- </td>-->
  2859. <!-- <td>-->
  2860. <!-- <?php if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) echo count ($used_blocks), ' (', implode (', ', array_slice ($used_blocks, 0, 22)), count ($used_blocks) > 22 ? ',...' : '', ')'; ?>-->
  2861. <!-- </td>-->
  2862. <!-- </tr>-->
  2863. <?php if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) { ?>
  2864. <tr class="system-debugging" style="display: none;">
  2865. <td>
  2866. Tracking
  2867. </td>
  2868. <td>
  2869. <?php global $ai_dst; echo $ai_dst->get_tracking () ? 'on' : 'off'; ?>
  2870. </td>
  2871. </tr>
  2872. <?php } ?>
  2873. <tr class="system-debugging" style="display: none;">
  2874. <td>
  2875. Review
  2876. </td>
  2877. <td>
  2878. <?php echo get_option ('ai-notice-review'); ?>
  2879. </td>
  2880. </tr>
  2881. <?php if (function_exists ('ai_system_debugging')) ai_system_debugging (); ?>
  2882. </table>
  2883. </div>
  2884. </div>
  2885. </div>
  2886. </div> <!-- tab-0 -->
  2887. </div> <!-- ai-tab-container -->
  2888. <?php if (!isset ($_GET ['settings'])): // start of code only for normal settings ?>
  2889. </div> <!-- ai-container -->
  2890. <img id="ai-dummy-1" src="<?php echo AD_INSERTER_PLUGIN_URL, 'css/images/'; ?>blank.png" style="width: 1px; height: 1px; display: block; margin-top: -1px;" />
  2891. <?php
  2892. $sidebar = 0;
  2893. $number_of_used_blocks = count ($used_blocks);
  2894. if (isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL])) {
  2895. if ($ai_wp_data [AI_DAYS_SINCE_INSTAL] > 2)
  2896. $sidebar = 1;
  2897. if ($number_of_used_blocks >= 4 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 5 ||
  2898. $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 10)
  2899. $sidebar = 2;
  2900. if ($number_of_used_blocks >= 12 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 7 ||
  2901. $number_of_used_blocks >= 8 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 10 ||
  2902. $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 15)
  2903. $sidebar = 3;
  2904. if ($ai_wp_data [AI_DAYS_SINCE_INSTAL] > 20)
  2905. $sidebar = 4;
  2906. } else {
  2907. if ($number_of_used_blocks >= 1) $sidebar = 4;
  2908. }
  2909. // $sidebar = 0;
  2910. if (!function_exists ('ai_settings_side')) {
  2911. switch ($sidebar) {
  2912. case 0:
  2913. break;
  2914. case 1:
  2915. break;
  2916. case 2:
  2917. sidebar_addense_alternative ();
  2918. break;
  2919. case 3:
  2920. sidebar_support_review ();
  2921. sidebar_addense_alternative ();
  2922. break;
  2923. case 4:
  2924. sidebar_addense_alternative ();
  2925. break;
  2926. }
  2927. }
  2928. ?>
  2929. <input id="ai-active-tab" type="hidden" name="ai-active-tab" value="[<?php echo $active_tab, ',', $active_tab_0; ?>]" />
  2930. <?php wp_nonce_field ('save_adinserter_settings'); ?>
  2931. </form>
  2932. </div> <!-- #ai-settings -->
  2933. <div id="ai-sidebar" style="float: left;">
  2934. <?php
  2935. if ($subpage == 'main') {
  2936. page_checker_container ();
  2937. ads_txt_container ();
  2938. if (defined ('AI_ADSENSE_API')) {
  2939. adsense_list_container ();
  2940. }
  2941. code_block_list_container ($start, $end, $active_tab);
  2942. if (function_exists ('ai_settings_side')) {
  2943. ai_settings_side ();
  2944. } else {
  2945. switch ($sidebar) {
  2946. case 0:
  2947. sidebar_help ();
  2948. // sidebar_pro ();
  2949. break;
  2950. case 1:
  2951. // sidebar_support_plugin ();
  2952. sidebar_help ();
  2953. sidebar_pro ();
  2954. break;
  2955. case 2:
  2956. // sidebar_support_plugin ();
  2957. sidebar_help ();
  2958. sidebar_pro ();
  2959. break;
  2960. case 3:
  2961. // sidebar_support_plugin ();
  2962. sidebar_help ();
  2963. sidebar_pro ();
  2964. break;
  2965. case 4:
  2966. // sidebar_support_plugin ();
  2967. sidebar_support_review ();
  2968. sidebar_help ();
  2969. sidebar_pro ();
  2970. break;
  2971. }
  2972. }
  2973. }
  2974. ?>
  2975. <img id="ai-dummy-2" src="<?php echo AD_INSERTER_PLUGIN_URL, 'css/images/'; ?>blank.png" style="width: 1px; height: 1px; display: block; margin-top: -1px;" />
  2976. </div>
  2977. <script type="text/javascript">
  2978. jQuery(document).ready(function($) {
  2979. setTimeout (check_blocked_images, 400);
  2980. });
  2981. function check_blocked_images () {
  2982. function replace_blocked_image (image_id, image_src, css_display) {
  2983. var image_selector = "#" + image_id;
  2984. if (jQuery (image_selector).length && !jQuery(image_selector + ":visible").length) {
  2985. blocking_counter ++;
  2986. if (image_src != '') {
  2987. var image = jQuery(image_selector);
  2988. image.hide ().after (image.clone ().attr ('class', '').attr ("id", image_id + '-ajax').
  2989. attr ('src', ajaxurl+'?action=ai_ajax_backend&image=' + image_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>').
  2990. css ('display', css_display));
  2991. }
  2992. }
  2993. }
  2994. function replace_blocked_css (css_id, css_src) {
  2995. var css_selector = "#" + css_id;
  2996. if (jQuery (css_selector).length) {
  2997. var css = jQuery(css_selector);
  2998. css.after (css.clone ().attr ("id", css_id + '-ajax').
  2999. attr ('href', ajaxurl+'?action=ai_ajax_backend&css=' + css_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>'));
  3000. }
  3001. }
  3002. function replace_blocked_js (js_src) {
  3003. // var js_selector = 'script[src*="'+js_src+'"]';
  3004. // if (jQuery (js_selector).length) {
  3005. // var js = jQuery(js_selector);
  3006. // console.log ('src', ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>');
  3007. // js.after (js.clone ().attr ('src', ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>'));
  3008. // }
  3009. var script = ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>';
  3010. jQuery.getScript (script, function (data, textStatus, jqxhr) {
  3011. // console.log( data ); // Data returned
  3012. // console.log( textStatus ); // Success
  3013. // console.log( jqxhr.status ); // 200
  3014. // console.log( "Load was performed." );
  3015. // }).fail(function( jqxhr, settings, exception ) {
  3016. // console.log ('FAIL');
  3017. // console.log( jqxhr ); // Data returned
  3018. // console.log( settings ); // Success
  3019. // console.log( exception ); // 200
  3020. });
  3021. }
  3022. function show_warining () {
  3023. jQuery("#blocked-warning").attr ('title', message).show ();
  3024. jQuery("#blocked-warning .blocked-warning-text").css ('color', '#00f');
  3025. }
  3026. jQuery("#blocked-warning.warning-enabled").show ();
  3027. jQuery("#blocked-warning.warning-enabled .blocked-warning-text").css ('color', '#00f');
  3028. var blocking_counter = 0;
  3029. <?php
  3030. if (!function_exists ('ai_settings_side')) {
  3031. ?>
  3032. replace_blocked_image ('ai-media-1', 'contextual-1.gif', 'block');
  3033. replace_blocked_image ('ai-media-2', 'contextual-2.jpg', 'block');
  3034. replace_blocked_image ('ai-media-3', 'contextual-3.png', 'block');
  3035. replace_blocked_image ('ai-media-4', 'contextual-4.gif', 'block');
  3036. replace_blocked_image ('ai-media-5', 'contextual-5.png', 'block');
  3037. replace_blocked_image ('ai-media-6', 'contextual-6.gif', 'block');
  3038. replace_blocked_image ('ai-media-7', 'contextual-7.gif', 'block');
  3039. replace_blocked_image ('ai-media-8', 'contextual-8.gif', 'block');
  3040. replace_blocked_image ('ai-media-9', 'contextual-9.jpg', 'block');
  3041. replace_blocked_image ('ai-info-1', 'info-1.jpg', 'block');
  3042. replace_blocked_image ('ai-info-2', 'info-2.jpg', 'block');
  3043. replace_blocked_image ('ai-info-3', 'info-3.jpg', 'block');
  3044. replace_blocked_image ('ai-ez-1', 'ez-1.jpg', 'block');
  3045. replace_blocked_image ('ai-ez-2', 'ez-2.jpg', 'block');
  3046. replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg', 'block');
  3047. replace_blocked_image ('ai-pro-2', 'ai-charts-250.png', 'block');
  3048. replace_blocked_image ('ai-pro-3', 'ai-countries-250.png', 'block');
  3049. replace_blocked_image ('ai-preview', 'ai-preview-250.png', 'block');
  3050. replace_blocked_image ('ai-adb', 'ai-adb.png', 'block');
  3051. replace_blocked_image ('ai-amp', 'ai-amp.png', 'block');
  3052. replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
  3053. <?php
  3054. } else {
  3055. ?>
  3056. replace_blocked_image ('ai-dummy-1', '', '');
  3057. replace_blocked_image ('ai-dummy-2', '', '');
  3058. <?php
  3059. }
  3060. ?>
  3061. if (blocking_counter >= 2) {
  3062. var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
  3063. console.log ('AI AD BLOCKING:', blocking_counter, 'images not loaded');
  3064. show_warining ();
  3065. setTimeout (function() {
  3066. show_warining ();
  3067. }, 2000);
  3068. setTimeout (function() {
  3069. show_warining ();
  3070. }, 5000);
  3071. // replace_blocked_image ('ai-loading', 'loading.gif', 'block'); // new ids not used in js
  3072. // replace_blocked_image ('ai-loading-2', 'loading.gif', 'block');
  3073. replace_blocked_css ('ai-admin-css', 'ai-settings.css');
  3074. replace_blocked_css ('ai-admin-jquery-ui-css', 'jquery-ui-1.10.3.custom.min.css');
  3075. replace_blocked_css ('ai-admin-flags-css', 'flags.css');
  3076. replace_blocked_css ('ai-admin-multi-select-css', 'multi-select.css');
  3077. replace_blocked_css ('ai-image-picker-css', 'image-picker.css');
  3078. replace_blocked_css ('ai-combobox-css-css', 'jquery.scombobox.min.css');
  3079. replace_blocked_css ('ai-admin-gen-css', 'ai-admin.css');
  3080. // replace_blocked_css ('puc-debug-bar-style-v4-css', 'includes/update-checker/css/puc-debug-bar.css');
  3081. // replace_blocked_js ('ad-inserter.js');
  3082. }
  3083. }
  3084. </script>
  3085. <?php
  3086. endif; // end of code only for normal settings
  3087. if (isset ($_POST [AI_FORM_SAVE])) {
  3088. if (function_exists ('ai_save_settings')) ai_save_settings ();
  3089. }
  3090. } // generate_settings_form ()
  3091. function get_sidebar_widgets () {
  3092. $sidebar_widgets = wp_get_sidebars_widgets();
  3093. $widget_options = get_option ('widget_ai_widget');
  3094. $sidebars_with_widgets = array ();
  3095. // for ($block = $start; $block <= $end; $block ++){
  3096. for ($block = 1; $block <= 96; $block ++){
  3097. $sidebars_with_widget [$block]= array ();
  3098. }
  3099. foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
  3100. if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
  3101. $sidebar_name = $GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'];
  3102. if ($sidebar_name != "") {
  3103. foreach ($sidebar_widget as $widget) {
  3104. if (preg_match ("/ai_widget-([\d]+)/", $widget, $widget_id)) {
  3105. if (isset ($widget_id [1]) && is_numeric ($widget_id [1])) {
  3106. $widget_option = $widget_options [$widget_id [1]];
  3107. $widget_block = $widget_option ['block'];
  3108. // if ($widget_block >= $start && $widget_block <= $end && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) {
  3109. if ($widget_block >= 1 && $widget_block <= 96 && !in_array ($sidebar_name, $sidebars_with_widget [$widget_block])) {
  3110. $sidebars_with_widget [$widget_block] []= $sidebar_name;
  3111. }
  3112. }
  3113. }
  3114. }
  3115. }
  3116. }
  3117. }
  3118. return $sidebars_with_widget;
  3119. }
  3120. function page_checker_container () {
  3121. global $ai_custom_hooks;
  3122. $current_theme = wp_get_theme();
  3123. ?>
  3124. <div id="page-checker-container" class="ai-check-pages ai-form responsive-table rounded" style="background: rgb(255, 255, 255); display: none;">
  3125. <div style="margin-bottom: 10px; min-height: 24px;">
  3126. <?php echo __('Available positions for current theme', 'ad-inserter'), " <strong>", $current_theme->get ('Name'), " ", $current_theme->get ('Version'); ?></strong>
  3127. <span class="ai-error-message" style="margin-left: 30px; color: #f00; display: none;"><?php _e ('Error checking pages', 'ad-inserter'); ?>: <span class="ai-error-message-text"></span></span>
  3128. <div style="float: right;">
  3129. <img id="ai-loading-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>loading.gif" style="width: 24px; height: 24px; vertical-align: middle; margin-right: 10px; display: none;" />
  3130. <button type="button" id="check-pages-button" style="display: none; margin-right: 4px;" title="<?php _e ('Toggle theme checker for available positions for automatic insertion', 'ad-inserter'); ?>"><?php _ex ('Check', 'Button', 'ad-inserter'); ?></button>
  3131. </div>
  3132. <div style="clear: both;"></div>
  3133. </div>
  3134. <table cellspacing="0" cellpadding="0" class="check-pages">
  3135. <tbody>
  3136. <tr>
  3137. <th style="width: 10%; text-align: left;"><?php _e ('Position', 'ad-inserter'); ?></th>
  3138. <th style="width: 15%;"><?php _e ('Posts', 'ad-inserter'); ?></th>
  3139. <th style="width: 15%;"><?php _e ('Static pages', 'ad-inserter'); ?></th>
  3140. <th style="width: 15%;"><?php _e ('Homepage', 'ad-inserter'); ?></th>
  3141. <th style="width: 15%;"><?php _e ('Category pages', 'ad-inserter'); ?></th>
  3142. <th style="width: 15%;"><?php _e ('Archive pages', 'ad-inserter'); ?></th>
  3143. <th style="width: 15%;"><?php _e ('Search pages', 'ad-inserter'); ?></th>
  3144. </tr>
  3145. <tr>
  3146. <th style="min-height: 18px;">&nbsp;</th>
  3147. <th><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3148. <th><a class="simple-link ai-pa" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3149. <th><a class="simple-link ai-hp" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3150. <th><a class="simple-link ai-cp" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3151. <th><a class="simple-link ai-ap" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3152. <th><a class="simple-link ai-sp" target="_blank"><span class="dashicons dashicons-external"></span></a><a class="simple-link ai-po" target="_blank"><span class="dashicons dashicons-external"></span></a></th>
  3153. </tr>
  3154. <?php
  3155. // To check
  3156. // ai-button2
  3157. // ai-button-updating
  3158. $insertions = array ();
  3159. $insertions [AI_AUTOMATIC_INSERTION_ABOVE_HEADER] = AI_TEXT_ABOVE_HEADER;
  3160. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_POST] = AI_TEXT_BEFORE_POST;
  3161. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_CONTENT] = AI_TEXT_BEFORE_CONTENT;
  3162. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH] = AI_TEXT_BEFORE_PARAGRAPH;
  3163. $insertions [AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH] = AI_TEXT_AFTER_PARAGRAPH;
  3164. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_IMAGE] = AI_TEXT_BEFORE_IMAGE;
  3165. $insertions [AI_AUTOMATIC_INSERTION_AFTER_IMAGE] = AI_TEXT_AFTER_IMAGE;
  3166. $insertions [AI_AUTOMATIC_INSERTION_AFTER_CONTENT] = AI_TEXT_AFTER_CONTENT;
  3167. $insertions [AI_AUTOMATIC_INSERTION_AFTER_POST] = AI_TEXT_AFTER_POST;
  3168. $insertions [AI_AUTOMATIC_INSERTION_FOOTER] = AI_TEXT_FOOTER;
  3169. $insertions [AI_AUTOMATIC_INSERTION_BETWEEN_POSTS] = AI_TEXT_BETWEEN_POSTS;
  3170. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT] = AI_TEXT_BEFORE_EXCERPT;
  3171. $insertions [AI_AUTOMATIC_INSERTION_AFTER_EXCERPT] = AI_TEXT_AFTER_EXCERPT;
  3172. $insertions [AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS] = AI_TEXT_BEFORE_COMMENTS;
  3173. $insertions [AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS] = AI_TEXT_BETWEEN_COMMENTS;
  3174. $insertions [AI_AUTOMATIC_INSERTION_AFTER_COMMENTS] = AI_TEXT_AFTER_COMMENTS;
  3175. foreach ($ai_custom_hooks as $hook_index => $custom_hook) {
  3176. $insertions [AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1] = $custom_hook ['name'];
  3177. }
  3178. $counter = 0;
  3179. foreach ($insertions as $insertion_type => $insertion_name) {
  3180. // $single = true;
  3181. // $blog = true;
  3182. // switch ($insertion_type) {
  3183. // case AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT:
  3184. // case AI_AUTOMATIC_INSERTION_AFTER_EXCERPT:
  3185. // case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
  3186. // $single = false;
  3187. // break;
  3188. // case AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS:
  3189. // case AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS:
  3190. // case AI_AUTOMATIC_INSERTION_AFTER_COMMENTS:
  3191. // $blog = false;
  3192. // break;
  3193. // }
  3194. if ($insertion_type == AI_AUTOMATIC_INSERTION_ABOVE_HEADER && (!defined ('AI_BUFFERING') || !get_output_buffering ())) {
  3195. $class = '';
  3196. $title = __('Position not available because output buffering (tab [*]) is not enabled', 'ad-inserter');
  3197. } else {
  3198. $class = 'ai-position ';
  3199. $title = __('Position not checked yet', 'ad-inserter');;
  3200. }
  3201. ?>
  3202. <tr style="background: <?php echo $counter %2 == 0 ? '#eee' : '#fff'; ?>">
  3203. <td data-insertion="<?php echo $insertion_type; ?>" class="ai-position-name" style="text-align: left; padding-right: 10px;"><?php echo $insertion_name; ?></td>
  3204. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-po ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3205. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-pa ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3206. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-hp ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3207. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-cp ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3208. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-ap ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3209. <td data-insertion="<?php echo $insertion_type; ?>" class="<?php echo $class; ?>ai-sp ai-not-checked" style="" title="<?php echo $title; ?>">&#9679;</td>
  3210. </tr>
  3211. <?php
  3212. $counter ++;
  3213. }
  3214. ?>
  3215. </tbody>
  3216. </table>
  3217. </div>
  3218. <?php
  3219. }
  3220. function code_block_list_container ($start, $end, $active_block) {
  3221. $blocks_sticky = function_exists ('ai_block_list_buttons') ? get_blocks_sticky () : false;
  3222. ?>
  3223. <div id="ai-list-container" class="ai-form rounded" style="background: #fff; <?php echo $blocks_sticky ? '' : 'display: none;'; ?>">
  3224. <div id='ai-list-controls' class='ui-widget' style='margin: 0 auto 8px;'>
  3225. <span style="vertical-align: middle; float: left;">
  3226. <input id="ai-list-search" type="text" value="" size="35" maxlength="40" />
  3227. </span>
  3228. <?php
  3229. if (function_exists ('ai_block_list_buttons')) ai_block_list_buttons ($blocks_sticky);
  3230. ?>
  3231. <span style="float: right;">
  3232. <span id="ai-load-all" class="checkbox-button dashicons dashicons-lightbulb light-blue" title="<?php _e ('Toggle active/all blocks', 'ad-inserter'); ?>"></span>
  3233. </span>
  3234. <span style="margin-right: 10px; float: right;">
  3235. <span id="ai-rearrange" class="checkbox-button dashicons dashicons-sort" title="<?php _e ('Rearrange block order', 'ad-inserter'); ?>"></span>
  3236. </span>
  3237. <span id='list-rearrange-controls' style="margin-right: 10px; float: right; display: none;">
  3238. <span id="list-save" style="display: none;">
  3239. <span id="ai-save-changes" class="checkbox-button dashicons dashicons-yes-alt green" title="<?php _e ('Save new block order', 'ad-inserter'); ?>"></span>
  3240. </span>
  3241. </span>
  3242. <div style="clear: both;"></div>
  3243. </div>
  3244. <div id="ai-list-data"<?php echo $blocks_sticky ? ' class="ai-sticky"' :''; ?>>
  3245. <?php echo $blocks_sticky ? code_block_list ($start, $end, '', false, $active_block) : __ ('Loading...', 'ad-inserter'); ?>
  3246. </div>
  3247. </div>
  3248. <?php
  3249. }
  3250. if (defined ('AI_ADSENSE_API')) {
  3251. function adsense_list_container () {
  3252. ?>
  3253. <div id="adsense-list-container" class="ai-form rounded" style="background: #fff; display: none;">
  3254. <div id='adsense-list-controls' class='ui-widget' style='margin: 0 auto 8px; display: none;'>
  3255. <span style="vertical-align: middle; float: left;">
  3256. <input id="adsense-list-search" type="text" value="" size="40" maxlength="40" />
  3257. </span>
  3258. <span class="ai-toolbar-button small" style="vertical-align: middle; float: right;">
  3259. <input type="checkbox" value="0" id="adsense-load-all" style="display: none;" />
  3260. <label class="checkbox-button" for="adsense-load-all" title="<?php _e ('Toggle active/all ad units', 'ad-inserter'); ?>"><span class="checkbox-icon size-16 icon-enabled-all on"></span></label>
  3261. </span>
  3262. <span class="ai-toolbar-button small" style="vertical-align: middle; float: right;">
  3263. <input type="checkbox" value="0" id="adsense-reload" style="display: none;" />
  3264. <label class="checkbox-button" for="adsense-reload" title="<?php _e ('Reload AdSense ad units', 'ad-inserter'); ?>"><span class="checkbox-icon size-16w icon-reload"></span></label>
  3265. </span>
  3266. <span class="ai-toolbar-button small" style="vertical-align: middle; float: right;">
  3267. <input type="checkbox" value="" id="clear-adsense-authorization" style="display: none;" />
  3268. <label class="checkbox-button" for="clear-adsense-authorization" title="<?php _e ('Clear authorization to access AdSense account', 'ad-inserter'); ?>"><span class="list-button lb-size-16 ui-icon ui-icon-power"></span></label>
  3269. </span>
  3270. <span class="ai-toolbar-button small" style="vertical-align: middle; float: right;">
  3271. <input type="checkbox" value="0" id="google-adsense" style="display: none;" />
  3272. <label class="checkbox-button" id="google-adsense-button" for="google-adsense" title="<?php _e ('Google AdSense Homepage', 'ad-inserter'); ?>" onclick="window.open('https://www.google.com/adsense/login')" ><span class="checkbox-icon size-img16 size-img16a icon-adsense"></span></label>
  3273. </span>
  3274. <div style="clear: both;"></div>
  3275. </div>
  3276. <div id="adsense-list-data">
  3277. <?php _e ('Loading...', 'ad-inserter'); ?>
  3278. </div>
  3279. </div>
  3280. <?php
  3281. }
  3282. }
  3283. function ads_txt_container () {
  3284. $virtual_ads_txt = (get_option (AI_ADS_TXT_NAME) !== false);
  3285. $virtual_text = __ ('Switch to physical ads.txt file', 'ad-inserter');
  3286. $physical_text = __ ('Switch to virtual ads.txt file', 'ad-inserter');
  3287. $virtual_title = $virtual_ads_txt ? $virtual_text : $physical_text;
  3288. ?>
  3289. <div id="ads-txt-container" class="ai-form rounded" style="background: #fff; display: none;">
  3290. <div id='ads-txt-controls' class='ui-widget' style='margin: 0 auto 8px; display: none;'>
  3291. <span style="vertical-align: middle; float: left;">
  3292. <input id="ads-txt-search" type="text" value="" size="40" maxlength="40" />
  3293. </span>
  3294. <span style="float: right;">
  3295. <label class="checkbox-button iab-ads-txt" title="<?php /* translators: %s: ads.txt */ echo sprintf (__('Open %s', 'ad-inserter'), home_url ('/') . 'ads.txt'); ?>" onclick="window.open('<?php echo home_url ('/'); ?>ads.txt')"><span class="checkbox-icon icon-ads-txt"></span></label>
  3296. </span>
  3297. <span style="margin-right: 10px; float: right;">
  3298. <span id="ads-txt-virtual" class="checkbox-button dashicons dashicons-shield<?php echo $virtual_ads_txt ? ' violet' : ''; ?>" title="<?php echo $virtual_title; ?>" title-virtual="<?php echo $virtual_text; ?>" title-physical="<?php echo $physical_text; ?>"></span>
  3299. </span>
  3300. <span style="margin-right: 10px; float: right;">
  3301. <span id="ads-txt-reload" class="checkbox-button dashicons dashicons-download" title="<?php _e ('Reload ads.txt file', 'ad-inserter'); ?>" title-editor="<?php _e ('Cancel', 'ad-inserter'); ?>" title-table="<?php _e ('Reload ads.txt file', 'ad-inserter'); ?>"></span>
  3302. </span>
  3303. <span style="margin-right: 10px; float: right;">
  3304. <span id="ads-txt-editor" class="checkbox-button dashicons dashicons-edit" title="<?php _e ('Edit', 'ad-inserter'); ?>" title-editor="<?php _e ('Save', 'ad-inserter'); ?>" title-table="<?php _e ('Edit', 'ad-inserter'); ?>" ></span>
  3305. </span>
  3306. <div style="clear: both;"></div>
  3307. </div>
  3308. <div id="ads-txt-error" style="margin: 0 0 8px; color: red;"></div>
  3309. <div id="ads-txt-data">
  3310. <?php _e ('Loading...', 'ad-inserter'); ?>
  3311. </div>
  3312. </div>
  3313. <?php
  3314. }
  3315. function ads_txt ($action) {
  3316. global $block_object;
  3317. $block_ads = array ();
  3318. for ($block = 1; $block <= 96 + 3; $block ++) {
  3319. switch ($block) {
  3320. case 96 + 1:
  3321. $obj = $block_object [AI_HEADER_OPTION_NAME];
  3322. break;
  3323. case 96 + 2:
  3324. $obj = $block_object [AI_FOOTER_OPTION_NAME];
  3325. break;
  3326. case 96 + 3:
  3327. $obj = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
  3328. break;
  3329. default:
  3330. $obj = $block_object [$block];
  3331. break;
  3332. }
  3333. $block_code = $obj->get_ad_data ();
  3334. // data-ad-client="ca-pub-3118622027477755"
  3335. if (preg_match_all ('#data-ad-client\s*=\s*"(.+?)"#', $block_code, $adsense_matches)) {
  3336. foreach ($adsense_matches [1] as $adsense_match) {
  3337. if (preg_match ('#(pub-[0-9]+)#', $adsense_match, $adsense_pub_id)) {
  3338. $found = false;
  3339. foreach ($block_ads as $block_ad) {
  3340. if ($block_ad ['ads_data'][1] == $adsense_pub_id [1]) {
  3341. $found = true;
  3342. break;
  3343. }
  3344. }
  3345. if (!$found) {
  3346. $block_ads [] = array ('ads_data' => array ('google.com', $adsense_pub_id [1], 'DIRECT', 'f08c47fec0942fa0'), 'found' => false);
  3347. }
  3348. }
  3349. }
  3350. }
  3351. // google_ad_client = "ca-pub-3118622027477755";
  3352. if (preg_match_all ('#google_ad_client\s*=\s*"(.+?)"#', $block_code, $adsense_matches)) {
  3353. foreach ($adsense_matches [1] as $adsense_match) {
  3354. if (preg_match ('#(pub-[0-9]+)#', $adsense_match, $adsense_pub_id)) {
  3355. $found = false;
  3356. foreach ($block_ads as $block_ad) {
  3357. if ($block_ad ['ads_data'][1] == $adsense_pub_id [1]) {
  3358. $found = true;
  3359. break;
  3360. }
  3361. }
  3362. if (!$found) {
  3363. $block_ads [] = array ('ads_data' => array ('google.com', $adsense_pub_id [1], 'DIRECT', 'f08c47fec0942fa0'), 'found' => false);
  3364. }
  3365. }
  3366. }
  3367. }
  3368. }
  3369. $site_url = site_url ();
  3370. $home_url = home_url ();
  3371. $url_parts = explode (DIRECTORY_SEPARATOR, str_replace (array ('https', 'http', '://'), '', $site_url));
  3372. $ads_txt_home = 'http' . (is_ssl() ? 's' : '') . '://'. $url_parts [0];
  3373. $ads_txt_url = $ads_txt_home . DIRECTORY_SEPARATOR . 'ads.txt';
  3374. $wp_content_dir_array = explode ('/', WP_CONTENT_DIR);
  3375. $wp_content_dir = $wp_content_dir_array [count ($wp_content_dir_array) - 1];
  3376. $root_path = str_replace ($wp_content_dir, '', WP_CONTENT_DIR);
  3377. $ads_txt_file = $root_path . 'ads.txt';
  3378. $wp_folder = '';
  3379. if (count ($url_parts) > 1) {
  3380. $wp_folder = str_replace ($ads_txt_home, '', $site_url);
  3381. $wp_folder = str_replace ('/', DIRECTORY_SEPARATOR, $wp_folder);
  3382. }
  3383. echo '<div class="rounded system-debugging" style="display: none;">';
  3384. echo "<pre style='margin: 0;'>\n";
  3385. echo "site_url ", site_url (), "\n";
  3386. echo "home_url ", home_url (), "\n";
  3387. echo "ads_txt_home ", $ads_txt_home, "\n";
  3388. echo "wp_folder ", $wp_folder, "\n";
  3389. echo "ABSPATH ", ABSPATH, "\n";
  3390. echo "WP_CONTENT_DIR ", WP_CONTENT_DIR, "\n";
  3391. echo "root_path ", $root_path, "\n";
  3392. echo "</pre>\n";
  3393. echo '</div>';
  3394. $virtual = isset ($_GET ["virtual"]) && $_GET ["virtual"];
  3395. $virtual_file_missing = false;
  3396. if ($virtual) {
  3397. $ads = get_option (AI_ADS_TXT_NAME);
  3398. if ($ads === false) {
  3399. $virtual_file_missing = true;
  3400. $ads = '';
  3401. if ($action == 'table') {
  3402. $action = 'text';
  3403. }
  3404. }
  3405. } else {
  3406. if (file_exists ($ads_txt_file)) {
  3407. $ads = file_get_contents ($ads_txt_file);
  3408. } else {
  3409. $ads = '';
  3410. if ($action == 'table') {
  3411. $action = 'text';
  3412. }
  3413. }
  3414. }
  3415. $ads_lines = explode ("\n", $ads);
  3416. $rows = array ();
  3417. foreach ($ads_lines as $ads_line) {
  3418. if (trim ($ads_line) == '') continue;
  3419. $ads_data = explode ('#', str_replace (array ("\r", ' '), '', $ads_line));
  3420. $ads_elements = explode (',', $ads_data [0]);
  3421. if (count ($ads_elements) == 0) continue;
  3422. $found = false;
  3423. foreach ($block_ads as $index => $block_ad) {
  3424. if (!isset ($ads_elements [1])) continue;
  3425. if ($block_ad ['ads_data'][1] == $ads_elements [1]) {
  3426. $found = true;
  3427. $block_ads [$index]['found'] = true;
  3428. break;
  3429. }
  3430. }
  3431. $rows []= array ('ads_elements' => $ads_elements, 'status' => $found ? 'F' : '');
  3432. }
  3433. $missing_lines = array ();
  3434. foreach ($block_ads as $block_ad) {
  3435. if (!$block_ad ['found']) {
  3436. array_unshift ($rows, array ('ads_elements' => $block_ad ['ads_data'], 'status' => 'M'));
  3437. $missing_lines []= implode (', ', $block_ad ['ads_data']);
  3438. }
  3439. }
  3440. $search_text = isset ($_GET ["search"]) ? trim ($_GET ["search"]) : '';
  3441. if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array ();
  3442. foreach ($rows as $index => $row) {
  3443. $ads_line = implode (' ', $row ['ads_elements']);
  3444. foreach ($search_array as $search_item) {
  3445. if (stripos ($ads_line, trim ($search_item)) === false) {
  3446. unset ($rows [$index]);
  3447. continue 2;
  3448. }
  3449. }
  3450. }
  3451. switch ($virtual) {
  3452. case true:
  3453. echo '<div class="rounded">';
  3454. // translators: %s: Ad Inserter
  3455. echo '<div>', sprintf (__('ads.txt file: %s virtual ads.txt file', 'ad-inserter'), AD_INSERTER_NAME), '</div>';
  3456. echo '</div>';
  3457. if ($virtual_file_missing) {
  3458. echo '<div id="ads-txt-missing" class="rounded">';
  3459. echo '<div><strong><span style="color: red;">', __('Warning', 'ad-inserter'), ':</span></strong> ', /* translators: %s: Ad Inserter */ sprintf (__('%s virtual file ads.txt not found', 'ad-inserter'), AD_INSERTER_NAME), '</div>';
  3460. echo '</div>';
  3461. }
  3462. break;
  3463. default:
  3464. echo '<div class="rounded">';
  3465. if ($wp_folder != '') {
  3466. echo '<div><strong><span style="color: red;">', __('IMPORTANT', 'ad-inserter'), '</span>: ', __('ads.txt file must be placed on the root domain', 'ad-inserter'), ' <a href="', $ads_txt_url, '" target="_blank" class="simple-link">', $ads_txt_url, '</a></strong></div>';
  3467. echo '<hr>';
  3468. }
  3469. echo '<table border-spacing="0" cell-spacing="0"><tbody>';
  3470. echo '<tr><td style="padding-right: 20px; font-weight: bold;">WordPress</td><td>', ABSPATH, '</td></tr>';
  3471. echo '<tr><td style="padding-right: 20px; font-weight: bold;">', __('ads.txt file', 'ad-inserter'), '</td><td>', $ads_txt_file, is_writable ($ads_txt_file) ? '' : '<span style="margin-left: 20px; color: red;">'.__('NOT WRITABLE', 'ad-inserter').'</span>', '</td></tr>';
  3472. echo '</tbody></table>';
  3473. echo '</div>';
  3474. if (!file_exists ($ads_txt_file)) {
  3475. echo '<div id="ads-txt-missing" class="rounded">';
  3476. echo '<div><strong><span style="color: red;">', __('Warning', 'ad-inserter'), ':</span></strong> ', sprintf (__('file %s not found', 'ad-inserter'), $ads_txt_file), '</div>';
  3477. echo '</div>';
  3478. }
  3479. break;
  3480. }
  3481. // $missing_lines = array ();
  3482. switch ($action) {
  3483. case 'text':
  3484. if (count ($missing_lines)) {
  3485. echo '<div>', __('Account IDs found in blocks but not present in the ads.txt file', 'ad-inserter'), '</div>';
  3486. echo '<textarea disabled style="width: 100%; font-family: monospace, Courier, \'Courier New\'; font-size: 12px;" rows="', count ($missing_lines), '">';
  3487. echo implode ("\n", $missing_lines);
  3488. echo '</textarea>';
  3489. if ($virtual) {
  3490. // translators: %s: Ad Inserter
  3491. echo '<div style="margin-top: 8px;">', sprintf (__('%s virtual ads.txt file', 'ad-inserter'), AD_INSERTER_NAME), '</div>';
  3492. } else {
  3493. echo '<div style="margin-top: 8px;">', $ads_txt_file, '</div>';
  3494. }
  3495. }
  3496. echo '<textarea id="ads-txt-text" style="width: 100%; height: 700px; font-family: monospace, Courier, \'Courier New\'; font-size: 12px;">';
  3497. echo $ads;
  3498. echo '</textarea>';
  3499. if (!$virtual) {
  3500. delete_option (AI_ADS_TXT_NAME);
  3501. }
  3502. ai_add_rewrite_rules ();
  3503. flush_rewrite_rules();
  3504. break;
  3505. case 'table':
  3506. ?>
  3507. <table id="ads-txt-table" class="exceptions" cellspacing=0 cellpadding=0 style="width: 100%;">
  3508. <thead>
  3509. <tr>
  3510. <th style="text-align: left;"><?php _e ('Advertising system', 'ad-inserter'); ?></th>
  3511. <th style="text-align: left;"><?php _e ('Account ID', 'ad-inserter'); ?></th>
  3512. <th style="text-align: left;"><?php _e ('Type', 'ad-inserter'); ?></th>
  3513. <th style="text-align: left;"><?php _e ('Certification authority ID', 'ad-inserter'); ?></th>
  3514. </tr>
  3515. </thead>
  3516. <tbody>
  3517. <?php
  3518. $row_counter = 0;
  3519. foreach ($rows as $row) {
  3520. $row_counter ++;
  3521. $ads_elements = $row ['ads_elements'];
  3522. switch ($row ['status']) {
  3523. case 'F':
  3524. $row_color = $row_counter % 2 == 0 ? '#D4FFD8' : '#CDF7D1';
  3525. $title = __('Account ID found in block and present in ads.txt', 'ad-inserter');
  3526. break;
  3527. case 'M':
  3528. $row_color = $row_counter % 2 == 0 ? '#FFC9C9' : '#F7C2C2';
  3529. $title = __('Account ID found in block but not present in ads.txt', 'ad-inserter');
  3530. break;
  3531. default:
  3532. $row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
  3533. $title = '';
  3534. break;
  3535. }
  3536. $variable = count ($ads_elements) == 1 && strpos ($ads_elements [0], '=') !== false;
  3537. if (isset ($ads_elements [3])) {
  3538. if (strlen ($ads_elements [3]) == 16) {
  3539. $element3 = '<a href="https://tag-members-prod.herokuapp.com/registry/lookup?q='.$ads_elements [3].'" class="simple-link" style="color: #021b79;" target="_blank">'.$ads_elements [3] .'</a>';
  3540. } else $element3 = $ads_elements [3];
  3541. } else $element3 = '';
  3542. ?>
  3543. <tr style="background: <?php echo $row_color; ?>" title="<?php echo $title; ?>">
  3544. <td style="padding-right: 10px;<?php echo $variable ? ' color: #3959ff;' : ''; ?>" <?php echo $variable ? ' colspan="4"' : ''; ?>>
  3545. <?php echo isset ($ads_elements [0]) ? $ads_elements [0] : ''; ?>
  3546. </td>
  3547. <?php
  3548. if (!$variable):
  3549. ?>
  3550. <td style="padding-right: 10px;">
  3551. <?php echo isset ($ads_elements [1]) ? $ads_elements [1] : ''; ?>
  3552. </td>
  3553. <td style="padding-right: 10px;">
  3554. <?php echo isset ($ads_elements [2]) ? $ads_elements [2] : ''; ?>
  3555. </td>
  3556. <td>
  3557. <?php echo $element3; ?>
  3558. </td>
  3559. <?php
  3560. endif;
  3561. ?>
  3562. </tr>
  3563. <?php
  3564. }
  3565. ?>
  3566. </tbody>
  3567. </table>
  3568. <?php
  3569. if (!$virtual) {
  3570. delete_option (AI_ADS_TXT_NAME);
  3571. }
  3572. ai_add_rewrite_rules ();
  3573. flush_rewrite_rules();
  3574. break;
  3575. case 'save':
  3576. if ($virtual) {
  3577. if (isset ($_POST ['text'])) {
  3578. $text = @base64_decode ($_POST ['text']);
  3579. if ($text != '') {
  3580. update_option (AI_ADS_TXT_NAME, $text);
  3581. } else {
  3582. delete_option (AI_ADS_TXT_NAME);
  3583. }
  3584. ai_add_rewrite_rules ();
  3585. flush_rewrite_rules();
  3586. }
  3587. } else {
  3588. if (isset ($_POST ['text']) && is_writable (dirname ($ads_txt_file))) {
  3589. $text = @base64_decode ($_POST ['text']);
  3590. @file_put_contents ($ads_txt_file, esc_html ($text));
  3591. }
  3592. }
  3593. break;
  3594. }
  3595. }
  3596. function ai_change_settings () {
  3597. global $block_object, $ai_db_options_extract;
  3598. $command = isset ($_GET ["cmd"]) ? $_GET ["cmd"] : null;
  3599. $block = isset ($_GET ["cmd-block"]) ? $_GET ["cmd-block"] : null;
  3600. $data = isset ($_GET ["cmd-data"]) ? $_GET ["cmd-data"] : null;
  3601. if ($block === null || $block < 1 || $block > 96 || $command === null) {
  3602. return;
  3603. }
  3604. $ai_options = ai_get_option (AI_OPTION_NAME);
  3605. $update_settings = false;
  3606. switch ($command) {
  3607. case 'pause':
  3608. $value = $block_object [$block]->get_disable_insertion () == AI_DISABLED ? AI_ENABLED : AI_DISABLED;
  3609. $ai_options [$block][AI_OPTION_DISABLE_INSERTION] = $value;
  3610. $update_settings = true;
  3611. break;
  3612. }
  3613. if ($update_settings) {
  3614. ai_update_option (AI_OPTION_NAME, $ai_options);
  3615. ai_load_settings ();
  3616. $ai_options [AI_OPTION_EXTRACT] = ai_generate_extract ($ai_options);
  3617. $ai_db_options_extract = $ai_options [AI_OPTION_EXTRACT];
  3618. $ai_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'] = generate_viewport_css ();
  3619. $ai_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS'] = generate_alignment_css ();
  3620. $ai_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
  3621. ai_update_option (AI_OPTION_NAME, $ai_options);
  3622. update_option (AI_EXTRACT_NAME, $ai_db_options_extract);
  3623. ai_load_settings ();
  3624. }
  3625. }
  3626. function code_block_list ($start, $end, $search_text, $show_all_blocks, $active_block) {
  3627. global $block_object, $wpdb, $ai_db_options_extract;
  3628. if (defined ('AI_SAFE_MODE') || isset ($_GET ['safe-mode'])) {
  3629. $url_safe_mode = '&ai-safe-mode';
  3630. } else $url_safe_mode = '';
  3631. if (isset ($_GET ["cmd"])) {
  3632. ai_change_settings ();
  3633. }
  3634. if (isset ($_GET ["blocks-org"]) && isset ($_GET ["blocks-new"])) {
  3635. $blocks_org = json_decode ($_GET ["blocks-org"]);
  3636. $blocks_new = json_decode ($_GET ["blocks-new"]);
  3637. if (!empty ($blocks_org) && count ($blocks_org) == count ($blocks_new)) {
  3638. // Update widgets
  3639. $current_options = ai_get_option (AI_OPTION_NAME);
  3640. $new_options = $current_options;
  3641. $error = false;
  3642. foreach ($blocks_org as $index => $block) {
  3643. $new_block = $blocks_new [$index];
  3644. if ($block >= 1 && $block <= 96 && $new_block >= 1 && $new_block <= 96) {
  3645. if (isset ($current_options [$new_block])) {
  3646. $new_options [$block] = $current_options [$new_block];
  3647. } else {
  3648. unset ($new_options [$block]);
  3649. }
  3650. } else $error = true;
  3651. }
  3652. if (!$error) {
  3653. // Update AI_OPTION_FALLBACK and AI_OPTION_ADB_BLOCK_REPLACEMENT
  3654. for ($block = 1; $block <= 96; $block ++) {
  3655. if (isset ($new_options [$block][AI_OPTION_FALLBACK])) {
  3656. $ai_option_fallback = $new_options [$block][AI_OPTION_FALLBACK];
  3657. if ($ai_option_fallback != '')
  3658. foreach ($blocks_new as $index => $org_block) {
  3659. if ($ai_option_fallback == $org_block) {
  3660. $new_options [$block][AI_OPTION_FALLBACK] = $blocks_org [$index];
  3661. }
  3662. }
  3663. }
  3664. if (isset ($new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT])) {
  3665. $ai_option_adb_block_replacement = $new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT];
  3666. if ($ai_option_adb_block_replacement != '')
  3667. foreach ($blocks_new as $index => $org_block) {
  3668. if ($ai_option_adb_block_replacement == $org_block) {
  3669. $new_options [$block][AI_OPTION_ADB_BLOCK_REPLACEMENT] = $blocks_org [$index];
  3670. }
  3671. }
  3672. }
  3673. }
  3674. ai_update_option (AI_OPTION_NAME, $new_options);
  3675. ai_load_settings ();
  3676. $new_options [AI_OPTION_EXTRACT] = ai_generate_extract ($new_options);
  3677. $ai_db_options_extract = $new_options [AI_OPTION_EXTRACT];
  3678. $new_options [AI_OPTION_GLOBAL]['VIEWPORT_CSS'] = generate_viewport_css ();
  3679. $new_options [AI_OPTION_GLOBAL]['ALIGNMENT_CSS'] = generate_alignment_css ();
  3680. $new_options [AI_OPTION_GLOBAL]['TIMESTAMP'] = time ();
  3681. ai_update_option (AI_OPTION_NAME, $new_options);
  3682. update_option (AI_EXTRACT_NAME, $ai_db_options_extract);
  3683. ai_load_settings ();
  3684. $ai_widgets = get_option ('widget_ai_widget');
  3685. if (is_array ($ai_widgets))
  3686. foreach ($ai_widgets as $widget_index => $ai_widget) {
  3687. if (isset ($ai_widget ['block'])) {
  3688. $widget_block = $ai_widget ['block'];
  3689. if ($widget_block >= 1 && $widget_block <= 96) {
  3690. foreach ($blocks_new as $index => $org_block) {
  3691. if ($widget_block == $org_block) {
  3692. $ai_widgets [$widget_index]['block'] = $blocks_org [$index];
  3693. break;
  3694. }
  3695. }
  3696. }
  3697. }
  3698. }
  3699. update_option ('widget_ai_widget', $ai_widgets);
  3700. if (defined ('AI_STATISTICS') && AI_STATISTICS) {
  3701. // Update statistics - two passes to avoid duplicate entries
  3702. $offset = 1000;
  3703. // Lock table to prevent updates of old blocks
  3704. $query = 'LOCK TABLES ' . AI_STATISTICS_DB_TABLE . ' WRITE;';
  3705. $update = $wpdb->query ($query);
  3706. // Pass 1 - new blocks with offset
  3707. $query = 'UPDATE ' . AI_STATISTICS_DB_TABLE . ' SET block= CASE ';
  3708. foreach ($blocks_new as $index => $org_block) {
  3709. $new_block = $blocks_org [$index] + $offset;
  3710. $query .= "WHEN block= $org_block THEN $new_block ";
  3711. }
  3712. $query .= 'ELSE block END;';
  3713. $update = $wpdb->query ($query);
  3714. // Pass 2 - remove offset
  3715. $query = 'UPDATE ' . AI_STATISTICS_DB_TABLE . " SET block = block - $offset WHERE block >= $offset;";
  3716. $update = $wpdb->query ($query);
  3717. // Unlock table
  3718. $query = 'UNLOCK TABLES;';
  3719. $update = $wpdb->query ($query);
  3720. }
  3721. }
  3722. }
  3723. }
  3724. $sidebars_with_widget = get_sidebar_widgets ();
  3725. ob_start ();
  3726. // $search_text = trim ($_GET ["list"]);
  3727. // $show_all_blocks = isset ($_GET ["all"]) && $_GET ["all"];
  3728. // $start = trim ($_GET ["start"]);
  3729. // $end = trim ($_GET ["end"]);
  3730. if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array ();
  3731. $blocks = array ();
  3732. $row_counter = 0;
  3733. for ($block = 1; $block <= 96; $block ++) {
  3734. $obj = $block_object [$block];
  3735. $automatic_insertion = $obj->get_automatic_insertion () != AI_AUTOMATIC_INSERTION_DISABLED;
  3736. $manual_widget = $obj->get_enable_widget() == AI_ENABLED;
  3737. $manual_shortcode = $obj->get_enable_manual() == AI_ENABLED;
  3738. $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED;
  3739. $disabled = $obj->get_disable_insertion ();
  3740. $block_used = /*!$disabled &&*/ ($automatic_insertion || $manual_php_function || $manual_shortcode || $manual_widget && !empty ($sidebars_with_widget [$block]));
  3741. if (!$show_all_blocks && !$block_used) continue;
  3742. $process_php = $obj->get_process_php ();
  3743. $exceptions = $obj->get_exceptions_enabled ();
  3744. $devices = $obj->get_detection_server_side () || $obj->get_detection_client_side ();
  3745. $scheduling = $obj->get_scheduling() != AI_SCHEDULING_OFF;
  3746. switch ($obj->get_scheduling ()) {
  3747. case AI_SCHEDULING_BETWEEN_DATES:
  3748. case AI_SCHEDULING_OUTSIDE_DATES:
  3749. $scheduling_period_inactive = !check_scheduling_time (
  3750. $obj->get_schedule_start_date () . ' ' . $obj->get_schedule_start_time (),
  3751. $obj->get_schedule_end_date () . ' ' . $obj->get_schedule_end_time (),
  3752. $obj->get_schedule_weekdays (),
  3753. $obj->get_scheduling () == AI_SCHEDULING_BETWEEN_DATES
  3754. );
  3755. break;
  3756. default:
  3757. $scheduling_period_inactive = false;
  3758. break;
  3759. }
  3760. $tracking = $obj->get_tracking (true);
  3761. if (function_exists ('get_global_tracking')) {
  3762. $limits =
  3763. $obj->get_visitor_max_impressions () || ($obj->get_visitor_limit_impressions_per_time_period () && $obj->get_visitor_limit_impressions_time_period ()) ||
  3764. $obj->get_visitor_max_clicks () || ($obj->get_visitor_limit_clicks_per_time_period () && $obj->get_visitor_limit_clicks_time_period ());
  3765. }
  3766. $block_text = $block . ' '. $obj->get_ad_name () . ' ' . $obj->get_automatic_insertion_text() . ' ' . implode (', ', $sidebars_with_widget [$block]);
  3767. if ($process_php) $block_text .= ' php';
  3768. if ($exceptions) $block_text .= ' exceptions';
  3769. if ($devices) $block_text .= ' device';
  3770. if ($scheduling) $block_text .= ' scheduling';
  3771. if (function_exists ('get_global_tracking')) {
  3772. if ($limits) $block_text .= ' limits';
  3773. }
  3774. if ($tracking) $block_text .= ' tracking';
  3775. if (!empty ($sidebars_with_widget [$block])) $block_text .= ' widget';
  3776. if ($manual_shortcode) $block_text .= ' shortcode';
  3777. if ($manual_php_function) $block_text .= ' function';
  3778. foreach ($search_array as $search_item) {
  3779. if (stripos ($block_text, trim ($search_item)) === false) continue 2;
  3780. }
  3781. $blocks []= $block;
  3782. $row_counter ++;
  3783. $row_class = $row_counter % 2 == 0 ? 'even' : 'odd';
  3784. if ($block == $active_block) {
  3785. $row_class .= ' ai-block-active';
  3786. }
  3787. $edit_url = admin_url ('options-general.php?page=ad-inserter.php') . '&start=' . (intval (($block - 1) / 16) * 16 + 1) . '&tab=' . $block . $url_safe_mode;
  3788. $visible_tab = $block >= $start && $block <= $end;
  3789. $insertion_parameter = '';
  3790. $insertion_title = '';
  3791. switch ($obj->get_automatic_insertion()) {
  3792. case AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH:
  3793. case AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH:
  3794. case AI_AUTOMATIC_INSERTION_BEFORE_IMAGE:
  3795. case AI_AUTOMATIC_INSERTION_AFTER_IMAGE:
  3796. $insertion_parameter = ' ' . $obj->get_paragraph_number ();
  3797. break;
  3798. case AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT:
  3799. case AI_AUTOMATIC_INSERTION_AFTER_EXCERPT:
  3800. case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
  3801. case AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS:
  3802. $insertion_parameter = ' ' . $obj->get_call_filter ();
  3803. break;
  3804. case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
  3805. case AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT:
  3806. case AI_AUTOMATIC_INSERTION_INSIDE_HTML_ELEMENT:
  3807. $insertion_title = $obj->get_html_selector ();
  3808. break;
  3809. }
  3810. ?>
  3811. <tr class="ai-block-list ai-block-<?php echo $block, ' ', $row_class; ?>" data-block="<?php echo $block; ?>">
  3812. <td style="min-width: 55px; color: <?php echo $block_used ? '#444' : '#ccc'; ?>;">
  3813. <span class="ai-list-button">
  3814. <label class="checkbox-button ai-preview-block" style="margin-top: -1px;" title="<?php _e ('Preview block', 'ad-inserter'); ?>"><span class="checkbox-icon size-8 icon-preview"></span></label>
  3815. </span>
  3816. <span class="ai-list-button">
  3817. <label class="checkbox-button ai-copy-block" style="margin-top: -1px;" title="<?php _e ('Copy block', 'ad-inserter'); ?>"><span class="checkbox-icon size-8 icon-text">&#9609;</span></label>
  3818. </span>
  3819. <span class="ai-list-button">
  3820. <label class="checkbox-button ai-pause-block<?php echo $disabled ? ' ai-paused' : ''; ?>" style="margin-top: -1px;" title="<?php _e ('Pause block', 'ad-inserter'); ?>"><span class="checkbox-icon size-8 icon-text" style="<?php echo $disabled ? 'color: #d00;' : ''; ?>">&#10074;&#10074;</span></label>
  3821. </span>
  3822. <span class="ai-list-button" style="text-align: right; width: 16px;"><?php echo $block; ?></span>
  3823. </td>
  3824. <?php if ($visible_tab): ?>
  3825. <td class="ai-tab-link" data-tab="<?php echo $block; ?>" style=" min-width: 120px; color: #0073aa; cursor: pointer; text-align: left; padding-left: 5px; max-width: 220px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name(); ?></td>
  3826. <?php else: ?>
  3827. <td style="min-width: 120px; text-align: left; padding-left: 5px; max-width: 250px; white-space: nowrap; overflow: hidden;"><a href="<?php echo $edit_url; ?>" style="text-decoration: none; box-shadow: 0 0 0;"><?php echo $obj->get_ad_name(); ?></a></td>
  3828. <?php endif ?>
  3829. <td style="min-width: 80px; text-align: left; padding-left: 5px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>" title="<?php echo $insertion_title; ?>"><?php echo $obj->get_automatic_insertion_text(), $insertion_parameter; ?></td>
  3830. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top;"><span class="<?php echo $process_php ? 'checkbox-icon size-img16 icon-php on' : ''; ?>" style="margin-top: 1px;"></span></td>
  3831. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; color: #66f;"><span class="<?php echo $exceptions ? 'dashicons dashicons-forms' : ''; ?>" style="font-size: 16px; width: 16px; height: 16px; margin-top: 1px;"></span></td>
  3832. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; color: #0df;"><span class="<?php echo $devices ? 'dashicons dashicons-desktop' : ''; ?>" style="font-size: 16px; width: 16px; height: 16px; margin-top: 1px;"></span></td>
  3833. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; color: <?php echo $scheduling_period_inactive ? '#e44' : '#00f'; ?>;"><?php echo $scheduling ? '&#9200;' : ''; ?></td>
  3834. <?php
  3835. if (function_exists ('get_global_tracking')) {
  3836. ?>
  3837. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top;"><span class="<?php echo $tracking ? 'checkbox-icon size-img16 icon-tracking on' : ''; ?>" style="margin-top: 1px;"></span></td>
  3838. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; color: #70f;"><?php echo $limits ? '&#11027;' : ''; ?></td>
  3839. <?php
  3840. }
  3841. ?>
  3842. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; font-weight: bold; color: <?php echo $manual_php_function ? '#8080ff' : 'transparent'; ?>;">fn</td>
  3843. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; font-weight: bold; color: <?php echo $manual_shortcode ? '#f66' : 'transparent'; ?>;">[s]</td>
  3844. <td style="min-width: 15px; text-align: center; padding-left: 5px; vertical-align: top; font-weight: bold; color: <?php echo $manual_widget ? (count ($sidebars_with_widget [$block]) ? '#7cda7c' : '#aaa') : 'transparent'; ?>;">w</td>
  3845. <td style="text-align: left; padding-left: 5px; max-width: 100px; white-space: nowrap; overflow: hidden; color: <?php echo $manual_widget ? '#666' : '#ccc'; ?>;"><?php echo implode (', ', $sidebars_with_widget [$block]); ?></td>
  3846. </tr>
  3847. <?php
  3848. }
  3849. $table_rows = ob_get_clean ();
  3850. ?>
  3851. <table id="ai-list-table" class="exceptions ai-sortable<?php if (function_exists ('get_global_tracking') && !get_global_tracking ()) echo ' tracking-disabled'; ?>" cellspacing=0 cellpadding=0 style="width: 100%;" data-blocks="<?php echo json_encode ($blocks); ?>">
  3852. <thead>
  3853. <tr>
  3854. <th style="text-align: left;"><?php _e ('Block', 'ad-inserter'); ?></th>
  3855. <th style="text-align: left; padding-left: 5px;"><?php _e ('Name', 'ad-inserter'); ?></th>
  3856. <!-- <th style="text-align: left; padding-left: 10px;"></th>-->
  3857. <th style="text-align: left; padding-left: 5px;"><?php _e ('Automatic insertion', 'ad-inserter'); ?></th>
  3858. <th style="text-align: center; padding-left: 5px;" title="<?php _e ('PHP code processing', 'ad-inserter'); ?>"><span class="checkbox-icon size-img16 icon-php"></span></th>
  3859. <th style="text-align: center; padding-left: 5px;" title="<?php _e ('Exceptions', 'ad-inserter'); ?>"><span class="dashicons dashicons-forms" style="font-size: 16px; width: 16px; height: 16px; margin-top: 1px; color: #999;"></span></th>
  3860. <th style="text-align: center; padding-left: 5px;" title="<?php _e ('Device detection', 'ad-inserter'); ?>"><span class="dashicons dashicons-desktop" style="font-size: 16px; width: 16px; height: 16px; margin-top: 1px; color: #999;"></span></th>
  3861. <th style="text-align: center; padding-left: 5px; color: #aaa;" title="<?php _e ('Scheduling', 'ad-inserter'); ?>">&#9200;</th>
  3862. <?php
  3863. if (function_exists ('get_global_tracking')) {
  3864. ?>
  3865. <th style="text-align: center; padding-left: 5px;" title="<?php _e ('Tracking', 'ad-inserter'); ?>"><span class="checkbox-icon size-img16 icon-tracking" style="margin-top: 1px;"></span></th>
  3866. <th style="text-align: center; padding-left: 5px; color: #999;" title="<?php _e ('Limits', 'ad-inserter'); ?>">&#11027;</th>
  3867. <?php
  3868. }
  3869. ?>
  3870. <th style="text-align: center; padding-left: 5px; color: #999;" title="<?php _e ('PHP function call', 'ad-inserter'); ?>">fn</th>
  3871. <th style="text-align: center; padding-left: 5px; color: #999;" title="<?php _e ('Shortcode', 'ad-inserter'); ?>">[s]</th>
  3872. <th style="text-align: center; padding-left: 5px; color: #999;" title="<?php _e ('Widget', 'ad-inserter'); ?>">W</th>
  3873. <th style="text-align: left; padding-left: 5px; color: #999;"><?php //_e ('Widget positions', 'ad-inserter'); ?></th>
  3874. </tr>
  3875. </thead>
  3876. <tbody>
  3877. <?php echo $table_rows; ?>
  3878. </tbody>
  3879. </table>
  3880. <?php
  3881. if ($row_counter == 0) {
  3882. if ($search_text == '')
  3883. echo "<div style='margin: 10px 0 0 20px;'>", __ ('No active block', 'ad-inserter'), "</div>"; else
  3884. echo "<div style='margin: 10px 0 0 20px;'>", __ ('No block matches search keywords', 'ad-inserter'), "</div>";
  3885. }
  3886. }
  3887. if (defined ('AI_ADSENSE_API')) {
  3888. function ai_adsense_data (&$error) {
  3889. require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
  3890. $error = 'AdSense not authorized';
  3891. $ad_data = false;
  3892. if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) {
  3893. $error = '';
  3894. $update_ad_units = isset ($_GET ["update_ad_units"]) ? $_GET ["update_ad_units"] == 1 : false;
  3895. $adsense = new adsense_api();
  3896. $ad_data = get_transient (AI_TRANSIENT_ADSENSE_ADS);
  3897. if ($ad_data === false || $update_ad_units) {
  3898. $ad_units = $adsense->getAdUnits();
  3899. $error = $adsense->getError ();
  3900. if ($error == '' && is_array ($ad_units)) {
  3901. $ad_data = array ($adsense->getAdSensePublisherID (), $ad_units);
  3902. set_transient (AI_TRANSIENT_ADSENSE_ADS, $ad_data, AI_TRANSIENT_ADSENSE_ADS_EXPIRATION);
  3903. }
  3904. }
  3905. }
  3906. return $ad_data;
  3907. }
  3908. function adsense_list () {
  3909. require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
  3910. if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) {
  3911. $publisher_id = '';
  3912. $ad_units = array ();
  3913. $error = '';
  3914. $ad_data = ai_adsense_data ($error);
  3915. if ($error == '') {
  3916. $publisher_id = $ad_data [0];
  3917. $ad_units = $ad_data [1];
  3918. $show_all_ad_units = isset ($_GET ["all"]) && $_GET ["all"];
  3919. ?>
  3920. <table id="ai-adsense-ad-units-table" class="exceptions" cellspacing=0 cellpadding=0 style="width: 100%;">
  3921. <thead>
  3922. <tr>
  3923. <th style="text-align: left; width: 66px;"><?php _e ('Ad unit', 'ad-inserter'); ?></th>
  3924. <th style="text-align: left;"><?php _e ('Name', 'ad-inserter'); ?></th>
  3925. <th style="text-align: left;"><?php _e ('Slot ID', 'ad-inserter'); ?></th>
  3926. <th style="text-align: left;"><?php _e ('Type', 'ad-inserter'); ?></th>
  3927. <th style="text-align: left;"><?php _e ('Size', 'ad-inserter'); ?></th>
  3928. </tr>
  3929. </thead>
  3930. <tbody>
  3931. <?php
  3932. $row_counter = 0;
  3933. foreach ($ad_units as $ad_unit) {
  3934. if (!$show_all_ad_units && !$ad_unit ['active']) continue;
  3935. $search_text = trim ($_GET ["adsense-list"]);
  3936. if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array ();
  3937. $block_text = $ad_unit ['name'] . ' ' . $ad_unit ['code'] . ' ' . $ad_unit ['type'] . ' ' . $ad_unit ['size'];
  3938. foreach ($search_array as $search_item) {
  3939. if (stripos ($block_text, trim ($search_item)) === false) continue 2;
  3940. }
  3941. $row_counter ++;
  3942. $row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
  3943. ?>
  3944. <tr style="background: <?php echo $row_color; ?>" data-id="ca-<?php echo $publisher_id, ':', $ad_unit ['code']; ?>" data-name="<?php echo base64_encode ($ad_unit ['name']); ?>">
  3945. <td>
  3946. <span class="ai-list-button">
  3947. <label class="checkbox-button adsense-copy-code" style="margin-top: -1px;" title="<?php _e ('Copy AdSense code', 'ad-inserter'); ?>"><span class="checkbox-icon size-8"></span></label>
  3948. </span>
  3949. <span class="ai-list-button">
  3950. <label class="checkbox-button adsense-preview-code" style="margin-top: -1px;" title="<?php _e ('Preview AdSense ad', 'ad-inserter'); ?>"><span class="checkbox-icon size-8 icon-preview"></span></label>
  3951. </span>
  3952. <span class="ai-list-button">
  3953. <label class="checkbox-button adsense-get-code" style="margin-top: -1px;" title="<?php _e ('Get AdSense code', 'ad-inserter'); ?>"><span class="checkbox-icon size-8 icon-get"></span></label>
  3954. </span>
  3955. </td>
  3956. <td style="color: <?php echo $ad_unit ['active'] ? '#444' : '#ccc'; ?>;">
  3957. <?php echo $ad_unit ['name']; ?>
  3958. </td>
  3959. <td class="select" style="text-align: left; color: <?php echo $ad_unit ['active'] ? '#444' : '#ccc'; ?>;">
  3960. <span><?php echo $ad_unit ['code']; ?></span>
  3961. </td>
  3962. <td style="color: <?php echo $ad_unit ['active'] ? '#444' : '#ccc'; ?>;">
  3963. <?php echo ucwords (strtolower (str_replace ('_', ', ', $ad_unit ['type']))); ?>
  3964. </td>
  3965. <td style="color: <?php echo $ad_unit ['active'] ? '#444' : '#ccc'; ?>;">
  3966. <?php echo ucwords (strtolower ($ad_unit ['size'])); ?>
  3967. </td>
  3968. </tr>
  3969. <?php
  3970. }
  3971. ?>
  3972. </tbody>
  3973. </table>
  3974. <div id="adsense-data" style="display: none;" data-publisher-id="<?php echo $publisher_id; ?>"></div>
  3975. <?php
  3976. } else {
  3977. echo
  3978. "<div style='margin: 10px 0 0 20px;'>$error</div>";
  3979. if (strpos ($error, 'unauthorized_client') !== false) {
  3980. echo '<div style="margin-top: 10px; border: 1px solid #ddd; border-radius: 5px; padding: 10px;">',
  3981. // translators: %s: HTML tags
  3982. sprintf (__('Please %s clear authorization %s with the button %s above and once again authorize access to your AdSense account.', 'ad-inserter'),
  3983. '<strong>',
  3984. '</strong>',
  3985. '<span class="list-button lb-size-16 ui-icon ui-icon-power" style="display: inline-block; margin-bottom: -3px;"></span>'
  3986. ), '</div>';
  3987. }
  3988. }
  3989. }
  3990. elseif (defined ('AI_ADSENSE_CLIENT_ID')) {
  3991. $adsense = new adsense_api();
  3992. $adsense_ids = defined ('AI_CI_STRING') && get_option (AI_ADSENSE_OWN_IDS) === false;
  3993. ?>
  3994. <table class="responsive-table" cellspacing=0 cellpadding=0 style="width: 100%;">
  3995. <tbody>
  3996. <tr>
  3997. <td colspan="2" style="white-space: inherit;">
  3998. <div class="rounded" style="margin: 0;">
  3999. <?php if ($adsense_ids): ?>
  4000. <h2 style="margin: 5px 0; float: left;"><strong><?php echo AD_INSERTER_NAME; ?></strong> <?php _e ('AdSense Integration', 'ad-inserter'); ?></h2>
  4001. <?php else: ?>
  4002. <h2 style="margin: 5px 0; float: left;"><strong><?php echo AD_INSERTER_NAME; ?></strong> <?php _e ('AdSense Integration - Step 2', 'ad-inserter'); ?></h2>
  4003. <?php endif; ?>
  4004. <a href="https://www.google.com/adsense/login" class="simple-link" style="float: right;" target="_blank" title="<?php _e ('Google AdSense Homepage', 'ad-inserter'); ?>"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ga-logo.png" style="margin: 3px 0 -4px 0;"/></a>
  4005. <div style="clear: both;"></div>
  4006. </div>
  4007. <?php if ($adsense_ids): ?>
  4008. <p style="text-align: justify;"><?php /* translators: %s: HTML tags */ printf (__('Authorize %s to access your AdSense account. Click on the %s Get Authorization Code %s button to open a new window where you can allow access. When you get the code copy it to the field below and click on the button %s Authorize. %s', 'ad-inserter'),
  4009. AD_INSERTER_NAME,
  4010. '<strong>',
  4011. '</strong>',
  4012. '<strong>',
  4013. '</strong>'
  4014. ); ?></p>
  4015. <p style="text-align: justify;"><?php /* translators: %s: HTML tags */ printf (__("If you get error, can't access ad units or would like to use own Google API IDs click on the button %s Use own API IDs %s to enter Client ID and Client Secret.", 'ad-inserter'), '<strong>', '</strong>'); ?></p>
  4016. <?php else: ?>
  4017. <p style="text-align: justify;"><?php /* translators: %s: HTML tags */ printf (__('Now you can authorize %s to access your AdSense account. Click on the %s Get Authorization Code %s button to open a new window where you can allow access. When you get the code copy it to the field below and click on the button %s Authorize. %s', 'ad-inserter'),
  4018. AD_INSERTER_NAME,
  4019. '<strong>',
  4020. '</strong>',
  4021. '<strong>',
  4022. '</strong>'
  4023. ); ?></p>
  4024. <p style="text-align: justify;"><?php /* translators: %s: HTML tags */ printf (__('If you get error %s invalid client %s click on the button %s Clear and return to Step 1 %s to re-enter Client ID and Client Secret.', 'ad-inserter'),
  4025. '<strong>',
  4026. '</strong>',
  4027. '<strong>',
  4028. '</strong>'
  4029. ); ?></p>
  4030. <?php endif; ?>
  4031. </td>
  4032. </tr>
  4033. <tr>
  4034. <td style="padding-right: 10px;">
  4035. <button type="button" class="ai-top-button" style="display: none; width: 162px; outline: none;" onclick="window.open('<?php echo $adsense->getAuthUrl (); ?>')"><?php _e ('Get Authorization Code', 'ad-inserter'); ?></button>
  4036. </td>
  4037. <td>
  4038. <input id="adsense-authorization-code" style="width: 100%;" type="text" value="" size="100" maxlength="200" title="<?php _e ('Enter Authorization Code', 'ad-inserter'); ?>"/>
  4039. </td>
  4040. </tr>
  4041. <tr>
  4042. <td>&nbsp;</td>
  4043. <td>&nbsp;</td>
  4044. </tr>
  4045. <tr>
  4046. <td>
  4047. <?php if ($adsense_ids): ?>
  4048. <button type="button" class="ai-top-button authorize-adsense own-ids" style="display: none; float: left; width: 162px; outline: none;"><?php _e ('Use own API IDs', 'ad-inserter'); ?></button>
  4049. <?php else: ?>
  4050. <button type="button" class="ai-top-button authorize-adsense clear-adsense" style="display: none; float: left; width: 162px; outline: none;"><?php _e ('Clear and return to Step 1', 'ad-inserter'); ?></button>
  4051. <?php endif; ?>
  4052. </td>
  4053. <td>
  4054. <button type="button" class="ai-top-button authorize-adsense" style="display: none; float: right; width: 162px; outline: none;"><?php _e ('Authorize', 'ad-inserter'); ?></button>
  4055. </td>
  4056. </tr>
  4057. </tbody>
  4058. </table>
  4059. <?php
  4060. }
  4061. else {
  4062. ?>
  4063. <table class="responsive-table" cellspacing=0 cellpadding=0 style="width: 100%;">
  4064. <tbody>
  4065. <tr>
  4066. <td colspan="2" style="white-space: inherit;">
  4067. <div class="rounded" style="margin: 0;">
  4068. <h2 style="margin: 5px 0; float: left;"><strong><?php echo AD_INSERTER_NAME; ?></strong> <?php _e ('AdSense Integration - Step 1', 'ad-inserter'); ?></h2>
  4069. <a href="https://www.google.com/adsense/login" class="simple-link" style="float: right;" target="_blank" title="<?php _e ('Google AdSense Homepage', 'ad-inserter'); ?>"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ga-logo.png" style="margin: 3px 0 -4px 0;"/></a>
  4070. <div style="clear: both;"></div>
  4071. </div>
  4072. <p style="text-align: justify;"><?php /* translators: %s: Ad Inserter */ printf (__('Here can %s list configured AdSense ad units and get code for AdSense ads. To do this you need to authorize %s to access your AdSense account. The first step is to create a Google API project in order to get Client ID and Client Secret.', 'ad-inserter'),
  4073. '<strong>'.AD_INSERTER_NAME.'</strong>',
  4074. AD_INSERTER_NAME
  4075. ); ?></p>
  4076. </td>
  4077. </tr>
  4078. <tr>
  4079. <td colspan="2" style="white-space: inherit;">
  4080. <ol>
  4081. <li title="Google APIs and Services console"><?php /* translators: %s: HTML tags */ printf (__('Go to %s Google APIs and Services console %s', 'ad-inserter'), '<a href="https://console.developers.google.com/" target="_blank">', '</a>'); ?></li>
  4082. <li title="Credentials"><?php /* translators: %1: Ad Inserter, 2, 3: HTML tags */ printf (__('Create %1$s project - if the project and IDs are already created click on the %2$s Credentials %3$s in the sidebar and go to step 16', 'ad-inserter'), '<strong>Ad Inserter</strong>', '<strong>', '</strong>'); ?></li>
  4083. <li title="Select a project"><?php /* translators: %s: HTML tags */ printf (__('Click on project selection and then click on the %s NEW PROJECT %s button to create a new project', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4084. <li title="Create"><?php /* translators: 1: Ad Inserter, 2, 3: HTML tags */ printf (__('Enter %1$s for project name and click on the %2$s Create %3$s button', 'ad-inserter'), '<strong>Ad Inserter</strong>', '<strong>', '</strong>'); ?></li>
  4085. <li><?php /* translators: %s: HTML tags */ printf (__('Click on project selection, wait for the project to be created and then and select %s as the current project', 'ad-inserter'), '<strong>Ad Inserter</strong>'); ?></li>
  4086. <li title="ENABLE APIS AND SERVICES"><?php /* translators: %s: HTML tags */ printf (__('Click on %s ENABLE APIS AND SERVICES %s', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4087. <li title="AdSense Management API"><?php /* translators: %s: HTML tags */ printf (__('Search for adsense and enable %s', 'ad-inserter'), '<strong>AdSense Management API</strong>'); ?></li>
  4088. <li title="Create credentials"><?php /* translators: %s: HTML tags */ printf (__('Click on %s CREATE CREDENTIALS %s', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4089. <li title="Where will you be calling the API from?"><?php /* translators: %s: HTML tags */ printf (__('For %s Where will you be calling the API from? %s select %s Other UI %s', 'ad-inserter'), '<strong>', '</strong>', '<strong>', '</strong>'); ?></li>
  4090. <li title="What data will you be accessing?"><?php /* translators: %s: HTML tags */ printf (__('For %s What data will you be accessing? %s select %s User data %s', 'ad-inserter'), '<strong>', '</strong>', '<strong>', '</strong>'); ?></li>
  4091. <li title="What credentials do I need?"><?php /* translators: %s: HTML tags */ printf (__('Click on %s What credentials do I need? %s', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4092. <li title="Create an OAuth 2.0 client ID"><?php /* translators: %s: HTML tags */ printf (__('Create an OAuth 2.0 client ID: For %s OAuth 2.0 client ID %s name enter %s Ad Inserter client %s', 'ad-inserter'), '<strong>', '</strong>', '<strong>', '</strong>'); ?></li>
  4093. <li title="Product name shown to users"><?php /* translators: %s: HTML tags */ printf (__('Set up the OAuth 2.0 consent screen: For %s Product name shown to users %s enter %s', 'ad-inserter'), '<strong>', '</strong>', '<strong>Ad Inserter</strong>'); ?></li>
  4094. <li title="Continue"><?php /* translators: %s: HTML tags */ printf (__('Click on %s Continue %s', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4095. <li title="Done"><?php /* translators: %s: HTML tags */ printf (__('Click on %s Done %s', 'ad-inserter'), '<strong>', '</strong>'); ?></li>
  4096. <li title=""><?php /* translators: %s: HTML tags */ printf (__('Click on %s Ad Inserter client %s to get %s Client ID %s and %s Client secret %s', 'ad-inserter'), '<strong>', '</strong>', '<strong>', '</strong>', '<strong>', '</strong>'); ?></li>
  4097. <li><?php _e ('Copy them to the appropriate fields below', 'ad-inserter'); ?></li>
  4098. </ol>
  4099. </td>
  4100. </tr>
  4101. <tr>
  4102. <td style="padding-right: 10px;">
  4103. <?php _e ('Client ID', 'ad-inserter'); ?>
  4104. </td>
  4105. <td>
  4106. <input id="adsense-client-id" style="width: 100%;" type="text" value="" size="100" maxlength="200" title="<?php _e ('Enter Client ID', 'ad-inserter'); ?>"/>
  4107. </td>
  4108. </tr>
  4109. <tr>
  4110. <td style="padding-right: 10px;">
  4111. <?php _e ('Client secret', 'ad-inserter'); ?>
  4112. </td>
  4113. <td>
  4114. <input id="adsense-client-secret" style="width: 100%;" type="text" value="" size="100" maxlength="200" title="<?php _e ('Enter Client secret', 'ad-inserter'); ?>"/>
  4115. </td>
  4116. </tr>
  4117. <tr>
  4118. <td>&nbsp;</td>
  4119. <td>&nbsp;</td>
  4120. </tr>
  4121. <tr>
  4122. <td>
  4123. <?php if (defined ('AI_ADSENSE_API_IDS') && defined ('AI_CI_STRING')): ?>
  4124. <button type="button" class="ai-top-button authorize-adsense clear-adsense" style="display: none; float: left; width: 162px; outline: none;"><?php _e ('Use default API IDs', 'ad-inserter'); ?></button>
  4125. <?php else: ?>
  4126. <?php endif; ?>
  4127. </td>
  4128. <td>
  4129. <button type="button" id="save-client-ids" class="ai-top-button" style="display: none; float: right; width: 162px; outline: none;"><?php _e ('Save', 'ad-inserter'); ?></button>
  4130. </td>
  4131. </tr>
  4132. </tbody>
  4133. </table>
  4134. <?php
  4135. }
  4136. }
  4137. }
  4138. function ai_adsense_code ($ad_slot_id) {
  4139. if (defined ('AI_ADSENSE_API')) {
  4140. require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
  4141. if (defined ('AI_ADSENSE_AUTHORIZATION_CODE')) {
  4142. $adsense = new adsense_api();
  4143. $code = $adsense->getAdCode ($ad_slot_id);
  4144. echo json_encode (array ('code' => $code, 'error-message' => $adsense->getError ()));
  4145. }
  4146. }
  4147. }
  4148. function adsense_ad_name ($adsense_data) {
  4149. if (defined ('AI_ADSENSE_API')) {
  4150. $publisher_id = '';
  4151. $ad_units = array ();
  4152. $error = '';
  4153. $ad_data = ai_adsense_data ($error);
  4154. if ($error == '') {
  4155. $publisher_id = $ad_data [0];
  4156. $ad_units = $ad_data [1];
  4157. $ad_slot_names = array ('publisher_id' => $publisher_id);
  4158. foreach ($ad_units as $ad_unit) {
  4159. if ($ad_unit ['active'])
  4160. $ad_slot_names [$ad_unit ['code']] = $ad_unit ['name'];
  4161. }
  4162. echo json_encode ($ad_slot_names);
  4163. }
  4164. }
  4165. }
  4166. function generate_list_options ($options) {
  4167. $max_items = 2000;
  4168. switch ($options) {
  4169. case 'category':
  4170. // $args = array("hide_empty" => 0);
  4171. $args = array("hide_empty" => 0, 'number' => $max_items);
  4172. $category_data = get_categories ($args);
  4173. // $category_data = array_slice ($category_data, 0, $max_items);
  4174. foreach ($category_data as $category) {
  4175. echo " <option value='{$category->slug}'>{$category->slug} ({$category->name})</option>\n";
  4176. $category_to_check = get_term_by ('slug', $category->slug, 'category');
  4177. if ($category_to_check) {
  4178. $descendants = get_term_children ($category_to_check->term_id, 'category');
  4179. if ($descendants) {
  4180. // Translators: %s: category name
  4181. echo " <option value='{$category->slug}*'>{$category->slug}* ("._x(sprintf ('%s or children', $category->name), 'Category children', 'ad-inserter').")</option>\n";
  4182. // Translators: %s: category name
  4183. echo " <option value='{$category->slug}+'>{$category->slug}+ ("._x(sprintf ('%s children only', $category->name), 'Category children', 'ad-inserter').")</option>\n";
  4184. }
  4185. }
  4186. }
  4187. break;
  4188. case 'tag':
  4189. $args = array ('number' => $max_items);
  4190. // $tag_data = get_tags ();
  4191. $tag_data = get_tags ($args);
  4192. // $tag_data = array_slice ($tag_data, 0, $max_items);
  4193. foreach ($tag_data as $tag) {
  4194. echo " <option value='{$tag->slug}'>{$tag->slug} ({$tag->name})</option>\n";
  4195. }
  4196. break;
  4197. case 'taxonomy':
  4198. $term_data = get_terms ();
  4199. $taxonomies = array ();
  4200. foreach ($term_data as $term) {
  4201. if ($term->taxonomy == 'category') continue;
  4202. if ($term->taxonomy == 'post_tag') continue;
  4203. $taxonomies [strtolower ($term->taxonomy) . ':' . strtolower ($term->slug)] = $term->name;
  4204. if (count ($taxonomies) >= $max_items) break;
  4205. }
  4206. $args = array (
  4207. 'public' => true,
  4208. // '_builtin' => false,
  4209. );
  4210. $custom_post_types = get_post_types ($args, 'objects', 'and');
  4211. foreach ($custom_post_types as $custom_post_type => $custom_post_data) {
  4212. $taxonomies ['post-type:' . strtolower ($custom_post_type)] = $custom_post_data->labels->singular_name;
  4213. }
  4214. $editable_roles = get_editable_roles ();
  4215. foreach ($editable_roles as $editable_role_slug => $editable_role) {
  4216. $taxonomies ['user-role:' . strtolower ($editable_role_slug)] = $editable_role ['name'];
  4217. }
  4218. $taxonomies ['user:logged-in'] = 'User logged in';
  4219. $taxonomies ['user:not-logged-in'] = 'User not logged in';
  4220. $users = get_users ();
  4221. foreach ($users as $user) {
  4222. $taxonomies ['user:' . strtolower ($user->data->user_login)] = $user->data->display_name;
  4223. $taxonomies ['author:' . strtolower ($user->data->user_login)] = $user->data->display_name;
  4224. if (count ($taxonomies) >= $max_items) break;
  4225. }
  4226. ksort ($taxonomies);
  4227. foreach ($taxonomies as $taxonomy => $taxonomy_name) {
  4228. if ($taxonomy_name != '')
  4229. echo " <option value='{$taxonomy}'>{$taxonomy} ({$taxonomy_name})</option>\n"; else
  4230. echo " <option value='{$taxonomy}'>{$taxonomy}</option>\n";
  4231. }
  4232. break;
  4233. case 'id':
  4234. $args = array (
  4235. 'public' => true,
  4236. '_builtin' => false
  4237. );
  4238. $custom_post_types = get_post_types ($args, 'names', 'and');
  4239. $screens = array_values (array_merge (array ('post', 'page'), $custom_post_types));
  4240. $args = array (
  4241. 'posts_per_page' => 3 * $max_items,
  4242. 'offset' => 0,
  4243. 'category' => '',
  4244. 'category_name' => '',
  4245. 'orderby' => 'ID',
  4246. 'order' => 'ASC',
  4247. 'include' => '',
  4248. 'exclude' => '',
  4249. 'meta_key' => '',
  4250. 'meta_value' => '',
  4251. 'post_type' => $screens,
  4252. 'post_mime_type' => '',
  4253. 'post_parent' => '',
  4254. 'author' => '',
  4255. 'author_name' => '',
  4256. 'post_status' => '',
  4257. 'suppress_filters' => true,
  4258. );
  4259. $posts_pages = get_posts ($args);
  4260. $counter = 0;
  4261. foreach ($posts_pages as $post_page) {
  4262. if ($post_page->post_title == '') continue;
  4263. echo " <option value='{$post_page->ID}'>{$post_page->ID} ({$post_page->post_type} \"{$post_page->post_title}\")</option>\n";
  4264. $counter ++;
  4265. if ($counter >= $max_items) break;
  4266. }
  4267. echo " <option value='posts'>posts (", __('All posts', 'ad-inserter'), ")</option>\n";
  4268. echo " <option value='pages'>pages (", __('All static pages', 'ad-inserter'), ")</option>\n";
  4269. break;
  4270. case 'client':
  4271. if (version_compare (phpversion (), "5.6", ">=")) {
  4272. require_once AD_INSERTER_PLUGIN_DIR.'includes/agent/Agent.php';
  4273. $agent = new Agent();
  4274. $clients = array_merge (
  4275. array_keys ($agent->getOperatingSystems ()),
  4276. array_keys ($agent->getBrowsers ()),
  4277. array_keys ($agent->getPhoneDevices ()),
  4278. array_keys ($agent->getTabletDevices ()),
  4279. array_keys ($agent->getUtilities ())
  4280. );
  4281. foreach ($clients as $client) {
  4282. echo " <option value='$client'>$client</option>\n";
  4283. }
  4284. } else {
  4285. }
  4286. break;
  4287. default:
  4288. if (function_exists ('ai_generate_list_options')) ai_generate_list_options ($options);
  4289. break;
  4290. }
  4291. }
  4292. function ai_check_page ($options) {
  4293. $download_urls = array ();
  4294. // echo '["1","2","3","4"]';
  4295. // return;
  4296. switch ($_GET ["check-page"]) {
  4297. case 'po':
  4298. case 'pa':
  4299. $args = array (
  4300. 'public' => true,
  4301. '_builtin' => false
  4302. );
  4303. $custom_post_types = get_post_types ($args, 'names', 'and');
  4304. $screens = array_values (array_merge (array ($_GET ["check-page"] == 'po' ? 'post' : 'page'), $custom_post_types));
  4305. $args = array (
  4306. 'posts_per_page' => 1,
  4307. 'offset' => 0,
  4308. 'category' => '',
  4309. 'category_name' => '',
  4310. 'orderby' => 'ID',
  4311. 'order' => 'DESC',
  4312. 'include' => '',
  4313. 'exclude' => '',
  4314. 'meta_key' => '',
  4315. 'meta_value' => '',
  4316. 'post_type' => $screens,
  4317. 'post_mime_type' => '',
  4318. 'post_parent' => '',
  4319. 'author' => '',
  4320. 'author_name' => '',
  4321. 'post_status' => '',
  4322. 'suppress_filters' => true,
  4323. );
  4324. $posts_pages = get_posts ($args);
  4325. if (isset ($posts_pages [0])) {
  4326. $download_urls []= get_permalink ($posts_pages [0]->ID);
  4327. }
  4328. // Check also post/page with comments
  4329. $args = array ('post_type' => $_GET ["check-page"] == 'po' ? 'post' : 'page', 'number' => 1);
  4330. $comment_data = get_comments ($args);
  4331. if (isset ($comment_data [0])) {
  4332. $download_urls []= get_permalink ($comment_data [0]->comment_post_ID);
  4333. }
  4334. break;
  4335. case 'hp':
  4336. $download_urls []= home_url () . '/';
  4337. break;
  4338. case 'cp':
  4339. $args = array ('hide_empty' => 0, 'orderby' => 'count', 'order' => 'DESC', 'number' => 1);
  4340. $category_data = get_categories ($args);
  4341. if (isset ($category_data [0])) {
  4342. $download_urls []= get_category_link ($category_data [0]->cat_ID) . '/';
  4343. }
  4344. break;
  4345. case 'ap':
  4346. $args = array ('hide_empty' => 0, 'orderby' => 'count', 'order' => 'DESC', 'number' => 1);
  4347. $tag_data = get_tags ($args);
  4348. if (isset ($tag_data [0])) {
  4349. $download_urls []= get_tag_link ($tag_data [0]->term_taxonomy_id) . '/';
  4350. }
  4351. break;
  4352. case 'sp':
  4353. $download_urls []= home_url () . '/?s=a';
  4354. break;
  4355. }
  4356. if (!empty ($download_urls)) {
  4357. $positions = array ();
  4358. $secret_key = ai_secret_key ();
  4359. foreach ($download_urls as $download_url) {
  4360. $tmp_file = download_url (add_query_arg (array (AI_URL_DEBUG_POSITIONS => '0', 'ai-secret' => $secret_key), $download_url));
  4361. if (!is_wp_error ($tmp_file) && file_exists ($tmp_file)) {
  4362. $page = file_get_contents ($tmp_file);
  4363. preg_match_all ('#data-ai-position=[\'\"](.+?)[\'\"]#', $page, $matches);
  4364. foreach (array_unique ($matches [1]) as $position) {
  4365. $positions [] = (int) $position;
  4366. }
  4367. } else {
  4368. @unlink ($tmp_file);
  4369. $error_string = $tmp_file->get_error_message();
  4370. echo $error_string;
  4371. return;
  4372. }
  4373. @unlink ($tmp_file);
  4374. }
  4375. switch ($_GET ["check-page"]) {
  4376. case 'po':
  4377. case 'pa':
  4378. if (in_array (AI_AUTOMATIC_INSERTION_BEFORE_CONTENT, $positions) && in_array (AI_AUTOMATIC_INSERTION_AFTER_CONTENT, $positions)) {
  4379. $positions [] = AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH;
  4380. $positions [] = AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH;
  4381. $positions [] = AI_AUTOMATIC_INSERTION_BEFORE_IMAGE;
  4382. $positions [] = AI_AUTOMATIC_INSERTION_AFTER_IMAGE;
  4383. }
  4384. if (in_array (AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS, $positions) && in_array (AI_AUTOMATIC_INSERTION_AFTER_COMMENTS, $positions)) {
  4385. $positions [] = AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS;
  4386. }
  4387. break;
  4388. }
  4389. $positions = array_unique ($positions);
  4390. sort ($positions);
  4391. foreach ($download_urls as $index => $download_url) {
  4392. $download_urls [$index] = add_query_arg (array (AI_URL_DEBUG_POSITIONS => '0', 'no-cookie' => '1'), $download_url);
  4393. }
  4394. echo json_encode (array ('positions' => $positions, 'urls' => $download_urls));
  4395. }
  4396. }
  4397. function sidebar_addense_alternative () { ?>
  4398. <?php
  4399. switch (rand (5, 12)) {
  4400. case 1:
  4401. ?>
  4402. <div class="ai-form header rounded">
  4403. <div style="float: left;">
  4404. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Blank ad blocks? Looking for AdSense alternative?', 'ad-inserter'); ?></h2>
  4405. </div>
  4406. <div style="clear: both;"></div>
  4407. </div>
  4408. <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
  4409. <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-4" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-4.gif" /></a>
  4410. </div>
  4411. <?php
  4412. break;
  4413. case 2:
  4414. ?>
  4415. <div class="ai-form header rounded">
  4416. <div style="float: left;">
  4417. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Blank ad blocks? Looking for AdSense alternative?', 'ad-inserter'); ?></h2>
  4418. </div>
  4419. <div style="clear: both;"></div>
  4420. </div>
  4421. <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
  4422. <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-7" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-7.gif" /></a>
  4423. </div>
  4424. <?php
  4425. break;
  4426. case 3:
  4427. case 4:
  4428. ?>
  4429. <div class="ai-form header rounded">
  4430. <div style="float: left;">
  4431. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Blank ad blocks? Looking for AdSense alternative?', 'ad-inserter'); ?></h2>
  4432. </div>
  4433. <div style="clear: both;"></div>
  4434. </div>
  4435. <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
  4436. <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-6" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-6.gif" /></a>
  4437. </div>
  4438. <?php
  4439. break;
  4440. case 5:
  4441. case 6:
  4442. case 7:
  4443. case 8:
  4444. ?>
  4445. <div class="ai-form header rounded">
  4446. <div style="float: left;">
  4447. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Blank ad blocks? Looking for AdSense alternative?', 'ad-inserter'); ?></h2>
  4448. </div>
  4449. <div style="clear: both;"></div>
  4450. </div>
  4451. <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
  4452. <a href='https://www.ezoic.com/?utm_source=ad-inserter&utm_medium=ads&utm_campaign=ad-inserter-ads&utm_term=adinserter&utm_content=ezoic' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-ez-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ez-1.jpg" /></a>
  4453. </div>
  4454. <?php
  4455. break;
  4456. case 9:
  4457. case 10:
  4458. case 11:
  4459. case 12:
  4460. ?>
  4461. <div class="ai-form header rounded">
  4462. <div style="float: left;">
  4463. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Try Infolinks Ads with Adsense or Media.net ads', 'ad-inserter'); ?></h2>
  4464. </div>
  4465. <div style="clear: both;"></div>
  4466. </div>
  4467. <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
  4468. <a href='https://www.infolinks.com/publishers/?kid=3114832&loc=2' class="clear-link" title="<?php _e ('Use Infolinks ads with Adsense to earn more', 'ad-inserter'); ?>" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
  4469. </div>
  4470. <?php
  4471. break;
  4472. }
  4473. ?>
  4474. <?php
  4475. }
  4476. function sidebar_support_review () {
  4477. global $rating_value, $rating_string, $rating_css;
  4478. if (!wp_is_mobile () && is_super_admin ()) {
  4479. ?>
  4480. <div class="ai-form header no-select rounded" style="position: relative; text-align: justify;">
  4481. <div style="float: left;">
  4482. <h2 style="display: inline-block; margin: 7px 0;"><?php _e ('Support plugin development', 'ad-inserter'); ?></h2>
  4483. <?php
  4484. switch ($text = rand (1,2)) {
  4485. case 1:
  4486. ?>
  4487. <button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 140px; width: 140px; outline: none;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Review', 'Review Ad Inserter', 'ad-inserter'); ?> Ad Inserter</button>
  4488. <?php
  4489. break;
  4490. default:
  4491. ?>
  4492. <button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 140px; width: 140px; outline: none;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by rating the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Rate', 'Rate Ad Inserter', 'ad-inserter'); ?> Ad Inserter</button>
  4493. <?php
  4494. break;
  4495. }
  4496. ?>
  4497. <button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; width: 62px; outline: none;" onclick="window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4')" title="<?php _e ('Support free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!', 'ad-inserter'); ?>"><?php _e ('Donate', 'ad-inserter'); ?></button>
  4498. </div>
  4499. <div style="float: right; margin: 7px 10px 0 0;">
  4500. <div id="ai-stars" style="float: right; margin: 0 0 -3px 0; cursor: pointer; font-size: 11px;"><span><?php //echo $rating_value; ?></span><img id="ai-stars-img" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>stars.png" style="margin: 0 0 -3px 10px;"/></div>
  4501. <div id="ai-rating-bar" class="header" style="float: right; cursor: pointer; margin: 3px 0 0 0; width: 148px; display: none;" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">
  4502. <div class="header" style="background: #ccc;" title="<?php _e ('Average rating of the plugin - Thank you!', 'ad-inserter'); ?>">
  4503. <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">
  4504. <div id="rating-value" style="text-align: center; font-size: 11px; line-height: 12px; border-radius: 2px; background: #fddf87; <?php echo $rating_css; ?>"><span style=""><?php echo $rating_string; ?></span></div>
  4505. </a>
  4506. </div>
  4507. </div>
  4508. </div>
  4509. <div style="clear: both;"></div>
  4510. <hr />
  4511. <?php /* translators: %s: Ad Inserter, HTML tags */ printf (__("You've been using %s for a while now, and I hope you're happy with it. Positive %s reviews %s are a great way to show your appreciation for my work. Besides being an incredible boost to my morale, they are also a great incentive to fix bugs and to add new features for better monetization of your website. When you rate it with 5 stars it's like saying 'Thank you'.", 'ad-inserter'),
  4512. '<strong>Ad Inserter</strong>',
  4513. '<a href="https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4514. '</a>',
  4515. ' '
  4516. ); ?>
  4517. </div>
  4518. <?php
  4519. }
  4520. }
  4521. function sidebar_support_plugin () {
  4522. global $rating_value, $rating_string, $rating_css;
  4523. ?>
  4524. <div class="ai-form header rounded no-select">
  4525. <div style="float: left;">
  4526. <h2 style="display: inline-block; margin: 7px 0;"><?php _e ('Support plugin development', 'ad-inserter'); ?></h2>
  4527. <button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 62px; width: 62px; outline: none;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres', 'ad-inserter'); ?>"><?php _e ('Review', 'ad-inserter'); ?></button>
  4528. </div>
  4529. <div style="float: right;">
  4530. <a href="https://twitter.com/AdInserter" class="clear-link" target="_blank"><img id="ai-tw" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>twitter.png" style="vertical-align: middle; margin: 0 0 0 20px;" title="<?php _e ('Ad Inserter on Twitter', 'ad-inserter'); ?>" alt="<?php _e ('Ad Inserter on Twitter', 'ad-inserter'); ?>" /></a>
  4531. <a href="https://www.facebook.com/AdInserter/" class="clear-link" target="_blank"><img id="ai-fb" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>facebook.png" style="vertical-align: middle; margin: 0 0 0 10px;" title="<?php _e ('Ad Inserter on Facebook', 'ad-inserter'); ?>" alt="<?php _e ('Ad Inserter on Facebook', 'ad-inserter'); ?>" /></a>
  4532. </div>
  4533. <div style="float: right; margin-top: 2px;">
  4534. <h2 style="display: inline-block; margin: 5px 0;"><?php _e ('Follow Ad Inserter', 'ad-inserter'); ?></h2>
  4535. </div>
  4536. <div style="float: right; margin: 8px 20px 0 0;">
  4537. <div id="ai-stars" style="float: right; margin: 0 0 -3px 0; cursor: pointer; font-size: 11px;"><span><?php //echo $rating_value; ?></span><img id="ai-stars-img" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>stars.png" style="margin: 0 0 -3px 10px;"/></div>
  4538. <div id="ai-rating-bar" class="header" style="float: right; cursor: pointer; margin: 3px 0 0 0; width: 148px; display: none;" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">
  4539. <div class="header" style="background: #ccc;" title="<?php _e ('Average rating of the plugin - Thank you!', 'ad-inserter'); ?>">
  4540. <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/?filter=5#new-post" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">
  4541. <div id="rating-value" style="text-align: center; font-size: 11px; line-height: 12px; border-radius: 2px; background: #fddf87; height: 100%; <?php echo $rating_css; ?>"><span style=""><?php echo $rating_string; ?></span></div>
  4542. </a>
  4543. </div>
  4544. </div>
  4545. </div>
  4546. <div style="clear: both;"></div>
  4547. </div>
  4548. <?php
  4549. }
  4550. function sidebar_help () { ?>
  4551. <div class="ai-form header rounded ai-help">
  4552. <div style="float: left;">
  4553. <div>
  4554. <?php /* translators: %s: HTML tags */ printf (__('Need help with %s settings? %s Check %s Quick Start, %s %s Code Editing %s and %s Common Settings %s pages', 'ad-inserter'),
  4555. '<a href="https://adinserter.pro/documentation" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4556. '</a>',
  4557. '<a href="https://adinserter.pro/documentation/quick-start" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4558. '</a>',
  4559. '<a href="https://adinserter.pro/documentation/code-editing" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4560. '</a>',
  4561. '<a href="https://adinserter.pro/documentation/common-settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4562. '</a>'
  4563. ); ?>
  4564. </div>
  4565. <div>
  4566. <?php /* translators: %s: HTML tags */ printf (__('%s New to %s AdSense? %s %s %s Connect your site %s - %s In-feed ads, %s %s Auto ads, %s %s AMP ads %s', 'ad-inserter'),
  4567. '<strong>',
  4568. '<a href="https://adinserter.pro/documentation/adsense-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4569. '</a>',
  4570. '</strong>',
  4571. '<a href="https://adinserter.pro/documentation/adsense-ads#connect-your-site" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4572. '</a>',
  4573. '<a href="https://adinserter.pro/documentation/adsense-ads#in-feed-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4574. '</a>',
  4575. '<a href="https://adinserter.pro/documentation/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4576. '</a>',
  4577. '<a href="https://adinserter.pro/documentation/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4578. '</a>'
  4579. ); ?>
  4580. </div>
  4581. <hr />
  4582. <div><?php /* translators: %s: HTML tags */ printf (__('Become an %s affiliate %s for Ad Inserter Pro and earn commission for each purchase you refer to us', 'ad-inserter'),
  4583. '<a href="https://affiliate.adinserter.pro/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4584. '</a>'
  4585. ); ?>
  4586. <img draggable="false" class="emoji" alt="happy" src="https://s.w.org/images/core/emoji/2.3/svg/1f642.svg" style="margin-left: 5px!important;">
  4587. </div>
  4588. <hr />
  4589. <div><?php /* translators: %s: HTML tags */ printf (__('Ads are not showing? Check %s troubleshooting guide %s to find out how to diagnose and fix the problem.', 'ad-inserter'),
  4590. '<a href="https://adinserter.pro/documentation/adsense-ads#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4591. '</a>'
  4592. ); ?></div>
  4593. <div><?php /* translators: %s: HTML tags */ printf (__('If you need any kind of help or support, please do not hesitate to open a thread on the %s support forum. %s', 'ad-inserter'),
  4594. '<a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">',
  4595. '</a>'
  4596. ); ?></div>
  4597. </div>
  4598. <!-- <div style="float: right; margin: -5px -5px 0 0;">-->
  4599. <!-- <a href="https://adinserter.pro/Ad_Inserter_User_Manual.pdf" class="clear-link" target="_blank"><img id="ai-pdf" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>manual.png" title="Download user manual"/></a>-->
  4600. <!-- <div style="text-align: center; font-size: 12px;">User Manual</div>-->
  4601. <!-- </div>-->
  4602. <div style="clear: both;"></div>
  4603. </div>
  4604. <?php
  4605. }
  4606. function sidebar_pro () {
  4607. $version = rand (0, 3);
  4608. ?>
  4609. <div class="ai-form rounded no-select feature-list" style="background: #fff;">
  4610. <?php if (!wp_is_mobile()): ?>
  4611. <div id="ai-sidebar-right">
  4612. <div class="ai-image-left">
  4613. <?php switch ($version) {
  4614. case 0: ?>
  4615. <!-- <a href='https://adinserter.pro/documentation/code-preview' class="clear-link" title="<?php _e ('Code preview with visual CSS editor', 'ad-inserter'); ?>" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" /></a>-->
  4616. <a href='https://www.infolinks.com/publishers/?kid=3114832&loc=2' class="clear-link" title="<?php _e ('Use Infolinks ads with Adsense to earn more', 'ad-inserter'); ?>" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" /></a>
  4617. <?php break; case 1: ?>
  4618. <a href='https://adinserter.pro/documentation/ad-blocking-detection' class="clear-link" title="<?php _e ('Ad blocking detection and content protection', 'ad-inserter'); ?>" target="_blank"><img id="ai-adb" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-adb.png" /></a>
  4619. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-9" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-9.jpg" /></a>-->
  4620. <?php break; case 2: ?>
  4621. <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="clear-link" title="<?php _e ('A/B testing - Track ad impressions and clicks', 'ad-inserter'); ?>" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" /></a>
  4622. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-9" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-9.jpg" /></a>-->
  4623. <?php break; case 3: ?>
  4624. <a href="https://www.ezoic.com/?utm_source=ad-inserter&utm_medium=ads&utm_campaign=ad-inserter-ads&utm_term=adinserter&utm_content=ezoic&loc=2" class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-ez-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ez-2.jpg" /></a>
  4625. <?php break;
  4626. } ?>
  4627. </div>
  4628. <div class="ai-image-right">
  4629. <?php switch ($version) {
  4630. case 0:
  4631. ?>
  4632. <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" /></a>
  4633. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" /></a>-->
  4634. <?php break;
  4635. case 1:
  4636. ?>
  4637. <a href='https://www.infolinks.com/publishers/?kid=3114832&loc=2' class="clear-link" title="<?php _e ('Use Infolinks ads with Adsense to earn more', 'ad-inserter'); ?>" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" /></a>
  4638. <!-- <a href="https://adinserter.pro/documentation/amp-pages" class="clear-link" title="<?php _e ('Insert ads on AMP pages', 'ad-inserter'); ?>" target="_blank"><img id="ai-amp" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-amp.png" /></a>-->
  4639. <?php break;
  4640. case 2:
  4641. ?>
  4642. <a href="https://www.ezoic.com/?utm_source=ad-inserter&utm_medium=ads&utm_campaign=ad-inserter-ads&utm_term=adinserter&utm_content=ezoic&loc=2" class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-ez-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ez-2.jpg" /></a>
  4643. <?php break;
  4644. case 3:
  4645. ?>
  4646. <a href='https://adinserter.pro/documentation/ad-blocking-detection' class="clear-link" title="<?php _e ('Ad blocking detection and content protection', 'ad-inserter'); ?>" target="_blank"><img id="ai-adb" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-adb.png" /></a>
  4647. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" /></a>-->
  4648. <?php break;
  4649. } ?>
  4650. </div>
  4651. <div style="clear: both;"></div>
  4652. <div class="ai-image-left">
  4653. <?php switch ($version) {
  4654. case 0: ?>
  4655. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-9" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-9.gif" /></a>-->
  4656. <a href="https://www.ezoic.com/?utm_source=ad-inserter&utm_medium=ads&utm_campaign=ad-inserter-ads&utm_term=adinserter&utm_content=ezoic&loc=2" class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-ez-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ez-2.jpg" /></a>
  4657. <?php break; case 1: ?>
  4658. <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" /></a>
  4659. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" /></a>-->
  4660. <?php break; case 2: ?>
  4661. <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" /></a>
  4662. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" /></a>-->
  4663. <?php break; case 3: ?>
  4664. <!-- <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" /></a>-->
  4665. <a href='https://www.infolinks.com/publishers/?kid=3114832&loc=2' class="clear-link" title="<?php _e ('Use Infolinks ads with Adsense to earn more', 'ad-inserter'); ?>" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" /></a>
  4666. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-10" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-10.gif" /></a>-->
  4667. <?php break;
  4668. } ?>
  4669. </div>
  4670. <div class="ai-image-right">
  4671. <?php switch ($version) {
  4672. case 0:
  4673. ?>
  4674. <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="clear-link" title="<?php _e ('A/B testing - Track ad impressions and clicks', 'ad-inserter'); ?>" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" /></a>
  4675. <!-- <a href="https://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" /></a>-->
  4676. <!-- <a href='https://www.media.net/program?ha=e9Pw4uwo2Uw/5xjjsB3lnYZZWUI+hzRSONzDaYA9EwX+3jg/PJYwFshOFEjop5NH2wRNDfr357ZTY1zlhCk7zw%3D%3D&loc=2' class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-media-8" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-8.gif" /></a>-->
  4677. <?php break;
  4678. case 1:
  4679. ?>
  4680. <a href="https://www.ezoic.com/?utm_source=ad-inserter&utm_medium=ads&utm_campaign=ad-inserter-ads&utm_term=adinserter&utm_content=ezoic&loc=2" class="clear-link" title="<?php _e ('Looking for AdSense alternative?', 'ad-inserter'); ?>" target="_blank"><img id="ai-ez-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ez-2.jpg" /></a>
  4681. <?php break;
  4682. case 2:
  4683. ?>
  4684. <a href='https://www.infolinks.com/publishers/?kid=3114832&loc=2' class="clear-link" title="<?php _e ('Use Infolinks ads with Adsense to earn more', 'ad-inserter'); ?>" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" /></a>
  4685. <!-- <a href='https://adinserter.pro/documentation/code-preview' class="clear-link" title="<?php _e ('Code preview with visual CSS editor', 'ad-inserter'); ?>" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" /></a>-->
  4686. <?php break;
  4687. case 3:
  4688. ?>
  4689. <a href='https://adinserter.pro/documentation/code-preview' class="clear-link" title="<?php _e ('Code preview with visual CSS editor', 'ad-inserter'); ?>" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" /></a>
  4690. <?php break;
  4691. } ?>
  4692. </div>
  4693. <div style="clear: both;"></div>
  4694. </div>
  4695. <?php endif; ?>
  4696. <h3 style="text-align: justify;"><?php _e('Looking for Pro Ad Management plugin?', 'ad-inserter'); ?></h3>
  4697. <h4 style="text-align: justify;"><?php _e ('To Optimally Monetize your WordPress website?', 'ad-inserter'); ?></h4>
  4698. <h4 style="text-align: justify;"><?php /* Translators: %s: price of Ad Inserter Pro*/ echo sprintf (__('Different license types starting from %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/features" class="simple-link" target="_blank">20 EUR</a>'); ?></h4>
  4699. <ul class="ai-help">
  4700. <li><?php /* translators: %s HTML tags */ printf (__('%s AdSense Integration %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/adsense-ads#integration" class="simple-link" target="_blank">', '</a>'); ?></li>
  4701. <li><?php /* translators: %s HTML tags */ printf (__('Syntax highlighting %s editor %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/code-editing" class="simple-link" target="_blank">', '</a>'); ?></li>
  4702. <li><?php /* translators: %s HTML tags */ printf (__('%s Code preview %s with visual CSS editor', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/code-preview" class="simple-link" target="_blank">', '</a>'); ?></li>
  4703. <li><?php /* translators: %s HTML tags */ printf (__('Simple user interface - all settings on a single page', 'ad-inserter')); ?></li>
  4704. <li><?php /* translators: %s HTML tags */ printf (__('%s Automatic insertion %s before or after post / content / %s paragraph %s / image / excerpt', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">', '</a>', '<a href="https://adinserter.pro/documentation/paragraph-settings" class="simple-link" target="_blank">', '</a>'); ?></li>
  4705. <li><?php /* translators: %s HTML tags */ printf (__('%s Automatic insertion %s between posts on blog pages', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">', '</a>'); ?></li>
  4706. <li><?php /* translators: %s HTML tags */ printf (__('%s Automatic insertion %s before, between and after comments', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">', '</a>'); ?></li>
  4707. <li><?php /* translators: %s HTML tags */ printf (__('%s Automatic insertion %s after %s or before %s tag', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">', '</a>', '<code>&lt;body&gt;</code>', '<code>&lt;/body&gt;</code>'); ?></li>
  4708. <li><?php /* translators: %s HTML tags */ printf (__('Automatic insertion at %s custom hook positions %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion#custom-hooks" class="simple-link" target="_blank">', '</a>'); ?></li>
  4709. <li><?php /* translators: %s HTML tags */ printf (__('Insertion %s before or after any HTML element on the page %s (using CSS selectors)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/automatic-insertion#before-after-html-element" class="simple-link" target="_blank">', '</a>'); ?></li>
  4710. <li><?php /* translators: %s HTML tags */ printf (__('%s Insertion exceptions %s for individual posts and pages', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/individual-post-and-page-exceptions" class="simple-link" target="_blank">', '</a>'); ?></li>
  4711. <li><?php /* translators: %s HTML tags */ printf (__('%s Manual insertion: %s widgets, shortcodes, PHP function call', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/manual-insertion" class="simple-link" target="_blank">', '</a>'); ?></li>
  4712. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky ads %s with optional close button (ads stay fixed when the page scrolls)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/sticky-ads" class="simple-link" target="_blank">', '</a>'); ?></li>
  4713. <li><?php /* translators: %s HTML tags */ printf (__('%s Background ads %s with one or left and right background images', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/sticky-ads#background-ads" class="simple-link" target="_blank">', '</a>'); ?></li>
  4714. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky sidebar ads %s (stick to the screen or to the content)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/sticky-ads" class="simple-link" target="_blank">', '</a>'); ?></li>
  4715. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky ad animations %s (fade, slide, turn, flip, zoom)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/sticky-ads" class="simple-link" target="_blank">', '</a>'); ?></li>
  4716. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky ad trigger %s (page scroll in %% or px, HTML element becomes visible)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/sticky-ads" class="simple-link" target="_blank">', '</a>'); ?></li>
  4717. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky (fixed) widgets %s (sidebar does not move when the page scrolls)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/manual-insertion" class="simple-link" target="_blank">', '</a>'); ?></li>
  4718. <li><?php /* translators: %s HTML tags */ printf (__('Block %s alignment and style %s customizations', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/alignments-and-styles" class="simple-link" target="_blank">', '</a>'); ?></li>
  4719. <li><?php /* translators: %s HTML tags */ printf (__('%s Clearance %s options to avoid insertion near images or headers (AdSense TOS)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/paragraph-settings" class="simple-link" target="_blank">', '</a>'); ?></li>
  4720. <li><?php /* translators: %s HTML tags */ printf (__('Options to %s disable insertion %s on Ajax calls, 404 error pages or in RSS feeds', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/additional-block-settings" class="simple-link" target="_blank">', '</a>'); ?></li>
  4721. <li><?php /* translators: %s HTML tags */ printf (__('%s Ad rotation %s (works also with caching)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-rotation" class="simple-link" target="_blank">', '</a>'); ?></li>
  4722. <li><?php /* translators: %s HTML tags */ printf (__('Create, edit and check %s ads.txt %s file', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ads-txt" class="simple-link" target="_blank">', '</a>'); ?></li>
  4723. <li><?php /* translators: %s HTML tags */ printf (__('Ad impression and click %s tracking %s (works also with Javascript ads like AdSense)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="simple-link" target="_blank">', '</a>'); ?></li>
  4724. <li><?php /* translators: %s HTML tags */ printf (__('Internal or external %s tracking %s (via Google Analytics or Matomo)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="simple-link" target="_blank">', '</a>'); ?></li>
  4725. <li><?php /* translators: %s HTML tags */ printf (__('%s Public web reports %s for clients, export to PDF', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#reports" class="simple-link" target="_blank">', '</a>'); ?></li>
  4726. <li><?php /* translators: %s HTML tags */ printf (__('Support for %s A/B testing %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ab-testing" class="simple-link" target="_blank">', '</a>'); ?></li>
  4727. <li><?php /* translators: %s HTML tags */ printf (__('Frequency capping - %s limit impressions or clicks %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-limiting" class="simple-link" target="_blank">', '</a>'); ?></li>
  4728. <li><?php /* translators: %s HTML tags */ printf (__('Click fraud %s protection %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-limiting#click-fraud-protection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4729. <li><?php /* translators: %s HTML tags */ printf (__('Support for %s GDPR consent cookie checks %s', 'ad-inserter'), '<a href="https://adinserter.pro/faq/gdpr-compliance-cookies-consent" class="simple-link" target="_blank">', '</a>'); ?></li>
  4730. <li><?php /* translators: %s HTML tags */ printf (__('Support for %s lazy loading %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/additional-block-settings#lazy-loading" class="simple-link" target="_blank">', '</a>'); ?></li>
  4731. <li><?php /* translators: %s HTML tags */ printf (__('Support for ads on %s AMP pages %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/amp-pages" class="simple-link" target="_blank">', '</a>'); ?></li>
  4732. <li><?php /* translators: %s HTML tags */ printf (__('Support for contextual %s Amazon Native Shopping Ads %s (responsive)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/common-settings#amazon" class="simple-link" target="_blank">', '</a>'); ?></li>
  4733. <li><?php /* translators: %s HTML tags */ printf (__('Custom CSS class name for wrapping divs to avoid ad blockers', 'ad-inserter')); ?></li>
  4734. <li><?php /* translators: %s HTML tags */ printf (__('PHP code processing', 'ad-inserter')); ?></li>
  4735. <li><?php /* translators: %s HTML tags */ printf (__('%s Banner %s code generator', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/code-editing#banners" class="simple-link" target="_blank">', '</a>'); ?></li>
  4736. <li><?php /* translators: %s HTML tags */ printf (__('Support for %s header and footer %s code', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/plugin-settings#header-footer" class="simple-link" target="_blank">', '</a>'); ?></li>
  4737. <li><?php /* translators: %s HTML tags */ printf (__('Support for Google Analytics, Matomo or any other web analytics code', 'ad-inserter')); ?></li>
  4738. <li><?php /* translators: %s HTML tags */ printf (__('Desktop, tablet and phone server-side %s device detection %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4739. <li><?php /* translators: %s HTML tags */ printf (__('Client-side %s mobile device detection %s (works with caching)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4740. <li><?php /* translators: %s HTML tags */ printf (__('%s Ad blocking detection %s - popup message, ad replacement, content protection', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-blocking-detection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4741. <li><?php /* translators: %s HTML tags */ printf (__('%s Ad blocking statistics %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ad-blocking-statistics" class="simple-link" target="_blank">', '</a>'); ?></li>
  4742. <li><?php /* translators: %s HTML tags */ printf (__('%s Black/White-list %s categories, tags, taxonomies, users, post IDs, urls, referrers, operating systems, browsers', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/black-and-white-lists" class="simple-link" target="_blank">', '</a>'); ?></li>
  4743. <li><?php /* translators: %s HTML tags */ printf (__('%s Black/White-list %s IP addresses or countries (works also with caching)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">', '</a>'); ?></li>
  4744. <li><?php /* translators: %s HTML tags */ printf (__('%s Multisite options %s to limit settings on the sites', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/plugin-settings#multisite" class="simple-link" target="_blank">', '</a>'); ?></li>
  4745. <li><?php /* translators: %s HTML tags */ printf (__('%s Import/Export %s block or plugin settings', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/code-editing#export-import" class="simple-link" target="_blank">', '</a>'); ?></li>
  4746. <li><?php /* translators: %s HTML tags */ printf (__('%s Insertion scheduling %s with fallback option', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/additional-block-settings#scheduling" class="simple-link" target="_blank">', '</a>'); ?></li>
  4747. <li><?php /* translators: %s HTML tags */ printf (__('Country-level %s GEO targeting %s (works also with caching)', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">', '</a>'); ?></li>
  4748. <li><?php /* translators: %s HTML tags */ printf (__('Simple troubleshooting with many %s debugging functions %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/debugging" class="simple-link" target="_blank">', '</a>'); ?></li>
  4749. <li><?php /* translators: %s HTML tags */ printf (__('%s Visualization %s of inserted blocks or ads for easier placement', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">', '</a>'); ?></li>
  4750. <li><?php /* translators: %s HTML tags */ printf (__('%s Visualization %s of available positions for automatic ad insertion', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">', '</a>'); ?></li>
  4751. <li><?php /* translators: %s HTML tags */ printf (__('%s Visualization %s of HTML tags for easier ad placement between paragraphs', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">', '</a>'); ?></li>
  4752. <li><?php /* translators: %s HTML tags */ printf (__('%s Clipboard support %s to easily copy blocks or settings', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/code-editing#clipboard" class="simple-link" target="_blank">', '</a>'); ?></li>
  4753. <li><?php /* translators: %s HTML tags */ printf (__('No ads on the settings page', 'ad-inserter')); ?></li>
  4754. <li><?php /* translators: %s HTML tags */ printf (__('Premium support', 'ad-inserter')); ?></li>
  4755. </ul>
  4756. <p style="text-align: justify;"><?php /* translators: %s HTML tags */ printf (__('Ad Inserter Pro is a complete all-in-one ad management plugin for WordPress website with many advertising features to automatically insert adverts on posts and pages. With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. 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'), '<a href="https://adinserter.pro/" style="text-decoration: none;" target="_blank">', '</a>'); ?></p>
  4757. </div>
  4758. <?php
  4759. }
  4760. function sidebar_pro_small () { ?>
  4761. <div class="ai-form header rounded" style="padding-bottom: 0;">
  4762. <div style="float: left;">
  4763. <a href="https://adinserter.pro/" class="simple-link" target="_blank"><img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="width: 100px;" /></a>
  4764. </div>
  4765. <div class="feature-list" style="float: right;">
  4766. <h3 style="text-align: center; margin: 0;"><?php /* translators: %s HTML tags */ printf (__('Looking for %s Pro Ad Management plugin? %s', 'ad-inserter'), '<a href="https://adinserter.pro/" class="simple-link" target="_blank">', '</a>'); ?></h3>
  4767. <hr style="margin-bottom: 0;" />
  4768. <div style="float: right; margin-left: 15px;">
  4769. <ul>
  4770. <li><?php /* translators: %s HTML tags */ printf (__('Ads between posts', 'ad-inserter')); ?></li>
  4771. <li><?php /* translators: %s HTML tags */ printf (__('Ads between comments', 'ad-inserter')); ?></li>
  4772. <li><?php /* translators: %s HTML tags */ printf (__('Support via email', 'ad-inserter')); ?></li>
  4773. </ul>
  4774. </div>
  4775. <div style="float: right; margin-left: 15px;">
  4776. <ul>
  4777. <li><?php /* translators: %s HTML tags */ printf (__('%s Sticky positions %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/alignments-and-styles" class="simple-link" target="_blank">', '</a>'); ?></li>
  4778. <li><?php /* translators: %s HTML tags */ printf (__('%s Limit insertions %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/black-and-white-lists" class="simple-link" target="_blank">', '</a>'); ?></li>
  4779. <li><?php /* translators: %s HTML tags */ printf (__('%s Clearance %s options', 'ad-inserter'), '<a href="https://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">', '</a>'); ?></li>
  4780. </ul>
  4781. </div>
  4782. <div style="float: right; margin-left: 15px;">
  4783. <ul>
  4784. <li><?php /* translators: %s HTML tags */ printf (__('Ad rotation', 'ad-inserter')); ?></li>
  4785. <li><?php /* translators: %s HTML tags */ printf (__('%s A/B testing %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ab-testing" class="simple-link" target="_blank">', '</a>'); ?></li>
  4786. <li><?php /* translators: %s HTML tags */ printf (__('%s Ad tracking %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="simple-link" target="_blank">', '</a>'); ?></li>
  4787. </ul>
  4788. </div>
  4789. <div style="float: right; margin-left: 15px;">
  4790. <ul>
  4791. <li><?php /* translators: %s HTML tags */ printf (__('Support for %s AMP pages %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/amp-pages" class="simple-link" target="_blank">', '</a>'); ?></li>
  4792. <li><?php /* translators: %s HTML tags */ printf (__('%s Ad blocking detection %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/ad-blocking-detection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4793. <li><?php /* translators: %s HTML tags */ printf (__('%s Mobile device detection %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">', '</a>'); ?></li>
  4794. </ul>
  4795. </div>
  4796. <div style="float: right; margin-left: 15px;">
  4797. <ul>
  4798. <li><?php /* translators: %s HTML tags */ printf (__('64 code blocks', 'ad-inserter')); ?></li>
  4799. <li><?php /* translators: %s HTML tags */ printf (__('%s GEO targeting %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">', '</a>'); ?></li>
  4800. <li><?php /* translators: %s HTML tags */ printf (__('%s Scheduling %s', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/additional-block-settings#scheduling" class="simple-link" target="_blank">', '</a>'); ?></li>
  4801. </ul>
  4802. </div>
  4803. <div style="clear: both;"></div>
  4804. </div>
  4805. <div style="clear: both;"></div>
  4806. </div>
  4807. <?php
  4808. }
  4809. function ai_block_code_demo ($block_class_name, $block_class, $block_number_class, $block_name_class, $inline_styles) {
  4810. global $block_object;
  4811. $default = $block_object [0];
  4812. $block_class_name = sanitize_html_class ($block_class_name);
  4813. $classes = array ();
  4814. if ($block_class_name != '' && $block_class) $classes []= $block_class_name;
  4815. if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !$inline_styles) $classes []= $default->generate_alignment_class ($block_class_name);
  4816. if ($block_class_name != '' && $block_number_class) $classes []= $block_class_name . '-n';
  4817. if ($block_class_name != '' && $block_name_class) $classes []= $block_class_name . '-name';
  4818. $class = count ($classes) ? ' class="' . implode (' ', $classes) . '"' : '';
  4819. $style = $inline_styles || !defined ('AI_NORMAL_HEADER_STYLES') ? ' style="' . AI_ALIGNMENT_CSS_DEFAULT . '"' : '';
  4820. echo "&lt;div$class$style&gt;";
  4821. }