Version Description
- Added position for automatic insertion Above header (after
<body>
tag) - Added rotation code editor
- Added support to name rotation options
- Added code generator for banners
- Added code generator for AdSense
- Added support to rearrange code blocks
- Added support to copy any block settings
- Added support for clipboard to copy/paste block settings
- Added option to select ad blocking detection mode (Pro only)
- Delayed insertion on posts now available for all insertion positions
- Few minor bug fixes, cosmetic changes and code improvements
Download this release
Release Info
Developer | spacetime |
Plugin | Ad Inserter – WordPress Ads Management with AdSense Header Integration |
Version | 2.2.8 |
Comparing to | |
See all releases |
Code changes from version 2.2.7 to 2.2.8
- ad-inserter.php +126 -32
- class.php +670 -303
- constants.php +24 -9
- css/ad-inserter.css +153 -17
- css/images/icons.png +0 -0
- css/images/insertions-alignmets.png +0 -0
- editor.php +417 -0
- images/loading.gif +0 -0
- includes/js/ai-adb.js +143 -0
- includes/js/ai-adb.min.js +24 -14
- includes/js/ai-rotate.js +9 -2
- includes/js/ai-rotate.min.js +3 -3
- js/ad-inserter.js +875 -162
- preview-adb.php +150 -5
- preview.php +20 -15
- readme.txt +39 -10
- settings.php +592 -350
ad-inserter.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
-
Version: 2.2.
|
5 |
Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
|
6 |
Author: Igor Funa
|
7 |
Author URI: http://igorfuna.com/
|
@@ -12,6 +12,19 @@ Plugin URI: http://adinserter.pro/documentation
|
|
12 |
|
13 |
Change Log
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
Ad Inserter 2.2.7 - 2017-11-08
|
16 |
- Fix for duplicate amp-custom tag on AMP pages
|
17 |
|
@@ -503,6 +516,7 @@ if (version_compare ($wp_version, "4.0", "<")) {
|
|
503 |
require_once AD_INSERTER_PLUGIN_DIR.'class.php';
|
504 |
require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
|
505 |
require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
|
|
|
506 |
require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
|
507 |
require_once AD_INSERTER_PLUGIN_DIR.'preview-adb.php';
|
508 |
|
@@ -674,6 +688,14 @@ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
|
674 |
|
675 |
|
676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
function ai_toolbar ($wp_admin_bar) {
|
678 |
global $block_object, $ai_wp_data;
|
679 |
|
@@ -947,7 +969,10 @@ function ai_block_insertion_status ($block, $ai_last_check) {
|
|
947 |
case AI_CHECK_AD_BELOW: $status .= "PARAGRAPH CLEARANCE BELOW"; break;
|
948 |
case AI_CHECK_SHORTCODE_ATTRIBUTES: $status .= "SHORTCODE ATTRIBUTES"; break;
|
949 |
|
950 |
-
case
|
|
|
|
|
|
|
951 |
case AI_CHECK_NONE: $status = "BLOCK $block"; break;
|
952 |
default: $status .= "?"; break;
|
953 |
}
|
@@ -1027,11 +1052,20 @@ function ai_buffering_end () {
|
|
1027 |
if (!defined ('AI_BUFFERING_START')) return;
|
1028 |
|
1029 |
$page = ob_get_clean();
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
$matches = preg_split ('/(<body.*?'.'>)/i', $page, - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
1031 |
|
1032 |
echo $matches [0], $matches [1];
|
1033 |
ai_custom_hook ('above_header', 'Above Header');
|
1034 |
echo $matches [2];
|
|
|
|
|
|
|
1035 |
}
|
1036 |
|
1037 |
function ai_post_check ($post, $action) {
|
@@ -1291,7 +1325,6 @@ function ai_wp_hook () {
|
|
1291 |
add_action ('wp_footer', 'ai_wp_footer_hook');
|
1292 |
}
|
1293 |
|
1294 |
-
|
1295 |
if ($ai_wp_data [AI_WP_AMP_PAGE]) {
|
1296 |
// No scripts on AMP pages
|
1297 |
if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
|
@@ -1304,6 +1337,13 @@ function ai_wp_hook () {
|
|
1304 |
$ai_total_plugin_time += microtime (true) - $start_time;
|
1305 |
ai_log ("WP HOOK END\n");
|
1306 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1307 |
};
|
1308 |
|
1309 |
function ai_init_hook() {
|
@@ -1315,8 +1355,10 @@ function ai_init_hook() {
|
|
1315 |
ai_wp_hook ();
|
1316 |
}
|
1317 |
|
1318 |
-
add_shortcode ('adinserter', '
|
1319 |
-
add_shortcode ('ADINSERTER', '
|
|
|
|
|
1320 |
}
|
1321 |
|
1322 |
function ai_wp_loaded_hook () {
|
@@ -1540,9 +1582,10 @@ function ai_replace_js_data ($js) {
|
|
1540 |
if (strpos ($js, 'AI_ADB_STATUS_MESSAGE') !== false) {
|
1541 |
$adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
1542 |
|
1543 |
-
$js = str_replace ('AI_ADB_OVERLAY_WINDOW', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) . get_overlay_css () . "'}})", $js);
|
1544 |
-
$js = str_replace ('AI_ADB_MESSAGE_WINDOW', "jQuery ('<div>', {attr: {'style': '" . str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) . get_message_css () . "'}, html: '" .
|
1545 |
-
str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ())) . "'})
|
|
|
1546 |
$js = str_replace ('AI_ADB_SELECTORS', str_replace (' ', '', get_adb_selectors ()), $js);
|
1547 |
|
1548 |
$redirection_page = get_redirection_page ();
|
@@ -1674,10 +1717,10 @@ function ai_admin_notice_hook () {
|
|
1674 |
|
1675 |
$used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
|
1676 |
|
1677 |
-
if ((get_option ('ai-notice-review') === false && $used_blocks >=
|
1678 |
|
1679 |
-
(get_option ('ai-notice-review') == 'later' && ($used_blocks >=
|
1680 |
-
$used_blocks >=
|
1681 |
|
1682 |
if (get_option ('ai-notice-review') == 'later') {
|
1683 |
$message = "Hey, you are now using <strong>{$used_blocks} Ad Inserter</strong> code blocks.";
|
@@ -3379,25 +3422,42 @@ function ai_ajax_backend () {
|
|
3379 |
urldecode ($_POST ["alignment"]),
|
3380 |
wp_unslash (urldecode ($_POST ["alignment_css"])),
|
3381 |
wp_unslash (urldecode ($_POST ["custom_css"])),
|
3382 |
-
wp_unslash (urldecode (base64_decode ($_POST ["code"]))),
|
3383 |
urldecode ($_POST ["php"]) == 1);
|
3384 |
}
|
3385 |
elseif ($block == 'adb') {
|
3386 |
-
generate_code_preview_adb (wp_unslash (urldecode ($_POST ["code"])), urldecode ($_POST ["php"]) == 1);
|
3387 |
-
|
|
|
|
|
|
|
|
|
|
|
3388 |
}
|
3389 |
}
|
3390 |
|
3391 |
-
elseif (isset ($
|
3392 |
$code_generator = new ai_code_generator ();
|
3393 |
|
3394 |
-
echo $code_generator->generate ($
|
3395 |
}
|
3396 |
|
3397 |
-
elseif (isset ($
|
3398 |
$code_generator = new ai_code_generator ();
|
3399 |
|
3400 |
-
echo json_encode ($code_generator->import (wp_unslash ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3401 |
}
|
3402 |
|
3403 |
elseif (isset ($_GET ["image"])) {
|
@@ -3439,6 +3499,10 @@ function ai_ajax_backend () {
|
|
3439 |
code_block_list ();
|
3440 |
}
|
3441 |
|
|
|
|
|
|
|
|
|
3442 |
elseif (function_exists ('ai_ajax_backend_2')) {
|
3443 |
ai_ajax_backend_2 ();
|
3444 |
}
|
@@ -3783,7 +3847,7 @@ function generate_alignment_css () {
|
|
3783 |
function generate_debug_css () {
|
3784 |
?>
|
3785 |
.ai-debug-tags {font-weight: bold; color: white; padding: 2px;}
|
3786 |
-
.ai-debug-positions {text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;}
|
3787 |
.ai-debug-page-type {text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid green; color: green; background: #efe;}
|
3788 |
.ai-debug-adb {text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid red; color: red; background: #fee; opacity: 0.85; cursor: pointer;}
|
3789 |
.ai-debug-widget {margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;}
|
@@ -4200,7 +4264,7 @@ function ai_adinserter ($ad_number = '', $ignore = ''){
|
|
4200 |
$obj = $block_object [$ad_number];
|
4201 |
$obj->clear_code_cache ();
|
4202 |
|
4203 |
-
$ai_last_check =
|
4204 |
if (!$obj->get_enable_php_call ()) return "";
|
4205 |
if (!$obj->check_server_side_detection ()) return "";
|
4206 |
if (!$obj->check_page_types_lists_users (in_array ("page-type", $ignore_array))) return "";
|
@@ -4298,6 +4362,7 @@ function ai_content_hook ($content = '') {
|
|
4298 |
|
4299 |
if (!isset ($block_object [$block])) continue;
|
4300 |
|
|
|
4301 |
$current_block = $block;
|
4302 |
|
4303 |
$obj = $block_object [$block];
|
@@ -5053,7 +5118,33 @@ function ai_custom_hook ($action, $name, $hook_parameter = null, $hook_check = n
|
|
5053 |
}
|
5054 |
}
|
5055 |
|
5056 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5057 |
global $block_object, $ai_last_check, $ai_wp_data;
|
5058 |
|
5059 |
if ($atts == '') return '';
|
@@ -5076,6 +5167,7 @@ function process_shortcode (&$block, $atts) {
|
|
5076 |
"data" => "",
|
5077 |
), $atts);
|
5078 |
|
|
|
5079 |
$output = "";
|
5080 |
if (function_exists ('ai_shortcode')) {
|
5081 |
$output = ai_shortcode ($parameters);
|
@@ -5121,6 +5213,8 @@ function process_shortcode (&$block, $atts) {
|
|
5121 |
|
5122 |
if ($block == - 1) {
|
5123 |
if ($parameters ['rotate'] != '' || in_array ('ROTATE', $atts) || in_array ('rotate', $atts)) {
|
|
|
|
|
5124 |
return AD_ROTATE_SEPARATOR;
|
5125 |
}
|
5126 |
if ($parameters ['count'] != '' || in_array ('COUNT', $atts) || in_array ('count', $atts)) {
|
@@ -5183,7 +5277,7 @@ function process_shortcode (&$block, $atts) {
|
|
5183 |
$obj = $block_object [$block];
|
5184 |
$obj->clear_code_cache ();
|
5185 |
|
5186 |
-
$ai_last_check =
|
5187 |
if (!$obj->get_enable_manual ()) return "";
|
5188 |
|
5189 |
if (!$obj->check_server_side_detection ()) return "";
|
@@ -5211,7 +5305,7 @@ function process_shortcode (&$block, $atts) {
|
|
5211 |
}
|
5212 |
}
|
5213 |
|
5214 |
-
function
|
5215 |
global $ai_last_check, $ai_wp_data, $ai_total_plugin_time;
|
5216 |
|
5217 |
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
@@ -5223,12 +5317,12 @@ function process_shortcodes ($atts, $ai_shortcode_name) {
|
|
5223 |
$atts_string .= $att.' '; else
|
5224 |
$atts_string .= $index.("='".$att."'").' ';
|
5225 |
}
|
5226 |
-
ai_log ("PROCESS SHORTCODES [$
|
5227 |
$start_time = microtime (true);
|
5228 |
}
|
5229 |
$ai_last_check = AI_CHECK_NONE;
|
5230 |
$block = - 1;
|
5231 |
-
$shortcode =
|
5232 |
|
5233 |
if ($debug_processing) {
|
5234 |
$ai_total_plugin_time += microtime (true) - $start_time;
|
@@ -5243,13 +5337,13 @@ function process_shortcodes ($atts, $ai_shortcode_name) {
|
|
5243 |
return $shortcode;
|
5244 |
}
|
5245 |
|
5246 |
-
function process_shortcodes_lc ($atts) {
|
5247 |
-
return process_shortcodes ($atts, 'adinserter');
|
5248 |
-
}
|
5249 |
|
5250 |
-
function process_shortcodes_uc ($atts) {
|
5251 |
-
return process_shortcodes ($atts, 'ADINSERTER');
|
5252 |
-
}
|
5253 |
|
5254 |
|
5255 |
class ai_widget extends WP_Widget {
|
@@ -5407,7 +5501,7 @@ function ai_widget_draw ($args, $instance, &$block) {
|
|
5407 |
|
5408 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
|
5409 |
|
5410 |
-
$ai_last_check =
|
5411 |
if (!$obj->get_enable_widget ()) return;
|
5412 |
if (!$obj->check_server_side_detection ()) return;
|
5413 |
if (!$obj->check_page_types_lists_users ()) return;
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
+
Version: 2.2.8
|
5 |
Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
|
6 |
Author: Igor Funa
|
7 |
Author URI: http://igorfuna.com/
|
12 |
|
13 |
Change Log
|
14 |
|
15 |
+
Ad Inserter 2.2.8 - 2017-12-08
|
16 |
+
- Added position for automatic insertion Above header (after `<body>` tag)
|
17 |
+
- Added rotation code editor
|
18 |
+
- Added support to name rotation options
|
19 |
+
- Added code generator for banners
|
20 |
+
- Added code generator for AdSense
|
21 |
+
- Added support to rearrange code blocks
|
22 |
+
- Added support to copy any block settings
|
23 |
+
- Added support for clipboard to copy/paste block settings
|
24 |
+
- Added option to select ad blocking detection mode (Pro only)
|
25 |
+
- Delayed insertion on posts now available for all insertion positions
|
26 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
27 |
+
|
28 |
Ad Inserter 2.2.7 - 2017-11-08
|
29 |
- Fix for duplicate amp-custom tag on AMP pages
|
30 |
|
516 |
require_once AD_INSERTER_PLUGIN_DIR.'class.php';
|
517 |
require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
|
518 |
require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
|
519 |
+
require_once AD_INSERTER_PLUGIN_DIR.'editor.php';
|
520 |
require_once AD_INSERTER_PLUGIN_DIR.'preview.php';
|
521 |
require_once AD_INSERTER_PLUGIN_DIR.'preview-adb.php';
|
522 |
|
688 |
|
689 |
|
690 |
|
691 |
+
function ai_wp_default_editor () {
|
692 |
+
return 'tinymce';
|
693 |
+
}
|
694 |
+
|
695 |
+
function ai_wp_default_editor_html () {
|
696 |
+
return 'html';
|
697 |
+
}
|
698 |
+
|
699 |
function ai_toolbar ($wp_admin_bar) {
|
700 |
global $block_object, $ai_wp_data;
|
701 |
|
969 |
case AI_CHECK_AD_BELOW: $status .= "PARAGRAPH CLEARANCE BELOW"; break;
|
970 |
case AI_CHECK_SHORTCODE_ATTRIBUTES: $status .= "SHORTCODE ATTRIBUTES"; break;
|
971 |
|
972 |
+
case AI_CHECK_ENABLED_PHP: $status .= "ENABLED PHP FUNCTION"; break;
|
973 |
+
case AI_CHECK_ENABLED_SHORTCODE: $status .= "ENABLED SHORTCODE"; break;
|
974 |
+
case AI_CHECK_ENABLED_WIDGET: $status .= "ENABLED WIDGET"; break;
|
975 |
+
|
976 |
case AI_CHECK_NONE: $status = "BLOCK $block"; break;
|
977 |
default: $status .= "?"; break;
|
978 |
}
|
1052 |
if (!defined ('AI_BUFFERING_START')) return;
|
1053 |
|
1054 |
$page = ob_get_clean();
|
1055 |
+
|
1056 |
+
|
1057 |
+
// TEST
|
1058 |
+
// $page = ai_content_hook ($page);
|
1059 |
+
|
1060 |
+
|
1061 |
$matches = preg_split ('/(<body.*?'.'>)/i', $page, - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
1062 |
|
1063 |
echo $matches [0], $matches [1];
|
1064 |
ai_custom_hook ('above_header', 'Above Header');
|
1065 |
echo $matches [2];
|
1066 |
+
|
1067 |
+
|
1068 |
+
// echo ai_content_hook ($matches [2]);
|
1069 |
}
|
1070 |
|
1071 |
function ai_post_check ($post, $action) {
|
1325 |
add_action ('wp_footer', 'ai_wp_footer_hook');
|
1326 |
}
|
1327 |
|
|
|
1328 |
if ($ai_wp_data [AI_WP_AMP_PAGE]) {
|
1329 |
// No scripts on AMP pages
|
1330 |
if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
|
1337 |
$ai_total_plugin_time += microtime (true) - $start_time;
|
1338 |
ai_log ("WP HOOK END\n");
|
1339 |
}
|
1340 |
+
|
1341 |
+
|
1342 |
+
|
1343 |
+
// wp_dequeue_script ('jquery');
|
1344 |
+
// wp_deregister_script ('jquery');
|
1345 |
+
|
1346 |
+
|
1347 |
};
|
1348 |
|
1349 |
function ai_init_hook() {
|
1355 |
ai_wp_hook ();
|
1356 |
}
|
1357 |
|
1358 |
+
add_shortcode ('adinserter', 'ai_process_shortcodes');
|
1359 |
+
add_shortcode ('ADINSERTER', 'ai_process_shortcodes');
|
1360 |
+
|
1361 |
+
add_filter ('pre_do_shortcode_tag', 'ai_pre_do_shortcode_tag', 10, 4);
|
1362 |
}
|
1363 |
|
1364 |
function ai_wp_loaded_hook () {
|
1582 |
if (strpos ($js, 'AI_ADB_STATUS_MESSAGE') !== false) {
|
1583 |
$adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
1584 |
|
1585 |
+
$js = str_replace ('AI_ADB_OVERLAY_WINDOW', "jQuery ('<div>', {attr: {'style': jQuery.base64Decode ('" . base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) . get_overlay_css ()) . "')}})", $js);
|
1586 |
+
$js = str_replace ('AI_ADB_MESSAGE_WINDOW', "jQuery ('<div>', {attr: {'style': jQuery.base64Decode ('" . base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) . get_message_css ()) . "')}, 'html': jQuery.base64Decode ('" .
|
1587 |
+
base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ()))) . "')})", $js);
|
1588 |
+
|
1589 |
$js = str_replace ('AI_ADB_SELECTORS', str_replace (' ', '', get_adb_selectors ()), $js);
|
1590 |
|
1591 |
$redirection_page = get_redirection_page ();
|
1717 |
|
1718 |
$used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
|
1719 |
|
1720 |
+
if ((get_option ('ai-notice-review') === false && $used_blocks >= 4 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 20) ||
|
1721 |
|
1722 |
+
(get_option ('ai-notice-review') == 'later' && ($used_blocks >= 8 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 50 ||
|
1723 |
+
$used_blocks >= 4 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 70))) {
|
1724 |
|
1725 |
if (get_option ('ai-notice-review') == 'later') {
|
1726 |
$message = "Hey, you are now using <strong>{$used_blocks} Ad Inserter</strong> code blocks.";
|
3422 |
urldecode ($_POST ["alignment"]),
|
3423 |
wp_unslash (urldecode ($_POST ["alignment_css"])),
|
3424 |
wp_unslash (urldecode ($_POST ["custom_css"])),
|
3425 |
+
wp_unslash (urldecode (base64_decode ($_POST ["code"]))), // base64_decode after wp_unslash / urldecode ?
|
3426 |
urldecode ($_POST ["php"]) == 1);
|
3427 |
}
|
3428 |
elseif ($block == 'adb') {
|
3429 |
+
generate_code_preview_adb (wp_unslash (urldecode (base64_decode ($_POST ["code"]))), urldecode ($_POST ["php"]) == 1);
|
3430 |
+
}
|
3431 |
+
}
|
3432 |
+
|
3433 |
+
elseif (isset ($_POST ["edit"])) {
|
3434 |
+
if (is_numeric ($_POST ["edit"]) && $_POST ["edit"] >= 1 && $_POST ["edit"] <= AD_INSERTER_BLOCKS) {
|
3435 |
+
generate_code_editor ($_POST ["edit"], wp_unslash (urldecode (base64_decode ($_POST ["code"]))), urldecode ($_POST ["php"]) == 1);
|
3436 |
}
|
3437 |
}
|
3438 |
|
3439 |
+
elseif (isset ($_POST ["generate-code"])) {
|
3440 |
$code_generator = new ai_code_generator ();
|
3441 |
|
3442 |
+
echo json_encode ($code_generator->generate ($_POST));
|
3443 |
}
|
3444 |
|
3445 |
+
elseif (isset ($_POST ["import-code"])) {
|
3446 |
$code_generator = new ai_code_generator ();
|
3447 |
|
3448 |
+
echo json_encode ($code_generator->import (wp_unslash (urldecode ($_POST ["import-code"]))));
|
3449 |
+
}
|
3450 |
+
|
3451 |
+
elseif (isset ($_POST ["import-rotation-code"])) {
|
3452 |
+
$code_generator = new ai_code_generator ();
|
3453 |
+
|
3454 |
+
echo json_encode ($code_generator->import_rotation (wp_unslash (urldecode ($_POST ["import-rotation-code"]))));
|
3455 |
+
}
|
3456 |
+
|
3457 |
+
elseif (isset ($_POST ["generate-rotation-code"])) {
|
3458 |
+
$code_generator = new ai_code_generator ();
|
3459 |
+
|
3460 |
+
echo json_encode ($code_generator->generate_rotation ($_POST ['generate-rotation-code']));
|
3461 |
}
|
3462 |
|
3463 |
elseif (isset ($_GET ["image"])) {
|
3499 |
code_block_list ();
|
3500 |
}
|
3501 |
|
3502 |
+
elseif (isset ($_GET ["settings"])) {
|
3503 |
+
generate_settings_form ();
|
3504 |
+
}
|
3505 |
+
|
3506 |
elseif (function_exists ('ai_ajax_backend_2')) {
|
3507 |
ai_ajax_backend_2 ();
|
3508 |
}
|
3847 |
function generate_debug_css () {
|
3848 |
?>
|
3849 |
.ai-debug-tags {font-weight: bold; color: white; padding: 2px;}
|
3850 |
+
.ai-debug-positions {clear: both; text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid blue; color: blue; background: #eef;}
|
3851 |
.ai-debug-page-type {text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid green; color: green; background: #efe;}
|
3852 |
.ai-debug-adb {text-align: center; padding: 10px 0; font-weight: bold; border: 1px solid red; color: red; background: #fee; opacity: 0.85; cursor: pointer;}
|
3853 |
.ai-debug-widget {margin: 0; padding: 0 5px; font-size: 10px; white-space: pre; overflow-x: auto; overflow-y: hidden;}
|
4264 |
$obj = $block_object [$ad_number];
|
4265 |
$obj->clear_code_cache ();
|
4266 |
|
4267 |
+
$ai_last_check = AI_CHECK_ENABLED_PHP;
|
4268 |
if (!$obj->get_enable_php_call ()) return "";
|
4269 |
if (!$obj->check_server_side_detection ()) return "";
|
4270 |
if (!$obj->check_page_types_lists_users (in_array ("page-type", $ignore_array))) return "";
|
4362 |
|
4363 |
if (!isset ($block_object [$block])) continue;
|
4364 |
|
4365 |
+
$ai_last_check = AI_CHECK_NONE;
|
4366 |
$current_block = $block;
|
4367 |
|
4368 |
$obj = $block_object [$block];
|
5118 |
}
|
5119 |
}
|
5120 |
|
5121 |
+
|
5122 |
+
function ai_pre_do_shortcode_tag ($return, $tag, $attr, $m) {
|
5123 |
+
global $ai_expand_only_rotate;
|
5124 |
+
|
5125 |
+
// Array
|
5126 |
+
//(
|
5127 |
+
// [0] => [ADINSERTER ROTATE='1']
|
5128 |
+
// [1] =>
|
5129 |
+
// [2] => ADINSERTER
|
5130 |
+
// [3] => ROTATE='1'
|
5131 |
+
// [4] =>
|
5132 |
+
// [5] =>
|
5133 |
+
// [6] =>
|
5134 |
+
|
5135 |
+
if (strtolower ($tag) == 'adinserter') {
|
5136 |
+
if ($ai_expand_only_rotate) {
|
5137 |
+
// Expand only ROTATE
|
5138 |
+
if (isset ($attr ['rotate']) || in_array ('ROTATE', $attr) || in_array ('rotate', $atts)) {
|
5139 |
+
return false;
|
5140 |
+
} else return $m [0];
|
5141 |
+
}
|
5142 |
+
}
|
5143 |
+
|
5144 |
+
return $return;
|
5145 |
+
}
|
5146 |
+
|
5147 |
+
function ai_process_shortcode (&$block, $atts) {
|
5148 |
global $block_object, $ai_last_check, $ai_wp_data;
|
5149 |
|
5150 |
if ($atts == '') return '';
|
5167 |
"data" => "",
|
5168 |
), $atts);
|
5169 |
|
5170 |
+
|
5171 |
$output = "";
|
5172 |
if (function_exists ('ai_shortcode')) {
|
5173 |
$output = ai_shortcode ($parameters);
|
5213 |
|
5214 |
if ($block == - 1) {
|
5215 |
if ($parameters ['rotate'] != '' || in_array ('ROTATE', $atts) || in_array ('rotate', $atts)) {
|
5216 |
+
if (!isset ($ai_wp_data [AI_SHORTCODES]['rotate'])) $ai_wp_data [AI_SHORTCODES]['rotate'] = array ();
|
5217 |
+
$ai_wp_data [AI_SHORTCODES]['rotate'] []= $parameters;
|
5218 |
return AD_ROTATE_SEPARATOR;
|
5219 |
}
|
5220 |
if ($parameters ['count'] != '' || in_array ('COUNT', $atts) || in_array ('count', $atts)) {
|
5277 |
$obj = $block_object [$block];
|
5278 |
$obj->clear_code_cache ();
|
5279 |
|
5280 |
+
$ai_last_check = AI_CHECK_ENABLED_SHORTCODE;
|
5281 |
if (!$obj->get_enable_manual ()) return "";
|
5282 |
|
5283 |
if (!$obj->check_server_side_detection ()) return "";
|
5305 |
}
|
5306 |
}
|
5307 |
|
5308 |
+
function ai_process_shortcodes ($atts, $content, $tag) {
|
5309 |
global $ai_last_check, $ai_wp_data, $ai_total_plugin_time;
|
5310 |
|
5311 |
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
5317 |
$atts_string .= $att.' '; else
|
5318 |
$atts_string .= $index.("='".$att."'").' ';
|
5319 |
}
|
5320 |
+
ai_log ("PROCESS SHORTCODES [$tag ".trim ($atts_string).']');
|
5321 |
$start_time = microtime (true);
|
5322 |
}
|
5323 |
$ai_last_check = AI_CHECK_NONE;
|
5324 |
$block = - 1;
|
5325 |
+
$shortcode = ai_process_shortcode ($block, $atts);
|
5326 |
|
5327 |
if ($debug_processing) {
|
5328 |
$ai_total_plugin_time += microtime (true) - $start_time;
|
5337 |
return $shortcode;
|
5338 |
}
|
5339 |
|
5340 |
+
//function process_shortcodes_lc ($atts, $content, $tag) {
|
5341 |
+
// return process_shortcodes ($atts, 'adinserter');
|
5342 |
+
//}
|
5343 |
|
5344 |
+
//function process_shortcodes_uc ($atts, $content, $tag) {
|
5345 |
+
// return process_shortcodes ($atts, 'ADINSERTER');
|
5346 |
+
//}
|
5347 |
|
5348 |
|
5349 |
class ai_widget extends WP_Widget {
|
5501 |
|
5502 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_WIDGET;
|
5503 |
|
5504 |
+
$ai_last_check = AI_CHECK_ENABLED_WIDGET;
|
5505 |
if (!$obj->get_enable_widget ()) return;
|
5506 |
if (!$obj->check_server_side_detection ()) return;
|
5507 |
if (!$obj->check_page_types_lists_users ()) return;
|
class.php
CHANGED
@@ -9,7 +9,9 @@ abstract class ai_BaseCodeBlock {
|
|
9 |
var $w3tc_code;
|
10 |
var $needs_class;
|
11 |
var $code_version;
|
12 |
-
var $
|
|
|
|
|
13 |
|
14 |
function __construct () {
|
15 |
|
@@ -21,7 +23,10 @@ abstract class ai_BaseCodeBlock {
|
|
21 |
$this->w3tc_code = '';
|
22 |
$this->needs_class = false;
|
23 |
$this->code_version = 0;
|
|
|
24 |
$this->color_class = 'ai-debug-default';
|
|
|
|
|
25 |
|
26 |
$this->wp_options [AI_OPTION_CODE] = AD_EMPTY_DATA;
|
27 |
$this->wp_options [AI_OPTION_PROCESS_PHP] = AI_DISABLED;
|
@@ -344,8 +349,8 @@ abstract class ai_BaseCodeBlock {
|
|
344 |
if ($this->fallback != 0) return $block_object [$this->fallback]->ai_getCode ();
|
345 |
|
346 |
$obj = $this;
|
347 |
-
$code = $client_code
|
348 |
-
$php = $process_php
|
349 |
|
350 |
if ($php && (!is_multisite() || is_main_site () || multisite_php_processing ())) {
|
351 |
|
@@ -1118,6 +1123,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1118 |
|
1119 |
$code = $this->ai_getCode ($client_code, $process_php);
|
1120 |
|
|
|
|
|
1121 |
$processed_code = $this->replace_ai_tags (do_shortcode ($code));
|
1122 |
|
1123 |
if (strpos ($code, AD_COUNT_SEPARATOR) !== false) {
|
@@ -1137,7 +1144,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1137 |
|
1138 |
|
1139 |
if (strpos ($processed_code, AD_ROTATE_SEPARATOR) !== false) {
|
|
|
1140 |
$ads = explode (AD_ROTATE_SEPARATOR, $processed_code);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
|
1142 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1143 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
@@ -1146,6 +1163,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1146 |
case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
|
1147 |
$this->code_version = mt_rand (1, count ($ads));
|
1148 |
$processed_code = trim ($ads [$this->code_version - 1]);
|
|
|
1149 |
break;
|
1150 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
|
1151 |
$this->code_version = '""';
|
@@ -1158,12 +1176,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1158 |
$ad = trim ($codes [0]);
|
1159 |
}
|
1160 |
|
|
|
|
|
1161 |
switch ($index) {
|
1162 |
case 0:
|
1163 |
-
$processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'>\n".trim ($ad, "\n")."\n</div>\n";
|
1164 |
break;
|
1165 |
default:
|
1166 |
-
$processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'>".trim ($ad, "\n")."\n</div>\n";
|
1167 |
break;
|
1168 |
}
|
1169 |
}
|
@@ -1183,7 +1203,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1183 |
|
1184 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1185 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && $this->w3tc_code == '') $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1186 |
-
elseif ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE
|
1187 |
|
1188 |
switch ($amp_dynamic_blocks) {
|
1189 |
case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
|
@@ -1213,7 +1233,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1213 |
break;
|
1214 |
}
|
1215 |
|
1216 |
-
|
1217 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1218 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1219 |
|
@@ -1286,8 +1305,13 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1286 |
if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($this->number); else $url_parameters = "";
|
1287 |
$url = admin_url ('options-general.php?page=ad-inserter.php') . $url_parameters . '&tab=' . $this->number;
|
1288 |
|
1289 |
-
$
|
1290 |
-
|
|
|
|
|
|
|
|
|
|
|
1291 |
}
|
1292 |
|
1293 |
return $processed_code;
|
@@ -1314,10 +1338,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1314 |
for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
|
1315 |
$viewport_name = get_viewport_name ($viewport);
|
1316 |
if ($viewport_name != '') {
|
|
|
1317 |
if ($this->get_detection_viewport ($viewport))
|
1318 |
-
$visible_viewports .= '<section class="ai-viewport-' . $viewport .'"><section class="ai-debug-bar '.$this->color_class.'"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () .'</a><a> '.$viewport_name.' </a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section></section>'; else
|
1319 |
if (!$ai_wp_data [AI_WP_AMP_PAGE])
|
1320 |
-
$hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible" style="' . $this->get_alignment_style() . '"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () .'</a><a> '.$viewport_name.' </a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
|
|
|
1321 |
}
|
1322 |
}
|
1323 |
|
@@ -1384,9 +1410,18 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1384 |
$wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
|
1385 |
}
|
1386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1387 |
$code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
1388 |
$code .= $this->w3tc_code.' if ($ai_enabled) echo str_replace (\'[#AI_DATA#]\', base64_encode ("[' . $this->number . ',$ai_index]"), unserialize (base64_decode (\''.base64_encode (serialize ($wrapper_before)).'\'))), $ai_code, unserialize (base64_decode (\''.base64_encode (serialize ($wrapper_after)).'\'));';
|
1389 |
$code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
|
|
1390 |
return $code;
|
1391 |
} else return $wrapper_before . $code . $wrapper_after;
|
1392 |
}
|
@@ -1854,12 +1889,22 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1854 |
}
|
1855 |
|
1856 |
|
1857 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1858 |
|
1859 |
-
|
|
|
1860 |
if (!$position_preview) {
|
1861 |
-
if (strpos ($
|
1862 |
-
$positions = explode (',', str_replace (' ', '', $
|
1863 |
foreach ($positions as $index => $position) {
|
1864 |
if ($position > 0 && $position < 1) {
|
1865 |
$positions [$index] = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
@@ -1867,11 +1912,35 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1867 |
elseif ($position <= 0) {
|
1868 |
$positions [$index] = mt_rand (0, count ($paragraph_positions) - 1);
|
1869 |
}
|
|
|
1870 |
}
|
1871 |
}
|
1872 |
-
elseif ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1873 |
foreach ($paragraph_positions as $index => $paragraph_position) {
|
1874 |
-
$positions []= $index + 1;
|
|
|
1875 |
}
|
1876 |
|
1877 |
if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
|
@@ -1912,164 +1981,222 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1912 |
}
|
1913 |
}
|
1914 |
|
1915 |
-
|
1916 |
-
if ($position > 0 && $position < 1) {
|
1917 |
-
$position = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
1918 |
-
}
|
1919 |
-
elseif ($position <= 0) {
|
1920 |
-
$position = mt_rand (0, count ($paragraph_positions) - 1);
|
1921 |
-
} else $position --;
|
1922 |
-
|
1923 |
|
|
|
|
|
1924 |
$avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
|
1925 |
$avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
|
1926 |
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
$avoid_paragraph_texts_below = explode (",", html_entity_decode (trim ($avoid_text_below)));
|
1932 |
|
1933 |
-
|
1934 |
-
|
1935 |
|
1936 |
-
|
1937 |
-
|
1938 |
-
do {
|
1939 |
-
$found_above = false;
|
1940 |
-
if ($position != 0 && $avoid_paragraphs_above != 0 && $avoid_text_above != "" && is_array ($avoid_paragraph_texts_above) && count ($avoid_paragraph_texts_above) != 0) {
|
1941 |
-
$paragraph_position_above = $position - $avoid_paragraphs_above;
|
1942 |
-
if ($paragraph_position_above < 0) $paragraph_position_above = 0;
|
1943 |
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1949 |
|
1950 |
-
foreach ($avoid_paragraph_texts_above as $paragraph_text_above) {
|
1951 |
-
if (trim ($paragraph_text_above) == '') continue;
|
1952 |
if ($multibyte) {
|
1953 |
-
|
1954 |
-
$found_above = true;
|
1955 |
-
break;
|
1956 |
-
}
|
1957 |
} else {
|
1958 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1959 |
$found_above = true;
|
1960 |
break;
|
1961 |
}
|
1962 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1963 |
}
|
1964 |
-
}
|
1965 |
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
|
1970 |
-
|
1971 |
-
if ($paragraph_position_below > count ($paragraph_positions) - 1)
|
1972 |
-
$content_position_below = mb_strlen ($content); else
|
1973 |
-
$content_position_below = $paragraph_positions [$paragraph_position_below];
|
1974 |
-
$paragraph_code = mb_substr ($content, $paragraph_positions [$position], $content_position_below - $paragraph_positions [$position]);
|
1975 |
-
} else {
|
1976 |
if ($paragraph_position_below > count ($paragraph_positions) - 1)
|
1977 |
-
$content_position_below =
|
1978 |
$content_position_below = $paragraph_positions [$paragraph_position_below];
|
1979 |
-
$paragraph_code =
|
1980 |
-
}
|
|
|
|
|
|
|
|
|
|
|
1981 |
|
1982 |
-
|
1983 |
-
|
1984 |
|
1985 |
-
|
1986 |
-
|
1987 |
-
$found_below = true;
|
1988 |
-
break;
|
1989 |
-
}
|
1990 |
-
} else {
|
1991 |
-
if (stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
1992 |
$found_below = true;
|
1993 |
break;
|
1994 |
}
|
1995 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1996 |
}
|
1997 |
-
}
|
1998 |
|
1999 |
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
|
2009 |
|
2010 |
-
|
2011 |
-
$ai_last_check = AI_CHECK_DO_NOT_INSERT;
|
2012 |
-
if ($this->get_avoid_action() == AD_DO_NOT_INSERT) return $content;
|
2013 |
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
$ai_last_check = AI_CHECK_AD_BELOW;
|
2022 |
-
if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2023 |
-
$position ++;
|
2024 |
-
break;
|
2025 |
-
case AD_ABOVE_AND_THEN_BELOW: // Try first above and then below
|
2026 |
-
if ($position == 0 || $checks == 0) {
|
2027 |
-
// Try below
|
2028 |
-
$direction = AD_BELOW;
|
2029 |
-
$checks = $max_checks;
|
2030 |
-
$position = $saved_position;
|
2031 |
-
$ai_last_check = AI_CHECK_AD_BELOW;
|
2032 |
-
if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2033 |
-
$position ++;
|
2034 |
-
} else $position --;
|
2035 |
break;
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
$checks = $max_checks;
|
2041 |
-
$position = $saved_position;
|
2042 |
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2043 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2044 |
$position --;
|
2045 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2046 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2047 |
}
|
2048 |
-
} else break; // Text not found - insert
|
2049 |
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
} while (true);
|
2054 |
-
}
|
2055 |
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
|
|
2059 |
}
|
2060 |
|
|
|
2061 |
if ($position_preview || !empty ($positions)) {
|
2062 |
$offset = 0;
|
2063 |
if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
2064 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2065 |
foreach ($paragraph_positions as $counter => $paragraph_position) {
|
2066 |
if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
|
2067 |
-
elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
|
|
|
2068 |
$this->increment_block_counter ();
|
2069 |
$inserted_code = $this->get_code_for_insertion ();
|
2070 |
-
$ai_last_check = AI_CHECK_INSERTED;
|
|
|
|
|
|
|
|
|
|
|
|
|
2071 |
}
|
2072 |
-
else continue;
|
2073 |
|
2074 |
if ($multibyte) {
|
2075 |
if ($this->get_direction_type() == AD_DIRECTION_FROM_BOTTOM) {
|
@@ -2088,9 +2215,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2088 |
}
|
2089 |
}
|
2090 |
|
|
|
2091 |
return $content;
|
2092 |
}
|
2093 |
|
|
|
2094 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
2095 |
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
2096 |
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
@@ -2318,12 +2447,22 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2318 |
}
|
2319 |
|
2320 |
|
2321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2322 |
|
2323 |
-
|
|
|
2324 |
if (!$position_preview) {
|
2325 |
-
if (strpos ($
|
2326 |
-
$positions = explode (',', str_replace (' ', '', $
|
2327 |
foreach ($positions as $index => $position) {
|
2328 |
if ($position > 0 && $position < 1) {
|
2329 |
$positions [$index] = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
@@ -2331,9 +2470,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2331 |
elseif ($position <= 0) {
|
2332 |
$positions [$index] = mt_rand (0, count ($paragraph_positions) - 1);
|
2333 |
}
|
|
|
2334 |
}
|
2335 |
}
|
2336 |
-
elseif ($
|
|
|
2337 |
|
2338 |
$min_words_above = $this->get_minimum_words_above ();
|
2339 |
if (!empty ($min_words_above)) {
|
@@ -2348,14 +2489,16 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2348 |
|
2349 |
$words_above += number_of_words ($paragraph_code);
|
2350 |
if ($words_above >= $min_words_above) {
|
2351 |
-
$positions []= $index + 1;
|
|
|
2352 |
$words_above = 0;
|
2353 |
}
|
2354 |
|
2355 |
}
|
2356 |
} else
|
2357 |
foreach ($paragraph_positions as $index => $paragraph_position) {
|
2358 |
-
$positions []= $index + 1;
|
|
|
2359 |
}
|
2360 |
|
2361 |
if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
|
@@ -2389,156 +2532,203 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2389 |
$positions = $filtered_positions;
|
2390 |
} else $positions = array ();
|
2391 |
}
|
2392 |
-
|
2393 |
}
|
2394 |
-
|
2395 |
}
|
2396 |
|
2397 |
-
|
2398 |
-
if ($position > 0 && $position < 1) {
|
2399 |
-
$position = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
2400 |
-
}
|
2401 |
-
elseif ($position <= 0) {
|
2402 |
-
$position = mt_rand (0, count ($paragraph_positions) - 1);
|
2403 |
-
} else $position --;
|
2404 |
-
|
2405 |
|
|
|
|
|
2406 |
$avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
|
2407 |
$avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
|
2408 |
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
$avoid_paragraph_texts_below = explode (",", html_entity_decode (trim ($avoid_text_below)));
|
2414 |
-
|
2415 |
-
$direction = $this->get_avoid_direction();
|
2416 |
-
$max_checks = $this->get_avoid_try_limit();
|
2417 |
-
|
2418 |
-
$checks = $max_checks;
|
2419 |
-
$saved_position = $position;
|
2420 |
-
do {
|
2421 |
-
$found_above = false;
|
2422 |
-
if ($avoid_paragraphs_above != 0 && $avoid_text_above != "" && is_array ($avoid_paragraph_texts_above) && count ($avoid_paragraph_texts_above) != 0) {
|
2423 |
-
$paragraph_position_above = $position - $avoid_paragraphs_above;
|
2424 |
-
if ($paragraph_position_above <= 0)
|
2425 |
-
$content_position_above = 0; else
|
2426 |
-
$content_position_above = $paragraph_positions [$paragraph_position_above] + 1;
|
2427 |
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
|
|
|
|
2433 |
|
2434 |
-
|
2435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2436 |
|
2437 |
if ($multibyte) {
|
2438 |
-
|
2439 |
-
$found_above = true;
|
2440 |
-
break;
|
2441 |
-
}
|
2442 |
} else {
|
2443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2444 |
$found_above = true;
|
2445 |
break;
|
2446 |
}
|
2447 |
-
}
|
|
|
|
|
|
|
|
|
|
|
2448 |
|
|
|
2449 |
}
|
2450 |
-
}
|
2451 |
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
|
2456 |
-
|
2457 |
-
if ($paragraph_position_below > count ($paragraph_positions) - 1) $paragraph_position_below = count ($paragraph_positions) - 1;
|
2458 |
-
$paragraph_code = mb_substr ($content, $paragraph_positions [$position] + 1, $paragraph_positions [$paragraph_position_below] - $paragraph_positions [$position]);
|
2459 |
-
} else {
|
2460 |
if ($paragraph_position_below > count ($paragraph_positions) - 1) $paragraph_position_below = count ($paragraph_positions) - 1;
|
2461 |
-
$paragraph_code =
|
2462 |
-
}
|
|
|
|
|
|
|
2463 |
|
2464 |
-
|
2465 |
-
|
2466 |
|
2467 |
-
|
2468 |
-
|
2469 |
-
$found_below = true;
|
2470 |
-
break;
|
2471 |
-
}
|
2472 |
-
} else {
|
2473 |
-
if (stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
2474 |
$found_below = true;
|
2475 |
break;
|
2476 |
}
|
2477 |
-
}
|
|
|
|
|
|
|
|
|
|
|
2478 |
|
|
|
2479 |
}
|
2480 |
-
}
|
2481 |
|
2482 |
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
|
2492 |
|
2493 |
-
|
2494 |
-
$ai_last_check = AI_CHECK_DO_NOT_INSERT;
|
2495 |
-
if ($this->get_avoid_action() == AD_DO_NOT_INSERT) return $content;
|
2496 |
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
$ai_last_check = AI_CHECK_AD_BELOW;
|
2505 |
-
if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2506 |
-
$position ++;
|
2507 |
-
break;
|
2508 |
-
case AD_ABOVE_AND_THEN_BELOW: // Try first above and then below
|
2509 |
-
if ($position == 0 || $checks == 0) {
|
2510 |
-
// Try below
|
2511 |
-
$direction = AD_BELOW;
|
2512 |
-
$checks = $max_checks;
|
2513 |
-
$position = $saved_position;
|
2514 |
-
$ai_last_check = AI_CHECK_AD_BELOW;
|
2515 |
-
if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2516 |
-
$position ++;
|
2517 |
-
} else $position --;
|
2518 |
break;
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
$checks = $max_checks;
|
2524 |
-
$position = $saved_position;
|
2525 |
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2527 |
$position --;
|
2528 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2529 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2530 |
}
|
2531 |
-
} else break; // Text not found - insert
|
2532 |
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
} while (true);
|
2537 |
-
}
|
2538 |
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
|
|
2542 |
}
|
2543 |
|
2544 |
|
@@ -2546,14 +2736,24 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2546 |
$offset = 0;
|
2547 |
if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
2548 |
|
|
|
|
|
|
|
|
|
2549 |
foreach ($paragraph_positions as $counter => $paragraph_position) {
|
2550 |
if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
|
2551 |
-
elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
|
|
|
2552 |
$this->increment_block_counter ();
|
2553 |
$inserted_code = $this->get_code_for_insertion ();
|
2554 |
-
$ai_last_check = AI_CHECK_INSERTED;
|
|
|
|
|
|
|
|
|
|
|
|
|
2555 |
}
|
2556 |
-
else continue;
|
2557 |
|
2558 |
if ($multibyte) {
|
2559 |
if ($this->get_direction_type() == AD_DIRECTION_FROM_BOTTOM) {
|
@@ -2573,9 +2773,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2573 |
|
2574 |
}
|
2575 |
|
|
|
2576 |
return $content;
|
2577 |
}
|
2578 |
|
|
|
2579 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
2580 |
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
2581 |
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
@@ -3544,8 +3746,8 @@ class ai_code_generator {
|
|
3544 |
}
|
3545 |
|
3546 |
public function generate ($data){
|
3547 |
-
|
3548 |
$code = '';
|
|
|
3549 |
switch ($data ['generate-code']) {
|
3550 |
case AI_CODE_BANNER:
|
3551 |
$code = '';
|
@@ -3663,8 +3865,64 @@ class ai_code_generator {
|
|
3663 |
<script>
|
3664 |
(adsbygoogle = window.adsbygoogle || []).push({});
|
3665 |
</script>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3666 |
break;
|
3667 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3668 |
break;
|
3669 |
}
|
3670 |
|
@@ -3673,84 +3931,133 @@ class ai_code_generator {
|
|
3673 |
|
3674 |
public function import ($code){
|
3675 |
|
|
|
|
|
|
|
|
|
|
|
3676 |
$dom = new DOMDocument ();
|
3677 |
@$dom->loadHTML ($code);
|
3678 |
|
3679 |
// AdSense
|
3680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3681 |
|
3682 |
-
|
3683 |
-
|
3684 |
|
3685 |
-
|
3686 |
-
|
3687 |
-
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
|
|
|
|
|
3696 |
|
3697 |
-
|
3698 |
-
|
3699 |
|
3700 |
-
|
3701 |
|
3702 |
-
|
3703 |
-
|
3704 |
|
3705 |
-
|
3706 |
-
|
3707 |
|
3708 |
-
|
3709 |
|
3710 |
-
|
3711 |
-
|
3712 |
-
|
3713 |
-
|
3714 |
-
|
3715 |
-
|
3716 |
-
|
3717 |
-
|
3718 |
-
|
3719 |
-
|
3720 |
-
|
3721 |
-
|
3722 |
-
|
3723 |
-
|
3724 |
-
|
3725 |
-
|
3726 |
|
3727 |
-
|
3728 |
-
|
3729 |
-
|
3730 |
-
|
3731 |
-
|
3732 |
|
3733 |
-
|
3734 |
|
3735 |
-
|
3736 |
-
|
3737 |
|
3738 |
-
|
3739 |
-
|
3740 |
|
3741 |
|
3742 |
-
|
|
|
3743 |
}
|
3744 |
|
3745 |
-
// Old AdSense
|
3746 |
if (strpos ($code, 'google_ad_client') !== false) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3747 |
if (preg_match ("/google_ad_client.+[\"\'](.+?)[\"\']/", $code, $match)) {
|
3748 |
-
$data
|
|
|
3749 |
|
3750 |
-
|
|
|
|
|
3751 |
|
3752 |
-
|
|
|
|
|
|
|
|
|
|
|
3753 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3754 |
}
|
3755 |
|
3756 |
|
@@ -3775,4 +4082,64 @@ class ai_code_generator {
|
|
3775 |
|
3776 |
return array ('type' => AI_CODE_UNKNOWN);
|
3777 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3778 |
}
|
9 |
var $w3tc_code;
|
10 |
var $needs_class;
|
11 |
var $code_version;
|
12 |
+
var $version_name;
|
13 |
+
var $debug_code_before;
|
14 |
+
var $debug_code_after;
|
15 |
|
16 |
function __construct () {
|
17 |
|
23 |
$this->w3tc_code = '';
|
24 |
$this->needs_class = false;
|
25 |
$this->code_version = 0;
|
26 |
+
$this->version_name = '';
|
27 |
$this->color_class = 'ai-debug-default';
|
28 |
+
$this->debug_code_before = '';
|
29 |
+
$this->debug_code_after = '';
|
30 |
|
31 |
$this->wp_options [AI_OPTION_CODE] = AD_EMPTY_DATA;
|
32 |
$this->wp_options [AI_OPTION_PROCESS_PHP] = AI_DISABLED;
|
349 |
if ($this->fallback != 0) return $block_object [$this->fallback]->ai_getCode ();
|
350 |
|
351 |
$obj = $this;
|
352 |
+
$code = $client_code === null ? $obj->get_ad_data() : $client_code;
|
353 |
+
$php = $process_php === null ? $obj->get_process_php () : $process_php;
|
354 |
|
355 |
if ($php && (!is_multisite() || is_main_site () || multisite_php_processing ())) {
|
356 |
|
1123 |
|
1124 |
$code = $this->ai_getCode ($client_code, $process_php);
|
1125 |
|
1126 |
+
unset ($ai_wp_data [AI_SHORTCODES]['rotate']);
|
1127 |
+
|
1128 |
$processed_code = $this->replace_ai_tags (do_shortcode ($code));
|
1129 |
|
1130 |
if (strpos ($code, AD_COUNT_SEPARATOR) !== false) {
|
1144 |
|
1145 |
|
1146 |
if (strpos ($processed_code, AD_ROTATE_SEPARATOR) !== false) {
|
1147 |
+
|
1148 |
$ads = explode (AD_ROTATE_SEPARATOR, $processed_code);
|
1149 |
+
if (trim ($ads [0]) == '') {
|
1150 |
+
unset ($ads [0]);
|
1151 |
+
$ads = array_values ($ads);
|
1152 |
+
} else array_unshift ($ai_wp_data [AI_SHORTCODES]['rotate'], array ('name' => ''));
|
1153 |
+
|
1154 |
+
$version_names = array ();
|
1155 |
+
foreach ($ai_wp_data [AI_SHORTCODES]['rotate'] as $index => $option) {
|
1156 |
+
$version_names []= isset ($option ['name']) && trim ($option ['name']) != '' ? $option ['name'] : chr (ord ('A') + $index);
|
1157 |
+
}
|
1158 |
|
1159 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1160 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1163 |
case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
|
1164 |
$this->code_version = mt_rand (1, count ($ads));
|
1165 |
$processed_code = trim ($ads [$this->code_version - 1]);
|
1166 |
+
$this->version_name = $version_names [$this->code_version - 1];
|
1167 |
break;
|
1168 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE:
|
1169 |
$this->code_version = '""';
|
1176 |
$ad = trim ($codes [0]);
|
1177 |
}
|
1178 |
|
1179 |
+
$version_name_data = " data-name='".base64_encode ($version_names [$index])."'";
|
1180 |
+
|
1181 |
switch ($index) {
|
1182 |
case 0:
|
1183 |
+
$processed_code .= "<div class='ai-rotate-option' style='visibility: hidden;'".$version_name_data.">\n".trim ($ad, "\n")."\n</div>\n";
|
1184 |
break;
|
1185 |
default:
|
1186 |
+
$processed_code .= "<div class='ai-rotate-option' style='visibility: hidden; position: absolute; top: 0; left: 0; width: 100%; height: 100%;'".$version_name_data.">".trim ($ad, "\n")."\n</div>\n";
|
1187 |
break;
|
1188 |
}
|
1189 |
}
|
1203 |
|
1204 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1205 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && $this->w3tc_code == '') $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1206 |
+
elseif ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1207 |
|
1208 |
switch ($amp_dynamic_blocks) {
|
1209 |
case AI_DYNAMIC_BLOCKS_SERVER_SIDE:
|
1233 |
break;
|
1234 |
}
|
1235 |
|
|
|
1236 |
$amp_dynamic_blocks = $dynamic_blocks;
|
1237 |
if ($amp_dynamic_blocks == AI_DYNAMIC_BLOCKS_CLIENT_SIDE && $ai_wp_data [AI_WP_AMP_PAGE]) $amp_dynamic_blocks = AI_DYNAMIC_BLOCKS_SERVER_SIDE;
|
1238 |
|
1305 |
if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($this->number); else $url_parameters = "";
|
1306 |
$url = admin_url ('options-general.php?page=ad-inserter.php') . $url_parameters . '&tab=' . $this->number;
|
1307 |
|
1308 |
+
$version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
|
1309 |
+
|
1310 |
+
$this->debug_code_before = '<section class="ai-debug-block '.$this->color_class.'"><section class="ai-debug-bar ai-debug-bar-left '.$this->color_class.'"><a title="Click to go to block settings" href="'
|
1311 |
+
. $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a> '.$fallback_code.'<a class="ai-debug-text-right"><kbd class="ai-debug-text-right" title="'.$title.'">'.$counters.'</kbd><kbd class="ai-debug-invisible">[/AI]</kbd></a></section>';
|
1312 |
+
$this->debug_code_after = '</section>';
|
1313 |
+
|
1314 |
+
$processed_code = $this->debug_code_before . $processed_code . $this->debug_code_after;
|
1315 |
}
|
1316 |
|
1317 |
return $processed_code;
|
1338 |
for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
|
1339 |
$viewport_name = get_viewport_name ($viewport);
|
1340 |
if ($viewport_name != '') {
|
1341 |
+
$version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
|
1342 |
if ($this->get_detection_viewport ($viewport))
|
1343 |
+
$visible_viewports .= '<section class="ai-viewport-' . $viewport .'"><section class="ai-debug-bar '.$this->color_class.'"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a> '.$viewport_name.' </a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section></section>'; else
|
1344 |
if (!$ai_wp_data [AI_WP_AMP_PAGE])
|
1345 |
+
$hidden_viewports .= '<section class="ai-viewport-' . $viewport .' ai-debug-block ai-debug-viewport-invisible" style="' . $this->get_alignment_style() . '"><section class="ai-debug-bar ai-debug-viewport-invisible"><a class="ai-debug-text-left" title="Click to go to block settings" href="' . $url . '"><kbd class="ai-debug-invisible">[AI]</kbd>' . $this->number . ' ' . $this->get_ad_name () . '<span class="ai-option-name">' . $version_name . '</span></a><a> '.$viewport_name.' </a><a class="ai-debug-text-right" title="'.$title.'">'.$counters.'<kbd class="ai-debug-invisible">[/AI]</kbd></a></section>' . $hidden_block_text . '</section>';
|
1346 |
+
|
1347 |
}
|
1348 |
}
|
1349 |
|
1410 |
$wrapper_before = $hidden_viewports . "<div" . $class . $tracking_code_pre . $tracking_code_data . $tracking_code_post . " style='" . $additional_block_style . $this->get_alignment_style() . "'>\n";
|
1411 |
}
|
1412 |
|
1413 |
+
$wrapper_before .= $this->debug_code_before;
|
1414 |
+
$wrapper_after = $this->debug_code_after . $wrapper_after;
|
1415 |
+
|
1416 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && $this->get_detection_client_side()) {
|
1417 |
+
$wrapper_before .= "<div class='ai-debug-block " . $this->color_class . "'>".$visible_viewports;
|
1418 |
+
$wrapper_after = '</div>' . $wrapper_after;
|
1419 |
+
}
|
1420 |
+
|
1421 |
$code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
1422 |
$code .= $this->w3tc_code.' if ($ai_enabled) echo str_replace (\'[#AI_DATA#]\', base64_encode ("[' . $this->number . ',$ai_index]"), unserialize (base64_decode (\''.base64_encode (serialize ($wrapper_before)).'\'))), $ai_code, unserialize (base64_decode (\''.base64_encode (serialize ($wrapper_after)).'\'));';
|
1423 |
$code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
1424 |
+
|
1425 |
return $code;
|
1426 |
} else return $wrapper_before . $code . $wrapper_after;
|
1427 |
}
|
1889 |
}
|
1890 |
|
1891 |
|
1892 |
+
// $position is index in $paragraph_positions
|
1893 |
+
$position_text = trim ($this->get_paragraph_number());
|
1894 |
+
$position = $position_text;
|
1895 |
+
if ($position > 0 && $position < 1) {
|
1896 |
+
$position = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
1897 |
+
}
|
1898 |
+
elseif ($position <= 0) {
|
1899 |
+
$position = mt_rand (0, count ($paragraph_positions) - 1);
|
1900 |
+
} else $position --;
|
1901 |
+
|
1902 |
|
1903 |
+
// $positions contains indexes in $paragraph_positions
|
1904 |
+
$positions = array ($position);
|
1905 |
if (!$position_preview) {
|
1906 |
+
if (strpos ($position_text, ',') !== false) {
|
1907 |
+
$positions = explode (',', str_replace (' ', '', $position_text));
|
1908 |
foreach ($positions as $index => $position) {
|
1909 |
if ($position > 0 && $position < 1) {
|
1910 |
$positions [$index] = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
1912 |
elseif ($position <= 0) {
|
1913 |
$positions [$index] = mt_rand (0, count ($paragraph_positions) - 1);
|
1914 |
}
|
1915 |
+
else $positions [$index] = $position - 1;
|
1916 |
}
|
1917 |
}
|
1918 |
+
elseif ($position_text == '') {
|
1919 |
+
$positions = array ();
|
1920 |
+
|
1921 |
+
$min_words_above = $this->get_minimum_words_above ();
|
1922 |
+
if (!empty ($min_words_above)) {
|
1923 |
+
$words_above = 0;
|
1924 |
+
foreach ($paragraph_positions as $index => $paragraph_position) {
|
1925 |
+
|
1926 |
+
if ($multibyte) {
|
1927 |
+
$paragraph_code = $index == count ($paragraph_positions) - 1 ? mb_substr ($content, $paragraph_position) : mb_substr ($content, $paragraph_position, $paragraph_positions [$index + 1] - $paragraph_position);
|
1928 |
+
} else {
|
1929 |
+
$paragraph_code = $index == count ($paragraph_positions) - 1 ? substr ($content, $paragraph_position) : substr ($content, $paragraph_position, $paragraph_positions [$index + 1] - $paragraph_position);
|
1930 |
+
}
|
1931 |
+
|
1932 |
+
$words_above += number_of_words ($paragraph_code);
|
1933 |
+
if ($words_above >= $min_words_above) {
|
1934 |
+
// $positions []= $index + 1;
|
1935 |
+
$positions []= $index;
|
1936 |
+
$words_above = 0;
|
1937 |
+
}
|
1938 |
+
|
1939 |
+
}
|
1940 |
+
} else
|
1941 |
foreach ($paragraph_positions as $index => $paragraph_position) {
|
1942 |
+
// $positions []= $index + 1;
|
1943 |
+
$positions []= $index;
|
1944 |
}
|
1945 |
|
1946 |
if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
|
1981 |
}
|
1982 |
}
|
1983 |
|
1984 |
+
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1985 |
|
1986 |
+
// if (empty ($positions)) {
|
1987 |
+
if (!empty ($positions)) {
|
1988 |
$avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
|
1989 |
$avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
|
1990 |
|
1991 |
+
$avoid_text_above = $this->get_avoid_text_above();
|
1992 |
+
$avoid_text_below = $this->get_avoid_text_below();
|
1993 |
+
$avoid_paragraph_texts_above = explode (",", html_entity_decode (trim ($avoid_text_above)));
|
1994 |
+
$avoid_paragraph_texts_below = explode (",", html_entity_decode (trim ($avoid_text_below)));
|
|
|
1995 |
|
1996 |
+
$direction = $this->get_avoid_direction();
|
1997 |
+
$max_checks = $this->get_avoid_try_limit();
|
1998 |
|
1999 |
+
$failed_clearance_positions = array ();
|
2000 |
+
foreach ($positions as $position_index => $position) {
|
|
|
|
|
|
|
|
|
|
|
2001 |
|
2002 |
+
if (($avoid_paragraphs_above != 0 || $avoid_paragraphs_below != 0) && count ($paragraph_positions) > $position) {
|
2003 |
+
|
2004 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' CLEARANCE CHECK POSITION ' . ($position + 1));
|
2005 |
+
|
2006 |
+
$checks = $max_checks;
|
2007 |
+
$saved_position = $position;
|
2008 |
+
do {
|
2009 |
+
$found_above = false;
|
2010 |
+
if ($position != 0 && $avoid_paragraphs_above != 0 && $avoid_text_above != "" && is_array ($avoid_paragraph_texts_above) && count ($avoid_paragraph_texts_above) != 0) {
|
2011 |
+
$paragraph_position_above = $position - $avoid_paragraphs_above;
|
2012 |
+
if ($paragraph_position_above < 0) $paragraph_position_above = 0;
|
2013 |
|
|
|
|
|
2014 |
if ($multibyte) {
|
2015 |
+
$paragraph_code = mb_substr ($content, $paragraph_positions [$paragraph_position_above], $paragraph_positions [$position] - $paragraph_positions [$paragraph_position_above]);
|
|
|
|
|
|
|
2016 |
} else {
|
2017 |
+
$paragraph_code = substr ($content, $paragraph_positions [$paragraph_position_above], $paragraph_positions [$position] - $paragraph_positions [$paragraph_position_above]);
|
2018 |
+
}
|
2019 |
+
|
2020 |
+
foreach ($avoid_paragraph_texts_above as $paragraph_text_above) {
|
2021 |
+
if (trim ($paragraph_text_above) == '') continue;
|
2022 |
+
if ($multibyte) {
|
2023 |
+
if (mb_stripos ($paragraph_code, trim ($paragraph_text_above)) !== false) {
|
2024 |
$found_above = true;
|
2025 |
break;
|
2026 |
}
|
2027 |
+
} else {
|
2028 |
+
if (stripos ($paragraph_code, trim ($paragraph_text_above)) !== false) {
|
2029 |
+
$found_above = true;
|
2030 |
+
break;
|
2031 |
+
}
|
2032 |
+
}
|
2033 |
+
}
|
2034 |
}
|
|
|
2035 |
|
2036 |
+
$found_below = false;
|
2037 |
+
if ($avoid_paragraphs_below != 0 && $avoid_text_below != "" && is_array ($avoid_paragraph_texts_below) && count ($avoid_paragraph_texts_below) != 0) {
|
2038 |
+
$paragraph_position_below = $position + $avoid_paragraphs_below;
|
2039 |
|
2040 |
+
if ($multibyte) {
|
|
|
|
|
|
|
|
|
|
|
2041 |
if ($paragraph_position_below > count ($paragraph_positions) - 1)
|
2042 |
+
$content_position_below = mb_strlen ($content); else
|
2043 |
$content_position_below = $paragraph_positions [$paragraph_position_below];
|
2044 |
+
$paragraph_code = mb_substr ($content, $paragraph_positions [$position], $content_position_below - $paragraph_positions [$position]);
|
2045 |
+
} else {
|
2046 |
+
if ($paragraph_position_below > count ($paragraph_positions) - 1)
|
2047 |
+
$content_position_below = strlen ($content); else
|
2048 |
+
$content_position_below = $paragraph_positions [$paragraph_position_below];
|
2049 |
+
$paragraph_code = substr ($content, $paragraph_positions [$position], $content_position_below - $paragraph_positions [$position]);
|
2050 |
+
}
|
2051 |
|
2052 |
+
foreach ($avoid_paragraph_texts_below as $paragraph_text_below) {
|
2053 |
+
if (trim ($paragraph_text_below) == '') continue;
|
2054 |
|
2055 |
+
if ($multibyte) {
|
2056 |
+
if (mb_stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
|
|
|
|
|
|
|
|
|
|
2057 |
$found_below = true;
|
2058 |
break;
|
2059 |
}
|
2060 |
+
} else {
|
2061 |
+
if (stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
2062 |
+
$found_below = true;
|
2063 |
+
break;
|
2064 |
+
}
|
2065 |
+
}
|
2066 |
+
}
|
2067 |
}
|
|
|
2068 |
|
2069 |
|
2070 |
+
// echo "position: $position = before #", $position + 1, "<br />\n";
|
2071 |
+
// echo "checks: $checks<br />\n";
|
2072 |
+
// echo "direction: $direction<br />\n";
|
2073 |
+
// if ($found_above)
|
2074 |
+
// echo "found_above<br />\n";
|
2075 |
+
// if ($found_below)
|
2076 |
+
// echo "found_below<br />\n";
|
2077 |
+
// echo "=================<br />\n";
|
2078 |
|
2079 |
|
2080 |
+
if ($found_above || $found_below) {
|
|
|
|
|
2081 |
|
2082 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' CLEARANCE CHECK POSITION ' . ($position + 1) . ' FAILED');
|
2083 |
+
|
2084 |
+
$ai_last_check = AI_CHECK_DO_NOT_INSERT;
|
2085 |
+
// if ($this->get_avoid_action() == AD_DO_NOT_INSERT) return $content;
|
2086 |
+
if ($this->get_avoid_action() == AD_DO_NOT_INSERT) {
|
2087 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2088 |
+
$positions [$position_index] = - 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2089 |
break;
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
switch ($direction) {
|
2093 |
+
case AD_ABOVE: // Try above
|
|
|
|
|
2094 |
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2095 |
+
// if ($position == 0) return $content; // Already at the top - do not insert
|
2096 |
+
if ($position == 0) {
|
2097 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2098 |
+
$positions [$position_index] = - 1;
|
2099 |
+
break 2;
|
2100 |
+
}
|
2101 |
+
|
2102 |
$position --;
|
2103 |
+
break;
|
2104 |
+
case AD_BELOW: // Try below
|
2105 |
+
$ai_last_check = AI_CHECK_AD_BELOW;
|
2106 |
+
// if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2107 |
+
if ($position >= count ($paragraph_positions) - 1) {
|
2108 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2109 |
+
$positions [$position_index] = - 1;
|
2110 |
+
break 2;
|
2111 |
+
}
|
2112 |
+
|
2113 |
+
$position ++;
|
2114 |
+
break;
|
2115 |
+
case AD_ABOVE_AND_THEN_BELOW: // Try first above and then below
|
2116 |
+
if ($position == 0 || $checks == 0) {
|
2117 |
+
// Try below
|
2118 |
+
$direction = AD_BELOW;
|
2119 |
+
$checks = $max_checks;
|
2120 |
+
$position = $saved_position;
|
2121 |
+
$ai_last_check = AI_CHECK_AD_BELOW;
|
2122 |
+
// if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2123 |
+
if ($position >= count ($paragraph_positions) - 1) {
|
2124 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2125 |
+
$positions [$position_index] = - 1;
|
2126 |
+
break 2;
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
$position ++;
|
2130 |
+
} else $position --;
|
2131 |
+
break;
|
2132 |
+
case AD_BELOW_AND_THEN_ABOVE: // Try first below and then above
|
2133 |
+
if ($position >= count ($paragraph_positions) - 1 || $checks == 0) {
|
2134 |
+
// Try above
|
2135 |
+
$direction = AD_ABOVE;
|
2136 |
+
$checks = $max_checks;
|
2137 |
+
$position = $saved_position;
|
2138 |
+
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2139 |
+
// if ($position == 0) return $content; // Already at the top - do not insert
|
2140 |
+
if ($position == 0) {
|
2141 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2142 |
+
$positions [$position_index] = - 1;
|
2143 |
+
break 2;
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
$position --;
|
2147 |
+
} else $position ++;
|
2148 |
+
break;
|
2149 |
+
}
|
2150 |
+
} else {
|
2151 |
+
// Text not found - insert
|
2152 |
+
$positions [$position_index] = $position;
|
2153 |
break;
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
// Try next position
|
2157 |
+
// if ($checks <= 0) return $content; // Suitable position not found - do not insert
|
2158 |
+
if ($checks <= 0) {
|
2159 |
+
// Suitable position not found - do not insert
|
2160 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2161 |
+
$positions [$position_index] = - 1;
|
2162 |
+
break;
|
2163 |
}
|
|
|
2164 |
|
2165 |
+
$checks --;
|
2166 |
+
} while (true);
|
2167 |
+
}
|
|
|
|
|
2168 |
|
2169 |
+
// Nothing to do
|
2170 |
+
$ai_last_check = AI_CHECK_PARAGRAPHS_AFTER_CLEARANCE;
|
2171 |
+
if (count ($paragraph_positions) == 0) return $content;
|
2172 |
+
}
|
2173 |
}
|
2174 |
|
2175 |
+
|
2176 |
if ($position_preview || !empty ($positions)) {
|
2177 |
$offset = 0;
|
2178 |
if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
2179 |
|
2180 |
+
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
2181 |
+
|
2182 |
+
$real_positions = array ();
|
2183 |
+
foreach ($positions as $position_index) $real_positions []= $position_index >= 0 ? $position_index + 1 : '*';
|
2184 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' INSERTION POSITIONS: ' . implode (', ', $real_positions));
|
2185 |
+
|
2186 |
foreach ($paragraph_positions as $counter => $paragraph_position) {
|
2187 |
if ($position_preview) $inserted_code = "[[AI_BP".($counter + 1)."]]";
|
2188 |
+
// elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
|
2189 |
+
elseif (!empty ($positions) && in_array ($counter, $positions) && $this->check_block_counter ()) {
|
2190 |
$this->increment_block_counter ();
|
2191 |
$inserted_code = $this->get_code_for_insertion ();
|
2192 |
+
// $ai_last_check = AI_CHECK_INSERTED;
|
2193 |
+
if ($debug_processing) ai_log (ai_log_block_status ($this->number, AI_CHECK_INSERTED));
|
2194 |
+
}
|
2195 |
+
// else continue;
|
2196 |
+
else {
|
2197 |
+
if ($debug_processing && isset ($failed_clearance_positions [$counter])) ai_log (ai_log_block_status ($this->number, $failed_clearance_positions [$counter]));
|
2198 |
+
continue;
|
2199 |
}
|
|
|
2200 |
|
2201 |
if ($multibyte) {
|
2202 |
if ($this->get_direction_type() == AD_DIRECTION_FROM_BOTTOM) {
|
2215 |
}
|
2216 |
}
|
2217 |
|
2218 |
+
$ai_last_check = AI_CHECK_NONE; // Already logged on each insertion
|
2219 |
return $content;
|
2220 |
}
|
2221 |
|
2222 |
+
// Deprecated since $postion is now in array $positions
|
2223 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
2224 |
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
2225 |
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
2447 |
}
|
2448 |
|
2449 |
|
2450 |
+
// $position is index in $paragraph_positions
|
2451 |
+
$position_text = trim ($this->get_paragraph_number());
|
2452 |
+
$position = $position_text;
|
2453 |
+
if ($position > 0 && $position < 1) {
|
2454 |
+
$position = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
2455 |
+
}
|
2456 |
+
elseif ($position <= 0) {
|
2457 |
+
$position = mt_rand (0, count ($paragraph_positions) - 1);
|
2458 |
+
} else $position --;
|
2459 |
+
|
2460 |
|
2461 |
+
// $positions contains indexes in $paragraph_positions
|
2462 |
+
$positions = array ($position);
|
2463 |
if (!$position_preview) {
|
2464 |
+
if (strpos ($position_text, ',') !== false) {
|
2465 |
+
$positions = explode (',', str_replace (' ', '', $position_text));
|
2466 |
foreach ($positions as $index => $position) {
|
2467 |
if ($position > 0 && $position < 1) {
|
2468 |
$positions [$index] = intval ($position * (count ($paragraph_positions) - 1) + 0.5);
|
2470 |
elseif ($position <= 0) {
|
2471 |
$positions [$index] = mt_rand (0, count ($paragraph_positions) - 1);
|
2472 |
}
|
2473 |
+
else $positions [$index] = $position - 1;
|
2474 |
}
|
2475 |
}
|
2476 |
+
elseif ($position_text == '') {
|
2477 |
+
$positions = array ();
|
2478 |
|
2479 |
$min_words_above = $this->get_minimum_words_above ();
|
2480 |
if (!empty ($min_words_above)) {
|
2489 |
|
2490 |
$words_above += number_of_words ($paragraph_code);
|
2491 |
if ($words_above >= $min_words_above) {
|
2492 |
+
// $positions []= $index + 1;
|
2493 |
+
$positions []= $index;
|
2494 |
$words_above = 0;
|
2495 |
}
|
2496 |
|
2497 |
}
|
2498 |
} else
|
2499 |
foreach ($paragraph_positions as $index => $paragraph_position) {
|
2500 |
+
// $positions []= $index + 1;
|
2501 |
+
$positions []= $index;
|
2502 |
}
|
2503 |
|
2504 |
if ($this->get_filter_type() == AI_FILTER_PARAGRAPHS) {
|
2532 |
$positions = $filtered_positions;
|
2533 |
} else $positions = array ();
|
2534 |
}
|
|
|
2535 |
}
|
|
|
2536 |
}
|
2537 |
|
2538 |
+
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2539 |
|
2540 |
+
// if (empty ($positions)) {
|
2541 |
+
if (!empty ($positions)) {
|
2542 |
$avoid_paragraphs_above = intval ($this->get_avoid_paragraphs_above());
|
2543 |
$avoid_paragraphs_below = intval ($this->get_avoid_paragraphs_below());
|
2544 |
|
2545 |
+
$avoid_text_above = $this->get_avoid_text_above();
|
2546 |
+
$avoid_text_below = $this->get_avoid_text_below();
|
2547 |
+
$avoid_paragraph_texts_above = explode (",", html_entity_decode (trim ($avoid_text_above)));
|
2548 |
+
$avoid_paragraph_texts_below = explode (",", html_entity_decode (trim ($avoid_text_below)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2549 |
|
2550 |
+
$direction = $this->get_avoid_direction();
|
2551 |
+
$max_checks = $this->get_avoid_try_limit();
|
2552 |
+
|
2553 |
+
$failed_clearance_positions = array ();
|
2554 |
+
foreach ($positions as $position_index => $position) {
|
2555 |
+
|
2556 |
+
if (($avoid_paragraphs_above != 0 || $avoid_paragraphs_below != 0) && count ($paragraph_positions) > $position) {
|
2557 |
|
2558 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' CLEARANCE CHECK POSITION ' . ($position + 1));
|
2559 |
+
|
2560 |
+
$checks = $max_checks;
|
2561 |
+
$saved_position = $position;
|
2562 |
+
do {
|
2563 |
+
$found_above = false;
|
2564 |
+
if ($avoid_paragraphs_above != 0 && $avoid_text_above != "" && is_array ($avoid_paragraph_texts_above) && count ($avoid_paragraph_texts_above) != 0) {
|
2565 |
+
$paragraph_position_above = $position - $avoid_paragraphs_above;
|
2566 |
+
if ($paragraph_position_above <= 0)
|
2567 |
+
$content_position_above = 0; else
|
2568 |
+
$content_position_above = $paragraph_positions [$paragraph_position_above] + 1;
|
2569 |
|
2570 |
if ($multibyte) {
|
2571 |
+
$paragraph_code = mb_substr ($content, $content_position_above, $paragraph_positions [$position] - $content_position_above);
|
|
|
|
|
|
|
2572 |
} else {
|
2573 |
+
$paragraph_code = substr ($content, $content_position_above, $paragraph_positions [$position] - $content_position_above);
|
2574 |
+
}
|
2575 |
+
|
2576 |
+
foreach ($avoid_paragraph_texts_above as $paragraph_text_above) {
|
2577 |
+
if (trim ($paragraph_text_above) == '') continue;
|
2578 |
+
|
2579 |
+
if ($multibyte) {
|
2580 |
+
if (mb_stripos ($paragraph_code, trim ($paragraph_text_above)) !== false) {
|
2581 |
$found_above = true;
|
2582 |
break;
|
2583 |
}
|
2584 |
+
} else {
|
2585 |
+
if (stripos ($paragraph_code, trim ($paragraph_text_above)) !== false) {
|
2586 |
+
$found_above = true;
|
2587 |
+
break;
|
2588 |
+
}
|
2589 |
+
}
|
2590 |
|
2591 |
+
}
|
2592 |
}
|
|
|
2593 |
|
2594 |
+
$found_below = false;
|
2595 |
+
if ($avoid_paragraphs_below != 0 && $position != count ($paragraph_positions) - 1 && $avoid_text_below != "" && is_array ($avoid_paragraph_texts_below) && count ($avoid_paragraph_texts_below) != 0) {
|
2596 |
+
$paragraph_position_below = $position + $avoid_paragraphs_below;
|
2597 |
|
2598 |
+
if ($multibyte) {
|
|
|
|
|
|
|
2599 |
if ($paragraph_position_below > count ($paragraph_positions) - 1) $paragraph_position_below = count ($paragraph_positions) - 1;
|
2600 |
+
$paragraph_code = mb_substr ($content, $paragraph_positions [$position] + 1, $paragraph_positions [$paragraph_position_below] - $paragraph_positions [$position]);
|
2601 |
+
} else {
|
2602 |
+
if ($paragraph_position_below > count ($paragraph_positions) - 1) $paragraph_position_below = count ($paragraph_positions) - 1;
|
2603 |
+
$paragraph_code = substr ($content, $paragraph_positions [$position] + 1, $paragraph_positions [$paragraph_position_below] - $paragraph_positions [$position]);
|
2604 |
+
}
|
2605 |
|
2606 |
+
foreach ($avoid_paragraph_texts_below as $paragraph_text_below) {
|
2607 |
+
if (trim ($paragraph_text_below) == '') continue;
|
2608 |
|
2609 |
+
if ($multibyte) {
|
2610 |
+
if (mb_stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
|
|
|
|
|
|
|
|
|
|
2611 |
$found_below = true;
|
2612 |
break;
|
2613 |
}
|
2614 |
+
} else {
|
2615 |
+
if (stripos ($paragraph_code, trim ($paragraph_text_below)) !== false) {
|
2616 |
+
$found_below = true;
|
2617 |
+
break;
|
2618 |
+
}
|
2619 |
+
}
|
2620 |
|
2621 |
+
}
|
2622 |
}
|
|
|
2623 |
|
2624 |
|
2625 |
+
// echo "position: $position = after #", $position + 1, "<br />\n";
|
2626 |
+
// echo "checks: $checks<br />\n";
|
2627 |
+
// echo "direction: $direction<br />\n";
|
2628 |
+
// if ($found_above)
|
2629 |
+
// echo "found_above<br />\n";
|
2630 |
+
// if ($found_below)
|
2631 |
+
// echo "found_below<br />\n";
|
2632 |
+
// echo "=================<br />\n";
|
2633 |
|
2634 |
|
2635 |
+
if ($found_above || $found_below) {
|
|
|
|
|
2636 |
|
2637 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' CLEARANCE CHECK POSITION ' . ($position + 1) . ' FAILED');
|
2638 |
+
|
2639 |
+
$ai_last_check = AI_CHECK_DO_NOT_INSERT;
|
2640 |
+
// if ($this->get_avoid_action() == AD_DO_NOT_INSERT) return $content;
|
2641 |
+
if ($this->get_avoid_action() == AD_DO_NOT_INSERT) {
|
2642 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2643 |
+
$positions [$position_index] = - 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2644 |
break;
|
2645 |
+
}
|
2646 |
+
|
2647 |
+
switch ($direction) {
|
2648 |
+
case AD_ABOVE: // Try above
|
|
|
|
|
2649 |
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2650 |
+
// Already at the top - do not insert
|
2651 |
+
// if ($position == 0) return $content;
|
2652 |
+
if ($position == 0) {
|
2653 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2654 |
+
$positions [$position_index] = - 1;
|
2655 |
+
break 2;
|
2656 |
+
}
|
2657 |
+
|
2658 |
$position --;
|
2659 |
+
break;
|
2660 |
+
case AD_BELOW: // Try below
|
2661 |
+
$ai_last_check = AI_CHECK_AD_BELOW;
|
2662 |
+
// Already at the bottom - do not insert
|
2663 |
+
// if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2664 |
+
if ($position >= count ($paragraph_positions) - 1) {
|
2665 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2666 |
+
$positions [$position_index] = - 1;
|
2667 |
+
break 2;
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
$position ++;
|
2671 |
+
break;
|
2672 |
+
case AD_ABOVE_AND_THEN_BELOW: // Try first above and then below
|
2673 |
+
if ($position == 0 || $checks == 0) {
|
2674 |
+
// Try below
|
2675 |
+
$direction = AD_BELOW;
|
2676 |
+
$checks = $max_checks;
|
2677 |
+
$position = $saved_position;
|
2678 |
+
$ai_last_check = AI_CHECK_AD_BELOW;
|
2679 |
+
// Already at the bottom - do not insert
|
2680 |
+
// if ($position >= count ($paragraph_positions) - 1) return $content; // Already at the bottom - do not insert
|
2681 |
+
if ($position >= count ($paragraph_positions) - 1) {
|
2682 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2683 |
+
$positions [$position_index] = - 1;
|
2684 |
+
break 2;
|
2685 |
+
}
|
2686 |
+
|
2687 |
+
$position ++;
|
2688 |
+
} else $position --;
|
2689 |
+
break;
|
2690 |
+
case AD_BELOW_AND_THEN_ABOVE: // Try first below and then above
|
2691 |
+
if ($position >= count ($paragraph_positions) - 1 || $checks == 0) {
|
2692 |
+
// Try above
|
2693 |
+
$direction = AD_ABOVE;
|
2694 |
+
$checks = $max_checks;
|
2695 |
+
$position = $saved_position;
|
2696 |
+
$ai_last_check = AI_CHECK_AD_ABOVE;
|
2697 |
+
// Already at the top - do not insert
|
2698 |
+
// if ($position == 0) return $content; // Already at the top - do not insert
|
2699 |
+
if ($position == 0) {
|
2700 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2701 |
+
$positions [$position_index] = - 1;
|
2702 |
+
break 2;
|
2703 |
+
}
|
2704 |
+
|
2705 |
+
$position --;
|
2706 |
+
} else $position ++;
|
2707 |
+
break;
|
2708 |
+
}
|
2709 |
+
} else {
|
2710 |
+
// Text not found - insert
|
2711 |
+
$positions [$position_index] = $position;
|
2712 |
break;
|
2713 |
+
}
|
2714 |
+
|
2715 |
+
// Try next position
|
2716 |
+
// if ($checks <= 0) return $content; // Suitable position not found - do not insert
|
2717 |
+
if ($checks <= 0) {
|
2718 |
+
// Suitable position not found - do not insert
|
2719 |
+
$failed_clearance_positions [$positions [$position_index]] = $ai_last_check;
|
2720 |
+
$positions [$position_index] = - 1;
|
2721 |
+
break;
|
2722 |
}
|
|
|
2723 |
|
2724 |
+
$checks --;
|
2725 |
+
} while (true);
|
2726 |
+
}
|
|
|
|
|
2727 |
|
2728 |
+
// Nothing to do
|
2729 |
+
$ai_last_check = AI_CHECK_PARAGRAPHS_AFTER_CLEARANCE;
|
2730 |
+
if (count ($paragraph_positions) == 0) return $content;
|
2731 |
+
}
|
2732 |
}
|
2733 |
|
2734 |
|
2736 |
$offset = 0;
|
2737 |
if (!empty ($positions)) $ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
2738 |
|
2739 |
+
$real_positions = array ();
|
2740 |
+
foreach ($positions as $position_index) $real_positions []= $position_index >= 0 ? $position_index + 1 : '*';
|
2741 |
+
if ($debug_processing && $this->number != 0) ai_log ('BLOCK ' . $this->number . ' INSERTION POSITIONS: ' . implode (', ', $real_positions));
|
2742 |
+
|
2743 |
foreach ($paragraph_positions as $counter => $paragraph_position) {
|
2744 |
if ($position_preview) $inserted_code = "[[AI_AP".($counter + 1)."]]";
|
2745 |
+
// elseif (!empty ($positions) && in_array ($counter + 1, $positions) && $this->check_block_counter ()) {
|
2746 |
+
elseif (!empty ($positions) && in_array ($counter, $positions) && $this->check_block_counter ()) {
|
2747 |
$this->increment_block_counter ();
|
2748 |
$inserted_code = $this->get_code_for_insertion ();
|
2749 |
+
// $ai_last_check = AI_CHECK_INSERTED;
|
2750 |
+
if ($debug_processing) ai_log (ai_log_block_status ($this->number, AI_CHECK_INSERTED));
|
2751 |
+
}
|
2752 |
+
// else continue;
|
2753 |
+
else {
|
2754 |
+
if ($debug_processing && isset ($failed_clearance_positions [$counter])) ai_log (ai_log_block_status ($this->number, $failed_clearance_positions [$counter]));
|
2755 |
+
continue;
|
2756 |
}
|
|
|
2757 |
|
2758 |
if ($multibyte) {
|
2759 |
if ($this->get_direction_type() == AD_DIRECTION_FROM_BOTTOM) {
|
2773 |
|
2774 |
}
|
2775 |
|
2776 |
+
$ai_last_check = AI_CHECK_NONE; // Already logged on each insertion
|
2777 |
return $content;
|
2778 |
}
|
2779 |
|
2780 |
+
// Deprecated since $postion is now in array $positions
|
2781 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
2782 |
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
2783 |
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
3746 |
}
|
3747 |
|
3748 |
public function generate ($data){
|
|
|
3749 |
$code = '';
|
3750 |
+
|
3751 |
switch ($data ['generate-code']) {
|
3752 |
case AI_CODE_BANNER:
|
3753 |
$code = '';
|
3865 |
<script>
|
3866 |
(adsbygoogle = window.adsbygoogle || []).push({});
|
3867 |
</script>';
|
3868 |
+
break;
|
3869 |
+
case AI_ADSENSE_AUTO:
|
3870 |
+
$code = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
3871 |
+
<script>
|
3872 |
+
(adsbygoogle = window.adsbygoogle || []).push({
|
3873 |
+
google_ad_client: "ca-'.$data ['adsense-publisher-id'].'",
|
3874 |
+
enable_page_level_ads: true
|
3875 |
+
});
|
3876 |
+
</script>';
|
3877 |
+
|
3878 |
break;
|
3879 |
}
|
3880 |
+
|
3881 |
+
if ($data ['adsense-amp'] != AI_ADSENSE_AMP_DISABLED) {
|
3882 |
+
switch ($data ['adsense-type']) {
|
3883 |
+
case AI_ADSENSE_AUTO:
|
3884 |
+
$code .= '
|
3885 |
+
|
3886 |
+
[ADINSERTER AMP]
|
3887 |
+
|
3888 |
+
<amp-auto-ads
|
3889 |
+
type="adsense"
|
3890 |
+
data-ad-client="'.$data ['adsense-publisher-id'].'">
|
3891 |
+
</amp-auto-ads>';
|
3892 |
+
break;
|
3893 |
+
default:
|
3894 |
+
switch ($data ['adsense-amp']) {
|
3895 |
+
case AI_ADSENSE_AMP_ABOVE_THE_FOLD:
|
3896 |
+
$code .= '
|
3897 |
+
|
3898 |
+
[ADINSERTER AMP]
|
3899 |
+
|
3900 |
+
<amp-ad
|
3901 |
+
layout="fixed-height"
|
3902 |
+
height=100
|
3903 |
+
type="adsense"
|
3904 |
+
data-ad-client="ca-'.$data ['adsense-publisher-id'].'"
|
3905 |
+
data-ad-slot="'.$data ['adsense-ad-slot-id'].'">
|
3906 |
+
</amp-ad>';
|
3907 |
+
break;
|
3908 |
+
case AI_ADSENSE_AMP_BELOW_THE_FOLD:
|
3909 |
+
$code .= '
|
3910 |
+
|
3911 |
+
[ADINSERTER AMP]
|
3912 |
+
|
3913 |
+
<amp-ad
|
3914 |
+
layout="responsive"
|
3915 |
+
width=300
|
3916 |
+
height=250
|
3917 |
+
type="adsense"
|
3918 |
+
data-ad-client="ca-'.$data ['adsense-publisher-id'].'"
|
3919 |
+
data-ad-slot="'.$data ['adsense-ad-slot-id'].'">
|
3920 |
+
</amp-ad>';
|
3921 |
+
break;
|
3922 |
+
}
|
3923 |
+
break;
|
3924 |
+
}
|
3925 |
+
}
|
3926 |
break;
|
3927 |
}
|
3928 |
|
3931 |
|
3932 |
public function import ($code){
|
3933 |
|
3934 |
+
$amp = AI_ADSENSE_AMP_DISABLED;
|
3935 |
+
if (strpos (do_shortcode ($code), AD_AMP_SEPARATOR) !== false) {
|
3936 |
+
$amp = AI_ADSENSE_AMP_ABOVE_THE_FOLD;
|
3937 |
+
}
|
3938 |
+
|
3939 |
$dom = new DOMDocument ();
|
3940 |
@$dom->loadHTML ($code);
|
3941 |
|
3942 |
// AdSense
|
3943 |
+
if (strpos ($code, 'data-ad-client') !== false) {
|
3944 |
+
$adsense_code = $dom->getElementsByTagName ('ins');
|
3945 |
+
$adsense_code_amp = $dom->getElementsByTagName ('amp-ad');
|
3946 |
+
|
3947 |
+
if ($adsense_code_amp->length != 0) {
|
3948 |
+
$layout = $adsense_code_amp [0]->getAttribute ('layout');
|
3949 |
+
switch ($layout) {
|
3950 |
+
case 'fixed-height':
|
3951 |
+
$amp = AI_ADSENSE_AMP_ABOVE_THE_FOLD;
|
3952 |
+
break;
|
3953 |
+
case 'responsive':
|
3954 |
+
$amp = AI_ADSENSE_AMP_BELOW_THE_FOLD;
|
3955 |
+
break;
|
3956 |
+
}
|
3957 |
|
3958 |
+
if ($adsense_code->length == 0) $adsense_code = $adsense_code_amp;
|
3959 |
+
}
|
3960 |
|
3961 |
+
if ($adsense_code->length != 0) {
|
3962 |
+
$data = array (
|
3963 |
+
'type' => AI_CODE_ADSENSE,
|
3964 |
+
'adsense-publisher-id' => '',
|
3965 |
+
'adsense-ad-slot-id' => '',
|
3966 |
+
'adsense-type' => AI_ADSENSE_STANDARD,
|
3967 |
+
'adsense-responsive' => 0,
|
3968 |
+
'adsense-width' => '',
|
3969 |
+
'adsense-height' => '',
|
3970 |
+
'adsense-layout' => '',
|
3971 |
+
'adsense-layout-key' => '',
|
3972 |
+
'adsense-amp' => $amp,
|
3973 |
+
);
|
3974 |
|
3975 |
+
$data ['adsense-publisher-id'] = str_replace ('ca-', '', $adsense_code [0]->getAttribute ('data-ad-client'));
|
3976 |
+
$data ['adsense-ad-slot-id'] = $adsense_code [0]->getAttribute ('data-ad-slot');
|
3977 |
|
3978 |
+
$adsense_style = $adsense_code [0]->getAttribute ('style');
|
3979 |
|
3980 |
+
$style_width = preg_match ("/width\s*:\s*(\d+)px/", $adsense_style, $width_match);
|
3981 |
+
if ($style_width) $data ['adsense-width'] = $width_match [1];
|
3982 |
|
3983 |
+
$style_height = preg_match ("/height\s*:\s*(\d+)px/", $adsense_style, $height_match);
|
3984 |
+
if ($style_height) $data ['adsense-height'] = $height_match [1];
|
3985 |
|
3986 |
+
$adsense_responsive = !$style_width && !$style_height;
|
3987 |
|
3988 |
+
$adsense_ad_format = $adsense_code [0]->getAttribute ('data-ad-format');
|
3989 |
+
switch ($adsense_ad_format) {
|
3990 |
+
case '':
|
3991 |
+
break;
|
3992 |
+
case 'auto':
|
3993 |
+
if ($adsense_responsive) $data ['adsense-responsive'] = 1;
|
3994 |
+
break;
|
3995 |
+
case 'autorelaxed':
|
3996 |
+
$data ['adsense-type'] = AI_ADSENSE_MATCHED_CONTENT;
|
3997 |
+
break;
|
3998 |
+
case 'link':
|
3999 |
+
$data ['adsense-type'] = AI_ADSENSE_LINK;
|
4000 |
+
if ($adsense_responsive) $data ['adsense-responsive'] = 1;
|
4001 |
+
break;
|
4002 |
+
case 'fluid':
|
4003 |
+
$adsense_ad_layout = $adsense_code [0]->getAttribute ('data-ad-layout');
|
4004 |
|
4005 |
+
switch ($adsense_ad_layout) {
|
4006 |
+
case 'in-article':
|
4007 |
+
$data ['adsense-type'] = AI_ADSENSE_IN_ARTICLE;
|
4008 |
+
break 2;
|
4009 |
+
}
|
4010 |
|
4011 |
+
$data ['adsense-type'] = AI_ADSENSE_IN_FEED;
|
4012 |
|
4013 |
+
$data ['adsense-layout'] = $adsense_ad_layout;
|
4014 |
+
$data ['adsense-layout-key'] = urlencode ($adsense_code [0]->getAttribute ('data-ad-layout-key'));
|
4015 |
|
4016 |
+
break;
|
4017 |
+
}
|
4018 |
|
4019 |
|
4020 |
+
return $data;
|
4021 |
+
}
|
4022 |
}
|
4023 |
|
4024 |
+
// Old AdSense / AdSense Auto ads
|
4025 |
if (strpos ($code, 'google_ad_client') !== false) {
|
4026 |
+
|
4027 |
+
$data = array (
|
4028 |
+
'type' => AI_CODE_ADSENSE,
|
4029 |
+
'adsense-publisher-id' => '',
|
4030 |
+
'adsense-ad-slot-id' => '',
|
4031 |
+
'adsense-type' => AI_ADSENSE_STANDARD,
|
4032 |
+
'adsense-responsive' => 0,
|
4033 |
+
'adsense-width' => '',
|
4034 |
+
'adsense-height' => '',
|
4035 |
+
'adsense-layout' => '',
|
4036 |
+
'adsense-layout-key' => '',
|
4037 |
+
'adsense-amp' => $amp,
|
4038 |
+
);
|
4039 |
+
|
4040 |
if (preg_match ("/google_ad_client.+[\"\'](.+?)[\"\']/", $code, $match)) {
|
4041 |
+
$data ['adsense-publisher-id'] = str_replace ('ca-', '', $match [1]);
|
4042 |
+
}
|
4043 |
|
4044 |
+
if (preg_match ("/google_ad_slot.+[\"\'](.+?)[\"\']/", $code, $match)) {
|
4045 |
+
$data ['adsense-ad-slot-id'] = $match [1];
|
4046 |
+
}
|
4047 |
|
4048 |
+
if (preg_match ("/google_ad_width[^\d]+(\d+)/", $code, $match)) {
|
4049 |
+
$data ['adsense-width'] = $match [1];
|
4050 |
+
}
|
4051 |
+
|
4052 |
+
if (preg_match ("/google_ad_height[^\d]+(\d+)/", $code, $match)) {
|
4053 |
+
$data ['adsense-height'] = $match [1];
|
4054 |
}
|
4055 |
+
|
4056 |
+
if (preg_match ("/enable_page_level_ads[^\d]+true/", $code, $match)) {
|
4057 |
+
$data ['adsense-type'] = AI_ADSENSE_AUTO;
|
4058 |
+
}
|
4059 |
+
|
4060 |
+
return $data;
|
4061 |
}
|
4062 |
|
4063 |
|
4082 |
|
4083 |
return array ('type' => AI_CODE_UNKNOWN);
|
4084 |
}
|
4085 |
+
|
4086 |
+
public function import_rotation ($code){
|
4087 |
+
global $ai_expand_only_rotate, $ai_wp_data;
|
4088 |
+
|
4089 |
+
$data = array (
|
4090 |
+
'options' => array (
|
4091 |
+
array (
|
4092 |
+
'code' => $code,
|
4093 |
+
'name' => '',
|
4094 |
+
),
|
4095 |
+
),
|
4096 |
+
);
|
4097 |
+
|
4098 |
+
$ai_expand_only_rotate = true;
|
4099 |
+
unset ($ai_wp_data [AI_SHORTCODES]['rotate']);
|
4100 |
+
$code = do_shortcode ($code);
|
4101 |
+
$ai_expand_only_rotate = false;
|
4102 |
+
|
4103 |
+
if (strpos ($code, AD_ROTATE_SEPARATOR) !== false) {
|
4104 |
+
$options = explode (AD_ROTATE_SEPARATOR, $code);
|
4105 |
+
$data ['options'] = array ();
|
4106 |
+
foreach ($options as $index => $option) {
|
4107 |
+
$option_code = trim ($option);
|
4108 |
+
$option_name = isset ($ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name']) ? $ai_wp_data [AI_SHORTCODES]['rotate'][$index - 1]['name'] : '';
|
4109 |
+
if ($index == 0 && $option_code == '') continue;
|
4110 |
+
$data ['options'] []= array ('code' => $option_code, 'name' => $option_name);
|
4111 |
+
}
|
4112 |
+
}
|
4113 |
+
|
4114 |
+
return $data;
|
4115 |
+
}
|
4116 |
+
|
4117 |
+
public function generate_rotation ($rotation_data){
|
4118 |
+
|
4119 |
+
if (count ($rotation_data) == 1) {
|
4120 |
+
$rotation_code = wp_unslash (urldecode (trim ($rotation_data [0]['code'])));
|
4121 |
+
} else {
|
4122 |
+
$rotation_code = '';
|
4123 |
+
foreach ($rotation_data as $index => $rotation_data_row) {
|
4124 |
+
|
4125 |
+
$name = wp_unslash (urldecode (trim ($rotation_data_row ['name'])));
|
4126 |
+
$code = wp_unslash (urldecode (trim ($rotation_data_row ['code'])));
|
4127 |
+
|
4128 |
+
if ($index != 0 || $name != '') {
|
4129 |
+
|
4130 |
+
$shortcode = "" ;
|
4131 |
+
if ($index != 0) $shortcode .= "\n\n";
|
4132 |
+
|
4133 |
+
$shortcode .= '[ADINSERTER ROTATE';
|
4134 |
+
|
4135 |
+
if ($name != '') $shortcode .= ' name="'.str_replace ('"', '\'', $name).'"';
|
4136 |
+
$shortcode .= "]\n\n";
|
4137 |
+
} else $shortcode = '';
|
4138 |
+
|
4139 |
+
$rotation_code .= $shortcode . $code;
|
4140 |
+
}
|
4141 |
+
}
|
4142 |
+
|
4143 |
+
return $rotation_code;
|
4144 |
+
}
|
4145 |
}
|
constants.php
CHANGED
@@ -19,7 +19,7 @@ if (!defined( 'AD_INSERTER_NAME'))
|
|
19 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
20 |
|
21 |
if (!defined( 'AD_INSERTER_VERSION'))
|
22 |
-
define ('AD_INSERTER_VERSION', '2.2.
|
23 |
|
24 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
25 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -409,6 +409,10 @@ define ('AI_TEXT_REPLACE', 'Replace');
|
|
409 |
define ('AI_TEXT_SHOW', 'Show');
|
410 |
define ('AI_TEXT_HIDE', 'Hide');
|
411 |
|
|
|
|
|
|
|
|
|
412 |
// Click detection
|
413 |
define ('AI_CLICK_DETECTION_STANDARD', 0);
|
414 |
define ('AI_CLICK_DETECTION_ADVANCED', 1);
|
@@ -468,12 +472,13 @@ define ('DEFAULT_TRACKING_LOGGED_IN', AI_TRACKING_ENABLED);
|
|
468 |
define ('DEFAULT_TRACK_PAGEVIEWS', AI_TRACKING_DISABLED);
|
469 |
define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
|
470 |
define ('DEFAULT_ADB_BLOCK_ACTION', AI_ADB_BLOCK_ACTION_DO_NOTHING);
|
|
|
471 |
define ('DEFAULT_CUSTOM_HOOK_PRIORITY', 10);
|
472 |
|
473 |
define ('AI_ADBLOCKING_DETECTION', true);
|
474 |
define ('AI_AMP_HEADER_STYLES', true);
|
475 |
-
|
476 |
-
|
477 |
define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
|
478 |
define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
|
479 |
define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
|
@@ -552,9 +557,10 @@ define ('AI_CHECK_DISABLED_MANUALLY', 26);
|
|
552 |
define ('AI_CHECK_MAX_INSERTIONS', 27);
|
553 |
define ('AI_CHECK_FILTER', 28);
|
554 |
define ('AI_CHECK_PARAGRAPH_COUNTING', 29);
|
555 |
-
define ('
|
556 |
-
define ('
|
557 |
-
|
|
|
558 |
define ('AI_CHECK_DEBUG_NO_INSERTION', 33);
|
559 |
define ('AI_CHECK_PARAGRAPH_TAGS', 34);
|
560 |
define ('AI_CHECK_PARAGRAPHS_WITH_TAGS', 35);
|
@@ -574,6 +580,7 @@ define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
|
|
574 |
define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
|
575 |
define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
|
576 |
define ('AI_CHECK_TAXONOMY', 51);
|
|
|
577 |
|
578 |
define ('AI_PT_NONE', - 1);
|
579 |
define ('AI_PT_ANY', 0);
|
@@ -615,6 +622,7 @@ define ('AI_TAGS', 19);
|
|
615 |
define ('AI_VIEWPORTS', 20);
|
616 |
define ('AI_WORD_COUNT', 21);
|
617 |
define ('AI_ADB_SHORTCODE_ACTION', 22);
|
|
|
618 |
|
619 |
define ('AI_CONTEXT_NONE', 0);
|
620 |
define ('AI_CONTEXT_CONTENT', 1);
|
@@ -668,18 +676,25 @@ define ('AI_DEBUG_POSITIONS_CLASS', 'ai-debug-positions');
|
|
668 |
define ('AI_DEBUG_PAGE_TYPE_CLASS', 'ai-debug-page-type');
|
669 |
define ('AI_DEBUG_ADB_CLASS', 'ai-debug-adb');
|
670 |
|
671 |
-
define ('AI_CODE_UNKNOWN',
|
672 |
-
define ('AI_CODE_BANNER',
|
673 |
-
define ('AI_CODE_ADSENSE',
|
674 |
|
675 |
define ('AI_ADSENSE_STANDARD', 0);
|
676 |
define ('AI_ADSENSE_LINK', 1);
|
677 |
define ('AI_ADSENSE_IN_ARTICLE', 2);
|
678 |
define ('AI_ADSENSE_IN_FEED', 3);
|
679 |
define ('AI_ADSENSE_MATCHED_CONTENT', 4);
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
define ('AI_TEXT_LINK', 'Link');
|
682 |
define ('AI_TEXT_IN_ARTICLE', 'In-article');
|
683 |
define ('AI_TEXT_IN_FEED', 'In-feed');
|
684 |
define ('AI_TEXT_MATCHED_CONTENT', 'Matched content');
|
685 |
|
|
|
|
19 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
20 |
|
21 |
if (!defined( 'AD_INSERTER_VERSION'))
|
22 |
+
define ('AD_INSERTER_VERSION', '2.2.8');
|
23 |
|
24 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
25 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
409 |
define ('AI_TEXT_SHOW', 'Show');
|
410 |
define ('AI_TEXT_HIDE', 'Hide');
|
411 |
|
412 |
+
// Ad blocking detection
|
413 |
+
define ('AI_ADB_DETECTION_STANDARD', 0);
|
414 |
+
define ('AI_ADB_DETECTION_ADVANCED', 1);
|
415 |
+
|
416 |
// Click detection
|
417 |
define ('AI_CLICK_DETECTION_STANDARD', 0);
|
418 |
define ('AI_CLICK_DETECTION_ADVANCED', 1);
|
472 |
define ('DEFAULT_TRACK_PAGEVIEWS', AI_TRACKING_DISABLED);
|
473 |
define ('DEFAULT_CLICK_DETECTION', AI_CLICK_DETECTION_STANDARD);
|
474 |
define ('DEFAULT_ADB_BLOCK_ACTION', AI_ADB_BLOCK_ACTION_DO_NOTHING);
|
475 |
+
define ('DEFAULT_ADB_DETECTION', AI_ADB_DETECTION_ADVANCED);
|
476 |
define ('DEFAULT_CUSTOM_HOOK_PRIORITY', 10);
|
477 |
|
478 |
define ('AI_ADBLOCKING_DETECTION', true);
|
479 |
define ('AI_AMP_HEADER_STYLES', true);
|
480 |
+
define ('AI_CODE_GENERATOR', true);
|
481 |
+
define ('AI_BUFFERING', true);
|
482 |
define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
|
483 |
define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
|
484 |
define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
|
557 |
define ('AI_CHECK_MAX_INSERTIONS', 27);
|
558 |
define ('AI_CHECK_FILTER', 28);
|
559 |
define ('AI_CHECK_PARAGRAPH_COUNTING', 29);
|
560 |
+
define ('AI_CHECK_ENABLED_PHP', 30);
|
561 |
+
define ('AI_CHECK_ENABLED_SHORTCODE', 31);
|
562 |
+
define ('AI_CHECK_PARAGRAPHS_MIN_NUMBER', 32);
|
563 |
+
|
564 |
define ('AI_CHECK_DEBUG_NO_INSERTION', 33);
|
565 |
define ('AI_CHECK_PARAGRAPH_TAGS', 34);
|
566 |
define ('AI_CHECK_PARAGRAPHS_WITH_TAGS', 35);
|
580 |
define ('AI_CHECK_MIN_NUMBER_OF_WORDS', 49);
|
581 |
define ('AI_CHECK_MAX_NUMBER_OF_WORDS', 50);
|
582 |
define ('AI_CHECK_TAXONOMY', 51);
|
583 |
+
define ('AI_CHECK_ENABLED_WIDGET', 52);
|
584 |
|
585 |
define ('AI_PT_NONE', - 1);
|
586 |
define ('AI_PT_ANY', 0);
|
622 |
define ('AI_VIEWPORTS', 20);
|
623 |
define ('AI_WORD_COUNT', 21);
|
624 |
define ('AI_ADB_SHORTCODE_ACTION', 22);
|
625 |
+
define ('AI_SHORTCODES', 23);
|
626 |
|
627 |
define ('AI_CONTEXT_NONE', 0);
|
628 |
define ('AI_CONTEXT_CONTENT', 1);
|
676 |
define ('AI_DEBUG_PAGE_TYPE_CLASS', 'ai-debug-page-type');
|
677 |
define ('AI_DEBUG_ADB_CLASS', 'ai-debug-adb');
|
678 |
|
679 |
+
define ('AI_CODE_UNKNOWN', 100);
|
680 |
+
define ('AI_CODE_BANNER', 0);
|
681 |
+
define ('AI_CODE_ADSENSE', 1);
|
682 |
|
683 |
define ('AI_ADSENSE_STANDARD', 0);
|
684 |
define ('AI_ADSENSE_LINK', 1);
|
685 |
define ('AI_ADSENSE_IN_ARTICLE', 2);
|
686 |
define ('AI_ADSENSE_IN_FEED', 3);
|
687 |
define ('AI_ADSENSE_MATCHED_CONTENT', 4);
|
688 |
+
define ('AI_ADSENSE_AUTO', 5);
|
689 |
+
|
690 |
+
define ('AI_ADSENSE_AMP_DISABLED', 0);
|
691 |
+
define ('AI_ADSENSE_AMP_ABOVE_THE_FOLD', 1);
|
692 |
+
define ('AI_ADSENSE_AMP_BELOW_THE_FOLD', 2);
|
693 |
|
694 |
define ('AI_TEXT_LINK', 'Link');
|
695 |
define ('AI_TEXT_IN_ARTICLE', 'In-article');
|
696 |
define ('AI_TEXT_IN_FEED', 'In-feed');
|
697 |
define ('AI_TEXT_MATCHED_CONTENT', 'Matched content');
|
698 |
|
699 |
+
define ('AI_TEXT_ABOVE_THE_FOLD', 'Above the fold');
|
700 |
+
define ('AI_TEXT_BELOW_THE_FOLD', 'Below the fold');
|
css/ad-inserter.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#ai-data {
|
2 |
-
font-family: "2.2.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
@@ -35,8 +35,16 @@
|
|
35 |
color: #555;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
.ai-top-button.ui-button-text-only .ui-button-text {
|
39 |
-
padding: .4em 0.
|
40 |
}
|
41 |
|
42 |
.ace_editor {
|
@@ -147,13 +155,18 @@ a.clear-link, a.clear-link:hover, a.clear-link:focus {
|
|
147 |
-webkit-user-select: none; /* Chrome all / Safari all */
|
148 |
-moz-user-select: none; /* Firefox all */
|
149 |
-ms-user-select: none; /* IE 10+ */
|
150 |
-
user-select: none;
|
151 |
}
|
152 |
.select {
|
153 |
-
-webkit-user-select:
|
154 |
-
-moz-user-select:
|
155 |
-
-ms-user-select:
|
156 |
-
user-select:
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
.ui-dialog {
|
@@ -368,13 +381,17 @@ div.automatic-insertion img {
|
|
368 |
display: table-cell;
|
369 |
vertical-align: top;
|
370 |
width: 28px;
|
371 |
-
padding:
|
372 |
}
|
373 |
|
374 |
.ai-toolbar-button.text {
|
375 |
width: auto;
|
376 |
}
|
377 |
|
|
|
|
|
|
|
|
|
378 |
.checkbox-button {
|
379 |
background-image: none, linear-gradient(to bottom, #f6f6f6 0, #eaeaea 100%);
|
380 |
background-position: 50% 50%;
|
@@ -418,11 +435,6 @@ div.automatic-insertion img {
|
|
418 |
vertical-align: middle;
|
419 |
}
|
420 |
|
421 |
-
/* TEMP */
|
422 |
-
img.automatic-insertion.above-header {
|
423 |
-
background: url('images/insertions-alignmets.png') -56px 0;
|
424 |
-
}
|
425 |
-
|
426 |
img.automatic-insertion.disabled {
|
427 |
background: url('images/insertions-alignmets.png') 0 0;
|
428 |
}
|
@@ -531,9 +543,9 @@ img.automatic-insertion.sticky-bottom {
|
|
531 |
background: url('images/insertions-alignmets.png') -112px -168px;
|
532 |
}
|
533 |
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
|
538 |
/*img.automatic-insertion.align-right {*/
|
539 |
/* background: url('images/insertions-alignmets.png') -224px -168px;*/
|
@@ -669,6 +681,91 @@ img.automatic-insertion.preview {
|
|
669 |
background: url('images/icons.png') -120px 0;
|
670 |
}
|
671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
.checkbox-icon.icon-enabled-all {
|
673 |
width: 16px;
|
674 |
height: 16px;
|
@@ -680,6 +777,16 @@ img.automatic-insertion.preview {
|
|
680 |
}
|
681 |
|
682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
.checkbox-icon.icon-loading {
|
684 |
width: 12px;
|
685 |
height: 12px;
|
@@ -708,6 +815,30 @@ img.automatic-insertion.preview {
|
|
708 |
margin-top: 6px;
|
709 |
}
|
710 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
#ai-sidebar .notice-dismiss {
|
712 |
position: absolute;
|
713 |
top: 0;
|
@@ -751,7 +882,7 @@ img.automatic-insertion.preview {
|
|
751 |
.ai-settings-table tr {
|
752 |
height: 40px;
|
753 |
}
|
754 |
-
.ai-settings-table input {
|
755 |
height: 30px;
|
756 |
}
|
757 |
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
|
@@ -778,6 +909,11 @@ img.automatic-insertion.preview {
|
|
778 |
.checkbox-icon.icon-enabled-all.on {
|
779 |
background: url('images/icons.png') -140px -0px;
|
780 |
}
|
|
|
|
|
|
|
|
|
|
|
781 |
}
|
782 |
|
783 |
@media(min-width: 769px) {
|
1 |
#ai-data {
|
2 |
+
font-family: "2.2.8"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
35 |
color: #555;
|
36 |
}
|
37 |
|
38 |
+
.ui-state-highlight {
|
39 |
+
background: #ff4;
|
40 |
+
}
|
41 |
+
|
42 |
+
button.ai-top-button {
|
43 |
+
min-width: 52px;
|
44 |
+
}
|
45 |
+
|
46 |
.ai-top-button.ui-button-text-only .ui-button-text {
|
47 |
+
padding: .4em 0.6em;
|
48 |
}
|
49 |
|
50 |
.ace_editor {
|
155 |
-webkit-user-select: none; /* Chrome all / Safari all */
|
156 |
-moz-user-select: none; /* Firefox all */
|
157 |
-ms-user-select: none; /* IE 10+ */
|
158 |
+
user-select: none;
|
159 |
}
|
160 |
.select {
|
161 |
+
-webkit-user-select: text;
|
162 |
+
-moz-user-select: text;
|
163 |
+
-ms-user-select: text;
|
164 |
+
user-select: text;
|
165 |
+
}
|
166 |
+
.copy-blocker {
|
167 |
+
position: absolute;
|
168 |
+
user-select: text;
|
169 |
+
height: 100%;
|
170 |
}
|
171 |
|
172 |
.ui-dialog {
|
381 |
display: table-cell;
|
382 |
vertical-align: top;
|
383 |
width: 28px;
|
384 |
+
padding: 0 0 0 10px;
|
385 |
}
|
386 |
|
387 |
.ai-toolbar-button.text {
|
388 |
width: auto;
|
389 |
}
|
390 |
|
391 |
+
.ai-toolbar-button.ai-button-left {
|
392 |
+
padding: 0 10px 0 0;
|
393 |
+
}
|
394 |
+
|
395 |
.checkbox-button {
|
396 |
background-image: none, linear-gradient(to bottom, #f6f6f6 0, #eaeaea 100%);
|
397 |
background-position: 50% 50%;
|
435 |
vertical-align: middle;
|
436 |
}
|
437 |
|
|
|
|
|
|
|
|
|
|
|
438 |
img.automatic-insertion.disabled {
|
439 |
background: url('images/insertions-alignmets.png') 0 0;
|
440 |
}
|
543 |
background: url('images/insertions-alignmets.png') -112px -168px;
|
544 |
}
|
545 |
|
546 |
+
img.automatic-insertion.above-header {
|
547 |
+
background: url('images/insertions-alignmets.png') -168px -168px;
|
548 |
+
}
|
549 |
|
550 |
/*img.automatic-insertion.align-right {*/
|
551 |
/* background: url('images/insertions-alignmets.png') -224px -168px;*/
|
681 |
background: url('images/icons.png') -120px 0;
|
682 |
}
|
683 |
|
684 |
+
.checkbox-icon.icon-code {
|
685 |
+
background: url('images/icons.png') 0 -80px;
|
686 |
+
}
|
687 |
+
|
688 |
+
.checkbox-icon.icon-code.on {
|
689 |
+
background: url('images/icons.png') 0 -60px;
|
690 |
+
}
|
691 |
+
|
692 |
+
.checkbox-icon.icon-rotation {
|
693 |
+
background: url('images/icons.png') -20px -80px;
|
694 |
+
}
|
695 |
+
|
696 |
+
.checkbox-icon.icon-rotation.on {
|
697 |
+
background: url('images/icons.png') -20px -60px;
|
698 |
+
}
|
699 |
+
|
700 |
+
.checkbox-icon.icon-rotation.active {
|
701 |
+
background: url('images/icons.png') -100px -40px;
|
702 |
+
}
|
703 |
+
|
704 |
+
.checkbox-icon.icon-generate {
|
705 |
+
background: url('images/icons.png') -40px -80px;
|
706 |
+
}
|
707 |
+
|
708 |
+
.checkbox-icon.icon-generate.on {
|
709 |
+
background: url('images/icons.png') -40px -60px;
|
710 |
+
}
|
711 |
+
|
712 |
+
.checkbox-icon.icon-import {
|
713 |
+
background: url('images/icons.png') -60px -80px;
|
714 |
+
}
|
715 |
+
|
716 |
+
.checkbox-icon.icon-import.on {
|
717 |
+
background: url('images/icons.png') -60px -60px;
|
718 |
+
}
|
719 |
+
|
720 |
+
.checkbox-icon.icon-edit {
|
721 |
+
background: url('images/icons.png') -80px -40px;
|
722 |
+
}
|
723 |
+
|
724 |
+
.checkbox-icon.icon-minus {
|
725 |
+
background: url('images/icons.png') -80px -80px;
|
726 |
+
}
|
727 |
+
|
728 |
+
.checkbox-icon.icon-plus {
|
729 |
+
background: url('images/icons.png') -80px -60px;
|
730 |
+
}
|
731 |
+
|
732 |
+
.checkbox-icon.icon-tools {
|
733 |
+
background: url('images/icons.png') -100px -80px;
|
734 |
+
}
|
735 |
+
|
736 |
+
.checkbox-icon.icon-tools.on {
|
737 |
+
background: url('images/icons.png') -100px -60px;
|
738 |
+
}
|
739 |
+
|
740 |
+
.checkbox-icon.icon-copy {
|
741 |
+
background: url('images/icons.png') -120px -80px;
|
742 |
+
}
|
743 |
+
|
744 |
+
.checkbox-icon.icon-copy.on {
|
745 |
+
background: url('images/icons.png') -120px -60px;
|
746 |
+
}
|
747 |
+
|
748 |
+
.checkbox-icon.icon-paste {
|
749 |
+
background: url('images/icons.png') -120px -40px;
|
750 |
+
}
|
751 |
+
|
752 |
+
.checkbox-icon.icon-paste-name {
|
753 |
+
background: url('images/icons.png') -140px -40px;
|
754 |
+
}
|
755 |
+
|
756 |
+
.checkbox-icon.icon-paste-code {
|
757 |
+
background: url('images/icons.png') -160px -40px;
|
758 |
+
}
|
759 |
+
|
760 |
+
.checkbox-icon.icon-paste-settings {
|
761 |
+
background: url('images/icons.png') -180px -40px;
|
762 |
+
}
|
763 |
+
|
764 |
+
.checkbox-icon.icon-clear {
|
765 |
+
background: url('images/icons.png') -160px -80px;
|
766 |
+
}
|
767 |
+
|
768 |
+
|
769 |
.checkbox-icon.icon-enabled-all {
|
770 |
width: 16px;
|
771 |
height: 16px;
|
777 |
}
|
778 |
|
779 |
|
780 |
+
.checkbox-icon.icon-rearrange {
|
781 |
+
width: 16px;
|
782 |
+
height: 16px;
|
783 |
+
background: url('images/icons.png') -140px -80px;
|
784 |
+
}
|
785 |
+
|
786 |
+
.checkbox-icon.icon-rearrange.on {
|
787 |
+
background: url('images/icons.png') -140px -60px;
|
788 |
+
}
|
789 |
+
|
790 |
.checkbox-icon.icon-loading {
|
791 |
width: 12px;
|
792 |
height: 12px;
|
815 |
margin-top: 6px;
|
816 |
}
|
817 |
|
818 |
+
.checkbox-icon.icon-none-small {
|
819 |
+
width: 8px;
|
820 |
+
height: 8px;
|
821 |
+
}
|
822 |
+
|
823 |
+
.banner-preview {
|
824 |
+
float: left;
|
825 |
+
margin: 0 10px 0 0;
|
826 |
+
}
|
827 |
+
|
828 |
+
.banner-preview img {
|
829 |
+
max-width: 100px;
|
830 |
+
max-height: 160px;
|
831 |
+
}
|
832 |
+
|
833 |
+
.ai-banner-top .banner-preview img {
|
834 |
+
max-width: 718px;
|
835 |
+
max-height: 100px;
|
836 |
+
}
|
837 |
+
|
838 |
+
.ai-banner-top table {
|
839 |
+
float: right;
|
840 |
+
}
|
841 |
+
|
842 |
#ai-sidebar .notice-dismiss {
|
843 |
position: absolute;
|
844 |
top: 0;
|
882 |
.ai-settings-table tr {
|
883 |
height: 40px;
|
884 |
}
|
885 |
+
.ai-settings-table input[type=text] {
|
886 |
height: 30px;
|
887 |
}
|
888 |
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
|
909 |
.checkbox-icon.icon-enabled-all.on {
|
910 |
background: url('images/icons.png') -140px -0px;
|
911 |
}
|
912 |
+
|
913 |
+
.banner-preview img {
|
914 |
+
max-width: 160px;
|
915 |
+
max-height: 160px;
|
916 |
+
}
|
917 |
}
|
918 |
|
919 |
@media(min-width: 769px) {
|
css/images/icons.png
CHANGED
Binary file
|
css/images/insertions-alignmets.png
CHANGED
Binary file
|
editor.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//ini_set ('display_errors', 1);
|
4 |
+
//error_reporting (E_ALL);
|
5 |
+
|
6 |
+
function ai_editor_media_buttons () {
|
7 |
+
echo '<button type="button" id="use-button" class="button" style="width: 90px;" title="Use current settings"> Use </button>';
|
8 |
+
echo '<button type="button" id="reset-button" class="button" style="width: 90px;" title="Reset to the saved settings"> Reset </button>';
|
9 |
+
echo '<button type="button" id="cancel-button" class="button" style="width: 90px;" title="Use current settings"> Cancel </button>';
|
10 |
+
}
|
11 |
+
|
12 |
+
function ai_editor_mce_buttons ($buttons, $id) {
|
13 |
+
$buttons = array_unique (array_merge ($buttons, array ('styleselect')));
|
14 |
+
return $buttons;
|
15 |
+
}
|
16 |
+
|
17 |
+
function ai_editor_mce_buttons_2 ($buttons, $id) {
|
18 |
+
$buttons = array_unique (array_merge ($buttons, array ('forecolor', 'backcolor', 'hr', 'fontselect', 'fontsizeselect')));
|
19 |
+
if (($key = array_search ('wp_help', $buttons)) !== false) {
|
20 |
+
unset ($buttons [$key]);
|
21 |
+
}
|
22 |
+
return $buttons;
|
23 |
+
}
|
24 |
+
|
25 |
+
function generate_code_editor ($block, $client_code, $process_php) {
|
26 |
+
global $block_object, $ai_wp_data;
|
27 |
+
|
28 |
+
$ai_wp_data [AI_WP_DEBUGGING] = 0;
|
29 |
+
|
30 |
+
$obj = $block_object [$block];
|
31 |
+
$code = $obj->ai_getCode ($client_code, $process_php);
|
32 |
+
|
33 |
+
wp_enqueue_script ('ai-adb-js', plugins_url ('includes/js/ad-inserter-check.js', __FILE__), array (
|
34 |
+
'jquery',
|
35 |
+
'jquery-ui-tabs',
|
36 |
+
'jquery-ui-button',
|
37 |
+
'jquery-ui-tooltip',
|
38 |
+
'jquery-ui-datepicker',
|
39 |
+
'jquery-ui-dialog',
|
40 |
+
), AD_INSERTER_VERSION);
|
41 |
+
|
42 |
+
wp_enqueue_style ('ai-editor-css', plugins_url ('css/ad-inserter.css', __FILE__), array (), AD_INSERTER_VERSION);
|
43 |
+
|
44 |
+
add_action ('media_buttons', 'ai_editor_media_buttons');
|
45 |
+
|
46 |
+
add_filter ('mce_buttons', 'ai_editor_mce_buttons', 99999, 2);
|
47 |
+
add_filter ('mce_buttons_2', 'ai_editor_mce_buttons_2', 99999, 2);
|
48 |
+
add_filter ('wp_default_editor', 'ai_wp_default_editor');
|
49 |
+
|
50 |
+
$editorSettings = array(
|
51 |
+
'wpautop' => true,
|
52 |
+
'media_buttons' => true,
|
53 |
+
'textarea_rows' => 38,
|
54 |
+
'tinymce'=> array (
|
55 |
+
'menubar ' => false,
|
56 |
+
'statusbar' => false,
|
57 |
+
// 'setup' => 'function (editor) {
|
58 |
+
// editor.on("change keyup redo undo", function (e) {
|
59 |
+
// update_message_preview (editor, e);
|
60 |
+
// });
|
61 |
+
// }',
|
62 |
+
'protect' => '[/<\?php.*?\?'.'>/g]',
|
63 |
+
),
|
64 |
+
);
|
65 |
+
|
66 |
+
ob_start ();
|
67 |
+
wp_head ();
|
68 |
+
$head = ob_get_clean ();
|
69 |
+
$head = preg_replace ('#<title>([^<]*)</title>#', '<title>' . AD_INSERTER_NAME . ' Visual Code Editor</title>', $head);
|
70 |
+
?>
|
71 |
+
<html>
|
72 |
+
<head>
|
73 |
+
<?php
|
74 |
+
echo $head;
|
75 |
+
?>
|
76 |
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
77 |
+
<script>
|
78 |
+
|
79 |
+
// initialize_preview ();
|
80 |
+
|
81 |
+
window.onkeydown = function (event) {
|
82 |
+
if (event.keyCode === 27 ) {
|
83 |
+
window.close();
|
84 |
+
}
|
85 |
+
};
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* jQuery BASE64 functions
|
90 |
+
*
|
91 |
+
* <code>
|
92 |
+
* Encodes the given data with base64.
|
93 |
+
* String $.base64Encode ( String str )
|
94 |
+
* <br />
|
95 |
+
* Decodes a base64 encoded data.
|
96 |
+
* String $.base64Decode ( String str )
|
97 |
+
* </code>
|
98 |
+
*
|
99 |
+
* Encodes and Decodes the given data in base64.
|
100 |
+
* This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
|
101 |
+
* Base64-encoded data takes about 33% more space than the original data.
|
102 |
+
* This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.
|
103 |
+
* If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
|
104 |
+
* This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
|
105 |
+
*
|
106 |
+
* Example
|
107 |
+
* Code
|
108 |
+
* <code>
|
109 |
+
* $.base64Encode("I'm Persian.");
|
110 |
+
* </code>
|
111 |
+
* Result
|
112 |
+
* <code>
|
113 |
+
* "SSdtIFBlcnNpYW4u"
|
114 |
+
* </code>
|
115 |
+
* Code
|
116 |
+
* <code>
|
117 |
+
* $.base64Decode("SSdtIFBlcnNpYW4u");
|
118 |
+
* </code>
|
119 |
+
* Result
|
120 |
+
* <code>
|
121 |
+
* "I'm Persian."
|
122 |
+
* </code>
|
123 |
+
*
|
124 |
+
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
125 |
+
* @link http://www.semnanweb.com/jquery-plugin/base64.html (no longer available?)
|
126 |
+
* @link https://gist.github.com/gists/1602210
|
127 |
+
* @see http://www.webtoolkit.info/
|
128 |
+
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
129 |
+
* @param {jQuery} {base64Encode:function(input))
|
130 |
+
* @param {jQuery} {base64Decode:function(input))
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
|
134 |
+
(function($){
|
135 |
+
|
136 |
+
var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
137 |
+
|
138 |
+
var uTF8Encode = function(string) {
|
139 |
+
string = string.replace(/\x0d\x0a/g, "\x0a");
|
140 |
+
var output = "";
|
141 |
+
for (var n = 0; n < string.length; n++) {
|
142 |
+
var c = string.charCodeAt(n);
|
143 |
+
if (c < 128) {
|
144 |
+
output += String.fromCharCode(c);
|
145 |
+
} else if ((c > 127) && (c < 2048)) {
|
146 |
+
output += String.fromCharCode((c >> 6) | 192);
|
147 |
+
output += String.fromCharCode((c & 63) | 128);
|
148 |
+
} else {
|
149 |
+
output += String.fromCharCode((c >> 12) | 224);
|
150 |
+
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
151 |
+
output += String.fromCharCode((c & 63) | 128);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
return output;
|
155 |
+
};
|
156 |
+
|
157 |
+
var uTF8Decode = function(input) {
|
158 |
+
var string = "";
|
159 |
+
var i = 0;
|
160 |
+
var c = c1 = c2 = 0;
|
161 |
+
while ( i < input.length ) {
|
162 |
+
c = input.charCodeAt(i);
|
163 |
+
if (c < 128) {
|
164 |
+
string += String.fromCharCode(c);
|
165 |
+
i++;
|
166 |
+
} else if ((c > 191) && (c < 224)) {
|
167 |
+
c2 = input.charCodeAt(i+1);
|
168 |
+
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
169 |
+
i += 2;
|
170 |
+
} else {
|
171 |
+
c2 = input.charCodeAt(i+1);
|
172 |
+
c3 = input.charCodeAt(i+2);
|
173 |
+
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
174 |
+
i += 3;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
return string;
|
178 |
+
}
|
179 |
+
|
180 |
+
$.extend({
|
181 |
+
base64Encode: function(input) {
|
182 |
+
var output = "";
|
183 |
+
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
184 |
+
var i = 0;
|
185 |
+
input = uTF8Encode(input);
|
186 |
+
while (i < input.length) {
|
187 |
+
chr1 = input.charCodeAt(i++);
|
188 |
+
chr2 = input.charCodeAt(i++);
|
189 |
+
chr3 = input.charCodeAt(i++);
|
190 |
+
enc1 = chr1 >> 2;
|
191 |
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
192 |
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
193 |
+
enc4 = chr3 & 63;
|
194 |
+
if (isNaN(chr2)) {
|
195 |
+
enc3 = enc4 = 64;
|
196 |
+
} else if (isNaN(chr3)) {
|
197 |
+
enc4 = 64;
|
198 |
+
}
|
199 |
+
output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
|
200 |
+
}
|
201 |
+
return output;
|
202 |
+
},
|
203 |
+
base64Decode: function(input) {
|
204 |
+
var output = "";
|
205 |
+
var chr1, chr2, chr3;
|
206 |
+
var enc1, enc2, enc3, enc4;
|
207 |
+
var i = 0;
|
208 |
+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
209 |
+
while (i < input.length) {
|
210 |
+
enc1 = keyString.indexOf(input.charAt(i++));
|
211 |
+
enc2 = keyString.indexOf(input.charAt(i++));
|
212 |
+
enc3 = keyString.indexOf(input.charAt(i++));
|
213 |
+
enc4 = keyString.indexOf(input.charAt(i++));
|
214 |
+
chr1 = (enc1 << 2) | (enc2 >> 4);
|
215 |
+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
216 |
+
chr3 = ((enc3 & 3) << 6) | enc4;
|
217 |
+
output = output + String.fromCharCode(chr1);
|
218 |
+
if (enc3 != 64) {
|
219 |
+
output = output + String.fromCharCode(chr2);
|
220 |
+
}
|
221 |
+
if (enc4 != 64) {
|
222 |
+
output = output + String.fromCharCode(chr3);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
output = uTF8Decode(output);
|
226 |
+
return output;
|
227 |
+
}
|
228 |
+
});
|
229 |
+
})(jQuery);
|
230 |
+
|
231 |
+
// https://gist.github.com/RadGH/523bed274f307830752c
|
232 |
+
|
233 |
+
// 0) If you are not using the default visual editor, make your own in PHP with a defined editor ID:
|
234 |
+
// wp_editor( $content, 'tab-editor' );
|
235 |
+
|
236 |
+
// 1) Get contents of your editor in JavaScript:
|
237 |
+
// tmce_getContent( 'tab-editor' )
|
238 |
+
|
239 |
+
// 2) Set content of the editor:
|
240 |
+
// tmce_setContent( content, 'tab-editor' )
|
241 |
+
|
242 |
+
// Note: If you just want to use the default editor, you can leave the ID blank:
|
243 |
+
// tmce_getContent()
|
244 |
+
// tmce_setContent( content )
|
245 |
+
|
246 |
+
// Note: If using a custom textarea ID, different than the editor id, add an extra argument:
|
247 |
+
// tmce_getContent( 'visual-id', 'textarea-id' )
|
248 |
+
// tmce_getContent( content, 'visual-id', 'textarea-id')
|
249 |
+
|
250 |
+
// Note: An additional function to provide "focus" to the displayed editor:
|
251 |
+
// tmce_focus( 'tab-editor' )
|
252 |
+
|
253 |
+
function tmce_getContent (editor_id, textarea_id) {
|
254 |
+
if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
|
255 |
+
if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
|
256 |
+
|
257 |
+
if (jQuery('#wp-' + editor_id + '-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
|
258 |
+
return tinyMCE.get(editor_id).getContent();
|
259 |
+
} else {
|
260 |
+
return jQuery('#'+textarea_id).val();
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
function tmce_setContent (content, editor_id, textarea_id) {
|
265 |
+
if (typeof editor_id == 'undefined' ) editor_id = wpActiveEditor;
|
266 |
+
if (typeof textarea_id == 'undefined' ) textarea_id = editor_id;
|
267 |
+
|
268 |
+
if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
|
269 |
+
return tinyMCE.get (editor_id).setContent (content);
|
270 |
+
} else {
|
271 |
+
return jQuery('#'+textarea_id).val (content);
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
function tmce_focus (editor_id, textarea_id) {
|
276 |
+
if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
|
277 |
+
if (typeof textarea_id == 'undefined') textarea_id = editor_id;
|
278 |
+
|
279 |
+
if (jQuery('#wp-'+editor_id+'-wrap').hasClass ('tmce-active') && tinyMCE.get (editor_id)) {
|
280 |
+
return tinyMCE.get (editor_id).focus();
|
281 |
+
} else {
|
282 |
+
return jQuery('#'+textarea_id).focus();
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
// function update_message_preview (editor, e) {
|
287 |
+
// if (e.type == 'keyup' && e.key == 'Escape') window.close();
|
288 |
+
// jQuery('#code-preview').html (editor.getContent());
|
289 |
+
// }
|
290 |
+
|
291 |
+
jQuery(document).ready(function($) {
|
292 |
+
|
293 |
+
function process_display_elements () {
|
294 |
+
$('#code-preview').html (tmce_getContent ());
|
295 |
+
}
|
296 |
+
|
297 |
+
function initialize_preview () {
|
298 |
+
|
299 |
+
var debug = <?php echo get_javascript_debugging () ? 'true' : 'false'; ?>;
|
300 |
+
|
301 |
+
function load_from_settings () {
|
302 |
+
|
303 |
+
if (window.opener != null && !window.opener.closed) {
|
304 |
+
var settings = $(window.opener.document).contents();
|
305 |
+
|
306 |
+
tmce_setContent ($.base64Decode ("<?php echo base64_encode ($code); ?>"));
|
307 |
+
|
308 |
+
process_display_elements ();
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
function apply_to_settings () {
|
313 |
+
if (window.opener != null && !window.opener.closed) {
|
314 |
+
var settings = $(window.opener.document).contents ();
|
315 |
+
|
316 |
+
window.opener.set_editor_text (<?php echo $block; ?>, tmce_getContent ())
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
$("#use-button").button ({
|
321 |
+
}).click (function () {
|
322 |
+
apply_to_settings ();
|
323 |
+
window.close();
|
324 |
+
});
|
325 |
+
|
326 |
+
$("#reset-button").button ({
|
327 |
+
}).click (function () {
|
328 |
+
load_from_settings ();
|
329 |
+
});
|
330 |
+
|
331 |
+
$("#cancel-button").button ({
|
332 |
+
}).click (function () {
|
333 |
+
window.close();
|
334 |
+
});
|
335 |
+
|
336 |
+
$('#ai-editor').bind ('input propertychange', function() {
|
337 |
+
$('#code-preview').html ($('#ai-editor').val ());
|
338 |
+
});
|
339 |
+
|
340 |
+
load_from_settings ();
|
341 |
+
}
|
342 |
+
|
343 |
+
initialize_preview ();
|
344 |
+
|
345 |
+
setTimeout (show_blocked_warning, 400);
|
346 |
+
});
|
347 |
+
|
348 |
+
function show_blocked_warning () {
|
349 |
+
jQuery("#blocked-warning.warning-enabled").show ();
|
350 |
+
}
|
351 |
+
|
352 |
+
</script>
|
353 |
+
<style>
|
354 |
+
body {
|
355 |
+
background: #fff;
|
356 |
+
display: block;
|
357 |
+
margin: 8px;
|
358 |
+
}
|
359 |
+
|
360 |
+
button,
|
361 |
+
input[type="button"] {
|
362 |
+
width: initial;
|
363 |
+
}
|
364 |
+
|
365 |
+
.button {
|
366 |
+
font-size: 14px!important;
|
367 |
+
}
|
368 |
+
|
369 |
+
/*#code-preview {*/
|
370 |
+
/* min-height: 300px;*/
|
371 |
+
/*}*/
|
372 |
+
|
373 |
+
/*#text {*/
|
374 |
+
/* position: relative;*/
|
375 |
+
/*}*/
|
376 |
+
</style>
|
377 |
+
</head>
|
378 |
+
<body style='font-family: arial; overflow-x: hidden;'>
|
379 |
+
<div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>"></div>
|
380 |
+
|
381 |
+
<div id="blocked-warning" class="warning-enabled" style="padding: 2px 8px 2px 8px; margin: 8px 0 8px 0; border: 1px solid rgb(221, 221, 221); border-radius: 5px;">
|
382 |
+
<div style="float: right; text-align: right; margin: 20px 0px 0px 0;">
|
383 |
+
This page was not loaded properly. Please check browser, plugins and ad blockers.
|
384 |
+
</div>
|
385 |
+
<h3 style="color: red;" title="Error loading page">PAGE BLOCKED</h3>
|
386 |
+
|
387 |
+
<div style="clear: both;"></div>
|
388 |
+
</div>
|
389 |
+
|
390 |
+
<!-- <div id="text">-->
|
391 |
+
<!-- <div id="code-preview"></div>-->
|
392 |
+
<!-- </div>-->
|
393 |
+
|
394 |
+
<div style="width: 100%; min-height: 310px; margin: 8px 0;">
|
395 |
+
<?php
|
396 |
+
// wp_editor ($code, 'ai-editor', $editorSettings);
|
397 |
+
wp_editor ('', 'ai-editor', $editorSettings);
|
398 |
+
|
399 |
+
// To disable Notice: Trying to get property of non-object in /wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 271
|
400 |
+
$error_reporting = error_reporting ();
|
401 |
+
error_reporting ($error_reporting & ~E_NOTICE);
|
402 |
+
|
403 |
+
_WP_Editors::enqueue_scripts();
|
404 |
+
print_footer_scripts ();
|
405 |
+
_WP_Editors::editor_js();
|
406 |
+
|
407 |
+
error_reporting ($error_reporting);
|
408 |
+
|
409 |
+
?>
|
410 |
+
</div>
|
411 |
+
|
412 |
+
<?php wp_footer (); ?>
|
413 |
+
</body>
|
414 |
+
</html>
|
415 |
+
<?php
|
416 |
+
}
|
417 |
+
|
images/loading.gif
ADDED
Binary file
|
includes/js/ai-adb.js
CHANGED
@@ -1,3 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
var ai_adb = false;
|
2 |
var ai_adb_wrapping_div_selector = ".AI_BLOCK_CLASS_NAME";
|
3 |
var ai_adb_debugging = AI_DATAB_AI_JS_DEBUGGING;
|
1 |
+
/**
|
2 |
+
* jQuery BASE64 functions
|
3 |
+
*
|
4 |
+
* <code>
|
5 |
+
* Encodes the given data with base64.
|
6 |
+
* String $.base64Encode ( String str )
|
7 |
+
* <br />
|
8 |
+
* Decodes a base64 encoded data.
|
9 |
+
* String $.base64Decode ( String str )
|
10 |
+
* </code>
|
11 |
+
*
|
12 |
+
* Encodes and Decodes the given data in base64.
|
13 |
+
* This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
|
14 |
+
* Base64-encoded data takes about 33% more space than the original data.
|
15 |
+
* This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.
|
16 |
+
* If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
|
17 |
+
* This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
|
18 |
+
*
|
19 |
+
* Example
|
20 |
+
* Code
|
21 |
+
* <code>
|
22 |
+
* $.base64Encode("I'm Persian.");
|
23 |
+
* </code>
|
24 |
+
* Result
|
25 |
+
* <code>
|
26 |
+
* "SSdtIFBlcnNpYW4u"
|
27 |
+
* </code>
|
28 |
+
* Code
|
29 |
+
* <code>
|
30 |
+
* $.base64Decode("SSdtIFBlcnNpYW4u");
|
31 |
+
* </code>
|
32 |
+
* Result
|
33 |
+
* <code>
|
34 |
+
* "I'm Persian."
|
35 |
+
* </code>
|
36 |
+
*
|
37 |
+
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
38 |
+
* @link http://www.semnanweb.com/jquery-plugin/base64.html (no longer available?)
|
39 |
+
* @link https://gist.github.com/gists/1602210
|
40 |
+
* @see http://www.webtoolkit.info/
|
41 |
+
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
42 |
+
* @param {jQuery} {base64Encode:function(input))
|
43 |
+
* @param {jQuery} {base64Decode:function(input))
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
|
47 |
+
(function($){
|
48 |
+
|
49 |
+
var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
50 |
+
|
51 |
+
var uTF8Encode = function(string) {
|
52 |
+
string = string.replace(/\x0d\x0a/g, "\x0a");
|
53 |
+
var output = "";
|
54 |
+
for (var n = 0; n < string.length; n++) {
|
55 |
+
var c = string.charCodeAt(n);
|
56 |
+
if (c < 128) {
|
57 |
+
output += String.fromCharCode(c);
|
58 |
+
} else if ((c > 127) && (c < 2048)) {
|
59 |
+
output += String.fromCharCode((c >> 6) | 192);
|
60 |
+
output += String.fromCharCode((c & 63) | 128);
|
61 |
+
} else {
|
62 |
+
output += String.fromCharCode((c >> 12) | 224);
|
63 |
+
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
64 |
+
output += String.fromCharCode((c & 63) | 128);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
return output;
|
68 |
+
};
|
69 |
+
|
70 |
+
var uTF8Decode = function(input) {
|
71 |
+
var string = "";
|
72 |
+
var i = 0;
|
73 |
+
var c = c1 = c2 = 0;
|
74 |
+
while ( i < input.length ) {
|
75 |
+
c = input.charCodeAt(i);
|
76 |
+
if (c < 128) {
|
77 |
+
string += String.fromCharCode(c);
|
78 |
+
i++;
|
79 |
+
} else if ((c > 191) && (c < 224)) {
|
80 |
+
c2 = input.charCodeAt(i+1);
|
81 |
+
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
82 |
+
i += 2;
|
83 |
+
} else {
|
84 |
+
c2 = input.charCodeAt(i+1);
|
85 |
+
c3 = input.charCodeAt(i+2);
|
86 |
+
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
87 |
+
i += 3;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return string;
|
91 |
+
}
|
92 |
+
|
93 |
+
$.extend({
|
94 |
+
base64Encode: function(input) {
|
95 |
+
var output = "";
|
96 |
+
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
97 |
+
var i = 0;
|
98 |
+
input = uTF8Encode(input);
|
99 |
+
while (i < input.length) {
|
100 |
+
chr1 = input.charCodeAt(i++);
|
101 |
+
chr2 = input.charCodeAt(i++);
|
102 |
+
chr3 = input.charCodeAt(i++);
|
103 |
+
enc1 = chr1 >> 2;
|
104 |
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
105 |
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
106 |
+
enc4 = chr3 & 63;
|
107 |
+
if (isNaN(chr2)) {
|
108 |
+
enc3 = enc4 = 64;
|
109 |
+
} else if (isNaN(chr3)) {
|
110 |
+
enc4 = 64;
|
111 |
+
}
|
112 |
+
output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
|
113 |
+
}
|
114 |
+
return output;
|
115 |
+
},
|
116 |
+
base64Decode: function(input) {
|
117 |
+
var output = "";
|
118 |
+
var chr1, chr2, chr3;
|
119 |
+
var enc1, enc2, enc3, enc4;
|
120 |
+
var i = 0;
|
121 |
+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
122 |
+
while (i < input.length) {
|
123 |
+
enc1 = keyString.indexOf(input.charAt(i++));
|
124 |
+
enc2 = keyString.indexOf(input.charAt(i++));
|
125 |
+
enc3 = keyString.indexOf(input.charAt(i++));
|
126 |
+
enc4 = keyString.indexOf(input.charAt(i++));
|
127 |
+
chr1 = (enc1 << 2) | (enc2 >> 4);
|
128 |
+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
129 |
+
chr3 = ((enc3 & 3) << 6) | enc4;
|
130 |
+
output = output + String.fromCharCode(chr1);
|
131 |
+
if (enc3 != 64) {
|
132 |
+
output = output + String.fromCharCode(chr2);
|
133 |
+
}
|
134 |
+
if (enc4 != 64) {
|
135 |
+
output = output + String.fromCharCode(chr3);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
output = uTF8Decode(output);
|
139 |
+
return output;
|
140 |
+
}
|
141 |
+
});
|
142 |
+
})(jQuery);
|
143 |
+
|
144 |
var ai_adb = false;
|
145 |
var ai_adb_wrapping_div_selector = ".AI_BLOCK_CLASS_NAME";
|
146 |
var ai_adb_debugging = AI_DATAB_AI_JS_DEBUGGING;
|
includes/js/ai-adb.min.js
CHANGED
@@ -1,19 +1,29 @@
|
|
1 |
-
var
|
2 |
-
var
|
3 |
-
|
4 |
-
|
5 |
-
var
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
"undefined"
|
10 |
-
var
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
if(!document.getElementById("AI_CONST_AI_ADB_1_NAME"))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(1)});else jQuery(document).ready(function(){ai_adb_undetected(1)});if(typeof window.AI_CONST_AI_ADB_2_NAME=="undefined")jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(2)});else jQuery(document).ready(function(){ai_adb_undetected(2)});
|
15 |
jQuery(document).ready(function($){$(window).ready(function(){$("#ai-adb-bar").click(function(){$.removeCookie(ai_adb_act_cookie_name,{path:"/"});$.removeCookie(ai_adb_pgv_cookie_name,{path:"/"});var AI_ADB_STATUS_MESSAGE=5});if($("#banner-advert-container img").length>0){if($("#banner-advert-container img").outerHeight()===0)$(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(3)});else $(document).ready(function(){ai_adb_undetected(3)});$("#banner-advert-container img").remove()}if((!ai_adb_active||
|
16 |
-
ai_adb_debugging)&&ai_adb_selectors!=""){var ai_adb_el_counter=0;var ai_adb_el_zero=0;var ai_adb_selector=ai_adb_selectors.split(",");$.each(ai_adb_selector,function(i){if($(ai_adb_selector[i]).length!=0)$(ai_adb_selector[i]).each(function(n){
|
|
|
17 |
(function(factory){if(typeof define==="function"&&define.amd)define(["jquery"],factory);else if(typeof exports==="object")factory(require("jquery"));else factory(jQuery)})(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){if(s.indexOf('"')===0)s=s.slice(1,-1).replace(/\\"/g,
|
18 |
'"').replace(/\\\\/g,"\\");try{s=decodeURIComponent(s.replace(pluses," "));return config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date;t.setTime(+t+days*864E5)}return document.cookie=
|
19 |
[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split("; "):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split("=");var name=decode(parts.shift());var cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}if(!key&&
|
1 |
+
(function($){var keyString="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var uTF8Encode=function(string){string=string.replace(/\x0d\x0a/g,"\n");var output="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128)output+=String.fromCharCode(c);else if(c>127&&c<2048){output+=String.fromCharCode(c>>6|192);output+=String.fromCharCode(c&63|128)}else{output+=String.fromCharCode(c>>12|224);output+=String.fromCharCode(c>>6&63|128);output+=String.fromCharCode(c&63|128)}}return output};
|
2 |
+
var uTF8Decode=function(input){var string="";var i=0;var c=c1=c2=0;while(i<input.length){c=input.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++}else if(c>191&&c<224){c2=input.charCodeAt(i+1);string+=String.fromCharCode((c&31)<<6|c2&63);i+=2}else{c2=input.charCodeAt(i+1);c3=input.charCodeAt(i+2);string+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63);i+=3}}return string};$.extend({base64Encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=uTF8Encode(input);
|
3 |
+
while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2))enc3=enc4=64;else if(isNaN(chr3))enc4=64;output=output+keyString.charAt(enc1)+keyString.charAt(enc2)+keyString.charAt(enc3)+keyString.charAt(enc4)}return output},base64Decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/=]/g,"");while(i<
|
4 |
+
input.length){enc1=keyString.indexOf(input.charAt(i++));enc2=keyString.indexOf(input.charAt(i++));enc3=keyString.indexOf(input.charAt(i++));enc4=keyString.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64)output=output+String.fromCharCode(chr2);if(enc4!=64)output=output+String.fromCharCode(chr3)}output=uTF8Decode(output);return output}})})(jQuery);var ai_adb=false;var ai_adb_wrapping_div_selector=".AI_BLOCK_CLASS_NAME";
|
5 |
+
var ai_adb_debugging=AI_DATAB_AI_JS_DEBUGGING;var ai_adb_active=false;var ai_adb_counter=0;var ai_adb_overlay=AI_ADB_OVERLAY_WINDOW;var ai_adb_message_window=AI_ADB_MESSAGE_WINDOW;var ai_adb_message_undismissible=AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE;var ai_adb_act_cookie_name="aiADB";var ai_adb_pgv_cookie_name="aiADB_PV";var ai_adb_page_redirection_cookie_name="aiADB_PR";var ai_adb_message_cookie_lifetime=AI_FUNCT_GET_NO_ACTION_PERIOD;var ai_adb_action=AI_FUNC_GET_ADB_ACTION;var ai_adb_page_views=AI_FUNCT_GET_DELAY_ACTION;
|
6 |
+
var ai_adb_selectors="AI_ADB_SELECTORS";var ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
|
7 |
+
function ai_adb_process_content(){(function($){if(ai_adb_debugging)console.log("AI ad blocking CONTENT PROCESSING");$(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each(function(){var ai_adb_parent=$(this).parent();if(ai_adb_debugging)console.log("AI ad blocking parent",ai_adb_parent.prop("tagName"),'id="'+ai_adb_parent.attr("id")+'"','class="'+ai_adb_parent.attr("class")+'"');var ai_adb_css=$(this).data("css");if(typeof ai_adb_css=="undefined")ai_adb_css="display: none !important;";var ai_adb_selectors=$(this).data("selectors");
|
8 |
+
if(typeof ai_adb_selectors=="undefined"||ai_adb_selectors=="")ai_adb_selectors="p";if(ai_adb_debugging)console.log("AI ad blocking CSS, css='"+ai_adb_css+"'","selectors='"+ai_adb_selectors+"'");var ai_adb_action=false;$(ai_adb_parent).find(".AI_ADB_CONTENT_CSS_BEGIN_CLASS, "+ai_adb_selectors).each(function(){if($(this).hasClass("AI_ADB_CONTENT_CSS_BEGIN_CLASS")){$(this).remove();ai_adb_action=true}else if($(this).hasClass("AI_ADB_CONTENT_CSS_END_CLASS")){$(this).remove();ai_adb_action=false}else if(ai_adb_action){var ai_adb_style=
|
9 |
+
$(this).attr("style");if(typeof ai_adb_style=="undefined")ai_adb_style="";$(this).attr("style",ai_adb_style+";"+ai_adb_css)}})});$(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each(function(){var ai_adb_parent=$(this).parent();if(ai_adb_debugging)console.log("AI ad blocking DELETE, parent",ai_adb_parent.prop("tagName"),'id="'+ai_adb_parent.attr("id")+'"','class="'+ai_adb_parent.attr("class")+'"');var ai_adb_selectors=$(this).data("selectors");if(typeof ai_adb_selectors=="undefined"||ai_adb_selectors=="")ai_adb_selectors=
|
10 |
+
"p";if(ai_adb_debugging)console.log("AI ad blocking DELETE, selectors='"+ai_adb_selectors+"'");var ai_adb_action=false;$(ai_adb_parent).find(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS, "+ai_adb_selectors).each(function(){if($(this).hasClass("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")){$(this).remove();ai_adb_action=true}else if($(this).hasClass("AI_ADB_CONTENT_DELETE_END_CLASS")){$(this).remove();ai_adb_action=false}else if(ai_adb_action)$(this).remove()})});$(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each(function(){var ai_adb_parent=
|
11 |
+
$(this).parent();if(ai_adb_debugging)console.log("AI ad blocking REPLACE, parent",ai_adb_parent.prop("tagName"),'id="'+ai_adb_parent.attr("id")+'"','class="'+ai_adb_parent.attr("class")+'"');var ai_adb_text=$(this).data("text");if(typeof ai_adb_text=="undefined")ai_adb_text="";var ai_adb_css=$(this).data("css");if(typeof ai_adb_css=="undefined")ai_adb_css="";var ai_adb_selectors=$(this).data("selectors");if(typeof ai_adb_selectors=="undefined"||ai_adb_selectors=="")ai_adb_selectors="p";if(ai_adb_debugging)console.log("AI ad blocking REPLACE, text='"+
|
12 |
+
ai_adb_text+"'","css='"+ai_adb_css+"'","selectors='"+ai_adb_selectors+"'");var ai_adb_action=false;$(ai_adb_parent).find(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, "+ai_adb_selectors).each(function(){if($(this).hasClass("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS")){$(this).remove();ai_adb_action=true}else if($(this).hasClass("AI_ADB_CONTENT_REPLACE_END_CLASS")){$(this).remove();ai_adb_action=false}else if(ai_adb_action){if(ai_adb_text.length!=0){var n=Math.round($(this).text().length/(ai_adb_text.length+1));
|
13 |
+
$(this).text(Array(n+1).join(ai_adb_text+" "))}else $(this).text("");var ai_adb_style=$(this).attr("style");if(typeof ai_adb_style=="undefined")ai_adb_style="";$(this).attr("style",ai_adb_style+";"+ai_adb_css)}})})})(jQuery)}
|
14 |
+
var ai_adb_detected=function(n){if(ai_adb_debugging)console.log("AI ad blocking DETECTED",n);if(!ai_adb_active){ai_adb_active=true;(function($){$(window).ready(function(){if(ai_adb_debugging)console.log("AI ad blocking block actions");$(".ai-adb-show").each(function(){$(this).css({"display":"block","visibility":"visible"});var tracking_data=$(this).data("ai-tracking");if(typeof tracking_data!="undefined"){var wrapping_div=$(this).closest(ai_adb_wrapping_div_selector);if(typeof wrapping_div.data("ai")!=
|
15 |
+
"undefined"){if($(this).hasClass("ai-no-tracking")){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";tracking_data=btoa(JSON.stringify(data))}}wrapping_div.data("ai",tracking_data)}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI ad blocking SHOW",typeof debug_info!="undefined"?debug_info:"")}});$(".ai-adb-hide").each(function(){$(this).css({"display":"none","visibility":"hidden"});if(ai_adb_debugging){var debug_info=
|
16 |
+
$(this).data("ai-debug");console.log("AI ad blocking HIDE",typeof debug_info!="undefined"?debug_info:"")}});setTimeout(ai_adb_process_content,10)});if(ai_adb_debugging)console.log("AI ad blocking action check");if(ai_adb_page_views!=0){var ai_adb_page_view_counter=1;var cookie=$.cookie(ai_adb_pgv_cookie_name);if(typeof cookie!="undefined")ai_adb_page_view_counter=parseInt(cookie)+1;if(ai_adb_debugging)console.log("AI ad blocking page views cookie:",cookie,"- page view:",ai_adb_page_view_counter);
|
17 |
+
if(ai_adb_page_view_counter<ai_adb_page_views){if(ai_adb_debugging)console.log("AI ad blocking",ai_adb_page_views,"page views not reached, no action");var d1=ai_adb_page_view_counter;var AI_ADB_STATUS_MESSAGE=1;$.cookie(ai_adb_pgv_cookie_name,ai_adb_page_view_counter,{expires:365,path:"/"});return}}if(ai_adb_message_cookie_lifetime!=0&&(ai_adb_action!=1||!ai_adb_message_undismissible)){var cookie=$.cookie(ai_adb_act_cookie_name);if(ai_adb_debugging)console.log("AI ad blocking cookie:",cookie);if(typeof cookie!=
|
18 |
+
"undefined"&&cookie=="AI_CONST_AI_ADB_COOKIE_VALUE"){if(ai_adb_debugging)console.log("AI ad blocking valid cookie detected, no action");var AI_ADB_STATUS_MESSAGE=2;return}else if(ai_adb_debugging)console.log("AI ad blocking invalid cookie");$.cookie(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}else $.removeCookie(ai_adb_act_cookie_name,{path:"/"});if(ai_adb_debugging)console.log("AI ad blocking action",ai_adb_action);var AI_ADB_STATUS_MESSAGE=
|
19 |
+
3;switch(ai_adb_action){case 1:if(!ai_adb_message_undismissible){ai_adb_overlay.click(function(){$(this).remove();ai_adb_message_window.remove()}).css("cursor","pointer");ai_adb_message_window.click(function(){$(this).remove();ai_adb_overlay.remove()}).css("cursor","pointer");window.onkeydown=function(event){if(event.keyCode===27){ai_adb_overlay.click();ai_adb_message_window.click()}};if(ai_adb_debugging)console.log("AI ad blocking MESSAGE click detection installed")}else;if(ai_adb_debugging)console.log("AI ad blocking MESSAGE");
|
20 |
+
$("body").prepend(ai_adb_overlay).prepend(ai_adb_message_window);break;case 2:if(ai_adb_redirection_url!=""){if(ai_adb_debugging)console.log("AI ad blocking REDIRECTION to",ai_adb_redirection_url);var redirect=true;if(ai_adb_redirection_url.toLowerCase().substring(0,4)=="http"){if(window.location.href==ai_adb_redirection_url)var redirect=false}else if(window.location.pathname==ai_adb_redirection_url)var redirect=false;if(redirect){var cookie=$.cookie(ai_adb_page_redirection_cookie_name);if(typeof cookie==
|
21 |
+
"undefined"){var date=new Date;date.setTime(date.getTime()+10*1E3);$.cookie(ai_adb_page_redirection_cookie_name,window.location.href,{expires:date,path:"/"});window.location.replace(ai_adb_redirection_url)}else if(ai_adb_debugging)console.log("AI ad blocking no redirection, cookie:",cookie)}else{if(ai_adb_debugging)console.log("AI ad blocking already on page",window.location.href);jQuery.removeCookie(ai_adb_page_redirection_cookie_name,{path:"/"})}}break}})(jQuery);ai_adb=true}};
|
22 |
+
var ai_adb_undetected=function(n){ai_adb_counter++;if(ai_adb_debugging)console.log("AI ad blocking not detected",n,"- counter:",ai_adb_counter);if(!ai_adb_active&&ai_adb_counter==3){if(ai_adb_debugging)console.log("AI ad blocking NOT DETECTED");var AI_ADB_STATUS_MESSAGE=4}};if(AI_DBG_AI_DEBUG_AD_BLOCKING)jQuery(document).ready(function(){ai_adb_detected(0)});
|
23 |
if(!document.getElementById("AI_CONST_AI_ADB_1_NAME"))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(1)});else jQuery(document).ready(function(){ai_adb_undetected(1)});if(typeof window.AI_CONST_AI_ADB_2_NAME=="undefined")jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(2)});else jQuery(document).ready(function(){ai_adb_undetected(2)});
|
24 |
jQuery(document).ready(function($){$(window).ready(function(){$("#ai-adb-bar").click(function(){$.removeCookie(ai_adb_act_cookie_name,{path:"/"});$.removeCookie(ai_adb_pgv_cookie_name,{path:"/"});var AI_ADB_STATUS_MESSAGE=5});if($("#banner-advert-container img").length>0){if($("#banner-advert-container img").outerHeight()===0)$(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(3)});else $(document).ready(function(){ai_adb_undetected(3)});$("#banner-advert-container img").remove()}if((!ai_adb_active||
|
25 |
+
ai_adb_debugging)&&ai_adb_selectors!=""){var ai_adb_el_counter=0;var ai_adb_el_zero=0;var ai_adb_selector=ai_adb_selectors.split(",");$.each(ai_adb_selector,function(i){if(ai_adb_debugging)console.log("AI ad blocking selector",ai_adb_selector[i]);if($(ai_adb_selector[i]).length!=0)$(ai_adb_selector[i]).each(function(n){if(ai_adb_debugging)console.log('AI ad blocking element id="'+$(this).attr("id")+'" class="'+$(this).attr("class")+'" heights:',$(this).outerHeight(),$(this).innerHeight(),$(this).height());
|
26 |
+
ai_adb_el_counter++;if($(this).outerHeight()===0){$(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(4)});ai_adb_el_zero++;if(!ai_adb_debugging)return false}})});if(ai_adb_el_counter!=0&&ai_adb_el_zero==0)$(document).ready(function(){ai_adb_undetected(4)})}})});
|
27 |
(function(factory){if(typeof define==="function"&&define.amd)define(["jquery"],factory);else if(typeof exports==="object")factory(require("jquery"));else factory(jQuery)})(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){if(s.indexOf('"')===0)s=s.slice(1,-1).replace(/\\"/g,
|
28 |
'"').replace(/\\\\/g,"\\");try{s=decodeURIComponent(s.replace(pluses," "));return config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date;t.setTime(+t+days*864E5)}return document.cookie=
|
29 |
[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split("; "):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split("=");var name=decode(parts.shift());var cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}if(!key&&
|
includes/js/ai-rotate.js
CHANGED
@@ -9,9 +9,16 @@ jQuery (function ($) {
|
|
9 |
if (n % 2) random_index = rotate_options.length - random_index - 1;
|
10 |
|
11 |
rotate_options.hide ();
|
12 |
-
$(rotate_options [random_index])
|
|
|
13 |
$(this).css ({"position": ""});
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
var tracking_updated = false;
|
16 |
var adb_show_wrapping_div = $(this).closest ('.ai-adb-show');
|
17 |
if (typeof adb_show_wrapping_div != "undefined") {
|
@@ -26,7 +33,7 @@ jQuery (function ($) {
|
|
26 |
}
|
27 |
|
28 |
if (!tracking_updated) {
|
29 |
-
var wrapping_div = $(this).closest (wrapping_div_selector);
|
30 |
if (typeof wrapping_div.data ("ai") != "undefined") {
|
31 |
var data = JSON.parse (atob (wrapping_div.data ("ai")));
|
32 |
if (typeof data !== "undefined" && data.constructor === Array) {
|
9 |
if (n % 2) random_index = rotate_options.length - random_index - 1;
|
10 |
|
11 |
rotate_options.hide ();
|
12 |
+
var option = $(rotate_options [random_index]);
|
13 |
+
option.css ({"display": "", "visibility": "", "position": "", "width": "", "height": "", "top": "", "left": ""});
|
14 |
$(this).css ({"position": ""});
|
15 |
|
16 |
+
var wrapping_div = $(this).closest (wrapping_div_selector);
|
17 |
+
|
18 |
+
if (typeof wrapping_div != "undefined") {
|
19 |
+
wrapping_div.find ('span.ai-option-name').html (' - ' + atob (option.data ('name')));
|
20 |
+
}
|
21 |
+
|
22 |
var tracking_updated = false;
|
23 |
var adb_show_wrapping_div = $(this).closest ('.ai-adb-show');
|
24 |
if (typeof adb_show_wrapping_div != "undefined") {
|
33 |
}
|
34 |
|
35 |
if (!tracking_updated) {
|
36 |
+
// var wrapping_div = $(this).closest (wrapping_div_selector);
|
37 |
if (typeof wrapping_div.data ("ai") != "undefined") {
|
38 |
var data = JSON.parse (atob (wrapping_div.data ("ai")));
|
39 |
if (typeof data !== "undefined" && data.constructor === Array) {
|
includes/js/ai-rotate.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
jQuery(function($){var wrapping_div_selector=".AI_BLOCK_CLASS_NAME";$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();if(n%2)random_index=rotate_options.length-random_index-1;rotate_options.hide()
|
2 |
-
false;var adb_show_wrapping_div=$(this).closest(".ai-adb-show");if(typeof adb_show_wrapping_div!="undefined")if(typeof adb_show_wrapping_div.data("ai-tracking")!="undefined"){var data=JSON.parse(atob(adb_show_wrapping_div.data("ai-tracking")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+
|
3 |
-
"undefined"){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}}
|
1 |
+
jQuery(function($){var wrapping_div_selector=".AI_BLOCK_CLASS_NAME";$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);var d=new Date;var n=d.getMilliseconds();if(n%2)random_index=rotate_options.length-random_index-1;rotate_options.hide();var option=$(rotate_options[random_index]);option.css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""});$(this).css({"position":""});
|
2 |
+
var wrapping_div=$(this).closest(wrapping_div_selector);if(typeof wrapping_div!="undefined")wrapping_div.find("span.ai-option-name").html(" - "+atob(option.data("name")));var tracking_updated=false;var adb_show_wrapping_div=$(this).closest(".ai-adb-show");if(typeof adb_show_wrapping_div!="undefined")if(typeof adb_show_wrapping_div.data("ai-tracking")!="undefined"){var data=JSON.parse(atob(adb_show_wrapping_div.data("ai-tracking")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+
|
3 |
+
1;adb_show_wrapping_div.data("ai-tracking",btoa(JSON.stringify(data)));tracking_updated=true}}if(!tracking_updated)if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(atob(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;wrapping_div.data("ai",btoa(JSON.stringify(data)))}}})});
|
js/ad-inserter.js
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
-
var javascript_version = "2.2.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
5 |
var active_tab = 1;
|
6 |
var active_tab_0 = 0;
|
7 |
var tabs_to_configure = new Array();
|
|
|
|
|
8 |
|
9 |
var current_tab = 0;
|
10 |
var next_tab = 0;
|
@@ -53,9 +55,9 @@ var AI_ADB_BLOCK_ACTION_REPLACE = 1;
|
|
53 |
var AI_ADB_BLOCK_ACTION_SHOW = 2;
|
54 |
var AI_ADB_BLOCK_ACTION_HIDE = 3;
|
55 |
|
56 |
-
var AI_CODE_UNKNOWN =
|
57 |
-
var AI_CODE_BANNER =
|
58 |
-
var AI_CODE_ADSENSE =
|
59 |
|
60 |
var AI_ADSENSE_STANDARD = 0;
|
61 |
var AI_ADSENSE_LINK = 1;
|
@@ -245,13 +247,17 @@ function SyntaxHighlight (id, block, settings) {
|
|
245 |
// copy back to textarea on form submit...
|
246 |
form.submit (function () {
|
247 |
var block = textarea.attr ("id").replace ("block-","");
|
248 |
-
var editor_disabled =
|
|
|
|
|
|
|
249 |
if (!editor_disabled) {
|
250 |
textarea.val (session.getValue());
|
251 |
}
|
252 |
if (textarea.val () == "") {
|
253 |
textarea.removeAttr ("name");
|
254 |
}
|
|
|
255 |
// else textarea.val (jQuery.base64Encode (textarea.val ()));
|
256 |
|
257 |
jQuery("#ai-active-tab").attr ("value", '[' + active_tab + ',' + active_tab_0 + ']');
|
@@ -310,21 +316,25 @@ Number.isInteger = Number.isInteger || function (value) {
|
|
310 |
};
|
311 |
|
312 |
function get_editor_text (block) {
|
313 |
-
var
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
319 |
}
|
320 |
|
321 |
function set_editor_text (block, text) {
|
322 |
-
var
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
|
|
|
|
328 |
}
|
329 |
|
330 |
function window_open_post (url, windowoption, name, params) {
|
@@ -653,8 +663,7 @@ jQuery(document).ready(function($) {
|
|
653 |
geo_groups = parseInt (geo_groups_text);
|
654 |
}
|
655 |
|
656 |
-
|
657 |
-
var debug_title = false;
|
658 |
|
659 |
if (debug) {
|
660 |
var start_time = new Date().getTime();
|
@@ -962,11 +971,11 @@ jQuery(document).ready(function($) {
|
|
962 |
$("#scheduling-delay-warning-"+block).hide();
|
963 |
var scheduling = $("select#scheduling-"+block).val();
|
964 |
if (scheduling == "1") {
|
965 |
-
if (content_settings) {
|
966 |
$("#scheduling-delay-"+block).show();
|
967 |
-
} else {
|
968 |
-
$("#scheduling-delay-warning-"+block).show();
|
969 |
-
}
|
970 |
} else
|
971 |
if (scheduling == "2") {
|
972 |
$("#scheduling-between-dates-"+block).show();
|
@@ -1010,6 +1019,23 @@ jQuery(document).ready(function($) {
|
|
1010 |
}
|
1011 |
}
|
1012 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
function configure_editor (block) {
|
1014 |
|
1015 |
if (debug) console.log ("configure_editor:", block);
|
@@ -1022,20 +1048,23 @@ jQuery(document).ready(function($) {
|
|
1022 |
|
1023 |
var block = $(this).attr ("id").replace ("simple-editor-","");
|
1024 |
var editor_disabled = $(this).is(":checked");
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
textarea.
|
1038 |
-
|
|
|
|
|
|
|
1039 |
});
|
1040 |
}
|
1041 |
|
@@ -1228,9 +1257,14 @@ jQuery(document).ready(function($) {
|
|
1228 |
|
1229 |
if ($("#export-container-0").is(':visible') && !$(this).hasClass ("loaded")) {
|
1230 |
var nonce = $(this).attr ('nonce');
|
1231 |
-
$("#export_settings_0").load (ajaxurl+"?action=ai_ajax_backend&export=0&ai_check=" + nonce, function() {
|
1232 |
-
|
1233 |
-
|
|
|
|
|
|
|
|
|
|
|
1234 |
});
|
1235 |
}
|
1236 |
});
|
@@ -1258,12 +1292,36 @@ jQuery(document).ready(function($) {
|
|
1258 |
|
1259 |
$('#enable-header').checkboxButton ();
|
1260 |
$('#enable-header-404').checkboxButton ();
|
1261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1262 |
$('#process-php-h').checkboxButton ();
|
1263 |
|
1264 |
$('#enable-footer').checkboxButton ();
|
1265 |
$('#enable-footer-404').checkboxButton ();
|
1266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1267 |
$('#process-php-f').checkboxButton ();
|
1268 |
|
1269 |
$('#tracking').checkboxButton ();
|
@@ -1283,7 +1341,19 @@ jQuery(document).ready(function($) {
|
|
1283 |
});
|
1284 |
|
1285 |
$('#enable-adb-detection').checkboxButton ();
|
1286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1287 |
$('#process-php-a').checkboxButton ();
|
1288 |
|
1289 |
|
@@ -1297,8 +1367,7 @@ jQuery(document).ready(function($) {
|
|
1297 |
|
1298 |
$(this).blur ();
|
1299 |
|
1300 |
-
var code = get_editor_text ('a');
|
1301 |
-
// var code = $.base64Encode (get_editor_text ('a'));
|
1302 |
var php = $("input#process-php-a").is(":checked") ? 1 : 0;
|
1303 |
|
1304 |
var window_width = 820;
|
@@ -1317,15 +1386,25 @@ jQuery(document).ready(function($) {
|
|
1317 |
|
1318 |
$('#tab-' + tab).addClass ('configured');
|
1319 |
|
1320 |
-
$('#tab-' + tab + ' input[type=submit], #tab-' + tab + ' button').button().show ();
|
1321 |
|
1322 |
configure_editor (tab);
|
1323 |
|
1324 |
-
|
1325 |
-
$("select#display-type-"+tab
|
|
|
|
|
|
|
|
|
|
|
1326 |
|
1327 |
-
|
1328 |
-
$("select#block-alignment-"+tab
|
|
|
|
|
|
|
|
|
|
|
1329 |
|
1330 |
$("select#display-type-"+tab).change (function() {
|
1331 |
var block = $(this).attr('id').replace ("display-type-", "");
|
@@ -1572,9 +1651,13 @@ jQuery(document).ready(function($) {
|
|
1572 |
|
1573 |
if ($("#export-container-" + block).is(':visible') && !$(this).hasClass ("loaded")) {
|
1574 |
var nonce = $(this).attr ('nonce');
|
1575 |
-
$("#export_settings_" + block).load (ajaxurl+"?action=ai_ajax_backend&export=" + block + "&ai_check=" + nonce, function() {
|
1576 |
-
|
1577 |
-
|
|
|
|
|
|
|
|
|
1578 |
});
|
1579 |
}
|
1580 |
});
|
@@ -1586,8 +1669,8 @@ jQuery(document).ready(function($) {
|
|
1586 |
$("div#statistics-container-" + block).toggle ();
|
1587 |
$("div#settings-" + block).toggle ();
|
1588 |
|
1589 |
-
$("#
|
1590 |
-
$("#toolbar-" + block + ' .ai-statistics').toggle ();
|
1591 |
|
1592 |
var container = $("div#statistics-container-" + block);
|
1593 |
if (container.is(':visible')) {
|
@@ -1708,7 +1791,18 @@ jQuery(document).ready(function($) {
|
|
1708 |
generate_country_list ('country', tab);
|
1709 |
|
1710 |
$('#tracking-' + tab).checkboxButton ();
|
1711 |
-
$('#simple-editor-' + tab).checkboxButton ()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1712 |
$('#process-php-' + tab).checkboxButton ();
|
1713 |
|
1714 |
$('#ai-misc-container-' + tab).tabs();
|
@@ -1717,10 +1811,28 @@ jQuery(document).ready(function($) {
|
|
1717 |
$('#ai-devices-container-' + tab).tabs();
|
1718 |
$('#ai-devices-tabs-' + tab).show();
|
1719 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1720 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1721 |
|
1722 |
$('#ai-code-generator-container-' + tab).tabs();
|
1723 |
-
$('#ai-code-generator-tabs-' + tab).show();
|
1724 |
|
1725 |
$("select#adsense-type-"+tab).change (function() {
|
1726 |
var block = $(this).attr('id').replace ("adsense-type-", "");
|
@@ -1740,6 +1852,21 @@ jQuery(document).ready(function($) {
|
|
1740 |
$(this).next ("label").find ('.checkbox-icon').toggleClass("on");
|
1741 |
});
|
1742 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1743 |
$("#open-image-button-"+tab).click (function (event) {
|
1744 |
var block = $(this).attr('id').replace ("open-image-button-", "");
|
1745 |
var frame;
|
@@ -1779,7 +1906,16 @@ jQuery(document).ready(function($) {
|
|
1779 |
|
1780 |
$("#banner-image-url-" + tab).on ('input', function() {
|
1781 |
var block = $(this).attr('id').replace ("banner-image-url-", "");
|
1782 |
-
$('#banner-image-' + block)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1783 |
});
|
1784 |
|
1785 |
$("#banner-url-" + tab).on ('input', function() {
|
@@ -1787,15 +1923,14 @@ jQuery(document).ready(function($) {
|
|
1787 |
$('#banner-link-' + block).attr ('href', $(this).val ());
|
1788 |
});
|
1789 |
|
1790 |
-
$("#import-
|
1791 |
-
|
1792 |
|
|
|
1793 |
var nonce = $("#ai-form").attr ('nonce');
|
1794 |
-
var code_data = "&import-code=" + encodeURI (get_editor_text (block));
|
1795 |
|
1796 |
-
$.
|
1797 |
-
|
1798 |
-
}).done (function (data) {
|
1799 |
if (data != '') {
|
1800 |
var code_data = JSON.parse (data);
|
1801 |
if (typeof code_data !== "undefined" && typeof code_data ['type'] !== "undefined") {
|
@@ -1804,7 +1939,7 @@ jQuery(document).ready(function($) {
|
|
1804 |
|
1805 |
var code_type = code_data ['type'];
|
1806 |
|
1807 |
-
$("#ai-code-generator-container-" + block).tabs ({active: code_type});
|
1808 |
|
1809 |
switch (code_type) {
|
1810 |
case AI_CODE_BANNER:
|
@@ -1813,13 +1948,14 @@ jQuery(document).ready(function($) {
|
|
1813 |
$("#open-new-window-" + block).attr('checked', code_data ['target'] == '_blank');
|
1814 |
break;
|
1815 |
case AI_CODE_ADSENSE:
|
1816 |
-
$("#adsense-publisher-id-" + block).val (code_data ['
|
1817 |
-
$("#adsense-ad-slot-id-" + block).val (code_data ['
|
1818 |
|
1819 |
$("#adsense-type-" + block).val (code_data ['adsense-type']);
|
1820 |
$("#adsense-responsive-" + block).prop ('checked', code_data ['adsense-responsive']);
|
1821 |
$("#adsense-width-" + block).val (code_data ['adsense-width']);
|
1822 |
$("#adsense-height-" + block).val (code_data ['adsense-height']);
|
|
|
1823 |
|
1824 |
$("#adsense-layout-" + block).val (code_data ['adsense-layout']);
|
1825 |
$("#adsense-layout-key-" + block).val (code_data ['adsense-layout-key']);
|
@@ -1831,52 +1967,305 @@ jQuery(document).ready(function($) {
|
|
1831 |
}
|
1832 |
}
|
1833 |
}
|
|
|
|
|
|
|
|
|
|
|
1834 |
});
|
1835 |
});
|
1836 |
|
1837 |
-
$("#generate-
|
1838 |
-
|
1839 |
|
|
|
1840 |
var nonce = $("#ai-form").attr ('nonce');
|
1841 |
var code_type = $("#ai-code-generator-container-" + block).tabs('option', 'active');
|
1842 |
-
var code_data =
|
1843 |
|
1844 |
switch (code_type) {
|
1845 |
case AI_CODE_BANNER:
|
1846 |
-
code_data
|
1847 |
-
|
|
|
|
|
|
|
1848 |
break;
|
1849 |
case AI_CODE_ADSENSE:
|
1850 |
-
code_data =
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
});
|
1860 |
break;
|
1861 |
case AI_CODE_UNKNOWN:
|
|
|
1862 |
break;
|
1863 |
}
|
1864 |
|
1865 |
if (debug) {
|
1866 |
console.log ("AI GENERATE CODE:", code_type);
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1870 |
}
|
|
|
|
|
|
|
1871 |
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1877 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1878 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1879 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1880 |
}
|
1881 |
|
1882 |
function generate_country_list (element_name_prefix, index) {
|
@@ -2081,15 +2470,244 @@ jQuery(document).ready(function($) {
|
|
2081 |
});
|
2082 |
}
|
2083 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2084 |
function reload_list () {
|
2085 |
search_reload = false;
|
2086 |
var list = encodeURIComponent ($("#ai-list-search").val());
|
2087 |
var all = + !$("#ai-load-all").parent ().find ('.checkbox-icon').hasClass ('on');
|
2088 |
var nonce = $("#ai-list").attr ('nonce');
|
2089 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2090 |
var data_container = $("#ai-list-data");
|
2091 |
|
2092 |
-
data_container.load (ajaxurl+"?action=ai_ajax_backend&list=" + list + "&all=" + all + "&start=" + start + "&end=" + end + "&ai_check=" + nonce, function (response, status, xhr) {
|
2093 |
if (status == "error") {
|
2094 |
var message = "Error downloading list data: " + xhr.status + " " + xhr.statusText;
|
2095 |
data_container.html (message);
|
@@ -2099,10 +2717,147 @@ jQuery(document).ready(function($) {
|
|
2099 |
var tab = $(this).data ('tab') - start;
|
2100 |
$("#ai-tab-container").tabs ({active: tab});
|
2101 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2102 |
}
|
2103 |
});
|
2104 |
}
|
2105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2106 |
if (debug) console.log ("READY");
|
2107 |
if (debug_title) $("#plugin_name").css ("color", "#f00");
|
2108 |
if (debug) {
|
@@ -2130,16 +2885,6 @@ jQuery(document).ready(function($) {
|
|
2130 |
|
2131 |
if (debug) console.log ("active_tabs:", active_tab, active_tab_0);
|
2132 |
|
2133 |
-
var tabs_array = new Array ();
|
2134 |
-
if (active_tab != 0) tabs_array.push (0);
|
2135 |
-
for (var tab = end; tab >= start; tab --) {
|
2136 |
-
if (tab != active_tab) tabs_array.push (tab);
|
2137 |
-
}
|
2138 |
-
// Concatenate existing tabs_to_configure (if tab was clicked before page was loaded)
|
2139 |
-
tabs_to_configure = tabs_array.concat (tabs_to_configure);
|
2140 |
-
|
2141 |
-
setTimeout (configure_hidden_tab, 700);
|
2142 |
-
|
2143 |
var plugin_version = $('#ai-data').attr ('version').split ('-') [0];
|
2144 |
if (javascript_version != plugin_version) {
|
2145 |
console.log ('AD INSERTER: plugin version: ' + plugin_version + ', loaded Javascript version: ' + javascript_version);
|
@@ -2183,29 +2928,11 @@ jQuery(document).ready(function($) {
|
|
2183 |
$("#css-warning").show ();
|
2184 |
}
|
2185 |
|
2186 |
-
|
2187 |
-
if (active_tab != 0) index = active_tab - start;
|
2188 |
-
var block_tabs = $("#ai-tab-container").tabs ({active: index});
|
2189 |
-
$("#ai-plugin-settings-tab-container").tabs ({active: active_tab_0});
|
2190 |
-
|
2191 |
-
$('#ai-settings').tooltip({
|
2192 |
-
show: {effect: "blind",
|
2193 |
-
delay: 400,
|
2194 |
-
duration: 100}
|
2195 |
-
});
|
2196 |
-
|
2197 |
-
if (debug_title) $("#plugin_name").css ("color", "#00f");
|
2198 |
-
|
2199 |
-
if (active_tab == 0) configure_tab_0 (); else configure_tab (active_tab);
|
2200 |
|
2201 |
$('#dummy-ranges').hide();
|
2202 |
$('#ai-ranges').show();
|
2203 |
|
2204 |
-
$('#dummy-tabs').hide();
|
2205 |
-
$('#ai-tabs').show();
|
2206 |
-
|
2207 |
-
$('.header button').button().show ();
|
2208 |
-
|
2209 |
$("#ai-form").submit (function (event) {
|
2210 |
for (var tab = start; tab <= end; tab ++) {
|
2211 |
remove_default_values (tab);
|
@@ -2213,49 +2940,9 @@ jQuery(document).ready(function($) {
|
|
2213 |
remove_default_values (0);
|
2214 |
});
|
2215 |
|
2216 |
-
$('
|
2217 |
-
tab_block = $(this).attr ("id");
|
2218 |
-
tab_block = tab_block.replace ("ai-tab","");
|
2219 |
-
active_tab = tab_block;
|
2220 |
-
|
2221 |
-
if (debug) console.log ("active_tab: " + active_tab);
|
2222 |
-
|
2223 |
-
if (syntax_highlighting) {
|
2224 |
-
if (!$("#tab-" + tab_block).hasClass ('configured')) {
|
2225 |
-
if (debug) console.log ("");
|
2226 |
-
if (debug) console.log ("Empty tab: " + tab_block);
|
2227 |
-
tabs_to_configure.push (tab_block);
|
2228 |
-
setTimeout (configure_hidden_tab, 10);
|
2229 |
-
if (debug) console.log ("tabs_to_configure: " + tabs_to_configure);
|
2230 |
-
} else if (tab_block != 0) {
|
2231 |
-
var editor = ace.edit ("editor-" + tab_block);
|
2232 |
-
editor.getSession ().highlightLines (10000000);
|
2233 |
-
}
|
2234 |
-
}
|
2235 |
-
});
|
2236 |
-
|
2237 |
-
$('.ai-plugin-tab').click (function () {
|
2238 |
-
active_tab_0 = $("#ai-plugin-settings-tab-container").tabs ('option', 'active');
|
2239 |
-
if (debug) console.log ("active_tab_0: " + active_tab_0);
|
2240 |
-
|
2241 |
-
if (syntax_highlighting) {
|
2242 |
-
tab_block = $(this).attr ("id");
|
2243 |
-
tab_block = tab_block.replace ("ai-","");
|
2244 |
|
2245 |
-
|
2246 |
-
var editor = ace.edit ("editor-h");
|
2247 |
-
editor.getSession ().highlightLines (10000000);
|
2248 |
-
} else
|
2249 |
-
if (tab_block == 'f') {
|
2250 |
-
editor = ace.edit ("editor-f");
|
2251 |
-
editor.getSession ().highlightLines (10000000);
|
2252 |
-
} else
|
2253 |
-
if (tab_block == 'a') {
|
2254 |
-
editor = ace.edit ("editor-a");
|
2255 |
-
editor.getSession ().highlightLines (10000000);
|
2256 |
-
}
|
2257 |
-
}
|
2258 |
-
});
|
2259 |
|
2260 |
$('#plugin_name').dblclick (function () {
|
2261 |
$(".system-debugging").toggle();
|
@@ -2297,6 +2984,32 @@ jQuery(document).ready(function($) {
|
|
2297 |
reload_list ();
|
2298 |
});
|
2299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2300 |
setTimeout (update_rating, 1000);
|
2301 |
|
2302 |
if (debug) console.log ("");
|
1 |
+
var javascript_version = "2.2.8";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
5 |
var active_tab = 1;
|
6 |
var active_tab_0 = 0;
|
7 |
var tabs_to_configure = new Array();
|
8 |
+
var debug = false;
|
9 |
+
var debug_title = false;
|
10 |
|
11 |
var current_tab = 0;
|
12 |
var next_tab = 0;
|
55 |
var AI_ADB_BLOCK_ACTION_SHOW = 2;
|
56 |
var AI_ADB_BLOCK_ACTION_HIDE = 3;
|
57 |
|
58 |
+
var AI_CODE_UNKNOWN = 100;
|
59 |
+
var AI_CODE_BANNER = 0;
|
60 |
+
var AI_CODE_ADSENSE = 1;
|
61 |
|
62 |
var AI_ADSENSE_STANDARD = 0;
|
63 |
var AI_ADSENSE_LINK = 1;
|
247 |
// copy back to textarea on form submit...
|
248 |
form.submit (function () {
|
249 |
var block = textarea.attr ("id").replace ("block-","");
|
250 |
+
var editor_disabled = true;
|
251 |
+
if (typeof ace != 'undefined') {
|
252 |
+
editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
|
253 |
+
}
|
254 |
if (!editor_disabled) {
|
255 |
textarea.val (session.getValue());
|
256 |
}
|
257 |
if (textarea.val () == "") {
|
258 |
textarea.removeAttr ("name");
|
259 |
}
|
260 |
+
|
261 |
// else textarea.val (jQuery.base64Encode (textarea.val ()));
|
262 |
|
263 |
jQuery("#ai-active-tab").attr ("value", '[' + active_tab + ',' + active_tab_0 + ']');
|
316 |
};
|
317 |
|
318 |
function get_editor_text (block) {
|
319 |
+
var editor_disabled = true;
|
320 |
+
if (typeof ace != 'undefined') {
|
321 |
+
var editor = ace.edit ("editor-" + block);
|
322 |
+
editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
|
323 |
+
}
|
324 |
+
if (!editor_disabled) return editor.getSession ().getValue();
|
325 |
+
return jQuery ("#block-" + block).val ();
|
326 |
}
|
327 |
|
328 |
function set_editor_text (block, text) {
|
329 |
+
var editor_disabled = true;
|
330 |
+
if (typeof ace != 'undefined') {
|
331 |
+
var editor = ace.edit ("editor-" + block);
|
332 |
+
editor_disabled = jQuery("#simple-editor-" + block).is(":checked");
|
333 |
+
}
|
334 |
+
if (!editor_disabled)
|
335 |
+
editor.getSession ().setValue(text); else
|
336 |
+
jQuery ("#block-" + block).val (text);
|
337 |
+
|
338 |
}
|
339 |
|
340 |
function window_open_post (url, windowoption, name, params) {
|
663 |
geo_groups = parseInt (geo_groups_text);
|
664 |
}
|
665 |
|
666 |
+
debug = parseInt ($('#ai-data').attr ('javascript_debugging'));
|
|
|
667 |
|
668 |
if (debug) {
|
669 |
var start_time = new Date().getTime();
|
971 |
$("#scheduling-delay-warning-"+block).hide();
|
972 |
var scheduling = $("select#scheduling-"+block).val();
|
973 |
if (scheduling == "1") {
|
974 |
+
// if (content_settings) {
|
975 |
$("#scheduling-delay-"+block).show();
|
976 |
+
// } else {
|
977 |
+
// $("#scheduling-delay-warning-"+block).show();
|
978 |
+
// }
|
979 |
} else
|
980 |
if (scheduling == "2") {
|
981 |
$("#scheduling-between-dates-"+block).show();
|
1019 |
}
|
1020 |
}
|
1021 |
|
1022 |
+
function switch_editor (block, editor_disabled) {
|
1023 |
+
var editor = ace.edit ("editor-" + block);
|
1024 |
+
var textarea = $("#block-" + block);
|
1025 |
+
var ace_editor = $("#editor-" + block);
|
1026 |
+
|
1027 |
+
if (editor_disabled) {
|
1028 |
+
textarea.val (editor.session.getValue());
|
1029 |
+
textarea.css ('display', 'block');
|
1030 |
+
ace_editor.css ('display', 'none');
|
1031 |
+
} else {
|
1032 |
+
editor.session.setValue (textarea.val ())
|
1033 |
+
editor.renderer.updateFull();
|
1034 |
+
ace_editor.css ('display', 'block');
|
1035 |
+
textarea.css ('display', 'none');
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
|
1039 |
function configure_editor (block) {
|
1040 |
|
1041 |
if (debug) console.log ("configure_editor:", block);
|
1048 |
|
1049 |
var block = $(this).attr ("id").replace ("simple-editor-","");
|
1050 |
var editor_disabled = $(this).is(":checked");
|
1051 |
+
|
1052 |
+
switch_editor (block, editor_disabled);
|
1053 |
+
|
1054 |
+
// var editor = ace.edit ("editor-" + block);
|
1055 |
+
// var textarea = $("#block-" + block);
|
1056 |
+
// var ace_editor = $("#editor-" + block);
|
1057 |
+
|
1058 |
+
// if (editor_disabled) {
|
1059 |
+
// textarea.val (editor.session.getValue());
|
1060 |
+
// textarea.css ('display', 'block');
|
1061 |
+
// ace_editor.css ('display', 'none');
|
1062 |
+
// } else {
|
1063 |
+
// editor.session.setValue (textarea.val ())
|
1064 |
+
// editor.renderer.updateFull();
|
1065 |
+
// ace_editor.css ('display', 'block');
|
1066 |
+
// textarea.css ('display', 'none');
|
1067 |
+
// }
|
1068 |
});
|
1069 |
}
|
1070 |
|
1257 |
|
1258 |
if ($("#export-container-0").is(':visible') && !$(this).hasClass ("loaded")) {
|
1259 |
var nonce = $(this).attr ('nonce');
|
1260 |
+
$("#export_settings_0").load (ajaxurl+"?action=ai_ajax_backend&export=0&ai_check=" + nonce, function (response, status, xhr) {
|
1261 |
+
if (status == "error" ) {
|
1262 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
1263 |
+
} else {
|
1264 |
+
$("#export_settings_0").attr ("name", "export_settings_0");
|
1265 |
+
$("#export-switch-0").addClass ("loaded");
|
1266 |
+
}
|
1267 |
+
|
1268 |
});
|
1269 |
}
|
1270 |
});
|
1292 |
|
1293 |
$('#enable-header').checkboxButton ();
|
1294 |
$('#enable-header-404').checkboxButton ();
|
1295 |
+
|
1296 |
+
$('#simple-editor-h').checkboxButton ().click (function () {
|
1297 |
+
var tab_id = $("#ai-plugin-settings-tab-container .ui-tabs-panel:visible").attr("id");
|
1298 |
+
if (active_tab == 0 && tab_id == 'tab-header') {
|
1299 |
+
$('#ai-tab-container .simple-editor-button').click();
|
1300 |
+
}
|
1301 |
+
});
|
1302 |
+
// Switch to simple editor if the button was pressed before the tab was configured
|
1303 |
+
if ($('#simple-editor-h').is(":checked")) {
|
1304 |
+
switch_editor ('h', true);
|
1305 |
+
$('#simple-editor-h').next ("label").find ('.checkbox-icon').addClass("on");
|
1306 |
+
}
|
1307 |
+
|
1308 |
$('#process-php-h').checkboxButton ();
|
1309 |
|
1310 |
$('#enable-footer').checkboxButton ();
|
1311 |
$('#enable-footer-404').checkboxButton ();
|
1312 |
+
|
1313 |
+
$('#simple-editor-f').checkboxButton ().click (function () {
|
1314 |
+
var tab_id = $("#ai-plugin-settings-tab-container .ui-tabs-panel:visible").attr("id");
|
1315 |
+
if (active_tab == 0 && tab_id == 'tab-footer') {
|
1316 |
+
$('#ai-tab-container .simple-editor-button').click();
|
1317 |
+
}
|
1318 |
+
});
|
1319 |
+
// Switch to simple editor if the button was pressed before the tab was configured
|
1320 |
+
if ($('#simple-editor-f').is(":checked")) {
|
1321 |
+
switch_editor ('f', true);
|
1322 |
+
$('#simple-editor-f').next ("label").find ('.checkbox-icon').addClass("on");
|
1323 |
+
}
|
1324 |
+
|
1325 |
$('#process-php-f').checkboxButton ();
|
1326 |
|
1327 |
$('#tracking').checkboxButton ();
|
1341 |
});
|
1342 |
|
1343 |
$('#enable-adb-detection').checkboxButton ();
|
1344 |
+
|
1345 |
+
$('#simple-editor-a').checkboxButton ().click (function () {
|
1346 |
+
var tab_id = $("#ai-plugin-settings-tab-container .ui-tabs-panel:visible").attr("id");
|
1347 |
+
if (active_tab == 0 && tab_id == 'tab-adblocking') {
|
1348 |
+
$('#ai-tab-container .simple-editor-button').click();
|
1349 |
+
}
|
1350 |
+
});
|
1351 |
+
// Switch to simple editor if the button was pressed before the tab was configured
|
1352 |
+
if ($('#simple-editor-a').is(":checked")) {
|
1353 |
+
switch_editor ('a', true);
|
1354 |
+
$('#simple-editor-a').next ("label").find ('.checkbox-icon').addClass("on");
|
1355 |
+
}
|
1356 |
+
|
1357 |
$('#process-php-a').checkboxButton ();
|
1358 |
|
1359 |
|
1367 |
|
1368 |
$(this).blur ();
|
1369 |
|
1370 |
+
var code = $.base64Encode (get_editor_text ('a'));
|
|
|
1371 |
var php = $("input#process-php-a").is(":checked") ? 1 : 0;
|
1372 |
|
1373 |
var window_width = 820;
|
1386 |
|
1387 |
$('#tab-' + tab).addClass ('configured');
|
1388 |
|
1389 |
+
$('#tab-' + tab + ' input[type=submit], #tab-' + tab + ' button.ai-button').button().show ();
|
1390 |
|
1391 |
configure_editor (tab);
|
1392 |
|
1393 |
+
var titles = new Array();
|
1394 |
+
$("select#display-type-"+tab).imagepicker({hide_select: false}).find ('option').each (function (index) {
|
1395 |
+
titles.push ($(this).data ('title'));
|
1396 |
+
});
|
1397 |
+
$("select#display-type-"+tab+" + ul").appendTo("#automatic-insertion-"+tab).css ('padding-top', '10px').find ('li').each (function (index) {
|
1398 |
+
$(this).attr ('title', titles [index]);
|
1399 |
+
});
|
1400 |
|
1401 |
+
var titles = new Array();
|
1402 |
+
$("select#block-alignment-"+tab).imagepicker({hide_select: false}).find ('option').each (function (index) {
|
1403 |
+
titles.push ($(this).data ('title'));
|
1404 |
+
});
|
1405 |
+
$("select#block-alignment-"+tab+" + ul").appendTo("#alignment-style-"+tab).css ('padding-top', '10px').find ('li').each (function (index) {
|
1406 |
+
$(this).attr ('title', titles [index]);
|
1407 |
+
});
|
1408 |
|
1409 |
$("select#display-type-"+tab).change (function() {
|
1410 |
var block = $(this).attr('id').replace ("display-type-", "");
|
1651 |
|
1652 |
if ($("#export-container-" + block).is(':visible') && !$(this).hasClass ("loaded")) {
|
1653 |
var nonce = $(this).attr ('nonce');
|
1654 |
+
$("#export_settings_" + block).load (ajaxurl+"?action=ai_ajax_backend&export=" + block + "&ai_check=" + nonce, function (response, status, xhr) {
|
1655 |
+
if (status == "error" ) {
|
1656 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
1657 |
+
} else {
|
1658 |
+
$("#export_settings_" + block).attr ("name", "export_settings_" + block);
|
1659 |
+
$("#export-switch-"+block).addClass ("loaded");
|
1660 |
+
}
|
1661 |
});
|
1662 |
}
|
1663 |
});
|
1669 |
$("div#statistics-container-" + block).toggle ();
|
1670 |
$("div#settings-" + block).toggle ();
|
1671 |
|
1672 |
+
$("#tab-" + block + ' .ai-toolbars .ai-settings').toggle ();
|
1673 |
+
$("#ai-main-toolbar-" + block + ' .ai-statistics').toggle ();
|
1674 |
|
1675 |
var container = $("div#statistics-container-" + block);
|
1676 |
if (container.is(':visible')) {
|
1791 |
generate_country_list ('country', tab);
|
1792 |
|
1793 |
$('#tracking-' + tab).checkboxButton ();
|
1794 |
+
$('#simple-editor-' + tab).checkboxButton ().click (function () {
|
1795 |
+
var block = $(this).attr('id').replace ("simple-editor-", "");
|
1796 |
+
if (block == active_tab) {
|
1797 |
+
$('#ai-tab-container .simple-editor-button').click();
|
1798 |
+
}
|
1799 |
+
});
|
1800 |
+
// Switch to simple editor if the button was pressed before the tab was configured
|
1801 |
+
if ($('#simple-editor-' + tab).is(":checked")) {
|
1802 |
+
switch_editor (tab, true);
|
1803 |
+
$('#simple-editor-' + tab).next ("label").find ('.checkbox-icon').addClass("on");
|
1804 |
+
}
|
1805 |
+
|
1806 |
$('#process-php-' + tab).checkboxButton ();
|
1807 |
|
1808 |
$('#ai-misc-container-' + tab).tabs();
|
1811 |
$('#ai-devices-container-' + tab).tabs();
|
1812 |
$('#ai-devices-tabs-' + tab).show();
|
1813 |
|
1814 |
+
$("#tools-button-"+tab).click (function () {
|
1815 |
+
if (!$(this).find ('.checkbox-icon').hasClass("on")) {
|
1816 |
+
$('label.rotation-button').each (function () {
|
1817 |
+
if ($(this).find ('.checkbox-icon').hasClass("on")) {
|
1818 |
+
$(this).prev ().click ();
|
1819 |
+
}
|
1820 |
+
});
|
1821 |
|
1822 |
+
$('label.code-generator-button').each (function () {
|
1823 |
+
if ($(this).find ('.checkbox-icon').hasClass("on")) {
|
1824 |
+
$(this).prev ().click ();
|
1825 |
+
}
|
1826 |
+
});
|
1827 |
+
|
1828 |
+
$('code-generator').hide ();
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
$('.ai-tools-toolbar').toggle();
|
1832 |
+
$('label.tools-button').find ('.checkbox-icon').toggleClass("on");
|
1833 |
+
});
|
1834 |
|
1835 |
$('#ai-code-generator-container-' + tab).tabs();
|
|
|
1836 |
|
1837 |
$("select#adsense-type-"+tab).change (function() {
|
1838 |
var block = $(this).attr('id').replace ("adsense-type-", "");
|
1852 |
$(this).next ("label").find ('.checkbox-icon').toggleClass("on");
|
1853 |
});
|
1854 |
|
1855 |
+
$("#visual-editor-"+tab).click (function () {
|
1856 |
+
var block = $(this).attr('id').replace ("visual-editor-", "");
|
1857 |
+
|
1858 |
+
var code = $.base64Encode (get_editor_text (block));
|
1859 |
+
var php = $("input#process-php-" + block).is(":checked") ? 1 : 0;
|
1860 |
+
|
1861 |
+
var window_width = 820;
|
1862 |
+
var window_height = 870;
|
1863 |
+
var window_left = 120;
|
1864 |
+
var window_top = (screen.height / 2) - (window_height / 2);
|
1865 |
+
var nonce = $("#ai-form").attr ('nonce');
|
1866 |
+
var param = {'action': 'ai_ajax_backend', 'edit': block, 'ai_check': nonce, 'code': code, 'php': php};
|
1867 |
+
window_open_post (ajaxurl, 'width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no', 'edit', param);
|
1868 |
+
});
|
1869 |
+
|
1870 |
$("#open-image-button-"+tab).click (function (event) {
|
1871 |
var block = $(this).attr('id').replace ("open-image-button-", "");
|
1872 |
var frame;
|
1906 |
|
1907 |
$("#banner-image-url-" + tab).on ('input', function() {
|
1908 |
var block = $(this).attr('id').replace ("banner-image-url-", "");
|
1909 |
+
var image = $('#banner-image-' + block);
|
1910 |
+
image.attr ('src', $(this).val ()).load (function() {
|
1911 |
+
$(this).closest ('.ai-banner').removeClass ('ai-banner-top');
|
1912 |
+
var width = this.naturalWidth;
|
1913 |
+
var height = this.naturalHeight;
|
1914 |
+
if (width / height > 2 && width > 300) {
|
1915 |
+
$(this).closest ('.ai-banner').addClass ('ai-banner-top');
|
1916 |
+
}
|
1917 |
+
});
|
1918 |
+
|
1919 |
});
|
1920 |
|
1921 |
$("#banner-url-" + tab).on ('input', function() {
|
1923 |
$('#banner-link-' + block).attr ('href', $(this).val ());
|
1924 |
});
|
1925 |
|
1926 |
+
$("#import-code-"+tab).click (function () {
|
1927 |
+
$(this).next ("label").find ('.checkbox-icon').addClass("on");
|
1928 |
|
1929 |
+
var block = $(this).attr('id').replace ("import-code-", "");
|
1930 |
var nonce = $("#ai-form").attr ('nonce');
|
|
|
1931 |
|
1932 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-code': get_editor_text (block)}
|
1933 |
+
).done (function (data) {
|
|
|
1934 |
if (data != '') {
|
1935 |
var code_data = JSON.parse (data);
|
1936 |
if (typeof code_data !== "undefined" && typeof code_data ['type'] !== "undefined") {
|
1939 |
|
1940 |
var code_type = code_data ['type'];
|
1941 |
|
1942 |
+
$("#ai-code-generator-container-" + block).tabs ({active: code_type == AI_CODE_UNKNOWN ? AI_CODE_BANNER : code_type});
|
1943 |
|
1944 |
switch (code_type) {
|
1945 |
case AI_CODE_BANNER:
|
1948 |
$("#open-new-window-" + block).attr('checked', code_data ['target'] == '_blank');
|
1949 |
break;
|
1950 |
case AI_CODE_ADSENSE:
|
1951 |
+
$("#adsense-publisher-id-" + block).val (code_data ['adsense-publisher-id']);
|
1952 |
+
$("#adsense-ad-slot-id-" + block).val (code_data ['adsense-ad-slot-id']);
|
1953 |
|
1954 |
$("#adsense-type-" + block).val (code_data ['adsense-type']);
|
1955 |
$("#adsense-responsive-" + block).prop ('checked', code_data ['adsense-responsive']);
|
1956 |
$("#adsense-width-" + block).val (code_data ['adsense-width']);
|
1957 |
$("#adsense-height-" + block).val (code_data ['adsense-height']);
|
1958 |
+
$("#adsense-amp-" + block).val (code_data ['adsense-amp']);
|
1959 |
|
1960 |
$("#adsense-layout-" + block).val (code_data ['adsense-layout']);
|
1961 |
$("#adsense-layout-key-" + block).val (code_data ['adsense-layout-key']);
|
1967 |
}
|
1968 |
}
|
1969 |
}
|
1970 |
+
}).fail (function (xhr, status, error) {
|
1971 |
+
console.log ("AI IMPORT CODE ERROR:", xhr.status, xhr.statusText);
|
1972 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
1973 |
+
}).always (function() {
|
1974 |
+
$("#import-code-"+block).next ("label").find ('.checkbox-icon').removeClass("on");
|
1975 |
});
|
1976 |
});
|
1977 |
|
1978 |
+
$("#generate-code-"+tab).click (function () {
|
1979 |
+
$(this).next ("label").find ('.checkbox-icon').addClass("on");
|
1980 |
|
1981 |
+
var block = $(this).attr('id').replace ("generate-code-", "");
|
1982 |
var nonce = $("#ai-form").attr ('nonce');
|
1983 |
var code_type = $("#ai-code-generator-container-" + block).tabs('option', 'active');
|
1984 |
+
var code_data = {'action': 'ai_ajax_backend', 'ai_check': nonce, 'generate-code': code_type};
|
1985 |
|
1986 |
switch (code_type) {
|
1987 |
case AI_CODE_BANNER:
|
1988 |
+
code_data ['image'] = $("#banner-image-url-" + block).val ();
|
1989 |
+
code_data ['link'] = $("#banner-url-" + block).val ();
|
1990 |
+
|
1991 |
+
if ($("#open-new-window-" + block).is(":checked"))
|
1992 |
+
code_data ['target'] = '_blank';
|
1993 |
break;
|
1994 |
case AI_CODE_ADSENSE:
|
1995 |
+
code_data ['adsense-publisher-id'] = $("#adsense-publisher-id-" + block).val ();
|
1996 |
+
code_data ['adsense-ad-slot-id'] = $("#adsense-ad-slot-id-" + block).val ();
|
1997 |
+
code_data ['adsense-type'] = parseInt ($("select#adsense-type-" + block +" option:selected").attr ('value'));
|
1998 |
+
code_data ['adsense-responsive'] = $("#adsense-responsive-" + block).is(":checked") ? 1 : 0;
|
1999 |
+
code_data ['adsense-width'] = $("#adsense-width-" + block).val ();
|
2000 |
+
code_data ['adsense-height'] = $("#adsense-height-" + block).val ();
|
2001 |
+
code_data ['adsense-amp'] = parseInt ($("select#adsense-amp-" + block +" option:selected").attr ('value'));
|
2002 |
+
code_data ['adsense-layout'] = $("#adsense-layout-" + block).val ();
|
2003 |
+
code_data ['adsense-layout-key'] = $("#adsense-layout-key-" + block).val ();
|
|
|
2004 |
break;
|
2005 |
case AI_CODE_UNKNOWN:
|
2006 |
+
// if (debug) console.log ("AI GENERATE CODE:", code_type);
|
2007 |
break;
|
2008 |
}
|
2009 |
|
2010 |
if (debug) {
|
2011 |
console.log ("AI GENERATE CODE:", code_type);
|
2012 |
+
console.log (code_data);
|
2013 |
+
}
|
2014 |
+
|
2015 |
+
$.post (ajaxurl, code_data
|
2016 |
+
).done (function (code_data) {
|
2017 |
+
if (code_data != '') {
|
2018 |
+
var code = JSON.parse (code_data);
|
2019 |
+
if (typeof code !== "undefined")
|
2020 |
+
set_editor_text (block, code);
|
2021 |
+
}
|
2022 |
+
}).fail (function (xhr, status, error) {
|
2023 |
+
console.log ("AI GENERATE CODE ERROR:", xhr.status, xhr.statusText);
|
2024 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2025 |
+
}).always (function() {
|
2026 |
+
$("#generate-code-"+block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2027 |
+
});
|
2028 |
+
});
|
2029 |
+
|
2030 |
+
$("#clear-block-"+tab).click (function () {
|
2031 |
+
paste_from_clipboard (true, true, true, true);
|
2032 |
+
});
|
2033 |
+
|
2034 |
+
$("#copy-block-"+tab).click (function () {
|
2035 |
+
copy_to_clipboard ();
|
2036 |
+
});
|
2037 |
+
|
2038 |
+
$("#paste-name-"+tab).click (function () {
|
2039 |
+
paste_from_clipboard (true, false, false, false);
|
2040 |
+
});
|
2041 |
+
|
2042 |
+
$("#paste-code-"+tab).click (function () {
|
2043 |
+
paste_from_clipboard (false, true, false, false);
|
2044 |
+
});
|
2045 |
+
|
2046 |
+
$("#paste-settings-"+tab).click (function () {
|
2047 |
+
paste_from_clipboard (false, false, true, false);
|
2048 |
+
});
|
2049 |
+
|
2050 |
+
$("#paste-block-"+tab).click (function () {
|
2051 |
+
paste_from_clipboard (true, true, true, false);
|
2052 |
+
});
|
2053 |
+
|
2054 |
+
$("#rotation-"+tab).click (function () {
|
2055 |
+
var block = $(this).attr('id').replace ("rotation-", "");
|
2056 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2057 |
+
$(this).next ("label").find ('.checkbox-icon').toggleClass("on");
|
2058 |
+
|
2059 |
+
rotation_container.toggle();
|
2060 |
+
|
2061 |
+
var option_tabs = rotation_container.tabs ();
|
2062 |
+
|
2063 |
+
var ul = option_tabs.find ("ul");
|
2064 |
+
|
2065 |
+
if (rotation_container.is(':visible')) {
|
2066 |
+
rotation_container.data ('code', $.base64Encode (get_editor_text (block)));
|
2067 |
+
rotation_container.data ('option', 1);
|
2068 |
+
|
2069 |
+
add_rotate_options (block, 1);
|
2070 |
+
option_tabs.tabs ("option", "active", 0);
|
2071 |
+
|
2072 |
+
setTimeout (function() {import_rotation_code (block);}, 5);
|
2073 |
+
} else {
|
2074 |
+
// set_editor_text (block, $.base64Decode (rotation_container.data ('code')));
|
2075 |
+
generate_rotatation_code (block);
|
2076 |
+
|
2077 |
+
ul.find ("li").remove ();
|
2078 |
+
var div = option_tabs.find ("div.rounded").remove ();
|
2079 |
+
}
|
2080 |
+
});
|
2081 |
+
|
2082 |
+
$("#add-option-"+tab).click (function () {
|
2083 |
+
var block = $(this).attr('id').replace ("add-option-", "");
|
2084 |
+
add_rotate_options (block, 1);
|
2085 |
+
|
2086 |
+
$('#ai-rotation-container-' + block).find ("ul").find ("li").slice (- 1).click ();
|
2087 |
+
});
|
2088 |
+
|
2089 |
+
$("#remove-option-"+tab).click (function () {
|
2090 |
+
var block = $(this).attr('id').replace ("remove-option-", "");
|
2091 |
+
remove_rotate_option (block, $('#ai-rotation-container-' + block).tabs ("option", "active"));
|
2092 |
+
});
|
2093 |
+
}
|
2094 |
+
|
2095 |
+
function import_rotation_code (block) {
|
2096 |
+
$("#rotation-"+block).next ("label").find ('.checkbox-icon').addClass("active");
|
2097 |
+
|
2098 |
+
var nonce = $("#ai-form").attr ('nonce');
|
2099 |
+
|
2100 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-rotation-code': get_editor_text (block)}
|
2101 |
+
).done (function (data) {
|
2102 |
+
if (data != '') {
|
2103 |
+
var code_data = JSON.parse (data);
|
2104 |
+
if (typeof code_data !== "undefined" && typeof code_data ['options'] !== "undefined") {
|
2105 |
+
$('#ai-error-container').hide ();
|
2106 |
+
|
2107 |
+
var options = code_data ['options'].length;
|
2108 |
+
|
2109 |
+
if (debug) {
|
2110 |
+
console.log ("AI IMPORT ROTATION CODE:", options);
|
2111 |
+
console.log (" OPTIONS:", code_data ['options']);
|
2112 |
+
}
|
2113 |
+
|
2114 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2115 |
+
rotation_container.find ("ul").find ("li").remove ();
|
2116 |
+
rotation_container.find ("div.rounded").remove ();
|
2117 |
+
|
2118 |
+
var tabs = options;
|
2119 |
+
if (tabs < 1) tabs = 1;
|
2120 |
+
if (tabs > 18) tabs = 18;
|
2121 |
+
|
2122 |
+
add_rotate_options (block, tabs);
|
2123 |
+
|
2124 |
+
rotation_container.find ('ul li').each (function (index) {
|
2125 |
+
if (index < options) $(this).data ('code', $.base64Encode (code_data ['options'][index]['code'])); else
|
2126 |
+
$(this).data ('code', $.base64Encode (''));
|
2127 |
+
});
|
2128 |
+
|
2129 |
+
rotation_container.tabs ("option", "active", 0);
|
2130 |
+
|
2131 |
+
set_editor_text (block, code_data ['options'][0]['code']);
|
2132 |
+
|
2133 |
+
rotation_container.find ('input.option-name').each (function (index) {
|
2134 |
+
if (index < options) $(this).val (code_data ['options'][index]['name']);
|
2135 |
+
});
|
2136 |
+
}
|
2137 |
}
|
2138 |
+
}).fail (function (xhr, status, error) {
|
2139 |
+
console.log ("AI IMPORT ROTATION CODE ERROR:", xhr.status, xhr.statusText);
|
2140 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2141 |
|
2142 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2143 |
+
set_editor_text (block, $.base64Decode (rotation_container.data ('code')));
|
2144 |
+
rotation_container.hide();
|
2145 |
+
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2146 |
+
|
2147 |
+
rotation_container.find ("ul").find ("li").remove ();
|
2148 |
+
rotation_container.find ("div.rounded").remove ();
|
2149 |
+
}).always (function() {
|
2150 |
+
$("#rotation-"+block).next ("label").find ('.checkbox-icon').removeClass("active");
|
2151 |
+
});
|
2152 |
+
}
|
2153 |
+
|
2154 |
+
function generate_rotatation_code (block) {
|
2155 |
+
$("#rotation-"+block).next ("label").find ('.checkbox-icon').addClass("active");
|
2156 |
+
|
2157 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2158 |
+
var option = rotation_container.tabs ("option", "active") + 1;
|
2159 |
+
|
2160 |
+
$(('#option-' + block + '-' + option)).data ('code', $.base64Encode (get_editor_text (block)));
|
2161 |
+
|
2162 |
+
var nonce = $("#ai-form").attr ('nonce');
|
2163 |
+
|
2164 |
+
var rotation_data = [];
|
2165 |
+
rotation_container.find ("div.rounded").each (function (index) {
|
2166 |
+
var code_data = $('#option-' + block + '-' + (index + 1)).data ('code');
|
2167 |
+
var code = typeof code_data == 'undefined' ? '' : $.base64Decode (code_data);
|
2168 |
+
var option_data = {'name': $(this).find ('input.option-name').val (), 'code': code};
|
2169 |
+
|
2170 |
+
rotation_data.push (option_data);
|
2171 |
+
});
|
2172 |
+
|
2173 |
+
if (debug) console.log ('ROTATION DATA:', rotation_data);
|
2174 |
+
|
2175 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'generate-rotation-code': rotation_data}
|
2176 |
+
).done (function (data) {
|
2177 |
+
$('#ai-error-container').hide ();
|
2178 |
+
|
2179 |
+
if (data != '') {
|
2180 |
+
var rotation_code = JSON.parse (data);
|
2181 |
+
if (typeof rotation_code !== "undefined") {
|
2182 |
+
if (debug) console.log ('ROTATION CODE:', rotation_code);
|
2183 |
+
set_editor_text (block, rotation_code);
|
2184 |
}
|
2185 |
+
}
|
2186 |
+
|
2187 |
+
}).fail (function (xhr, status, error) {
|
2188 |
+
console.log ("AI GENERATE ROTATION CODE ERROR:", xhr.status, xhr.statusText);
|
2189 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2190 |
+
|
2191 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2192 |
+
set_editor_text (block, $.base64Decode (rotation_container.data ('code')));
|
2193 |
+
rotation_container.hide();
|
2194 |
+
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2195 |
+
|
2196 |
+
rotation_container.find ("ul").find ("li").remove ();
|
2197 |
+
rotation_container.find ("div.rounded").remove ();
|
2198 |
+
}).always (function() {
|
2199 |
+
$("#rotation-"+block).next ("label").find ('.checkbox-icon').removeClass("active");
|
2200 |
+
});
|
2201 |
+
}
|
2202 |
+
|
2203 |
+
function add_rotate_options (block, new_options) {
|
2204 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2205 |
+
var ul = rotation_container.find ("ul");
|
2206 |
+
var options = rotation_container.find ('ul >li').length;
|
2207 |
+
|
2208 |
+
var rotation_tabs = $('#rotation-tabs');
|
2209 |
+
var li = rotation_tabs.find ("li");
|
2210 |
+
var div = rotation_tabs.find ("div.rounded");
|
2211 |
+
|
2212 |
+
var insertion = 0;
|
2213 |
+
|
2214 |
+
for (option = options + 1; option <= options + new_options; option ++) {
|
2215 |
+
if (option > 18) break;
|
2216 |
+
|
2217 |
+
var new_li = li.clone ().show ();
|
2218 |
+
new_li.find ("a").attr ('href', '#tab-option-' + block + '-' + option).text (String.fromCharCode (64 + option));
|
2219 |
+
new_li.attr ('id', 'option-' + block + '-' + option).appendTo (ul).data ('code', $.base64Encode (''));
|
2220 |
+
|
2221 |
+
new_li.click (function () {
|
2222 |
+
var rotation_container = $(this).closest ('.ai-rotate');
|
2223 |
+
var block = rotation_container.attr('id').replace ("ai-rotation-container-", "");
|
2224 |
+
var old_option = rotation_container.data ('option');
|
2225 |
+
var new_option = $(this).attr('id').replace ("option-" + block + "-", "");
|
2226 |
+
rotation_container.data ('option', new_option);
|
2227 |
+
|
2228 |
+
if (debug) console.log ('OPTION CHANGE:', old_option, '=>', new_option);
|
2229 |
+
|
2230 |
+
$(('#option-' + block + '-' + old_option)).data ('code', $.base64Encode (get_editor_text (block)));
|
2231 |
+
set_editor_text (block, $.base64Decode ($(this).data ('code')));
|
2232 |
});
|
2233 |
+
|
2234 |
+
div.clone ().show ().attr ('id', 'tab-option-' + block + '-' + option).appendTo (rotation_container);
|
2235 |
+
|
2236 |
+
rotation_container.tabs ("refresh");
|
2237 |
+
}
|
2238 |
+
|
2239 |
+
rotation_container.tabs ("option", "active", option - 2);
|
2240 |
+
}
|
2241 |
+
|
2242 |
+
function remove_rotate_option (block, option) {
|
2243 |
+
var rotation_container = $('#ai-rotation-container-' + block);
|
2244 |
+
var options = rotation_container.find ('ul >li').length;
|
2245 |
+
|
2246 |
+
if (options == 1) return;
|
2247 |
+
|
2248 |
+
var ul = rotation_container.find ("ul");
|
2249 |
+
|
2250 |
+
ul.find ("li").slice (option, option + 1).remove ();
|
2251 |
+
var div = rotation_container.find ("div.rounded").slice (option, option + 1).remove ();
|
2252 |
+
|
2253 |
+
rotation_container.find ('ul li').each (function (index) {
|
2254 |
+
var option = index + 1;
|
2255 |
+
$(this).attr ('id', 'option-' + block + '-' + option).find ("a").attr ('href', '#tab-option-' + block + '-' + option).text (String.fromCharCode (64 + option));
|
2256 |
});
|
2257 |
+
|
2258 |
+
rotation_container.find ("div.rounded").each (function (index) {
|
2259 |
+
var option = index + 1;
|
2260 |
+
$(this).attr ('id', 'tab-option-' + block + '-' + option);
|
2261 |
+
});
|
2262 |
+
|
2263 |
+
rotation_container.tabs ("refresh");
|
2264 |
+
|
2265 |
+
var new_option = option == 0 ? 0 : option - 1;
|
2266 |
+
active_li = $('#option-' + block + '-' + (new_option + 1));
|
2267 |
+
set_editor_text (block, $.base64Decode (active_li.data ('code')));
|
2268 |
+
ul.closest ('.ai-rotate').data ('option', new_option + 1);
|
2269 |
}
|
2270 |
|
2271 |
function generate_country_list (element_name_prefix, index) {
|
2470 |
});
|
2471 |
}
|
2472 |
|
2473 |
+
function replace_block_number (element, attribute, old_block, new_block) {
|
2474 |
+
var attr_value = element.attr (attribute);
|
2475 |
+
var attr_number = attr_value.substr (- old_block.toString().length);
|
2476 |
+
if (attr_number == old_block) {
|
2477 |
+
element.attr (attribute, attr_value.substr (0, attr_value.length - old_block.toString().length) + new_block);
|
2478 |
+
|
2479 |
+
// console.log (attribute, element.attr (attribute));
|
2480 |
+
}
|
2481 |
+
}
|
2482 |
+
|
2483 |
+
function copy_to_clipboard () {
|
2484 |
+
if (debug) console.log ("AI COPY FROM BLOCK", active_tab);
|
2485 |
+
|
2486 |
+
var clipboard = $('#ai-clipboard');
|
2487 |
+
clipboard.html ($('#ai-clipboard-template').html ());
|
2488 |
+
|
2489 |
+
$('div#tab-' + active_tab + ' input[name]:checkbox').each (function (index){
|
2490 |
+
var attr = $(this).attr('checked');
|
2491 |
+
var checked = typeof attr !== typeof undefined && attr !== false;
|
2492 |
+
|
2493 |
+
if (checked)
|
2494 |
+
clipboard.find ('input[name]:checkbox').eq (index).attr ('checked', 'checked').next ("label").find ('.checkbox-icon').addClass("on"); else
|
2495 |
+
clipboard.find ('input[name]:checkbox').eq (index).removeAttr ('checked').next ("label").find ('.checkbox-icon').removeClass("on");
|
2496 |
+
});
|
2497 |
+
|
2498 |
+
$('div#tab-' + active_tab + ' select[name]').each (function (index){
|
2499 |
+
var value = $(this).find ("option:selected").val ();
|
2500 |
+
clipboard.find ('select[name]').eq (index).find ("option").removeAttr ('selected');
|
2501 |
+
clipboard.find ('select[name]').eq (index).find ("option[value = '" + value + "']").attr ("selected", true);
|
2502 |
+
});
|
2503 |
+
|
2504 |
+
$('div#tab-' + active_tab + ' input[name]:text').each (function (index){
|
2505 |
+
clipboard.find ('input[name]:text').eq (index).attr ('value', $(this).val ());
|
2506 |
+
});
|
2507 |
+
|
2508 |
+
clipboard.find ('textarea.simple-editor').text (get_editor_text (active_tab));
|
2509 |
+
|
2510 |
+
$("#ai-container .ai-copy").each (function () {
|
2511 |
+
$(this).next ("label").find ('.checkbox-icon').addClass("on");
|
2512 |
+
});
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
function load_saved_settings_to_clipboard (block, paste) {
|
2516 |
+
if (debug) console.log ("AI LOAD BLOCK", block, "FROM DB");
|
2517 |
+
|
2518 |
+
var tools_button = $("#tools-button-" + active_tab);
|
2519 |
+
if (!tools_button.next ('label').find ('.checkbox-icon').hasClass ("on")) {
|
2520 |
+
tools_button.click ();
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
$('#ai-loading').show ();
|
2524 |
+
var nonce = $("#ai-form").attr ('nonce');
|
2525 |
+
|
2526 |
+
$.get (ajaxurl + '?action=ai_ajax_backend&settings=' + block + '&single=1&ai_check=' + nonce, function (settings) {
|
2527 |
+
if (debug) console.log ("AI BLOCK LOADED");
|
2528 |
+
|
2529 |
+
var clipboard = $('#ai-clipboard');
|
2530 |
+
|
2531 |
+
clipboard.html ($('div#tab-' + block, settings).html ());
|
2532 |
+
|
2533 |
+
clipboard.find ('[id]').each (function () {
|
2534 |
+
replace_block_number ($(this), 'id', block, 999);
|
2535 |
+
});
|
2536 |
+
|
2537 |
+
clipboard.find ('[for]').each (function () {
|
2538 |
+
replace_block_number ($(this), 'for', block, 999);
|
2539 |
+
});
|
2540 |
+
|
2541 |
+
clipboard.find ('[href]').each (function () {
|
2542 |
+
replace_block_number ($(this), 'href', block, 999);
|
2543 |
+
});
|
2544 |
+
|
2545 |
+
clipboard.find ('[name]').each (function () {
|
2546 |
+
replace_block_number ($(this), 'name', block, 999);
|
2547 |
+
});
|
2548 |
+
|
2549 |
+
clipboard.find ('[class]').each (function () {
|
2550 |
+
replace_block_number ($(this), 'class', block, 999);
|
2551 |
+
});
|
2552 |
+
|
2553 |
+
clipboard.find ('pre.ai-block-number').each (function () {
|
2554 |
+
var text = $(this).text ().replace (block, 999);
|
2555 |
+
$(this).text (text);
|
2556 |
+
});
|
2557 |
+
|
2558 |
+
$("#ai-container .ai-copy").each (function () {
|
2559 |
+
$(this).next ("label").find ('.checkbox-icon').addClass("on");
|
2560 |
+
});
|
2561 |
+
|
2562 |
+
// if (paste) {
|
2563 |
+
// var tools_visible = $('#ai-tools-toolbar-' + active_tab).is(':visible');
|
2564 |
+
|
2565 |
+
// paste_from_clipboard (true, true, true, false);
|
2566 |
+
|
2567 |
+
// if (tools_visible) {
|
2568 |
+
// $('#ai-tools-toolbar-' + active_tab).show ();
|
2569 |
+
// $("#tools-button-"+active_tab).next ('label').find ('.checkbox-icon').addClass("on");
|
2570 |
+
// }
|
2571 |
+
// }
|
2572 |
+
}).fail (function (xhr, status, error) {
|
2573 |
+
console.log ("AI LOADING ERROR:", xhr.status, xhr.statusText);
|
2574 |
+
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2575 |
+
})
|
2576 |
+
.always (function () {
|
2577 |
+
$('#ai-loading').hide ();
|
2578 |
+
});
|
2579 |
+
}
|
2580 |
+
|
2581 |
+
function paste_from_clipboard (paste_name, paste_code, paste_settings, clear) {
|
2582 |
+
|
2583 |
+
if (clear) {
|
2584 |
+
var clipboard_template = $('#ai-clipboard-template');
|
2585 |
+
clipboard_template.find ('input#name-edit-999').attr ('value', 'Block ' + active_tab).attr ('default', 'Block ' + active_tab);
|
2586 |
+
var clipboard = clipboard_template.html ();
|
2587 |
+
} else {
|
2588 |
+
var clipboard = $('#ai-clipboard').html ();
|
2589 |
+
}
|
2590 |
+
|
2591 |
+
if (clipboard != '' && active_tab != 0) {
|
2592 |
+
if (debug) console.log ("AI PASTE TO BLOCK", active_tab);
|
2593 |
+
|
2594 |
+
var destination_tab = $('div#tab-' + active_tab);
|
2595 |
+
|
2596 |
+
var name = destination_tab.find ('input#name-edit-' + active_tab).val ();
|
2597 |
+
var code = get_editor_text (active_tab);
|
2598 |
+
|
2599 |
+
if (paste_settings) {
|
2600 |
+
var simple_editor = $('#simple-editor-' + active_tab).is(":checked");
|
2601 |
+
var tools_visible = $('#ai-tools-toolbar-' + active_tab).is(':visible');
|
2602 |
+
var copy_active = destination_tab.find ('.ai-copy').next ("label").find ('.checkbox-icon').hasClass("on");
|
2603 |
+
|
2604 |
+
if (simple_editor) {
|
2605 |
+
$('#simple-editor-' + active_tab).click ();
|
2606 |
+
}
|
2607 |
+
|
2608 |
+
var save_button_text = destination_tab.find ('input[name=ai_save]').attr('value');
|
2609 |
+
destination_tab.html (clipboard).find ('input[name=ai_save]').attr('value', save_button_text);
|
2610 |
+
|
2611 |
+
if (!paste_name) {
|
2612 |
+
destination_tab.find ('input#name-edit-999').val (name);
|
2613 |
+
}
|
2614 |
+
|
2615 |
+
if (!paste_code) {
|
2616 |
+
destination_tab.find ('textarea#block-999').val (code);
|
2617 |
+
}
|
2618 |
+
|
2619 |
+
destination_tab.find ('span#name-label-999').text (destination_tab.find ('input#name-edit-999').val ());
|
2620 |
+
|
2621 |
+
var block_name = destination_tab.find ('input#name-edit-999').val ();
|
2622 |
+
destination_tab.find ('pre.ai-block-name').text ('[adinserter name="' + block_name + '"]');
|
2623 |
+
|
2624 |
+
destination_tab.find ('[id]').each (function () {
|
2625 |
+
replace_block_number ($(this), 'id', 999, active_tab);
|
2626 |
+
});
|
2627 |
+
|
2628 |
+
destination_tab.find ('[for]').each (function () {
|
2629 |
+
replace_block_number ($(this), 'for', 999, active_tab);
|
2630 |
+
});
|
2631 |
+
|
2632 |
+
destination_tab.find ('[href]').each (function () {
|
2633 |
+
replace_block_number ($(this), 'href', 999, active_tab);
|
2634 |
+
});
|
2635 |
+
|
2636 |
+
destination_tab.find ('[name]').each (function () {
|
2637 |
+
replace_block_number ($(this), 'name', 999, active_tab);
|
2638 |
+
});
|
2639 |
+
|
2640 |
+
destination_tab.find ('[class]').each (function () {
|
2641 |
+
replace_block_number ($(this), 'class', 999, active_tab);
|
2642 |
+
});
|
2643 |
+
|
2644 |
+
destination_tab.find ('pre.ai-sidebars').text ('');
|
2645 |
+
|
2646 |
+
destination_tab.find ('pre.ai-block-number').each (function () {
|
2647 |
+
var text = $(this).text ().replace (999, active_tab);
|
2648 |
+
$(this).text (text);
|
2649 |
+
});
|
2650 |
+
|
2651 |
+
configure_tab (active_tab);
|
2652 |
+
|
2653 |
+
if (simple_editor) {
|
2654 |
+
$('#simple-editor-' + active_tab).click ();
|
2655 |
+
}
|
2656 |
+
|
2657 |
+
if (tools_visible) {
|
2658 |
+
$('#ai-tools-toolbar-' + active_tab).show ();
|
2659 |
+
$("#tools-button-" + active_tab).next ('label').find ('.checkbox-icon').addClass ("on");
|
2660 |
+
}
|
2661 |
+
|
2662 |
+
if (copy_active) {
|
2663 |
+
destination_tab.find ('.ai-copy').next ("label").find ('.checkbox-icon').addClass("on");
|
2664 |
+
}
|
2665 |
+
} else {
|
2666 |
+
if (paste_name) {
|
2667 |
+
var clipboard_name = $(clipboard).find ('input#name-edit-999').val ();
|
2668 |
+
destination_tab.find ('input#name-edit-' + active_tab).val (clipboard_name);
|
2669 |
+
destination_tab.find ('span#name-label-' + active_tab).text (clipboard_name);
|
2670 |
+
destination_tab.find ('pre.ai-block-name').text ('[adinserter name="' + clipboard_name + '"]');
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
if (paste_code) {
|
2674 |
+
set_editor_text (active_tab, $(clipboard).find ('textarea#block-999').val ());
|
2675 |
+
}
|
2676 |
+
}
|
2677 |
+
|
2678 |
+
if (debug) console.log ("AI PASTE END");
|
2679 |
+
} else if (debug) console.log ("AI PASTE FAILED");
|
2680 |
+
}
|
2681 |
+
|
2682 |
+
|
2683 |
function reload_list () {
|
2684 |
search_reload = false;
|
2685 |
var list = encodeURIComponent ($("#ai-list-search").val());
|
2686 |
var all = + !$("#ai-load-all").parent ().find ('.checkbox-icon').hasClass ('on');
|
2687 |
var nonce = $("#ai-list").attr ('nonce');
|
2688 |
|
2689 |
+
var rearrange_controls = $('#list-rearrange-controls');
|
2690 |
+
var rearrange = rearrange_controls.hasClass ('rearrange')
|
2691 |
+
rearrange_controls.removeClass ('rearrange').hide ();
|
2692 |
+
$("#ai-rearrange").parent ().find ('.checkbox-icon').removeClass ('on');
|
2693 |
+
|
2694 |
+
var rearrange_data = '';
|
2695 |
+
if (rearrange) {
|
2696 |
+
var table = $('table#ai-list-table');
|
2697 |
+
var original_blocks = table.data ('blocks');
|
2698 |
+
if (typeof original_blocks == 'undefined') original_blocks = new Array();
|
2699 |
+
|
2700 |
+
var new_blocks = new Array();
|
2701 |
+
table.find ('tbody tr').each (function (index) {
|
2702 |
+
new_blocks.push ($(this).data ('block'));
|
2703 |
+
});
|
2704 |
+
|
2705 |
+
rearrange_data = "&blocks-org=" + JSON.stringify (original_blocks) + "&blocks-new=" + JSON.stringify (new_blocks);
|
2706 |
+
}
|
2707 |
+
|
2708 |
var data_container = $("#ai-list-data");
|
2709 |
|
2710 |
+
data_container.load (ajaxurl+"?action=ai_ajax_backend&list=" + list + "&all=" + all + "&start=" + start + "&end=" + end + rearrange_data + "&ai_check=" + nonce, function (response, status, xhr) {
|
2711 |
if (status == "error") {
|
2712 |
var message = "Error downloading list data: " + xhr.status + " " + xhr.statusText;
|
2713 |
data_container.html (message);
|
2717 |
var tab = $(this).data ('tab') - start;
|
2718 |
$("#ai-tab-container").tabs ({active: tab});
|
2719 |
});
|
2720 |
+
|
2721 |
+
$("label.ai-load-settings").click (function () {
|
2722 |
+
var block = $(this).closest ('tr').data ('block');
|
2723 |
+
|
2724 |
+
load_saved_settings_to_clipboard (block, true);
|
2725 |
+
});
|
2726 |
+
|
2727 |
+
data_container.disableSelection();
|
2728 |
+
|
2729 |
+
if (rearrange) reload_settings ();
|
2730 |
}
|
2731 |
});
|
2732 |
}
|
2733 |
|
2734 |
+
function configure_tabs () {
|
2735 |
+
|
2736 |
+
var tabs_array = new Array ();
|
2737 |
+
if (active_tab != 0) tabs_array.push (0);
|
2738 |
+
for (var tab = end; tab >= start; tab --) {
|
2739 |
+
if (tab != active_tab) tabs_array.push (tab);
|
2740 |
+
}
|
2741 |
+
// Concatenate existing tabs_to_configure (if tab was clicked before page was loaded)
|
2742 |
+
tabs_to_configure = tabs_array.concat (tabs_to_configure);
|
2743 |
+
|
2744 |
+
setTimeout (configure_hidden_tab, 700);
|
2745 |
+
|
2746 |
+
var index = 16;
|
2747 |
+
if (active_tab != 0) index = active_tab - start;
|
2748 |
+
var block_tabs = $("#ai-tab-container").tabs ({active: index});
|
2749 |
+
$("#ai-plugin-settings-tab-container").tabs ({active: active_tab_0});
|
2750 |
+
|
2751 |
+
$('#ai-settings').tooltip({
|
2752 |
+
show: {effect: "blind",
|
2753 |
+
delay: 400,
|
2754 |
+
duration: 100}
|
2755 |
+
});
|
2756 |
+
|
2757 |
+
if (debug_title) $("#plugin_name").css ("color", "#00f");
|
2758 |
+
|
2759 |
+
if (active_tab == 0) configure_tab_0 (); else configure_tab (active_tab);
|
2760 |
+
|
2761 |
+
$('#dummy-tabs').hide();
|
2762 |
+
$('#ai-tabs').show();
|
2763 |
+
|
2764 |
+
$('.ai-tab').click (function () {
|
2765 |
+
var tab_block = $(this).attr ("id");
|
2766 |
+
tab_block = parseInt (tab_block.replace ("ai-tab",""));
|
2767 |
+
active_tab = tab_block;
|
2768 |
+
|
2769 |
+
if (debug) console.log ("active_tab: " + active_tab);
|
2770 |
+
|
2771 |
+
if (syntax_highlighting) {
|
2772 |
+
if (!$("#tab-" + tab_block).hasClass ('configured')) {
|
2773 |
+
if (debug) console.log ("");
|
2774 |
+
if (debug) console.log ("Empty tab: " + tab_block);
|
2775 |
+
tabs_to_configure.push (tab_block);
|
2776 |
+
setTimeout (configure_hidden_tab, 10);
|
2777 |
+
if (debug) console.log ("tabs_to_configure: " + tabs_to_configure);
|
2778 |
+
} else if (tab_block != 0) {
|
2779 |
+
var editor = ace.edit ("editor-" + tab_block);
|
2780 |
+
editor.getSession ().highlightLines (10000000);
|
2781 |
+
}
|
2782 |
+
}
|
2783 |
+
});
|
2784 |
+
|
2785 |
+
$('.ai-plugin-tab').click (function () {
|
2786 |
+
active_tab_0 = $("#ai-plugin-settings-tab-container").tabs ('option', 'active');
|
2787 |
+
if (debug) console.log ("active_tab_0: " + active_tab_0);
|
2788 |
+
|
2789 |
+
if (syntax_highlighting) {
|
2790 |
+
var tab_block = $(this).attr ("id");
|
2791 |
+
tab_block = tab_block.replace ("ai-","");
|
2792 |
+
|
2793 |
+
if (tab_block == 'h') {
|
2794 |
+
var editor = ace.edit ("editor-h");
|
2795 |
+
editor.getSession ().highlightLines (10000000);
|
2796 |
+
} else
|
2797 |
+
if (tab_block == 'f') {
|
2798 |
+
editor = ace.edit ("editor-f");
|
2799 |
+
editor.getSession ().highlightLines (10000000);
|
2800 |
+
} else
|
2801 |
+
if (tab_block == 'a') {
|
2802 |
+
editor = ace.edit ("editor-a");
|
2803 |
+
editor.getSession ().highlightLines (10000000);
|
2804 |
+
}
|
2805 |
+
}
|
2806 |
+
});
|
2807 |
+
}
|
2808 |
+
|
2809 |
+
|
2810 |
+
function reload_settings () {
|
2811 |
+
if (debug) console.log ('RELOAD SETTINGS');
|
2812 |
+
|
2813 |
+
var nonce = $("#ai-form").attr ('nonce');
|
2814 |
+
var settings_container = $("#ai-container");
|
2815 |
+
|
2816 |
+
$('#ai-error-container').hide ();
|
2817 |
+
if (debug_title) $("#plugin_name").css ("color", "#f00");
|
2818 |
+
|
2819 |
+
$('#ai-loading').show ();
|
2820 |
+
|
2821 |
+
var tools = $('#ai-tools-toolbar-' + active_tab).is (':visible');
|
2822 |
+
var simple_editor = $('#simple-editor-' + active_tab).is(":checked");
|
2823 |
+
var copy = $("#copy-block-" + active_tab).next ("label").find ('.checkbox-icon').hasClass("on");
|
2824 |
+
|
2825 |
+
|
2826 |
+
|
2827 |
+
settings_container.load (ajaxurl+"?action=ai_ajax_backend&settings=" + active_tab + "&ai_check=" + nonce, function (response, status, xhr) {
|
2828 |
+
if (status == "error") {
|
2829 |
+
$('#ai-loading').hide ();
|
2830 |
+
var message = "Error reloading settings: " + xhr.status + " " + xhr.statusText;
|
2831 |
+
$('#ai-error-container').text (message).show ();
|
2832 |
+
if (debug) console.log (message);
|
2833 |
+
} else {
|
2834 |
+
if (debug) console.log (' Configuring...');
|
2835 |
+
|
2836 |
+
if (debug) {
|
2837 |
+
start_time = new Date().getTime();
|
2838 |
+
last_time = start_time;
|
2839 |
+
}
|
2840 |
+
|
2841 |
+
configure_tabs ();
|
2842 |
+
|
2843 |
+
if (simple_editor) $('#simple-editor-' + active_tab).click ();
|
2844 |
+
|
2845 |
+
if (tools) $('#tools-button-' + active_tab).click ();
|
2846 |
+
|
2847 |
+
if (copy) {
|
2848 |
+
$("#ai-container .ai-copy").each (function () {
|
2849 |
+
$(this).next ("label").find ('.checkbox-icon').addClass("on");
|
2850 |
+
});
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
if (debug) console.log (' Configured');
|
2854 |
+
$('#ai-loading').hide ();
|
2855 |
+
}
|
2856 |
+
});
|
2857 |
+
}
|
2858 |
+
|
2859 |
+
|
2860 |
+
|
2861 |
if (debug) console.log ("READY");
|
2862 |
if (debug_title) $("#plugin_name").css ("color", "#f00");
|
2863 |
if (debug) {
|
2885 |
|
2886 |
if (debug) console.log ("active_tabs:", active_tab, active_tab_0);
|
2887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2888 |
var plugin_version = $('#ai-data').attr ('version').split ('-') [0];
|
2889 |
if (javascript_version != plugin_version) {
|
2890 |
console.log ('AD INSERTER: plugin version: ' + plugin_version + ', loaded Javascript version: ' + javascript_version);
|
2928 |
$("#css-warning").show ();
|
2929 |
}
|
2930 |
|
2931 |
+
$('.header button').button().show ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2932 |
|
2933 |
$('#dummy-ranges').hide();
|
2934 |
$('#ai-ranges').show();
|
2935 |
|
|
|
|
|
|
|
|
|
|
|
2936 |
$("#ai-form").submit (function (event) {
|
2937 |
for (var tab = start; tab <= end; tab ++) {
|
2938 |
remove_default_values (tab);
|
2940 |
remove_default_values (0);
|
2941 |
});
|
2942 |
|
2943 |
+
$("div#tab-999").attr ('id', 'ai-clipboard-template').insertBefore ("#ai-clipboard");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2944 |
|
2945 |
+
configure_tabs ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2946 |
|
2947 |
$('#plugin_name').dblclick (function () {
|
2948 |
$(".system-debugging").toggle();
|
2984 |
reload_list ();
|
2985 |
});
|
2986 |
|
2987 |
+
$("#ai-rearrange").click (function () {
|
2988 |
+
$(this).parent ().find ('.checkbox-icon').toggleClass ('on');
|
2989 |
+
|
2990 |
+
var data_container = $("#ai-list-data");
|
2991 |
+
var rearrange_controls = $('#list-rearrange-controls');
|
2992 |
+
if ($(this).parent ().find ('.checkbox-icon').hasClass ('on')) {
|
2993 |
+
$("#ai-rearrange").parent ().find ('.checkbox-button').attr ('title', 'Cancel block order rearrangement');
|
2994 |
+
rearrange_controls.show ();
|
2995 |
+
data_container.find ('tbody').sortable ({
|
2996 |
+
start: function (event, ui) {$('#list-save').show ();},
|
2997 |
+
placeholder: "ui-state-highlight"
|
2998 |
+
}).css ('cursor', 'move');
|
2999 |
+
} else {
|
3000 |
+
data_container.find ('tbody').sortable ("disable");
|
3001 |
+
$("#ai-rearrange").parent ().find ('.checkbox-button').attr ('title', 'Rearrange block order');
|
3002 |
+
$('#list-save').hide ();
|
3003 |
+
rearrange_controls.hide ();
|
3004 |
+
reload_list ();
|
3005 |
+
}
|
3006 |
+
});
|
3007 |
+
|
3008 |
+
$("#ai-save-changes").click (function () {
|
3009 |
+
$('#list-rearrange-controls').addClass ('rearrange')
|
3010 |
+
reload_list ();
|
3011 |
+
});
|
3012 |
+
|
3013 |
setTimeout (update_rating, 1000);
|
3014 |
|
3015 |
if (debug) console.log ("");
|
preview-adb.php
CHANGED
@@ -31,8 +31,8 @@ function generate_code_preview_adb ($client_code = null, $process_php = null) {
|
|
31 |
$ai_wp_data [AI_WP_DEBUGGING] = 0;
|
32 |
|
33 |
$obj = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
34 |
-
$adb_message = $obj->get_ad_data();
|
35 |
-
|
36 |
|
37 |
wp_enqueue_script ('ai-adb-js', plugins_url ('includes/js/ad-inserter-check.js', __FILE__), array (
|
38 |
'jquery',
|
@@ -69,7 +69,151 @@ function generate_code_preview_adb ($client_code = null, $process_php = null) {
|
|
69 |
if (event.keyCode === 27 ) {
|
70 |
window.close();
|
71 |
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
75 |
|
@@ -148,7 +292,8 @@ function generate_code_preview_adb ($client_code = null, $process_php = null) {
|
|
148 |
if (window.opener != null && !window.opener.closed) {
|
149 |
var settings = $(window.opener.document).contents();
|
150 |
|
151 |
-
tmce_setContent (
|
|
|
152 |
$("#message-css").val (settings.find ("#message-css").val ());
|
153 |
$("#overlay-css").val (settings.find ("#overlay-css").val ());
|
154 |
|
@@ -304,7 +449,7 @@ input[type="text"] {
|
|
304 |
),
|
305 |
);
|
306 |
|
307 |
-
add_filter ('wp_default_editor',
|
308 |
// wp_editor ($adb_message, 'aiadb', $editorSettings);
|
309 |
wp_editor ('', 'aiadb', $editorSettings);
|
310 |
|
31 |
$ai_wp_data [AI_WP_DEBUGGING] = 0;
|
32 |
|
33 |
$obj = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
34 |
+
// $adb_message = $obj->get_ad_data();
|
35 |
+
$adb_message = $obj->ai_getCode ($client_code, $process_php);
|
36 |
|
37 |
wp_enqueue_script ('ai-adb-js', plugins_url ('includes/js/ad-inserter-check.js', __FILE__), array (
|
38 |
'jquery',
|
69 |
if (event.keyCode === 27 ) {
|
70 |
window.close();
|
71 |
}
|
72 |
+
};
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* jQuery BASE64 functions
|
77 |
+
*
|
78 |
+
* <code>
|
79 |
+
* Encodes the given data with base64.
|
80 |
+
* String $.base64Encode ( String str )
|
81 |
+
* <br />
|
82 |
+
* Decodes a base64 encoded data.
|
83 |
+
* String $.base64Decode ( String str )
|
84 |
+
* </code>
|
85 |
+
*
|
86 |
+
* Encodes and Decodes the given data in base64.
|
87 |
+
* This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
|
88 |
+
* Base64-encoded data takes about 33% more space than the original data.
|
89 |
+
* This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.
|
90 |
+
* If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).
|
91 |
+
* This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
|
92 |
+
*
|
93 |
+
* Example
|
94 |
+
* Code
|
95 |
+
* <code>
|
96 |
+
* $.base64Encode("I'm Persian.");
|
97 |
+
* </code>
|
98 |
+
* Result
|
99 |
+
* <code>
|
100 |
+
* "SSdtIFBlcnNpYW4u"
|
101 |
+
* </code>
|
102 |
+
* Code
|
103 |
+
* <code>
|
104 |
+
* $.base64Decode("SSdtIFBlcnNpYW4u");
|
105 |
+
* </code>
|
106 |
+
* Result
|
107 |
+
* <code>
|
108 |
+
* "I'm Persian."
|
109 |
+
* </code>
|
110 |
+
*
|
111 |
+
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
112 |
+
* @link http://www.semnanweb.com/jquery-plugin/base64.html (no longer available?)
|
113 |
+
* @link https://gist.github.com/gists/1602210
|
114 |
+
* @see http://www.webtoolkit.info/
|
115 |
+
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
116 |
+
* @param {jQuery} {base64Encode:function(input))
|
117 |
+
* @param {jQuery} {base64Decode:function(input))
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
|
121 |
+
(function($){
|
122 |
+
|
123 |
+
var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
124 |
+
|
125 |
+
var uTF8Encode = function(string) {
|
126 |
+
string = string.replace(/\x0d\x0a/g, "\x0a");
|
127 |
+
var output = "";
|
128 |
+
for (var n = 0; n < string.length; n++) {
|
129 |
+
var c = string.charCodeAt(n);
|
130 |
+
if (c < 128) {
|
131 |
+
output += String.fromCharCode(c);
|
132 |
+
} else if ((c > 127) && (c < 2048)) {
|
133 |
+
output += String.fromCharCode((c >> 6) | 192);
|
134 |
+
output += String.fromCharCode((c & 63) | 128);
|
135 |
+
} else {
|
136 |
+
output += String.fromCharCode((c >> 12) | 224);
|
137 |
+
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
138 |
+
output += String.fromCharCode((c & 63) | 128);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
return output;
|
142 |
+
};
|
143 |
+
|
144 |
+
var uTF8Decode = function(input) {
|
145 |
+
var string = "";
|
146 |
+
var i = 0;
|
147 |
+
var c = c1 = c2 = 0;
|
148 |
+
while ( i < input.length ) {
|
149 |
+
c = input.charCodeAt(i);
|
150 |
+
if (c < 128) {
|
151 |
+
string += String.fromCharCode(c);
|
152 |
+
i++;
|
153 |
+
} else if ((c > 191) && (c < 224)) {
|
154 |
+
c2 = input.charCodeAt(i+1);
|
155 |
+
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
156 |
+
i += 2;
|
157 |
+
} else {
|
158 |
+
c2 = input.charCodeAt(i+1);
|
159 |
+
c3 = input.charCodeAt(i+2);
|
160 |
+
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
161 |
+
i += 3;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
return string;
|
165 |
+
}
|
166 |
+
|
167 |
+
$.extend({
|
168 |
+
base64Encode: function(input) {
|
169 |
+
var output = "";
|
170 |
+
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
171 |
+
var i = 0;
|
172 |
+
input = uTF8Encode(input);
|
173 |
+
while (i < input.length) {
|
174 |
+
chr1 = input.charCodeAt(i++);
|
175 |
+
chr2 = input.charCodeAt(i++);
|
176 |
+
chr3 = input.charCodeAt(i++);
|
177 |
+
enc1 = chr1 >> 2;
|
178 |
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
179 |
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
180 |
+
enc4 = chr3 & 63;
|
181 |
+
if (isNaN(chr2)) {
|
182 |
+
enc3 = enc4 = 64;
|
183 |
+
} else if (isNaN(chr3)) {
|
184 |
+
enc4 = 64;
|
185 |
+
}
|
186 |
+
output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
|
187 |
+
}
|
188 |
+
return output;
|
189 |
+
},
|
190 |
+
base64Decode: function(input) {
|
191 |
+
var output = "";
|
192 |
+
var chr1, chr2, chr3;
|
193 |
+
var enc1, enc2, enc3, enc4;
|
194 |
+
var i = 0;
|
195 |
+
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
196 |
+
while (i < input.length) {
|
197 |
+
enc1 = keyString.indexOf(input.charAt(i++));
|
198 |
+
enc2 = keyString.indexOf(input.charAt(i++));
|
199 |
+
enc3 = keyString.indexOf(input.charAt(i++));
|
200 |
+
enc4 = keyString.indexOf(input.charAt(i++));
|
201 |
+
chr1 = (enc1 << 2) | (enc2 >> 4);
|
202 |
+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
203 |
+
chr3 = ((enc3 & 3) << 6) | enc4;
|
204 |
+
output = output + String.fromCharCode(chr1);
|
205 |
+
if (enc3 != 64) {
|
206 |
+
output = output + String.fromCharCode(chr2);
|
207 |
+
}
|
208 |
+
if (enc4 != 64) {
|
209 |
+
output = output + String.fromCharCode(chr3);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
output = uTF8Decode(output);
|
213 |
+
return output;
|
214 |
+
}
|
215 |
+
});
|
216 |
+
})(jQuery);
|
217 |
|
218 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
219 |
|
292 |
if (window.opener != null && !window.opener.closed) {
|
293 |
var settings = $(window.opener.document).contents();
|
294 |
|
295 |
+
tmce_setContent ($.base64Decode ("<?php echo base64_encode ($adb_message); ?>"));
|
296 |
+
|
297 |
$("#message-css").val (settings.find ("#message-css").val ());
|
298 |
$("#overlay-css").val (settings.find ("#overlay-css").val ());
|
299 |
|
449 |
),
|
450 |
);
|
451 |
|
452 |
+
add_filter ('wp_default_editor', 'ai_wp_default_editor');
|
453 |
// wp_editor ($adb_message, 'aiadb', $editorSettings);
|
454 |
wp_editor ('', 'aiadb', $editorSettings);
|
455 |
|
preview.php
CHANGED
@@ -18,10 +18,10 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
|
|
18 |
|
19 |
$obj = $block_object [$block];
|
20 |
|
21 |
-
$block_name = $name
|
22 |
-
$alignment_type = $alignment
|
23 |
-
$wrapper_css = $alignment_css
|
24 |
-
$custom_css_code = $custom_css
|
25 |
|
26 |
// Head code must be called before ai_getProcessedCode (to process head PHP)
|
27 |
ob_start ();
|
@@ -638,8 +638,13 @@ function generate_code_preview ($block, $name = null, $alignment = null, $alignm
|
|
638 |
var current_time = new Date().getTime();
|
639 |
if (debug) console.log ("TIME: " + ((current_time - start_time) / 1000).toFixed (3));
|
640 |
|
641 |
-
|
642 |
-
$("select#block-alignment
|
|
|
|
|
|
|
|
|
|
|
643 |
|
644 |
$("div.automatic-insertion").dblclick (function () {
|
645 |
var selected_alignment = $("select#block-alignment option:selected");
|
@@ -975,15 +980,15 @@ div.automatic-insertion img {
|
|
975 |
<div style="margin: 20px 0 0 0;">
|
976 |
Alignment and Style:
|
977 |
<select id="block-alignment" style="border-radius: 5px; width:120px;">
|
978 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview default" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_DEFAULT, true)); ?> value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
|
979 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview align-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
|
980 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview center" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_CENTER, true)); ?> value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
|
981 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview align-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
|
982 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview float-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
|
983 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview float-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
|
984 |
<?php if (function_exists ('ai_preview_style_options')) ai_preview_style_options ($obj, $alignment_type); ?>
|
985 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
|
986 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
|
987 |
</select>
|
988 |
<span id="css-index" style="margin: 0 0 0 10px; font-size: 14px;" title="CSS code index"></span>
|
989 |
</div>
|
@@ -1015,7 +1020,7 @@ div.automatic-insertion img {
|
|
1015 |
</table>
|
1016 |
</div>
|
1017 |
|
1018 |
-
<p id="p1">This is a preview of the
|
1019 |
or write CSS code directly and watch live preview. Highlight button highlights background, wrapping div margin and code area, while Reset button restores all the values to those of the current block.</p>
|
1020 |
|
1021 |
<div id='padding-background'></div>
|
18 |
|
19 |
$obj = $block_object [$block];
|
20 |
|
21 |
+
$block_name = $name !== null ? $name : $obj->get_ad_name();
|
22 |
+
$alignment_type = $alignment !== null ? $alignment : $obj->get_alignment_type();
|
23 |
+
$wrapper_css = $alignment_css !== null ? $alignment_css : $obj->get_alignment_style ();
|
24 |
+
$custom_css_code = $custom_css !== null ? $custom_css : $obj->get_custom_css();
|
25 |
|
26 |
// Head code must be called before ai_getProcessedCode (to process head PHP)
|
27 |
ob_start ();
|
638 |
var current_time = new Date().getTime();
|
639 |
if (debug) console.log ("TIME: " + ((current_time - start_time) / 1000).toFixed (3));
|
640 |
|
641 |
+
var titles = new Array();
|
642 |
+
$("select#block-alignment").imagepicker({hide_select: false}).find ('option').each (function (index) {
|
643 |
+
titles.push ($(this).data ('title'));
|
644 |
+
});
|
645 |
+
$("select#block-alignment + ul").appendTo("#alignment-style").css ('padding-top', '10px').find ('li').each (function (index) {
|
646 |
+
$(this).attr ('title', titles [index]);
|
647 |
+
});
|
648 |
|
649 |
$("div.automatic-insertion").dblclick (function () {
|
650 |
var selected_alignment = $("select#block-alignment option:selected");
|
980 |
<div style="margin: 20px 0 0 0;">
|
981 |
Alignment and Style:
|
982 |
<select id="block-alignment" style="border-radius: 5px; width:120px;">
|
983 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview default" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_DEFAULT, true)); ?> value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" data-title="<?php echo AI_TEXT_DEFAULT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
|
984 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview align-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_LEFT; ?>" data-title="<?php echo AI_TEXT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
|
985 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview center" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_CENTER, true)); ?> value="<?php echo AI_ALIGNMENT_CENTER; ?>" data-title="<?php echo AI_TEXT_CENTER; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
|
986 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview align-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_RIGHT; ?>" data-title="<?php echo AI_TEXT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
|
987 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview float-left" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" data-title="<?php echo AI_TEXT_FLOAT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
|
988 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview float-right" <?php alt_styles_data ($obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT, true)); ?> value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" data-title="<?php echo AI_TEXT_FLOAT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
|
989 |
<?php if (function_exists ('ai_preview_style_options')) ai_preview_style_options ($obj, $alignment_type); ?>
|
990 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview custom-css" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" data-title="<?php echo AI_TEXT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
|
991 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion preview no-wrapping" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" data-title="<?php echo AI_TEXT_NO_WRAPPING; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
|
992 |
</select>
|
993 |
<span id="css-index" style="margin: 0 0 0 10px; font-size: 14px;" title="CSS code index"></span>
|
994 |
</div>
|
1020 |
</table>
|
1021 |
</div>
|
1022 |
|
1023 |
+
<p id="p1">This is a preview of the code between two dummy paragraphs. Here you can test various block alignments, visually edit margin and padding values of the wrapping div
|
1024 |
or write CSS code directly and watch live preview. Highlight button highlights background, wrapping div margin and code area, while Reset button restores all the values to those of the current block.</p>
|
1025 |
|
1026 |
<div id='padding-background'></div>
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad management, advertising manager, advanced contextual ads,
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.9
|
8 |
Requires PHP: 5.2.4
|
9 |
-
Stable tag: 2.2.
|
10 |
License: GPLv3
|
11 |
|
12 |
Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
|
@@ -23,6 +23,7 @@ Ad Inserter is more than just ad manager plugin. It provides many advanced optio
|
|
23 |
> * Syntax highlighting editor
|
24 |
> * Code preview with visual CSS editor
|
25 |
> * Automatically inserts ads in posts and pages
|
|
|
26 |
> * Insert before or after post
|
27 |
> * Insert before or after content
|
28 |
> * Insert before or after paragraph
|
@@ -31,6 +32,7 @@ Ad Inserter is more than just ad manager plugin. It provides many advanced optio
|
|
31 |
> * Insert before or after comments
|
32 |
> * Insert before or after excerpt
|
33 |
> * Insert before or after any HTML element in post
|
|
|
34 |
> * Insert at relative position in posts
|
35 |
> * Insert between posts on blog pages (in-feed AdSense ads)
|
36 |
> * Insert between excerpts on blog pages
|
@@ -42,6 +44,8 @@ Ad Inserter is more than just ad manager plugin. It provides many advanced optio
|
|
42 |
> * Insert raw HTTP response header lines
|
43 |
> * Insert Google Analytics, Piwik or any other web analytics code
|
44 |
> * Insert HTML, CSS, Javascript or PHP code
|
|
|
|
|
45 |
> * Manual insertion: widgets, shortcodes, PHP function call
|
46 |
> * Sticky (fixed) widgets (sticky sidebar - the sidebar does not move when the page is scrolled)
|
47 |
> * Custom block alignments and styles
|
@@ -50,10 +54,12 @@ Ad Inserter is more than just ad manager plugin. It provides many advanced optio
|
|
50 |
> * Use shortcodes from other plugins
|
51 |
> * Use custom fields as defined in posts
|
52 |
> * PHP code processing
|
|
|
53 |
> * Ad rotation (server-side and client-side - works with caching)
|
54 |
> * Ad blocking detection - popup message, page redirection
|
55 |
> * Desktop/mobile device detection (server-side and client-side - works with caching)
|
56 |
> * Black/White-list categories, tags, taxonomies, post IDs, urls, url query parameters, cookies, referers
|
|
|
57 |
> * Simple troubleshooting with many debugging functions
|
58 |
> * Function to visualize inserted code blocks
|
59 |
> * Function to visualize available insertion positions
|
@@ -130,6 +136,7 @@ Maintaining several plugins (often from different vendors) is not easy. And each
|
|
130 |
Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
|
131 |
|
132 |
* Code block is any code (for example Google AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
|
|
|
133 |
* **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
|
134 |
* **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
|
135 |
* For Posts and Static pages **leave default BLANK selection value** after the checkbox unless you really know what are you doing (using individual exceptions)
|
@@ -726,27 +733,40 @@ AD CODE RIGHT
|
|
726 |
|
727 |
== Screenshots ==
|
728 |
|
729 |
-
1. Settings for one code block (Before
|
730 |
2. Code preview with visual CSS editor
|
731 |
3. Code preview with visual CSS editor - highlighted code
|
732 |
4. Post / Page Ad Inserter Exceptions
|
733 |
5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
|
734 |
-
6. Ad Inserter settings
|
735 |
7. Visualization of HTML tags in post
|
736 |
8. Visualization of positions for automatic insertion in post
|
737 |
9. Visualization of inserted block in post
|
738 |
-
10.
|
739 |
-
11.
|
740 |
-
12.
|
741 |
-
13.
|
742 |
-
14.
|
743 |
-
15.
|
744 |
-
16.
|
745 |
17. Complete settings for one code block (Before Paragraph)
|
746 |
|
747 |
|
748 |
== Changelog ==
|
749 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
750 |
= 2.2.7 =
|
751 |
- Fix for duplicate amp-custom tag on AMP pages
|
752 |
|
@@ -878,6 +898,15 @@ AD CODE RIGHT
|
|
878 |
|
879 |
== Upgrade Notice ==
|
880 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
881 |
= 2.2.7 =
|
882 |
Fix for duplicate amp-custom tag on AMP pages
|
883 |
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.9
|
8 |
Requires PHP: 5.2.4
|
9 |
+
Stable tag: 2.2.7
|
10 |
License: GPLv3
|
11 |
|
12 |
Insert and manage ads: AdSense, Amazon, banners, ad rotation, sticky ad widgets, shortcodes, AMP, PHP, HTML, CSS, form, tracking, header, footer code
|
23 |
> * Syntax highlighting editor
|
24 |
> * Code preview with visual CSS editor
|
25 |
> * Automatically inserts ads in posts and pages
|
26 |
+
> * Insert above header (after `<body>` tag)
|
27 |
> * Insert before or after post
|
28 |
> * Insert before or after content
|
29 |
> * Insert before or after paragraph
|
32 |
> * Insert before or after comments
|
33 |
> * Insert before or after excerpt
|
34 |
> * Insert before or after any HTML element in post
|
35 |
+
> * Insert in footer (before `</body>` tag)
|
36 |
> * Insert at relative position in posts
|
37 |
> * Insert between posts on blog pages (in-feed AdSense ads)
|
38 |
> * Insert between excerpts on blog pages
|
44 |
> * Insert raw HTTP response header lines
|
45 |
> * Insert Google Analytics, Piwik or any other web analytics code
|
46 |
> * Insert HTML, CSS, Javascript or PHP code
|
47 |
+
> * Code generator for banners
|
48 |
+
> * Visual ad editor
|
49 |
> * Manual insertion: widgets, shortcodes, PHP function call
|
50 |
> * Sticky (fixed) widgets (sticky sidebar - the sidebar does not move when the page is scrolled)
|
51 |
> * Custom block alignments and styles
|
54 |
> * Use shortcodes from other plugins
|
55 |
> * Use custom fields as defined in posts
|
56 |
> * PHP code processing
|
57 |
+
> * Banner code generator
|
58 |
> * Ad rotation (server-side and client-side - works with caching)
|
59 |
> * Ad blocking detection - popup message, page redirection
|
60 |
> * Desktop/mobile device detection (server-side and client-side - works with caching)
|
61 |
> * Black/White-list categories, tags, taxonomies, post IDs, urls, url query parameters, cookies, referers
|
62 |
+
> * Clipboard support to easily copy code blocks or settings
|
63 |
> * Simple troubleshooting with many debugging functions
|
64 |
> * Function to visualize inserted code blocks
|
65 |
> * Function to visualize available insertion positions
|
136 |
Few very important things you need to know in order to <a href="http://adinserter.pro/documentation#quick-start">insert code and display some ad</a>:
|
137 |
|
138 |
* Code block is any code (for example Google AdSense ad) that has to be inserted (and displayed) at some position. Each code block can be configured to insert code at almost any position supported by Wordpress
|
139 |
+
* To rename block click on the name
|
140 |
* **Enable and use at least one insertion option** (Automatic insertion, Widget, Shortcode, PHP function call)
|
141 |
* **Enable insertion on at least one <a href="https://adinserter.pro/page-types">Wordpress page type</a>** (Posts, Static pages, Homepage, Category pages, Search Pages, Archive pages)
|
142 |
* For Posts and Static pages **leave default BLANK selection value** after the checkbox unless you really know what are you doing (using individual exceptions)
|
733 |
|
734 |
== Screenshots ==
|
735 |
|
736 |
+
1. Settings for one code block (Before content). Up to 16 blocks can be configured (up to 64 in <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a>)
|
737 |
2. Code preview with visual CSS editor
|
738 |
3. Code preview with visual CSS editor - highlighted code
|
739 |
4. Post / Page Ad Inserter Exceptions
|
740 |
5. Some <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
|
741 |
+
6. Ad Inserter plugin settings
|
742 |
7. Visualization of HTML tags in post
|
743 |
8. Visualization of positions for automatic insertion in post
|
744 |
9. Visualization of inserted block in post
|
745 |
+
10. Automatic insertion, Alignment and Style settings
|
746 |
+
11. Rotation code editor and banner code generator
|
747 |
+
12. Settings for automatic insertion before/after paragraphs
|
748 |
+
13. Settings for custom hooks
|
749 |
+
14. Settings automatic insertion at custom hook positions
|
750 |
+
15. Settings ad blocking detection
|
751 |
+
16. AdSense code generator
|
752 |
17. Complete settings for one code block (Before Paragraph)
|
753 |
|
754 |
|
755 |
== Changelog ==
|
756 |
|
757 |
+
= 2.2.8 =
|
758 |
+
- Added position for automatic insertion Above header (after `<body>` tag)
|
759 |
+
- Added rotation code editor
|
760 |
+
- Added support to name rotation options
|
761 |
+
- Added code generator for banners
|
762 |
+
- Added code generator for AdSense
|
763 |
+
- Added support to rearrange code blocks
|
764 |
+
- Added support to copy any block settings
|
765 |
+
- Added support for clipboard to copy/paste block settings
|
766 |
+
- Added option to select ad blocking detection mode (Pro only)
|
767 |
+
- Delayed insertion on posts now available for all insertion positions
|
768 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
769 |
+
|
770 |
= 2.2.7 =
|
771 |
- Fix for duplicate amp-custom tag on AMP pages
|
772 |
|
898 |
|
899 |
== Upgrade Notice ==
|
900 |
|
901 |
+
= 2.2.8 =
|
902 |
+
Added position for automatic insertion Above header (after `<body>` tag);
|
903 |
+
Added rotation code editor;
|
904 |
+
Added support to name rotation options;
|
905 |
+
Added code generator for banners and AdSense;
|
906 |
+
Added support to rearrange code blocks;
|
907 |
+
Added support for clipboard to copy/paste block settings;
|
908 |
+
Added option to select ad blocking detection mode (Pro only);
|
909 |
+
|
910 |
= 2.2.7 =
|
911 |
Fix for duplicate amp-custom tag on AMP pages
|
912 |
|
settings.php
CHANGED
@@ -28,7 +28,17 @@ function generate_settings_form (){
|
|
28 |
if ($active_tabs == null) $active_tabs = array ($start, 0);
|
29 |
}
|
30 |
|
31 |
-
if (isset ($_GET ['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
$active_tab = isset ($active_tabs [0]) ? $active_tabs [0] : $start;
|
33 |
if (!is_numeric ($active_tab)) $active_tab = 1;
|
34 |
if ($active_tab != 0)
|
@@ -101,6 +111,9 @@ function generate_settings_form (){
|
|
101 |
$rating_value = $rating_string == '' ? '' : number_format ($rating_string, 1);
|
102 |
|
103 |
if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) $used_blocks = unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]); else $used_blocks = array ();
|
|
|
|
|
|
|
104 |
?>
|
105 |
|
106 |
<div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo $ai_wp_data [AI_JS_DEBUGGING] ? '1' : '0'; ?>" ></div>
|
@@ -108,6 +121,8 @@ function generate_settings_form (){
|
|
108 |
if (function_exists ('ai_data_2')) ai_data_2 ();
|
109 |
?>
|
110 |
|
|
|
|
|
111 |
<div style="clear: both;"></div>
|
112 |
|
113 |
<div id="ai-settings" style="float: left;">
|
@@ -122,6 +137,7 @@ function generate_settings_form (){
|
|
122 |
<h2 id="plugin_name" style="display: inline-block; margin: 5px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
|
123 |
</div>
|
124 |
<div id="header-buttons">
|
|
|
125 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('http://adinserter.pro/documentation')" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button>
|
126 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter')" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button>
|
127 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4')" title="Support Free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!">Donate</button>
|
@@ -167,15 +183,44 @@ function generate_settings_form (){
|
|
167 |
<div style="clear: both;"></div>
|
168 |
</div>
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
<div id="ai-container">
|
|
|
|
|
|
|
171 |
<div id="ai-tab-container" class="ai-form rounded" style="padding-bottom: 1px;">
|
|
|
172 |
<div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
|
173 |
|
174 |
<div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
|
175 |
<?php
|
176 |
|
177 |
-
for ($
|
178 |
-
echo " <span id='ai-scroll-tab-$
|
179 |
}
|
180 |
?>
|
181 |
<span rel='0'>0</span>
|
@@ -190,9 +235,9 @@ function generate_settings_form (){
|
|
190 |
// $widget_options = get_option ('widget_ai_widget');
|
191 |
|
192 |
// $sidebars_with_widgets = array ();
|
193 |
-
//// for ($
|
194 |
-
// for ($
|
195 |
-
// $sidebars_with_widget [$
|
196 |
// }
|
197 |
// foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
|
198 |
// if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
|
@@ -220,22 +265,22 @@ function generate_settings_form (){
|
|
220 |
$manual = array ();
|
221 |
$sidebars = array ();
|
222 |
|
223 |
-
for ($
|
224 |
-
$obj = $block_object [$
|
225 |
|
226 |
$automatic = $obj->get_automatic_insertion() != AI_AUTOMATIC_INSERTION_DISABLED;
|
227 |
|
228 |
-
$manual_widget [$
|
229 |
-
$manual_shortcode [$
|
230 |
-
$manual_php_function [$
|
231 |
-
$manual [$
|
232 |
|
233 |
$style = "";
|
234 |
$ad_name = "";
|
235 |
-
$sidebars [$
|
236 |
-
if ($automatic && $manual [$
|
237 |
elseif ($automatic) $style = "font-weight: bold; color: #e44;";
|
238 |
-
elseif ($manual [$
|
239 |
|
240 |
if (!wp_is_mobile ()) {
|
241 |
$ad_name = $obj->get_ad_name();
|
@@ -246,27 +291,27 @@ function generate_settings_form (){
|
|
246 |
$ad_name_functions = true;
|
247 |
}
|
248 |
|
249 |
-
if (!empty ($sidebars_with_widget [$
|
250 |
-
if ($manual_widget [$
|
251 |
-
if ($sidebars [$
|
252 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
253 |
-
$ad_name .= "Widget used in: [".$sidebars [$
|
254 |
$ad_name_functions = true;
|
255 |
}
|
256 |
} else {
|
257 |
-
if (!empty ($sidebars_with_widget [$
|
258 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
259 |
-
$ad_name .= "Widget DISABLED but used in: [".$sidebars [$
|
260 |
$ad_name_functions = true;
|
261 |
}
|
262 |
}
|
263 |
|
264 |
-
if ($manual_shortcode [$
|
265 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
266 |
$ad_name .= "Shortcode";
|
267 |
$ad_name_functions = true;
|
268 |
}
|
269 |
-
if ($manual_php_function [$
|
270 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
271 |
$ad_name .= "PHP function";
|
272 |
$ad_name_functions = true;
|
@@ -274,7 +319,7 @@ function generate_settings_form (){
|
|
274 |
}
|
275 |
|
276 |
echo "
|
277 |
-
<li id=\"ai-tab$
|
278 |
|
279 |
}
|
280 |
|
@@ -298,14 +343,25 @@ function generate_settings_form (){
|
|
298 |
</ul>
|
299 |
|
300 |
<?php
|
301 |
-
for ($
|
|
|
|
|
|
|
|
|
302 |
|
303 |
-
|
304 |
-
$default->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$ad_number;
|
305 |
|
306 |
-
|
|
|
|
|
|
|
|
|
|
|
307 |
|
308 |
-
|
|
|
|
|
|
|
309 |
|
310 |
$client_side_devices = $obj->get_detection_client_side () == AI_ENABLED;
|
311 |
$server_side_devices = $obj->get_detection_server_side () == AI_ENABLED;
|
@@ -326,8 +382,8 @@ function generate_settings_form (){
|
|
326 |
$show_lists = $cat_list != '' || $tag_list != '' || $taxonomy_list != '' || $id_list != '' || $url_list != '' || $url_parameter_list != '' || $domain_list != '' || $lists;
|
327 |
if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
|
328 |
|
329 |
-
$show_manual = $manual [$
|
330 |
-
if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$
|
331 |
|
332 |
$insertion_options =
|
333 |
$obj->get_maximum_insertions () ||
|
@@ -386,96 +442,177 @@ function generate_settings_form (){
|
|
386 |
$filter_type = $obj->get_filter_type();
|
387 |
|
388 |
?>
|
389 |
-
<div id="tab-<?php echo $
|
390 |
-
<div
|
391 |
-
|
392 |
-
|
393 |
-
<span id="name-label-<?php echo $
|
394 |
-
|
|
|
|
|
395 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
<?php endif; ?>
|
401 |
-
<?php if (function_exists ('ai_settings_top_buttons_1')) ai_settings_top_buttons_1 ($ad_number, $obj, $default); ?>
|
402 |
|
403 |
<?php if (defined ('AI_CODE_GENERATOR')) : ?>
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
<?php endif; ?>
|
409 |
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
<?php if (function_exists ('ai_settings_top_buttons_2')) ai_settings_top_buttons_2 ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
</div>
|
417 |
|
418 |
-
<?php if (function_exists ('ai_settings_container')) ai_settings_container ($
|
419 |
|
420 |
-
<div id="settings-<?php echo $
|
421 |
|
422 |
<?php if (defined ('AI_CODE_GENERATOR')) : ?>
|
|
|
423 |
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
-
<ul
|
427 |
-
<li id="ai-visual-<?php echo $ad_number; ?>" class="ai-plugin-tab"><a href="#tab-visual-<?php echo $ad_number; ?>">Visual Editor</a></li>
|
428 |
-
<li id="ai-banner-<?php echo $ad_number; ?>" class="ai-plugin-tab"><a href="#tab-banner-<?php echo $ad_number; ?>">Banner</a></li>
|
429 |
-
<li id="ai-adsense-pub-id-<?php echo $ad_number; ?>" class="ai-plugin-tab"><a href="#tab-adsense-<?php echo $ad_number; ?>">AdSense</a></li>
|
430 |
</ul>
|
431 |
|
432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
</div>
|
434 |
|
435 |
-
<
|
436 |
-
<
|
437 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
<tr>
|
439 |
<td style="padding-right: 7px;">
|
440 |
Image
|
441 |
</td>
|
442 |
-
<td style="width:
|
443 |
-
<input id="banner-image-url-<?php echo $
|
444 |
-
</td>
|
445 |
-
<td style="width: 130px;">
|
446 |
-
<button id="open-image-button-<?php echo $ad_number; ?>" type="button" style="display: none; float: right;">Select</button>
|
447 |
</td>
|
448 |
</tr>
|
449 |
<tr>
|
450 |
<td>
|
451 |
Link
|
452 |
</td>
|
453 |
-
<td
|
454 |
-
<input id="banner-url-<?php echo $
|
|
|
|
|
|
|
|
|
|
|
455 |
</td>
|
456 |
<td>
|
457 |
-
<
|
458 |
-
<
|
459 |
</td>
|
460 |
</tr>
|
461 |
</table>
|
462 |
<div style="clear: both;"></div>
|
463 |
</div>
|
464 |
|
465 |
-
<div id="tab-adsense-<?php echo $
|
466 |
<table class="ai-settings-table" style="">
|
467 |
<tr>
|
468 |
<td>
|
469 |
Publisher ID
|
470 |
</td>
|
471 |
<td style="width: 50%; padding-left: 7px;">
|
472 |
-
<input id="adsense-publisher-id-<?php echo $
|
473 |
</td>
|
474 |
<td class="adsense-layout" style="padding-left: 7px;">
|
475 |
Layout
|
476 |
</td>
|
477 |
<td class="adsense-layout" style="width: 50%; padding-left: 7px;">
|
478 |
-
<input id="adsense-layout-<?php echo $
|
479 |
</td>
|
480 |
</tr>
|
481 |
|
@@ -484,13 +621,13 @@ function generate_settings_form (){
|
|
484 |
Ad Slot ID
|
485 |
</td>
|
486 |
<td style="width: 50%; padding-left: 7px;">
|
487 |
-
<input id="adsense-ad-slot-id-<?php echo $
|
488 |
</td>
|
489 |
<td class="adsense-layout" style="padding-left: 7px;">
|
490 |
Layout Key
|
491 |
</td>
|
492 |
<td class="adsense-layout" style="width: 50%; padding-left: 7px;">
|
493 |
-
<input id="adsense-layout-key-<?php echo $
|
494 |
</td>
|
495 |
</tr>
|
496 |
|
@@ -499,30 +636,49 @@ function generate_settings_form (){
|
|
499 |
Ad Type
|
500 |
</td>
|
501 |
<td style="padding-left: 7px;">
|
502 |
-
<select id="adsense-type-<?php echo $
|
503 |
<option value="<?php echo AI_ADSENSE_STANDARD; ?>" selected><?php echo AI_TEXT_STANDARD; ?></option>
|
504 |
<option value="<?php echo AI_ADSENSE_LINK; ?>"><?php echo AI_TEXT_LINK; ?></option>
|
505 |
<option value="<?php echo AI_ADSENSE_IN_ARTICLE; ?>"><?php echo AI_TEXT_IN_ARTICLE; ?></option>
|
506 |
<option value="<?php echo AI_ADSENSE_IN_FEED; ?>"><?php echo AI_TEXT_IN_FEED; ?></option>
|
507 |
<option value="<?php echo AI_ADSENSE_MATCHED_CONTENT; ?>"><?php echo AI_TEXT_MATCHED_CONTENT; ?></option>
|
|
|
508 |
</select>
|
509 |
<div class="adsense-responsive" style="float: right; margin-top: 3px;">
|
510 |
-
<input type="checkbox" id="adsense-responsive-<?php echo $
|
511 |
-
<label for="adsense-responsive-<?php echo $
|
512 |
</div>
|
513 |
</td>
|
514 |
<td>
|
515 |
-
|
516 |
</td>
|
517 |
-
<td
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
<div style="float: right;">
|
522 |
-
Height
|
523 |
-
<input id="adsense-height-<?php echo $ad_number; ?>" style="width: 50px;" type="text" size="5" maxlength="5" />
|
524 |
px
|
525 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
</td>
|
527 |
</tr>
|
528 |
</table>
|
@@ -530,30 +686,30 @@ function generate_settings_form (){
|
|
530 |
|
531 |
</div>
|
532 |
|
533 |
-
<div style="padding: 0; min-height: 28px;"
|
534 |
-
<div style="float: left;"
|
535 |
-
<button id="import-
|
536 |
-
</div
|
537 |
-
<div style="float: right;"
|
538 |
-
<button id="generate-
|
539 |
-
</div
|
540 |
-
<div style="clear: both;"></div
|
541 |
-
</div
|
542 |
|
543 |
</div>
|
544 |
<?php endif; ?>
|
545 |
|
546 |
<div style="margin: 8px 0;">
|
547 |
-
<textarea id="block-<?php echo $
|
548 |
</div>
|
549 |
|
550 |
<div style="padding: 0; min-height: 28px;">
|
551 |
<div style="float: left;">
|
552 |
-
<button id="lists-button-<?php echo $
|
553 |
-
<button id="manual-button-<?php echo $
|
554 |
-
<button id="device-detection-button-<?php echo $
|
555 |
-
<button id="misc-button-<?php echo $
|
556 |
-
<button id="preview-button-<?php echo $
|
557 |
</div>
|
558 |
<div style="float: right;">
|
559 |
<?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
|
@@ -566,65 +722,66 @@ function generate_settings_form (){
|
|
566 |
<div class="rounded">
|
567 |
<div style="float: left;">
|
568 |
Automatic Insertion:
|
569 |
-
<select style="margin-bottom: 3px;" id="display-type-<?php echo $
|
570 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion disabled" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
|
571 |
<?php if (defined ('AI_BUFFERING')) : ?>
|
572 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion above-header" value="<?php echo AI_AUTOMATIC_INSERTION_ABOVE_HEADER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_ABOVE_HEADER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ABOVE_HEADER; ?></option>
|
573 |
<?php endif; ?>
|
574 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-post" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
|
575 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-content" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
|
576 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_PARAGRAPH; ?></option>
|
577 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-paragraph" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_PARAGRAPH; ?></option>
|
578 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-content" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_CONTENT; ?></option>
|
579 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-post" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
|
580 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
|
581 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-excerpts" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
|
582 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion between-posts" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
|
583 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion before-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_COMMENTS; ?></option>
|
584 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion between-comments" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_COMMENTS; ?></option>
|
585 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion after-comments" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_COMMENTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_COMMENTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_COMMENTS; ?></option>
|
586 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion footer" value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
|
587 |
<?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
|
588 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion custom-hook" value="<?php echo AI_AUTOMATIC_INSERTION_CUSTOM_HOOK + $custom_hook ['index'] - 1; ?>" <?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>
|
589 |
<?php } ?>
|
590 |
</select>
|
591 |
</div>
|
592 |
|
593 |
<div style="float: right;">
|
594 |
Alignment and Style:
|
595 |
-
<select style="width:130px;" id="block-alignment-<?php echo $
|
596 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion default" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
|
597 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion align-left" value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
|
598 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion center" value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
|
599 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion align-right" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
|
600 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion float-left" value="<?php echo AI_ALIGNMENT_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>
|
601 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion float-right" value="<?php echo AI_ALIGNMENT_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>
|
602 |
<?php $css_code_height = 260; if (function_exists ('ai_style_options')) $css_code_height = ai_style_options ($obj); ?>
|
603 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion custom-css" value="<?php echo AI_ALIGNMENT_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>
|
604 |
-
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion no-wrapping" value="<?php echo AI_ALIGNMENT_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>
|
605 |
</select>
|
606 |
|
607 |
-
<button id="show-css-button-<?php echo $
|
608 |
</div>
|
609 |
<div style="clear: both;"></div>
|
610 |
|
611 |
-
<div id="css-code-<?php echo $
|
612 |
-
|
613 |
-
<div id="
|
|
|
614 |
<div class="max-input">
|
615 |
-
<span id="css-label-<?php echo $
|
616 |
-
<input id="custom-css-<?php echo $
|
617 |
<span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
|
618 |
-
<span id="css-no-wrapping-<?php echo $
|
619 |
-
<span id="css-none-<?php echo $
|
620 |
-
<span id="css-left-<?php echo $
|
621 |
-
<span id="css-right-<?php echo $
|
622 |
-
<span id="css-center-<?php echo $
|
623 |
-
<span id="css-float-left-<?php echo $
|
624 |
-
<span id="css-float-right-<?php echo $
|
625 |
-
<?php if (function_exists ('ai_style_css')) ai_style_css ($
|
626 |
</span>
|
627 |
-
<span style="display:table-cell; width: 46px;" ><button id="edit-css-button-<?php echo $
|
628 |
</div>
|
629 |
</div>
|
630 |
</div>
|
@@ -633,21 +790,21 @@ function generate_settings_form (){
|
|
633 |
<table>
|
634 |
<tr>
|
635 |
<td style="width: 70%; padding-bottom: 5px;">
|
636 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $
|
637 |
-
<input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $
|
638 |
|
639 |
-
<select style="margin: 0 0 0 10px;" id="enabled-on-which-posts-<?php echo $
|
640 |
<option value="<?php echo AI_NO_INDIVIDUAL_EXCEPTIONS; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_NO_INDIVIDUAL_EXCEPTIONS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_INDIVIDUAL_EXCEPTIONS; ?></option>
|
641 |
<option value="<?php echo AI_INDIVIDUALLY_DISABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_INDIVIDUALLY_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_DISABLED; ?></option>
|
642 |
<option value="<?php echo AI_INDIVIDUALLY_ENABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_INDIVIDUALLY_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_ENABLED; ?></option>
|
643 |
</select>
|
644 |
|
645 |
-
<label for="display-posts-<?php echo $
|
646 |
|
647 |
<?php
|
648 |
-
if (!empty ($block_exceptions [$
|
649 |
?>
|
650 |
-
<button id="exceptions-button-<?php echo $
|
651 |
<?php
|
652 |
}
|
653 |
?>
|
@@ -656,64 +813,64 @@ function generate_settings_form (){
|
|
656 |
<td style="padding-left: 8px;">
|
657 |
</td>
|
658 |
<td style="padding-left: 8px;">
|
659 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $
|
660 |
-
<input id= "display-homepage-<?php echo $
|
661 |
-
<label for="display-homepage-<?php echo $
|
662 |
</td>
|
663 |
<td style="padding-left: 8px;">
|
664 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $
|
665 |
-
<input id= "display-category-<?php echo $
|
666 |
-
<label for="display-category-<?php echo $
|
667 |
</td>
|
668 |
</tr>
|
669 |
|
670 |
<tr>
|
671 |
<td style="width: 70%">
|
672 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $
|
673 |
-
<input type="checkbox" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $
|
674 |
|
675 |
-
<select style="margin: 0 0 0 10px;" id="enabled-on-which-pages-<?php echo $
|
676 |
<option value="<?php echo AI_NO_INDIVIDUAL_EXCEPTIONS; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_NO_INDIVIDUAL_EXCEPTIONS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_INDIVIDUAL_EXCEPTIONS; ?></option>
|
677 |
<option value="<?php echo AI_INDIVIDUALLY_DISABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_INDIVIDUALLY_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_DISABLED; ?></option>
|
678 |
<option value="<?php echo AI_INDIVIDUALLY_ENABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_INDIVIDUALLY_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_ENABLED; ?></option>
|
679 |
</select>
|
680 |
|
681 |
-
<label for="display-pages-<?php echo $
|
682 |
</td>
|
683 |
<td style="padding-left: 8px;">
|
684 |
</td>
|
685 |
<td style="padding-left: 8px;">
|
686 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $
|
687 |
-
<input id= "display-search-<?php echo $
|
688 |
-
<label for="display-search-<?php echo $
|
689 |
</td>
|
690 |
<td style="padding-left: 8px;">
|
691 |
-
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $
|
692 |
-
<input id= "display-archive-<?php echo $
|
693 |
-
<label for="display-archive-<?php echo $
|
694 |
</td>
|
695 |
</tr>
|
696 |
</table>
|
697 |
</div>
|
698 |
|
699 |
-
<div id="block-exceptions-<?php echo $
|
700 |
<?php
|
701 |
|
702 |
-
if (!empty ($block_exceptions [$
|
703 |
?>
|
704 |
<table class="exceptions" cellspacing=0 cellpadding=0><tbody>
|
705 |
<tr>
|
706 |
<th class="id">ID</th><th class="type">Type</th><th class="page page-only"> Title</th><th>
|
707 |
-
<input id="clear-block-exceptions-<?php echo $
|
708 |
-
onclick="if (confirm('Are you sure you want to clear all exceptions for block <?php echo $
|
709 |
-
title="Clear all exceptions for block <?php echo $
|
710 |
name="<?php echo AI_FORM_CLEAR_EXCEPTIONS; ?>"
|
711 |
value="❌"
|
712 |
type="submit"
|
713 |
style="padding: 1px 3px; border: 0; background: transparent; font-size: 8px; color: #e44;" /></th>
|
714 |
</tr>
|
715 |
<?php
|
716 |
-
foreach ($block_exceptions [$
|
717 |
?>
|
718 |
<tr>
|
719 |
<td class="id"><a href="<?php
|
@@ -733,34 +890,34 @@ function generate_settings_form (){
|
|
733 |
?>
|
734 |
</div>
|
735 |
|
736 |
-
<div id="paragraph-settings-<?php echo $
|
737 |
<!-- <div>-->
|
738 |
<div style="float: left; margin-top: 1px;">
|
739 |
Paragraph(s)
|
740 |
<input
|
741 |
type="text"
|
742 |
-
name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $
|
743 |
default="<?php echo $default->get_paragraph_number(); ?>"
|
744 |
value="<?php echo $obj->get_paragraph_number(); ?>"
|
745 |
title="Paragraph number or comma separated paragraph numbers or empty (means all paragraphs): 1 to N means paragraph number, 0 means random paragraph, value between 0 and 1 means relative position on the page (0.2 means paragraph at 20% of page height, 0.5 means paragraph halfway down the page, 0.9 means paragraph at 90% of page paragraphs, etc.)"
|
746 |
-
size="
|
747 |
-
maxlength="
|
748 |
</div>
|
749 |
|
750 |
<div style="float: right;">
|
751 |
-
<button id="counting-button-<?php echo $
|
752 |
-
<button id="clearance-button-<?php echo $
|
753 |
</div>
|
754 |
|
755 |
<div style="clear: both;"></div>
|
756 |
<!-- </div>-->
|
757 |
</div>
|
758 |
|
759 |
-
<div id="paragraph-counting-<?php echo $
|
760 |
<div class="max-input" style="margin: 0 0 8px 0;">
|
761 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
762 |
Count
|
763 |
-
<select name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $
|
764 |
<option value="<?php echo AD_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_TOP; ?></option>
|
765 |
<option value="<?php echo AD_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_BOTTOM; ?></option>
|
766 |
</select>
|
@@ -770,7 +927,7 @@ function generate_settings_form (){
|
|
770 |
<input
|
771 |
style="width: 100%;"
|
772 |
title="Comma separated HTML tag names, usually only 'p' tags are used"
|
773 |
-
type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $
|
774 |
default="<?php echo $default->get_paragraph_tags(); ?>"
|
775 |
value="<?php echo $obj->get_paragraph_tags(); ?>"
|
776 |
size="12"
|
@@ -781,7 +938,7 @@ function generate_settings_form (){
|
|
781 |
that have between
|
782 |
<input
|
783 |
type="text"
|
784 |
-
name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $
|
785 |
default="<?php echo $default->get_minimum_paragraph_words(); ?>"
|
786 |
value="<?php echo $obj->get_minimum_paragraph_words(); ?>"
|
787 |
size="4"
|
@@ -789,7 +946,7 @@ function generate_settings_form (){
|
|
789 |
and
|
790 |
<input
|
791 |
type="text"
|
792 |
-
name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $
|
793 |
default="<?php echo $default->get_maximum_paragraph_words(); ?>"
|
794 |
value="<?php echo $obj->get_maximum_paragraph_words(); ?>"
|
795 |
title="Maximum number of paragraph words, leave empty for no limit"
|
@@ -802,7 +959,7 @@ function generate_settings_form (){
|
|
802 |
<div class="max-input" style="margin: 8px 0 8px 0;">
|
803 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
804 |
and
|
805 |
-
<select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_PARAGRAPH_TEXT_TYPE, WP_FORM_FIELD_POSTFIX, $
|
806 |
<option value="<?php echo AD_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_CONTAIN; ?></option>
|
807 |
<option value="<?php echo AD_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_CONTAIN; ?></option>
|
808 |
</select>
|
@@ -812,7 +969,7 @@ function generate_settings_form (){
|
|
812 |
style="width: 100%;"
|
813 |
title="Comma separated text"
|
814 |
type="text"
|
815 |
-
name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $
|
816 |
default="<?php echo $default->get_paragraph_text(); ?>"
|
817 |
value="<?php echo $obj->get_paragraph_text(); ?>"
|
818 |
maxlength="200" />
|
@@ -822,7 +979,7 @@ function generate_settings_form (){
|
|
822 |
Minimum number of paragraphs
|
823 |
<input
|
824 |
type="text"
|
825 |
-
name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $
|
826 |
default="<?php echo $default->get_paragraph_number_minimum(); ?>"
|
827 |
value="<?php echo $obj->get_paragraph_number_minimum() ?>"
|
828 |
size="2"
|
@@ -832,9 +989,9 @@ function generate_settings_form (){
|
|
832 |
|
833 |
<div class="max-input" style="margin: 8px 0 0 0;">
|
834 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
835 |
-
<input type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $
|
836 |
-
<input id= "ignore_blockquote-<?php echo $
|
837 |
-
<label for="ignore_blockquote-<?php echo $
|
838 |
</span>
|
839 |
|
840 |
<span class="small-input-tags" style="display: table-cell;">
|
@@ -848,7 +1005,7 @@ function generate_settings_form (){
|
|
848 |
Minimum number of words in paragraphs above
|
849 |
<input
|
850 |
type="text"
|
851 |
-
name="<?php echo AI_OPTION_MIN_WORDS_ABOVE, WP_FORM_FIELD_POSTFIX, $
|
852 |
default="<?php echo $default->get_minimum_words_above(); ?>"
|
853 |
value="<?php echo $obj->get_minimum_words_above() ?>"
|
854 |
title="Used only with automatic insertion After paragraph and empty paragraph numbers"
|
@@ -858,13 +1015,13 @@ function generate_settings_form (){
|
|
858 |
</div>
|
859 |
</div>
|
860 |
|
861 |
-
<div id="paragraph-clearance-<?php echo $
|
862 |
<div class="max-input" style="margin: 0 0 8px 0">
|
863 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
864 |
In
|
865 |
<input
|
866 |
type="text"
|
867 |
-
name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $
|
868 |
default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
|
869 |
value="<?php echo $obj->get_avoid_paragraphs_above(); ?>"
|
870 |
title="Number of paragraphs above to check, leave empty to disable checking"
|
@@ -877,7 +1034,7 @@ function generate_settings_form (){
|
|
877 |
style="width: 100%;"
|
878 |
title="Comma separated text"
|
879 |
type="text"
|
880 |
-
name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $
|
881 |
default="<?php echo $default->get_avoid_text_above(); ?>"
|
882 |
value="<?php echo $obj->get_avoid_text_above(); ?>"
|
883 |
maxlength="100" />
|
@@ -889,7 +1046,7 @@ function generate_settings_form (){
|
|
889 |
In
|
890 |
<input
|
891 |
type="text"
|
892 |
-
name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $
|
893 |
default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
|
894 |
value="<?php echo $obj->get_avoid_paragraphs_below(); ?>"
|
895 |
title="Number of paragraphs below to check, leave empty to disable checking"
|
@@ -902,7 +1059,7 @@ function generate_settings_form (){
|
|
902 |
style="width: 100%;"
|
903 |
title="Comma separated text"
|
904 |
type="text"
|
905 |
-
name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $
|
906 |
default="<?php echo $default->get_avoid_text_below(); ?>"
|
907 |
value="<?php echo $obj->get_avoid_text_below(); ?>"
|
908 |
maxlength="100" />
|
@@ -911,21 +1068,21 @@ function generate_settings_form (){
|
|
911 |
|
912 |
<div style="margin: 8px 0 0 0;">
|
913 |
If text is found
|
914 |
-
<select id="avoid-action-<?php echo $
|
915 |
<option value="<?php echo AD_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AD_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_INSERT; ?></option>
|
916 |
<option value="<?php echo AD_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AD_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_TRY_TO_SHIFT_POSITION; ?></option>
|
917 |
</select>
|
918 |
-
<span id="check-up-to-<?php echo $
|
919 |
— check up to
|
920 |
<input
|
921 |
type="text"
|
922 |
-
name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $
|
923 |
default="<?php echo $default->get_avoid_try_limit(); ?>"
|
924 |
value="<?php echo $obj->get_avoid_try_limit(); ?>"
|
925 |
size="2"
|
926 |
maxlength="3" />
|
927 |
paragraphs
|
928 |
-
<select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $
|
929 |
<option value="<?php echo AD_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE; ?></option>
|
930 |
<option value="<?php echo AD_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_BELOW; ?></option>
|
931 |
<option value="<?php echo AD_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE_AND_THEN_BELOW; ?></option>
|
@@ -935,7 +1092,7 @@ function generate_settings_form (){
|
|
935 |
</div>
|
936 |
</div>
|
937 |
|
938 |
-
<div class="responsive-table rounded" id="list-settings-<?php echo $
|
939 |
<table>
|
940 |
<tbody>
|
941 |
<tr>
|
@@ -943,15 +1100,15 @@ function generate_settings_form (){
|
|
943 |
Categories
|
944 |
</td>
|
945 |
<td style="padding-right: 7px; width: 70%;">
|
946 |
-
<input style="width: 100%;" title="Comma separated category slugs" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $
|
947 |
</td>
|
948 |
<td style="padding-right: 7px;">
|
949 |
-
<input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
950 |
-
<label for="category-blacklist-<?php echo $
|
951 |
</td>
|
952 |
<td>
|
953 |
-
<input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
954 |
-
<label for="category-whitelist-<?php echo $
|
955 |
</td>
|
956 |
</tr>
|
957 |
<tr>
|
@@ -959,15 +1116,15 @@ function generate_settings_form (){
|
|
959 |
Tags
|
960 |
</td>
|
961 |
<td style="padding-right: 7px;">
|
962 |
-
<input style="width: 100%;" title="Comma separated tags" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $
|
963 |
</td>
|
964 |
<td style="padding-right: 7px;">
|
965 |
-
<input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
966 |
-
<label for="tag-blacklist-<?php echo $
|
967 |
</td>
|
968 |
<td>
|
969 |
-
<input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
970 |
-
<label for="tag-whitelist-<?php echo $
|
971 |
</td>
|
972 |
</tr>
|
973 |
<tr>
|
@@ -975,15 +1132,15 @@ function generate_settings_form (){
|
|
975 |
Taxonomies
|
976 |
</td>
|
977 |
<td style="padding-right: 7px; width: 70%;">
|
978 |
-
<input style="width: 100%;" title="Comma separated slugs: taxonomy, term or taxonomy:term" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $
|
979 |
</td>
|
980 |
<td style="padding-right: 7px;">
|
981 |
-
<input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
982 |
-
<label for="category-blacklist-<?php echo $
|
983 |
</td>
|
984 |
<td>
|
985 |
-
<input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
986 |
-
<label for="category-whitelist-<?php echo $
|
987 |
</td>
|
988 |
</tr>
|
989 |
<tr>
|
@@ -991,15 +1148,15 @@ function generate_settings_form (){
|
|
991 |
Post IDs
|
992 |
</td>
|
993 |
<td style="padding-right: 7px;">
|
994 |
-
<input style="width: 100%;" title="Comma separated post/page IDs" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $
|
995 |
</td>
|
996 |
<td style="padding-right: 7px;">
|
997 |
-
<input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
998 |
-
<label for="id-blacklist-<?php echo $
|
999 |
</td>
|
1000 |
<td>
|
1001 |
-
<input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1002 |
-
<label for="id-whitelist-<?php echo $
|
1003 |
</td>
|
1004 |
</tr>
|
1005 |
<tr>
|
@@ -1007,17 +1164,17 @@ function generate_settings_form (){
|
|
1007 |
Urls
|
1008 |
</td>
|
1009 |
<td style="padding-right: 7px;">
|
1010 |
-
<input style="width: 100%;" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $
|
1011 |
<br />
|
1012 |
-
<!-- <textarea id="urls2-<?php echo $
|
1013 |
</td>
|
1014 |
<td style="padding-right: 7px;">
|
1015 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1016 |
-
<label for="url-blacklist-<?php echo $
|
1017 |
</td>
|
1018 |
<td>
|
1019 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1020 |
-
<label for="url-whitelist-<?php echo $
|
1021 |
</td>
|
1022 |
</tr>
|
1023 |
<tr>
|
@@ -1025,15 +1182,15 @@ function generate_settings_form (){
|
|
1025 |
Url parameters
|
1026 |
</td>
|
1027 |
<td style="padding-right: 7px;">
|
1028 |
-
<input style="width: 100%;" title="Comma separated url query parameters or cookies with optional values (use 'prameter', 'prameter=value', 'cookie' or 'cookie=value')" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $
|
1029 |
</td>
|
1030 |
<td style="padding-right: 7px;">
|
1031 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1032 |
-
<label for="url-parameter-blacklist-<?php echo $
|
1033 |
</td>
|
1034 |
<td>
|
1035 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1036 |
-
<label for="url-parameter-whitelist-<?php echo $
|
1037 |
</td>
|
1038 |
</tr>
|
1039 |
<tr>
|
@@ -1041,78 +1198,82 @@ function generate_settings_form (){
|
|
1041 |
Referers
|
1042 |
</td>
|
1043 |
<td style="padding-right: 7px;">
|
1044 |
-
<input style="width: 100%;" title="Comma separated domains, use # for no referer" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $
|
1045 |
</td>
|
1046 |
<td style="padding-right: 7px;">
|
1047 |
-
<input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1048 |
-
<label for="referer-blacklist-<?php echo $
|
1049 |
</td>
|
1050 |
<td>
|
1051 |
-
<input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $
|
1052 |
-
<label for="referer-whitelist-<?php echo $
|
1053 |
</td>
|
1054 |
</tr>
|
1055 |
-
<?php if (function_exists ('ai_list_rows')) ai_list_rows ($
|
1056 |
</tbody>
|
1057 |
</table>
|
1058 |
</div>
|
1059 |
|
1060 |
-
<div id="manual-settings-<?php echo $
|
1061 |
<table>
|
1062 |
<tr>
|
1063 |
<td style="padding: 4px 10px 4px 0;">
|
1064 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $
|
1065 |
-
<input id="enable-widget-<?php echo $
|
1066 |
-
<label for="enable-widget-<?php echo $
|
1067 |
Widget
|
1068 |
</label>
|
1069 |
</td>
|
1070 |
<td>
|
1071 |
-
<pre 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 [$
|
1072 |
-
<button id="widgets-button-<?php echo $
|
1073 |
</td>
|
1074 |
</tr>
|
1075 |
<tr>
|
1076 |
<td style="padding: 4px 10px 4px 0;">
|
1077 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $
|
1078 |
-
<input type="checkbox" id="enable-shortcode-<?php echo $
|
1079 |
-
<label for="enable-shortcode-<?php echo $
|
1080 |
Shortcode
|
1081 |
</label>
|
1082 |
</td>
|
1083 |
<td>
|
1084 |
-
<pre class="select" style="margin: 0; display: inline; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;">[adinserter block="<?php echo $
|
1085 |
-
|
|
|
|
|
|
|
1086 |
</td>
|
1087 |
</tr>
|
1088 |
<tr>
|
1089 |
<td style="padding: 4px 10px 4px 0;">
|
1090 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $
|
1091 |
-
<input id="enable-php-call-<?php echo $
|
1092 |
-
<label for="enable-php-call-<?php echo $
|
1093 |
PHP function
|
1094 |
</label>
|
1095 |
</td>
|
1096 |
<td class="select">
|
1097 |
-
<pre style="margin: 0; display: inline; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;"><?php if (function_exists ('adinserter')) echo adinserter (<?php echo $
|
|
|
1098 |
</td>
|
1099 |
</tr>
|
1100 |
</table>
|
1101 |
</div>
|
1102 |
|
1103 |
-
<div id="device-detection-settings-<?php echo $
|
1104 |
|
1105 |
-
<div id="ai-devices-container-<?php echo $
|
1106 |
-
<ul id="ai-devices-tabs-<?php echo $
|
1107 |
-
<li id="ai-client-side-detection-<?php echo $
|
1108 |
-
<li id="ai-server-side-detection<?php echo $
|
1109 |
</ul>
|
1110 |
|
1111 |
-
<div id="tab-client-side-<?php echo $
|
1112 |
<div style="float: left; margin-top: 0px;">
|
1113 |
-
<input type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $
|
1114 |
-
<input id="client-side-detection-<?php echo $
|
1115 |
-
<label for="client-side-detection-<?php echo $
|
1116 |
</div>
|
1117 |
|
1118 |
<div style="float: left; margin: -5px 0 -2px 0;">
|
@@ -1140,9 +1301,9 @@ function generate_settings_form (){
|
|
1140 |
}
|
1141 |
?>
|
1142 |
<td style='padding: 2px 0 0 20px;'>
|
1143 |
-
<input type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $
|
1144 |
-
<input type="checkbox" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $
|
1145 |
-
<label for="viewport-<?php echo $viewport, "-", $
|
1146 |
</td>
|
1147 |
<?php
|
1148 |
$column ++;
|
@@ -1164,12 +1325,12 @@ function generate_settings_form (){
|
|
1164 |
<div style="clear: both"></div>
|
1165 |
</div>
|
1166 |
|
1167 |
-
<div id="tab-server-side-<?php echo $
|
1168 |
-
<input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $
|
1169 |
-
<input type="checkbox" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $
|
1170 |
-
<label for="server-side-detection-<?php echo $
|
1171 |
|
1172 |
-
<select id="display-for-devices-<?php echo $
|
1173 |
<option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
|
1174 |
<option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
|
1175 |
<option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
|
@@ -1183,22 +1344,22 @@ function generate_settings_form (){
|
|
1183 |
|
1184 |
</div>
|
1185 |
|
1186 |
-
<div id="misc-settings-<?php echo $
|
1187 |
-
<div id="ai-misc-container-<?php echo $
|
1188 |
-
<ul id="ai-misc-tabs-<?php echo $
|
1189 |
-
<li id="ai-misc-insertion-<?php echo $
|
1190 |
-
<li id="ai-misc-word-count-<?php echo $
|
1191 |
-
<li id="ai-misc-filter-<?php echo $
|
1192 |
-
<li id="ai-misc-scheduling-<?php echo $
|
1193 |
-
<?php if (function_exists ('ai_adb_action_0')) ai_adb_action_0 ($
|
1194 |
-
<li id="ai-misc-general-<?php echo $
|
1195 |
</ul>
|
1196 |
|
1197 |
-
<div id="tab-insertion-<?php echo $
|
1198 |
<div class="max-input">
|
1199 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1200 |
Insert for
|
1201 |
-
<select id="display-for-users-<?php echo $
|
1202 |
<option value="<?php echo AD_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ALL_USERS; ?></option>
|
1203 |
<option value="<?php echo AD_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_LOGGED_IN_USERS; ?></option>
|
1204 |
<option value="<?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
|
@@ -1207,50 +1368,50 @@ function generate_settings_form (){
|
|
1207 |
</span>
|
1208 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1209 |
|
1210 |
-
Max <input type="text" style="width: 32px;" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $
|
1211 |
</span>
|
1212 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1213 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_AMP, WP_FORM_FIELD_POSTFIX, $
|
1214 |
-
<input style="margin-left: 10px;" id="enable-amp-<?php echo $
|
1215 |
-
<label for="enable-amp-<?php echo $
|
1216 |
</span>
|
1217 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1218 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $
|
1219 |
-
<input style="margin-left: 10px;" id="enable-ajax-<?php echo $
|
1220 |
-
<label for="enable-ajax-<?php echo $
|
1221 |
</span>
|
1222 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1223 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $
|
1224 |
-
<input style="margin-left: 10px;" id="enable-feed-<?php echo $
|
1225 |
-
<label for="enable-feed-<?php echo $
|
1226 |
</span>
|
1227 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1228 |
-
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $
|
1229 |
-
<input style="margin-left: 10px;" id="enable-404-<?php echo $
|
1230 |
-
<label for="enable-404-<?php echo $
|
1231 |
</span>
|
1232 |
</div>
|
1233 |
</div>
|
1234 |
|
1235 |
-
<div id="tab-word-count-<?php echo $
|
1236 |
Post/Static page must have between
|
1237 |
-
<input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $
|
1238 |
and
|
1239 |
-
<input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $
|
1240 |
words
|
1241 |
</div>
|
1242 |
|
1243 |
-
<div id="tab-filter-<?php echo $
|
1244 |
<div class="max-input">
|
1245 |
<span style="display: table-cell;">
|
1246 |
Filter insertions
|
1247 |
</span>
|
1248 |
<span style="display: table-cell;">
|
1249 |
-
<input style="width: 100%; padding-right: 10px;" type="text" name="<?php echo AI_OPTION_EXCERPT_NUMBER, WP_FORM_FIELD_POSTFIX, $
|
1250 |
</span>
|
1251 |
<span style="display: table-cell;">
|
1252 |
using
|
1253 |
-
<select id="filter-type-<?php echo $
|
1254 |
<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; ?></option>
|
1255 |
<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; ?></option>
|
1256 |
<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; ?></option>
|
@@ -1266,38 +1427,38 @@ function generate_settings_form (){
|
|
1266 |
counter
|
1267 |
</span>
|
1268 |
<span style="display: table-cell;">
|
1269 |
-
<input type="hidden" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $
|
1270 |
-
<input style="margin-left: 10px;" type="checkbox" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $
|
1271 |
-
<label for="enable-ajax-<?php echo $
|
1272 |
</span>
|
1273 |
</div>
|
1274 |
</div>
|
1275 |
|
1276 |
-
<div id="tab-scheduling-<?php echo $
|
1277 |
-
<select id="scheduling-<?php echo $
|
1278 |
<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_OFF; ?></option>
|
1279 |
<option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
|
1280 |
<?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
|
1281 |
</select>
|
1282 |
|
1283 |
-
<span id="scheduling-delay-<?php echo $
|
1284 |
-
for <input type="text" name="<?php echo AI_OPTION_AFTER_DAYS, WP_FORM_FIELD_POSTFIX, $
|
1285 |
</span>
|
1286 |
-
<span id="scheduling-delay-warning-<?php echo $
|
1287 |
|
1288 |
-
<?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($
|
1289 |
</div>
|
1290 |
|
1291 |
-
<?php if (function_exists ('ai_adb_action')) ai_adb_action ($
|
1292 |
|
1293 |
-
<div id="tab-general-<?php echo $
|
1294 |
<div class="max-input">
|
1295 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1296 |
General tag
|
1297 |
|
1298 |
</span>
|
1299 |
<span style="display: table-cell;">
|
1300 |
-
<input style="width: 100%;" type="text" name="<?php echo AI_OPTION_GENERAL_TAG, WP_FORM_FIELD_POSTFIX, $
|
1301 |
</span>
|
1302 |
<span style="display: table-cell; width: 400px; white-space: nowrap;">
|
1303 |
</span>
|
@@ -1307,8 +1468,8 @@ function generate_settings_form (){
|
|
1307 |
</div>
|
1308 |
</div>
|
1309 |
|
1310 |
-
<div id="no-wrapping-warning-<?php echo $
|
1311 |
-
<span
|
1312 |
</div>
|
1313 |
|
1314 |
</div>
|
@@ -1567,7 +1728,7 @@ function generate_settings_form (){
|
|
1567 |
<div style="margin: 8px 0;">
|
1568 |
<div style="float: right;">
|
1569 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1570 |
-
<input type="checkbox" value="0" id="simple-editor-h" style="display: none;" />
|
1571 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-h" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1572 |
<?php endif; ?>
|
1573 |
|
@@ -1623,7 +1784,7 @@ function generate_settings_form (){
|
|
1623 |
<div style="margin: 8px 0;">
|
1624 |
<div style="float: right;">
|
1625 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1626 |
-
<input type="checkbox" value="0" id="simple-editor-f" style="display: none;" />
|
1627 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-f" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1628 |
<?php endif; ?>
|
1629 |
|
@@ -1730,6 +1891,7 @@ function generate_settings_form (){
|
|
1730 |
<input style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_SELECTORS; ?>" title="Comma seprarated list of CSS selectors (.class, #id) used for additional ad blocking detection. Invisible or zero height of the element means ad blocking is present." value="<?php echo get_adb_selectors (); ?>" default="" size="50" maxlength="200" />
|
1731 |
</td>
|
1732 |
</tr>
|
|
|
1733 |
</table>
|
1734 |
</div>
|
1735 |
|
@@ -1779,7 +1941,7 @@ function generate_settings_form (){
|
|
1779 |
<div style="float: right;">
|
1780 |
|
1781 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1782 |
-
<input type="checkbox" value="0" id="simple-editor-a" style="display: none;" />
|
1783 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-a" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1784 |
<?php endif; ?>
|
1785 |
|
@@ -1787,7 +1949,7 @@ function generate_settings_form (){
|
|
1787 |
<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;" />
|
1788 |
<label class="checkbox-button" style="margin-left: 10px;" for="process-php-a" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adA->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
|
1789 |
|
1790 |
-
<button id="preview-button-adb" type="button" style="display: none; margin: 0 4px 0 10px;" title="Preview message when ad blocking is detected" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
|
1791 |
</div>
|
1792 |
<div style="clear: both;"></div>
|
1793 |
</div>
|
@@ -1899,6 +2061,7 @@ function generate_settings_form (){
|
|
1899 |
|
1900 |
</div> <!-- ai-tab-container -->
|
1901 |
|
|
|
1902 |
|
1903 |
</div> <!-- ai-container -->
|
1904 |
|
@@ -1957,7 +2120,7 @@ function generate_settings_form (){
|
|
1957 |
|
1958 |
</form>
|
1959 |
|
1960 |
-
</div>
|
1961 |
|
1962 |
<div id="ai-sidebar" style="float: left;">
|
1963 |
|
@@ -2032,6 +2195,7 @@ function generate_settings_form (){
|
|
2032 |
replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
|
2033 |
replace_blocked_image ('ai-tw', 'twitter.png', 'inline');
|
2034 |
replace_blocked_image ('ai-fb', 'facebook.png', 'inline');
|
|
|
2035 |
if (blocking_counter > 5) {
|
2036 |
var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
|
2037 |
console.log ('AD INSERTER:', message);
|
@@ -2045,6 +2209,9 @@ function generate_settings_form (){
|
|
2045 |
</script>
|
2046 |
|
2047 |
<?php
|
|
|
|
|
|
|
2048 |
} // generate_settings_form ()
|
2049 |
|
2050 |
function get_sidebar_widgets () {
|
@@ -2052,9 +2219,9 @@ function get_sidebar_widgets () {
|
|
2052 |
$widget_options = get_option ('widget_ai_widget');
|
2053 |
|
2054 |
$sidebars_with_widgets = array ();
|
2055 |
-
// for ($
|
2056 |
-
for ($
|
2057 |
-
$sidebars_with_widget [$
|
2058 |
}
|
2059 |
foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
|
2060 |
if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
|
@@ -2083,13 +2250,24 @@ function code_block_list_container () {
|
|
2083 |
?>
|
2084 |
<div id="ai-list-container" class="ai-form rounded" style="background: #fff; display: none;">
|
2085 |
<div id='list-controls' class='ui-widget' style='margin: 8px auto;'>
|
2086 |
-
<span class="ai-toolbar-button" style="vertical-align: middle;">
|
2087 |
<input type="checkbox" value="0" id="ai-load-all" style="display: none;" />
|
2088 |
<label class="checkbox-button" for="ai-load-all" title="Toggle active/all blocks"><span class="checkbox-icon icon-enabled-all on"></span></label>
|
2089 |
</span>
|
2090 |
-
<span class="ai-toolbar-button" style="vertical-align: middle;">
|
2091 |
<input id="ai-list-search" type="text" value="" size="40" maxlength="40" />
|
2092 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2093 |
</div>
|
2094 |
|
2095 |
<div id="ai-list-data">
|
@@ -2100,25 +2278,61 @@ function code_block_list_container () {
|
|
2100 |
}
|
2101 |
|
2102 |
function code_block_list () {
|
2103 |
-
global $block_object;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2104 |
|
2105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2106 |
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
|
|
|
|
2122 |
|
2123 |
$search_text = trim ($_GET ["list"]);
|
2124 |
|
@@ -2129,6 +2343,7 @@ function code_block_list () {
|
|
2129 |
|
2130 |
if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array ();
|
2131 |
|
|
|
2132 |
$row_counter = 0;
|
2133 |
for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
2134 |
$obj = $block_object [$block];
|
@@ -2152,6 +2367,7 @@ function code_block_list () {
|
|
2152 |
if (stripos ($block_text, trim ($search_item)) === false) continue 2;
|
2153 |
}
|
2154 |
|
|
|
2155 |
$row_counter ++;
|
2156 |
$row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
|
2157 |
|
@@ -2161,23 +2377,45 @@ function code_block_list () {
|
|
2161 |
$visible_tab = $block >= $start && $block <= $end;
|
2162 |
|
2163 |
?>
|
2164 |
-
<tr style="background: <?php echo $row_color; ?>">
|
2165 |
-
<td style="text-align: right; color: <?php echo $block_used ? '#444' : '#ccc'; ?>"
|
|
|
|
|
|
|
|
|
|
|
2166 |
<?php if ($visible_tab): ?>
|
2167 |
-
<td class="ai-tab-link" data-tab="<?php echo $block; ?>" style="color: #0073aa; cursor: pointer; text-align: left; padding-left: 10px; max-width:
|
2168 |
<?php else: ?>
|
2169 |
-
<td style="text-align: left;
|
2170 |
<?php endif ?>
|
2171 |
-
<td style="text-align: left; padding-left: 10px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>"><?php echo $obj->get_automatic_insertion_text(); ?></td>
|
2172 |
-
<td style="text-align: left; padding-left: 10px; max-width: 80px; white-space: nowrap; overflow: hidden; color: <?php echo $block_used ? '#444' : '#ccc'; ?>"><?php echo $obj->get_alignment_type_text (); ?></td>
|
2173 |
-
<td class="ai-dot" style="text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_php_function ? '#8080ff' : '#ddd'; ?>;">●</td>
|
2174 |
-
<td class="ai-dot" style="text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_shortcode ? '#ff8b8b' : '#ddd'; ?>;">●</td>
|
2175 |
-
<td class="ai-dot" style="text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_widget ? (count ($sidebars_with_widget [$block]) ? '#7cda7c' : '#666') : '#ddd'; ?>;">●</td>
|
2176 |
<td style="text-align: left; padding-left: 10px; max-width: 160px; white-space: nowrap; overflow: hidden; color: <?php echo $manual_widget ? '#666' : '#ccc'; ?>;"><?php echo implode (', ', $sidebars_with_widget [$block]); ?></td>
|
2177 |
</tr>
|
2178 |
<?php
|
2179 |
}
|
|
|
2180 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2181 |
</tbody>
|
2182 |
</table>
|
2183 |
<?php
|
@@ -2288,9 +2526,11 @@ function sidebar_pro () { ?>
|
|
2288 |
<li>64 code (ad) blocks</li>
|
2289 |
<li>Syntax highlighting editor</li>
|
2290 |
<li><a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
|
|
|
2291 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
|
2292 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
|
2293 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
|
|
|
2294 |
<li>Automatic insertion at <a href="https://adinserter.pro/documentation#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
|
2295 |
<li><a href="https://adinserter.pro/exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
|
2296 |
<li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
|
@@ -2306,6 +2546,7 @@ function sidebar_pro () { ?>
|
|
2306 |
<li>Support for contextual <a href="https://adinserter.pro/settings#amazon" class="simple-link" target="_blank">Amazon Native Shopping Ads</a> (responsive)</li>
|
2307 |
<li>Custom CSS class name for wrapping divs to avoid ad blockers</li>
|
2308 |
<li>PHP code processing</li>
|
|
|
2309 |
<li>Support for <a href="http://adinserter.pro/documentation#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
|
2310 |
<li>Support for Google Analytics, Piwik or any other web analytics code</li>
|
2311 |
<li>Desktop, tablet and phone server-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a></li>
|
@@ -2322,6 +2563,7 @@ function sidebar_pro () { ?>
|
|
2322 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
|
2323 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
|
2324 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
|
|
|
2325 |
<li>Support via email</li>
|
2326 |
</ul>
|
2327 |
|
28 |
if ($active_tabs == null) $active_tabs = array ($start, 0);
|
29 |
}
|
30 |
|
31 |
+
if (isset ($_GET ['settings'])) {
|
32 |
+
$active_tab = $_GET ['settings'];
|
33 |
+
if (isset ($_GET ['single'])) {
|
34 |
+
$start = $active_tab;
|
35 |
+
$end = $active_tab;
|
36 |
+
} else {
|
37 |
+
$start = intval (($active_tab - 1) / 16) * 16 + 1;
|
38 |
+
$end = $start + 15;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
elseif (isset ($_GET ['tab'])) $active_tab = $_GET ['tab']; else
|
42 |
$active_tab = isset ($active_tabs [0]) ? $active_tabs [0] : $start;
|
43 |
if (!is_numeric ($active_tab)) $active_tab = 1;
|
44 |
if ($active_tab != 0)
|
111 |
$rating_value = $rating_string == '' ? '' : number_format ($rating_string, 1);
|
112 |
|
113 |
if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) $used_blocks = unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]); else $used_blocks = array ();
|
114 |
+
|
115 |
+
if (!isset ($_GET ['settings'])): // start of code only for normal settings
|
116 |
+
|
117 |
?>
|
118 |
|
119 |
<div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo $ai_wp_data [AI_JS_DEBUGGING] ? '1' : '0'; ?>" ></div>
|
121 |
if (function_exists ('ai_data_2')) ai_data_2 ();
|
122 |
?>
|
123 |
|
124 |
+
<div id="ai-clipboard" style="display: none;"></div>
|
125 |
+
|
126 |
<div style="clear: both;"></div>
|
127 |
|
128 |
<div id="ai-settings" style="float: left;">
|
137 |
<h2 id="plugin_name" style="display: inline-block; margin: 5px 0;"><?php echo AD_INSERTER_NAME . ' ' . AD_INSERTER_VERSION ?></h2>
|
138 |
</div>
|
139 |
<div id="header-buttons">
|
140 |
+
<img id="ai-loading" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>loading.gif" style="width: 24px; height: 24px; vertical-align: middle; margin-right: 20px; display: none;" />
|
141 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('http://adinserter.pro/documentation')" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button>
|
142 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter')" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button>
|
143 |
<button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4')" title="Support Free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!">Donate</button>
|
183 |
<div style="clear: both;"></div>
|
184 |
</div>
|
185 |
|
186 |
+
<div id="rotation-tabs" style="display: none;">
|
187 |
+
<ul>
|
188 |
+
<li class="ai-rotate-option"><a></a></li>
|
189 |
+
</ul>
|
190 |
+
|
191 |
+
<div class="responsive-table rounded">
|
192 |
+
<table class="ai-settings-table" style="">
|
193 |
+
<tr>
|
194 |
+
<td style="padding-right: 7px;">
|
195 |
+
Option Name
|
196 |
+
</td>
|
197 |
+
<td style="width: 100%;">
|
198 |
+
<input class="option-name" style="width: 100%;" type="text" size="50" maxlength="200" />
|
199 |
+
</td>
|
200 |
+
<td style="width: 130px;">
|
201 |
+
</td>
|
202 |
+
</tr>
|
203 |
+
</table>
|
204 |
+
<div style="clear: both;"></div>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<div id="ai-error-container" class="rounded" style="border-color: red; display: none;"></div>
|
210 |
+
|
211 |
<div id="ai-container">
|
212 |
+
|
213 |
+
<?php endif; // of code only for normal settings ?>
|
214 |
+
|
215 |
<div id="ai-tab-container" class="ai-form rounded" style="padding-bottom: 1px;">
|
216 |
+
|
217 |
<div id="dummy-tabs" style="height: 30px; padding: .2em .2em 0;"></div>
|
218 |
|
219 |
<div id="ai-scroll-tabs" class="scroll_tabs_theme_light" style="display: none;">
|
220 |
<?php
|
221 |
|
222 |
+
for ($block = $start; $block <= $end; $block ++){
|
223 |
+
echo " <span id='ai-scroll-tab-$block' rel='$block'>$block</span>";
|
224 |
}
|
225 |
?>
|
226 |
<span rel='0'>0</span>
|
235 |
// $widget_options = get_option ('widget_ai_widget');
|
236 |
|
237 |
// $sidebars_with_widgets = array ();
|
238 |
+
//// for ($block = $start; $block <= $end; $block ++){
|
239 |
+
// for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++){
|
240 |
+
// $sidebars_with_widget [$block]= array ();
|
241 |
// }
|
242 |
// foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
|
243 |
// if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
|
265 |
$manual = array ();
|
266 |
$sidebars = array ();
|
267 |
|
268 |
+
for ($block = $start; $block <= $end; $block ++){
|
269 |
+
$obj = $block_object [$block];
|
270 |
|
271 |
$automatic = $obj->get_automatic_insertion() != AI_AUTOMATIC_INSERTION_DISABLED;
|
272 |
|
273 |
+
$manual_widget [$block] = $obj->get_enable_widget() == AI_ENABLED;
|
274 |
+
$manual_shortcode [$block] = $obj->get_enable_manual() == AI_ENABLED;
|
275 |
+
$manual_php_function [$block] = $obj->get_enable_php_call() == AI_ENABLED;
|
276 |
+
$manual [$block] = ($manual_widget [$block] && !empty ($sidebars_with_widget [$block])) || $manual_shortcode [$block] || $manual_php_function [$block];
|
277 |
|
278 |
$style = "";
|
279 |
$ad_name = "";
|
280 |
+
$sidebars [$block] = "";
|
281 |
+
if ($automatic && $manual [$block]) $style = "font-weight: bold; color: #c4f;";
|
282 |
elseif ($automatic) $style = "font-weight: bold; color: #e44;";
|
283 |
+
elseif ($manual [$block]) $style = "font-weight: bold; color: #66f;";
|
284 |
|
285 |
if (!wp_is_mobile ()) {
|
286 |
$ad_name = $obj->get_ad_name();
|
291 |
$ad_name_functions = true;
|
292 |
}
|
293 |
|
294 |
+
if (!empty ($sidebars_with_widget [$block])) $sidebars [$block] = implode (", ", $sidebars_with_widget [$block]);
|
295 |
+
if ($manual_widget [$block]) {
|
296 |
+
if ($sidebars [$block] != "") {
|
297 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
298 |
+
$ad_name .= "Widget used in: [".$sidebars [$block]."]";
|
299 |
$ad_name_functions = true;
|
300 |
}
|
301 |
} else {
|
302 |
+
if (!empty ($sidebars_with_widget [$block])) {
|
303 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
304 |
+
$ad_name .= "Widget DISABLED but used in: [".$sidebars [$block]."]";
|
305 |
$ad_name_functions = true;
|
306 |
}
|
307 |
}
|
308 |
|
309 |
+
if ($manual_shortcode [$block]) {
|
310 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
311 |
$ad_name .= "Shortcode";
|
312 |
$ad_name_functions = true;
|
313 |
}
|
314 |
+
if ($manual_php_function [$block]) {
|
315 |
$ad_name .= $ad_name_functions ? ", " : ": ";
|
316 |
$ad_name .= "PHP function";
|
317 |
$ad_name_functions = true;
|
319 |
}
|
320 |
|
321 |
echo "
|
322 |
+
<li id=\"ai-tab$block\" class=\"ai-tab\" title=\"$ad_name\"><a href=\"#tab-$block\"><span style=\"", $style, "\">$block</span></a></li>";
|
323 |
|
324 |
}
|
325 |
|
343 |
</ul>
|
344 |
|
345 |
<?php
|
346 |
+
for ($block = $start; $block <= $end + 1; $block ++){
|
347 |
+
|
348 |
+
if ($block <= $end) {
|
349 |
+
$default->number = $block;
|
350 |
+
$default->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." ".$block;
|
351 |
|
352 |
+
$tab_visible = $block == $active_tab || $generate_all;
|
|
|
353 |
|
354 |
+
$obj = $block_object [$block];
|
355 |
+
} else {
|
356 |
+
$default->number = 0;
|
357 |
+
$default->wp_options [AI_OPTION_BLOCK_NAME] = AD_NAME." 0";
|
358 |
+
|
359 |
+
$tab_visible = false;
|
360 |
|
361 |
+
$obj = $default;
|
362 |
+
|
363 |
+
$block = 999;
|
364 |
+
}
|
365 |
|
366 |
$client_side_devices = $obj->get_detection_client_side () == AI_ENABLED;
|
367 |
$server_side_devices = $obj->get_detection_server_side () == AI_ENABLED;
|
382 |
$show_lists = $cat_list != '' || $tag_list != '' || $taxonomy_list != '' || $id_list != '' || $url_list != '' || $url_parameter_list != '' || $domain_list != '' || $lists;
|
383 |
if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
|
384 |
|
385 |
+
$show_manual = $manual [$block];
|
386 |
+
if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$block] || empty ($sidebars_with_widget [$block]) ? "#66f;" : "#e44;"); else $manual_style = "";
|
387 |
|
388 |
$insertion_options =
|
389 |
$obj->get_maximum_insertions () ||
|
442 |
$filter_type = $obj->get_filter_type();
|
443 |
|
444 |
?>
|
445 |
+
<div id="tab-<?php echo $block; ?>" style="padding: 0;<?php echo $tab_visible ? "" : " display: none;" ?>">
|
446 |
+
<div class="ai-toolbars">
|
447 |
+
|
448 |
+
<div id="ai-main-toolbar-<?php echo $block; ?>" class="max-input" style="margin: 8px 0 0 2px; height: 28px; width: 731px;">
|
449 |
+
<span id="name-label-container-<?php echo $block; ?>" style="display: table-cell; width: 100%; padding: 0; font-weight: bold; cursor: pointer;">
|
450 |
+
<input id="name-edit-<?php echo $block; ?>" style="width: 100%; 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" />
|
451 |
+
<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>
|
452 |
+
</span>
|
453 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
454 |
+
<span class="ai-toolbar-button ai-settings">
|
455 |
+
<input type="checkbox" value="0" id="simple-editor-<?php echo $block; ?>" class="simple-editor-button" style="display: none;" />
|
456 |
+
<label class="checkbox-button" for="simple-editor-<?php echo $block; ?>" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
457 |
+
</span>
|
458 |
<?php endif; ?>
|
|
|
459 |
|
460 |
<?php if (defined ('AI_CODE_GENERATOR')) : ?>
|
461 |
+
<span class="ai-toolbar-button ai-settings">
|
462 |
+
<input type="checkbox" id="tools-button-<?php echo $block; ?>" style="display: none;" />
|
463 |
+
<label class="checkbox-button tools-button" for="tools-button-<?php echo $block; ?>" title="Toggle tools"><span class="checkbox-icon icon-tools"></span></label>
|
464 |
+
</span>
|
465 |
<?php endif; ?>
|
466 |
|
467 |
+
<span class="ai-toolbar-button ai-settings">
|
468 |
+
<input type="hidden" name="<?php echo AI_OPTION_PROCESS_PHP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
469 |
+
<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;" />
|
470 |
+
<label class="checkbox-button" for="process-php-<?php echo $block; ?>" title="Process PHP code in block"><span class="checkbox-icon icon-php<?php if ($obj->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
|
471 |
+
</span>
|
472 |
+
<?php if (function_exists ('ai_settings_top_buttons_2')) ai_settings_top_buttons_2 ($block, $obj, $default); ?>
|
473 |
+
</div>
|
474 |
+
|
475 |
+
<div class="ai-settings">
|
476 |
+
<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;">
|
477 |
+
<?php if (function_exists ('ai_settings_top_buttons_1')) ai_settings_top_buttons_1 ($block, $obj, $default); ?>
|
478 |
+
<?php if (defined ('AI_CODE_GENERATOR')) : ?>
|
479 |
+
<span class="ai-toolbar-button ai-button-left">
|
480 |
+
<input type="checkbox" id="code-generator-<?php echo $block; ?>" style="display: none;" />
|
481 |
+
<label class="checkbox-button code-generator-button" for="code-generator-<?php echo $block; ?>" title="Toggle code generator"><span class="checkbox-icon icon-code"></span></label>
|
482 |
+
</span>
|
483 |
+
<span class="ai-toolbar-button ai-button-left">
|
484 |
+
<input type="checkbox" id="rotation-<?php echo $block; ?>" style="display: none;" />
|
485 |
+
<label class="checkbox-button rotation-button" for="rotation-<?php echo $block; ?>" title="Toggle rotation editor"><span class="checkbox-icon icon-rotation"></span></label>
|
486 |
+
</span>
|
487 |
+
<span class="ai-toolbar-button ai-button-left">
|
488 |
+
<input type="checkbox" id="visual-editor-<?php echo $block; ?>" style="display: none;" />
|
489 |
+
<label class="checkbox-button" for="visual-editor-<?php echo $block; ?>" title="Open visual HTML editor"><span class="checkbox-icon icon-edit"></span></label>
|
490 |
+
</span>
|
491 |
+
|
492 |
+
<span style="display: table-cell; width: 100%;"></span>
|
493 |
+
|
494 |
+
<span class="ai-toolbar-button" style="padding-right: 15px;">
|
495 |
+
<input type="checkbox" id="clear-block-<?php echo $block; ?>" style="display: none;" />
|
496 |
+
<label class="checkbox-button" for="clear-block-<?php echo $block; ?>" title="Clear block"><span class="checkbox-icon icon-clear"></span></label>
|
497 |
+
</span>
|
498 |
+
|
499 |
+
<span class="ai-toolbar-button">
|
500 |
+
<input type="checkbox" id="copy-block-<?php echo $block; ?>" class="ai-copy" style="display: none;" />
|
501 |
+
<label class="checkbox-button" for="copy-block-<?php echo $block; ?>" title="Copy block"><span class="checkbox-icon icon-copy"></span></label>
|
502 |
+
</span>
|
503 |
+
<span class="ai-toolbar-button">
|
504 |
+
<input type="checkbox" id="paste-name-<?php echo $block; ?>" style="display: none;" />
|
505 |
+
<label class="checkbox-button" for="paste-name-<?php echo $block; ?>" title="Paste name"><span class="checkbox-icon icon-paste-name"></span></label>
|
506 |
+
</span>
|
507 |
+
<span class="ai-toolbar-button">
|
508 |
+
<input type="checkbox" id="paste-code-<?php echo $block; ?>" style="display: none;" />
|
509 |
+
<label class="checkbox-button" for="paste-code-<?php echo $block; ?>" title="Paste code"><span class="checkbox-icon icon-paste-code"></span></label>
|
510 |
+
</span>
|
511 |
+
<span class="ai-toolbar-button">
|
512 |
+
<input type="checkbox" id="paste-settings-<?php echo $block; ?>" style="display: none;" />
|
513 |
+
<label class="checkbox-button" for="paste-settings-<?php echo $block; ?>" title="Paste settings"><span class="checkbox-icon icon-paste-settings"></span></label>
|
514 |
+
</span>
|
515 |
+
<span class="ai-toolbar-button">
|
516 |
+
<input type="checkbox" id="paste-block-<?php echo $block; ?>" style="display: none;" />
|
517 |
+
<label class="checkbox-button" for="paste-block-<?php echo $block; ?>" title="Paste block (name, code and settings)"><span class="checkbox-icon icon-paste"></span></label>
|
518 |
+
</span>
|
519 |
+
<?php endif; ?>
|
520 |
+
</div>
|
521 |
+
</div>
|
522 |
+
|
523 |
</div>
|
524 |
|
525 |
+
<?php if (function_exists ('ai_settings_container')) ai_settings_container ($block, $obj); ?>
|
526 |
|
527 |
+
<div id="settings-<?php echo $block; ?>">
|
528 |
|
529 |
<?php if (defined ('AI_CODE_GENERATOR')) : ?>
|
530 |
+
<div id="ai-rotation-container-<?php echo $block; ?>" class='ai-rotate' style="padding: 0; margin: 8px 0; border: 0; display: none;">
|
531 |
|
532 |
+
<div class="max-input" style="height: 28px; position: absolute; top: 4px; left: -6px;">
|
533 |
+
<span style="display: table-cell; width: 100%;"></span>
|
534 |
+
<span class="ai-toolbar-button">
|
535 |
+
<input type="checkbox" id="remove-option-<?php echo $block; ?>" style="display: none;" />
|
536 |
+
<label class="checkbox-button" for="remove-option-<?php echo $block; ?>" title="Remove option"><span class="checkbox-icon icon-minus"></span></label>
|
537 |
+
</span>
|
538 |
+
<span class="ai-toolbar-button">
|
539 |
+
<input type="checkbox" id="add-option-<?php echo $block; ?>" style="display: none;" />
|
540 |
+
<label class="checkbox-button" for="add-option-<?php echo $block; ?>" title="Add option"><span class="checkbox-icon icon-plus"></span></label>
|
541 |
+
</span>
|
542 |
+
</div>
|
543 |
|
544 |
+
<ul>
|
|
|
|
|
|
|
545 |
</ul>
|
546 |
|
547 |
+
</div>
|
548 |
+
|
549 |
+
<div id="ai-code-generator-container-<?php echo $block; ?>" style="padding: 0; margin: 8px 0; border: 0; display: none;">
|
550 |
+
|
551 |
+
<div class="max-input" style="height: 28px; position: absolute; top: 4px; left: -6px;">
|
552 |
+
<span style="display: table-cell; width: 100%;"></span>
|
553 |
+
<span class="ai-toolbar-button">
|
554 |
+
<input type="checkbox" id="import-code-<?php echo $block; ?>" style="display: none;" />
|
555 |
+
<label class="checkbox-button" for="import-code-<?php echo $block; ?>" title="Import code"><span class="checkbox-icon icon-import"></span></label>
|
556 |
+
</span>
|
557 |
+
<span class="ai-toolbar-button">
|
558 |
+
<input type="checkbox" id="generate-code-<?php echo $block; ?>" style="display: none;" />
|
559 |
+
<label class="checkbox-button" for="generate-code-<?php echo $block; ?>" title="Generate code"><span class="checkbox-icon icon-generate"></span></label>
|
560 |
+
</span>
|
561 |
</div>
|
562 |
|
563 |
+
<ul>
|
564 |
+
<li id="ai-banner-<?php echo $block; ?>"><a href="#tab-banner-<?php echo $block; ?>">Banner</a></li>
|
565 |
+
<li id="ai-adsense-pub-id-<?php echo $block; ?>"><a href="#tab-adsense-<?php echo $block; ?>">AdSense</a></li>
|
566 |
+
</ul>
|
567 |
+
|
568 |
+
<div id="tab-banner-<?php echo $block; ?>" class="ai-banner ai-banner-top responsive-table rounded">
|
569 |
+
<div class="banner-preview">
|
570 |
+
<a id="banner-link-<?php echo $block; ?>" href="" target="_blank"><img id="banner-image-<?php echo $block; ?>" src="" /></a>
|
571 |
+
</div>
|
572 |
+
<table class="ai-settings-table">
|
573 |
<tr>
|
574 |
<td style="padding-right: 7px;">
|
575 |
Image
|
576 |
</td>
|
577 |
+
<td style="width: 98%;">
|
578 |
+
<input id="banner-image-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
|
|
|
|
|
|
|
579 |
</td>
|
580 |
</tr>
|
581 |
<tr>
|
582 |
<td>
|
583 |
Link
|
584 |
</td>
|
585 |
+
<td>
|
586 |
+
<input id="banner-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
|
587 |
+
</td>
|
588 |
+
</tr>
|
589 |
+
<tr>
|
590 |
+
<td>
|
591 |
+
<input type="checkbox" id="open-new-window-<?php echo $block; ?>" />
|
592 |
</td>
|
593 |
<td>
|
594 |
+
<label for="open-new-window-<?php echo $block; ?>" style="display: inline-block; margin-top: 6px;">Open link in a new tab</label>
|
595 |
+
<button id="open-image-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; float: right; margin: 0;">Select Image</button>
|
596 |
</td>
|
597 |
</tr>
|
598 |
</table>
|
599 |
<div style="clear: both;"></div>
|
600 |
</div>
|
601 |
|
602 |
+
<div id="tab-adsense-<?php echo $block; ?>" class="responsive-table rounded">
|
603 |
<table class="ai-settings-table" style="">
|
604 |
<tr>
|
605 |
<td>
|
606 |
Publisher ID
|
607 |
</td>
|
608 |
<td style="width: 50%; padding-left: 7px;">
|
609 |
+
<input id="adsense-publisher-id-<?php echo $block; ?>" style="width: 100%;" type="text" size="30" maxlength="30" />
|
610 |
</td>
|
611 |
<td class="adsense-layout" style="padding-left: 7px;">
|
612 |
Layout
|
613 |
</td>
|
614 |
<td class="adsense-layout" style="width: 50%; padding-left: 7px;">
|
615 |
+
<input id="adsense-layout-<?php echo $block; ?>" style="width: 100%;" type="text" size="80" maxlength="100" />
|
616 |
</td>
|
617 |
</tr>
|
618 |
|
621 |
Ad Slot ID
|
622 |
</td>
|
623 |
<td style="width: 50%; padding-left: 7px;">
|
624 |
+
<input id="adsense-ad-slot-id-<?php echo $block; ?>" style="width: 100%;" type="text" size="30" maxlength="30" />
|
625 |
</td>
|
626 |
<td class="adsense-layout" style="padding-left: 7px;">
|
627 |
Layout Key
|
628 |
</td>
|
629 |
<td class="adsense-layout" style="width: 50%; padding-left: 7px;">
|
630 |
+
<input id="adsense-layout-key-<?php echo $block; ?>" style="width: 100%;" type="text" size="80" maxlength="100" />
|
631 |
</td>
|
632 |
</tr>
|
633 |
|
636 |
Ad Type
|
637 |
</td>
|
638 |
<td style="padding-left: 7px;">
|
639 |
+
<select id="adsense-type-<?php echo $block; ?>">
|
640 |
<option value="<?php echo AI_ADSENSE_STANDARD; ?>" selected><?php echo AI_TEXT_STANDARD; ?></option>
|
641 |
<option value="<?php echo AI_ADSENSE_LINK; ?>"><?php echo AI_TEXT_LINK; ?></option>
|
642 |
<option value="<?php echo AI_ADSENSE_IN_ARTICLE; ?>"><?php echo AI_TEXT_IN_ARTICLE; ?></option>
|
643 |
<option value="<?php echo AI_ADSENSE_IN_FEED; ?>"><?php echo AI_TEXT_IN_FEED; ?></option>
|
644 |
<option value="<?php echo AI_ADSENSE_MATCHED_CONTENT; ?>"><?php echo AI_TEXT_MATCHED_CONTENT; ?></option>
|
645 |
+
<option value="<?php echo AI_ADSENSE_AUTO; ?>"><?php echo AI_TEXT_AUTO; ?></option>
|
646 |
</select>
|
647 |
<div class="adsense-responsive" style="float: right; margin-top: 3px;">
|
648 |
+
<input type="checkbox" id="adsense-responsive-<?php echo $block; ?>" />
|
649 |
+
<label for="adsense-responsive-<?php echo $block; ?>">Responsive</label>
|
650 |
</div>
|
651 |
</td>
|
652 |
<td>
|
|
|
653 |
</td>
|
654 |
+
<td style="padding-left: 7px;">
|
655 |
+
<span class="adsense-size">
|
656 |
+
Width
|
657 |
+
<input id="adsense-width-<?php echo $block; ?>" style="width: 50px;" type="text" size="5" maxlength="5" />
|
|
|
|
|
|
|
658 |
px
|
659 |
+
<span style="float: right;">
|
660 |
+
Height
|
661 |
+
<input id="adsense-height-<?php echo $block; ?>" style="width: 50px;" type="text" size="5" maxlength="5" />
|
662 |
+
px
|
663 |
+
</span>
|
664 |
+
</span>
|
665 |
+
</td>
|
666 |
+
</tr>
|
667 |
+
|
668 |
+
<tr>
|
669 |
+
<td>
|
670 |
+
AMP Ad
|
671 |
+
</td>
|
672 |
+
<td style="padding-left: 7px;">
|
673 |
+
<select id="adsense-amp-<?php echo $block; ?>">
|
674 |
+
<option value="<?php echo AI_ADSENSE_AMP_DISABLED; ?>" selected><?php echo AI_TEXT_DISABLED; ?></option>
|
675 |
+
<option value="<?php echo AI_ADSENSE_AMP_ABOVE_THE_FOLD; ?>"><?php echo AI_TEXT_ABOVE_THE_FOLD; ?></option>
|
676 |
+
<option value="<?php echo AI_ADSENSE_AMP_BELOW_THE_FOLD; ?>"><?php echo AI_TEXT_BELOW_THE_FOLD; ?></option>
|
677 |
+
</select>
|
678 |
+
</td>
|
679 |
+
<td>
|
680 |
+
</td>
|
681 |
+
<td style="padding-left: 7px;">
|
682 |
</td>
|
683 |
</tr>
|
684 |
</table>
|
686 |
|
687 |
</div>
|
688 |
|
689 |
+
<!-- <div style="padding: 0; min-height: 28px;">-->
|
690 |
+
<!-- <div style="float: left;">-->
|
691 |
+
<!-- <button id="import-button2-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="">Import</button>-->
|
692 |
+
<!-- </div>-->
|
693 |
+
<!-- <div style="float: right;">-->
|
694 |
+
<!-- <button id="generate-button2-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="">Generate</button>-->
|
695 |
+
<!-- </div>-->
|
696 |
+
<!-- <div style="clear: both;"></div>-->
|
697 |
+
<!-- </div>-->
|
698 |
|
699 |
</div>
|
700 |
<?php endif; ?>
|
701 |
|
702 |
<div style="margin: 8px 0;">
|
703 |
+
<textarea id="block-<?php echo $block; ?>" class="simple-editor" style="background-color:#F9F9F9; font-family: Courier, 'Courier New', monospace; font-weight: bold;" name="<?php echo AI_OPTION_CODE, WP_FORM_FIELD_POSTFIX, $block; ?>"><?php echo esc_textarea ($obj->get_ad_data()); ?></textarea>
|
704 |
</div>
|
705 |
|
706 |
<div style="padding: 0; min-height: 28px;">
|
707 |
<div style="float: left;">
|
708 |
+
<button id="lists-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="White/Black-list Category, Tag, Url, Referer (domain) or Country"><span style="<?php echo $lists_style; ?>">Lists</span></button>
|
709 |
+
<button id="manual-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="Widget, Shortcode and PHP function call"><span style="<?php echo $manual_style; ?>">Manual</span></button>
|
710 |
+
<button id="device-detection-button-<?php echo $block; ?>" class='ai-button' type="button" style="display: none; margin-right: 4px;" title="Client/Server-side Device Detection (Desktop, Tablet, Phone,...)"><span style="<?php echo $devices_style; ?>">Devices</span></button>
|
711 |
+
<button id="misc-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="Check for user status, Limit insertions, [error 404 page, Ajax requests, RSS feeds], Filter, Scheduling, General tag"><span style="<?php echo $misc_style; ?>">Misc</span></button>
|
712 |
+
<button id="preview-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; margin-right: 4px;" title="Preview saved code above" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
|
713 |
</div>
|
714 |
<div style="float: right;">
|
715 |
<?php if (function_exists ('ai_settings_bottom_buttons')) ai_settings_bottom_buttons ($start, $end); else { ?>
|
722 |
<div class="rounded">
|
723 |
<div style="float: left;">
|
724 |
Automatic Insertion:
|
725 |
+
<select class="ai-image-selection" style="margin-bottom: 3px;" id="display-type-<?php echo $block; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_automatic_insertion(); ?>" style="width:200px;">
|
726 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
727 |
<?php if (defined ('AI_BUFFERING')) : ?>
|
728 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
729 |
<?php endif; ?>
|
730 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
731 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
732 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
733 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
734 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
735 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
736 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
737 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
738 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
739 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
740 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
741 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
742 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
743 |
<?php foreach ($ai_custom_hooks as $hook_index => $custom_hook) { ?>
|
744 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
745 |
<?php } ?>
|
746 |
</select>
|
747 |
</div>
|
748 |
|
749 |
<div style="float: right;">
|
750 |
Alignment and Style:
|
751 |
+
<select style="width:130px;" 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(); ?>">
|
752 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
753 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
754 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
755 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
756 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
757 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
758 |
<?php $css_code_height = 260; if (function_exists ('ai_style_options')) $css_code_height = ai_style_options ($obj); ?>
|
759 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
760 |
+
<option data-img-src="<?php echo plugins_url ('css/images/blank.png', __FILE__); ?>" data-img-class="automatic-insertion 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>
|
761 |
</select>
|
762 |
|
763 |
+
<button id="show-css-button-<?php echo $block; ?>" type="button" class='ai-button' style="min-width: 60px; margin-right: 0px;">Show</button>
|
764 |
</div>
|
765 |
<div style="clear: both;"></div>
|
766 |
|
767 |
+
<!-- <div id="css-code-<?php echo $block; ?>" style="height: <?php echo $css_code_height; ?>px; margin: 4px 0 2px; display: none;">-->
|
768 |
+
<div id="css-code-<?php echo $block; ?>" style="margin: 4px 0 2px; display: none;">
|
769 |
+
<div id="automatic-insertion-<?php echo $block; ?>"></div>
|
770 |
+
<div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
|
771 |
<div class="max-input">
|
772 |
+
<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>
|
773 |
+
<input id="custom-css-<?php echo $block; ?>" style="width: 100%; display: none; font-family: Courier, 'Courier New', monospace; 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="160" title="Custom CSS code for wrapping div" />
|
774 |
<span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
|
775 |
+
<span id="css-no-wrapping-<?php echo $block; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
|
776 |
+
<span id="css-none-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_DEFAULT); ?></span>
|
777 |
+
<span id="css-left-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_LEFT); ?></span>
|
778 |
+
<span id="css-right-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_RIGHT); ?></span>
|
779 |
+
<span id="css-center-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_CENTER); ?></span>
|
780 |
+
<span id="css-float-left-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_FLOAT_LEFT); ?></span>
|
781 |
+
<span id="css-float-right-<?php echo $block; ?>" class='css-code-<?php echo $block; ?>' style="height: 18px; padding-right: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignment_style (AI_ALIGNMENT_FLOAT_RIGHT); ?></span>
|
782 |
+
<?php if (function_exists ('ai_style_css')) ai_style_css ($block, $obj); ?>
|
783 |
</span>
|
784 |
+
<span style="display:table-cell; width: 46px;" ><button id="edit-css-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: table-cell; padding: 0; margin: 0 0 0 8px;">Edit</button></span>
|
785 |
</div>
|
786 |
</div>
|
787 |
</div>
|
790 |
<table>
|
791 |
<tr>
|
792 |
<td style="width: 70%; padding-bottom: 5px;">
|
793 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_POSTS, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
794 |
+
<input 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(); ?>" id="display-posts-<?php echo $block; ?>" title="Enable or disable insertion on posts" <?php if ($obj->get_display_settings_post()==AI_ENABLED) echo 'checked '; ?> />
|
795 |
|
796 |
+
<select style="margin: 0 0 0 10px;" id="enabled-on-which-posts-<?php echo $block; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_POSTS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_enabled_on_which_posts(); ?>" style="width:160px">
|
797 |
<option value="<?php echo AI_NO_INDIVIDUAL_EXCEPTIONS; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_NO_INDIVIDUAL_EXCEPTIONS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_INDIVIDUAL_EXCEPTIONS; ?></option>
|
798 |
<option value="<?php echo AI_INDIVIDUALLY_DISABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_INDIVIDUALLY_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_DISABLED; ?></option>
|
799 |
<option value="<?php echo AI_INDIVIDUALLY_ENABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_posts()==AI_INDIVIDUALLY_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_ENABLED; ?></option>
|
800 |
</select>
|
801 |
|
802 |
+
<label for="display-posts-<?php echo $block; ?>" title="Individual post exceptions (if enabled here) can be configured in post editor. Leave blank for no individual post exceptions.">Posts</label>
|
803 |
|
804 |
<?php
|
805 |
+
if (!empty ($block_exceptions [$block])) {
|
806 |
?>
|
807 |
+
<button id="exceptions-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; width: 15px; height: 15px; margin-left: 20px;" title="Toggle list of individual exceptions"></button>
|
808 |
<?php
|
809 |
}
|
810 |
?>
|
813 |
<td style="padding-left: 8px;">
|
814 |
</td>
|
815 |
<td style="padding-left: 8px;">
|
816 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_HOMEPAGE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
817 |
+
<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="Enable or disable insertion on homepage: latest posts (including sub-pages), static page or theme homepage" value="1" default="<?php echo $default->get_display_settings_home(); ?>" <?php if ($obj->get_display_settings_home()==AI_ENABLED) echo 'checked '; ?> />
|
818 |
+
<label for="display-homepage-<?php echo $block; ?>" title="Enable or disable insertion on homepage: latest posts (including sub-pages), static page or theme homepage">Homepage</label>
|
819 |
</td>
|
820 |
<td style="padding-left: 8px;">
|
821 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_CATEGORY_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
822 |
+
<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="Enable or disable insertion on category blog pages (including sub-pages)" value="1" default="<?php echo $default->get_display_settings_category(); ?>" <?php if ($obj->get_display_settings_category()==AI_ENABLED) echo 'checked '; ?> />
|
823 |
+
<label for="display-category-<?php echo $block; ?>" title="Enable or disable insertion on category blog pages (including sub-pages)">Category pages</label>
|
824 |
</td>
|
825 |
</tr>
|
826 |
|
827 |
<tr>
|
828 |
<td style="width: 70%">
|
829 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
830 |
+
<input 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(); ?>" id="display-pages-<?php echo $block; ?>" title="Enable or disable insertion on static pages" <?php if ($obj->get_display_settings_page()==AI_ENABLED) echo 'checked '; ?> />
|
831 |
|
832 |
+
<select style="margin: 0 0 0 10px;" id="enabled-on-which-pages-<?php echo $block; ?>" name="<?php echo AI_OPTION_ENABLED_ON_WHICH_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_enabled_on_which_pages(); ?>" style="width:160px">
|
833 |
<option value="<?php echo AI_NO_INDIVIDUAL_EXCEPTIONS; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_NO_INDIVIDUAL_EXCEPTIONS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_INDIVIDUAL_EXCEPTIONS; ?></option>
|
834 |
<option value="<?php echo AI_INDIVIDUALLY_DISABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_INDIVIDUALLY_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_DISABLED; ?></option>
|
835 |
<option value="<?php echo AI_INDIVIDUALLY_ENABLED; ?>" <?php echo ($obj->get_ad_enabled_on_which_pages()==AI_INDIVIDUALLY_ENABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INDIVIDUALLY_ENABLED; ?></option>
|
836 |
</select>
|
837 |
|
838 |
+
<label for="display-pages-<?php echo $block; ?>" title="Individual static page exceptions (if enabled here) can be configured in page editor. Leave blank for no individual page exceptions.">Static pages</label>
|
839 |
</td>
|
840 |
<td style="padding-left: 8px;">
|
841 |
</td>
|
842 |
<td style="padding-left: 8px;">
|
843 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_SEARCH_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
844 |
+
<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="Enable or disable insertion on search blog pages" value="1" default="<?php echo $default->get_display_settings_search(); ?>" <?php if ($obj->get_display_settings_search()==AI_ENABLED) echo 'checked '; ?> />
|
845 |
+
<label for="display-search-<?php echo $block; ?>" title="Enable or disable insertion on search blog pages">Search pages</label>
|
846 |
</td>
|
847 |
<td style="padding-left: 8px;">
|
848 |
+
<input type="hidden" name="<?php echo AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
849 |
+
<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="Enable or disable insertion on tag or archive blog pages" value="1" default="<?php echo $default->get_display_settings_archive(); ?>" <?php if ($obj->get_display_settings_archive()==AI_ENABLED) echo 'checked '; ?> />
|
850 |
+
<label for="display-archive-<?php echo $block; ?>" title="Enable or disable insertion on tag or archive blog pages">Tag / Archive pages</label>
|
851 |
</td>
|
852 |
</tr>
|
853 |
</table>
|
854 |
</div>
|
855 |
|
856 |
+
<div id="block-exceptions-<?php echo $block; ?>" class="responsive-table rounded" style="display: none;">
|
857 |
<?php
|
858 |
|
859 |
+
if (!empty ($block_exceptions [$block])) {
|
860 |
?>
|
861 |
<table class="exceptions" cellspacing=0 cellpadding=0><tbody>
|
862 |
<tr>
|
863 |
<th class="id">ID</th><th class="type">Type</th><th class="page page-only"> Title</th><th>
|
864 |
+
<input id="clear-block-exceptions-<?php echo $block; ?>"
|
865 |
+
onclick="if (confirm('Are you sure you want to clear all exceptions for block <?php echo $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"
|
866 |
+
title="Clear all exceptions for block <?php echo $block; ?>"
|
867 |
name="<?php echo AI_FORM_CLEAR_EXCEPTIONS; ?>"
|
868 |
value="❌"
|
869 |
type="submit"
|
870 |
style="padding: 1px 3px; border: 0; background: transparent; font-size: 8px; color: #e44;" /></th>
|
871 |
</tr>
|
872 |
<?php
|
873 |
+
foreach ($block_exceptions [$block] as $id => $exception) {
|
874 |
?>
|
875 |
<tr>
|
876 |
<td class="id"><a href="<?php
|
890 |
?>
|
891 |
</div>
|
892 |
|
893 |
+
<div id="paragraph-settings-<?php echo $block; ?>" class="rounded" style="<?php echo $paragraph_settings ? "" : " display: none;" ?>">
|
894 |
<!-- <div>-->
|
895 |
<div style="float: left; margin-top: 1px;">
|
896 |
Paragraph(s)
|
897 |
<input
|
898 |
type="text"
|
899 |
+
name="<?php echo AI_OPTION_PARAGRAPH_NUMBER, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
900 |
default="<?php echo $default->get_paragraph_number(); ?>"
|
901 |
value="<?php echo $obj->get_paragraph_number(); ?>"
|
902 |
title="Paragraph number or comma separated paragraph numbers or empty (means all paragraphs): 1 to N means paragraph number, 0 means random paragraph, value between 0 and 1 means relative position on the page (0.2 means paragraph at 20% of page height, 0.5 means paragraph halfway down the page, 0.9 means paragraph at 90% of page paragraphs, etc.)"
|
903 |
+
size="20"
|
904 |
+
maxlength="50" />
|
905 |
</div>
|
906 |
|
907 |
<div style="float: right;">
|
908 |
+
<button id="counting-button-<?php echo $block; ?>" type="button" class='ai-button' style="min-width: 85px; margin-right: 8px; display: none;">Counting</button>
|
909 |
+
<button id="clearance-button-<?php echo $block; ?>" type="button" class='ai-button' style="min-width: 85px; margin-right: 0px; display: none;">Clearance</button>
|
910 |
</div>
|
911 |
|
912 |
<div style="clear: both;"></div>
|
913 |
<!-- </div>-->
|
914 |
</div>
|
915 |
|
916 |
+
<div id="paragraph-counting-<?php echo $block; ?>" class="rounded" style="<?php echo $paragraph_counting ? "" : "display: none;" ?>">
|
917 |
<div class="max-input" style="margin: 0 0 8px 0;">
|
918 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
919 |
Count
|
920 |
+
<select name="<?php echo AI_OPTION_DIRECTION_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_direction_type(); ?>">
|
921 |
<option value="<?php echo AD_DIRECTION_FROM_TOP; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_TOP) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_TOP; ?></option>
|
922 |
<option value="<?php echo AD_DIRECTION_FROM_BOTTOM; ?>" <?php echo ($obj->get_direction_type()==AD_DIRECTION_FROM_BOTTOM) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DIRECTION_FROM_BOTTOM; ?></option>
|
923 |
</select>
|
927 |
<input
|
928 |
style="width: 100%;"
|
929 |
title="Comma separated HTML tag names, usually only 'p' tags are used"
|
930 |
+
type="text" name="<?php echo AI_OPTION_PARAGRAPH_TAGS, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
931 |
default="<?php echo $default->get_paragraph_tags(); ?>"
|
932 |
value="<?php echo $obj->get_paragraph_tags(); ?>"
|
933 |
size="12"
|
938 |
that have between
|
939 |
<input
|
940 |
type="text"
|
941 |
+
name="<?php echo AI_OPTION_MIN_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
942 |
default="<?php echo $default->get_minimum_paragraph_words(); ?>"
|
943 |
value="<?php echo $obj->get_minimum_paragraph_words(); ?>"
|
944 |
size="4"
|
946 |
and
|
947 |
<input
|
948 |
type="text"
|
949 |
+
name="<?php echo AI_OPTION_MAX_PARAGRAPH_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
950 |
default="<?php echo $default->get_maximum_paragraph_words(); ?>"
|
951 |
value="<?php echo $obj->get_maximum_paragraph_words(); ?>"
|
952 |
title="Maximum number of paragraph words, leave empty for no limit"
|
959 |
<div class="max-input" style="margin: 8px 0 8px 0;">
|
960 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
961 |
and
|
962 |
+
<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(); ?>">
|
963 |
<option value="<?php echo AD_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_CONTAIN; ?></option>
|
964 |
<option value="<?php echo AD_DO_NOT_CONTAIN; ?>" <?php echo ($obj->get_paragraph_text_type() == AD_DO_NOT_CONTAIN) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_CONTAIN; ?></option>
|
965 |
</select>
|
969 |
style="width: 100%;"
|
970 |
title="Comma separated text"
|
971 |
type="text"
|
972 |
+
name="<?php echo AI_OPTION_PARAGRAPH_TEXT, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
973 |
default="<?php echo $default->get_paragraph_text(); ?>"
|
974 |
value="<?php echo $obj->get_paragraph_text(); ?>"
|
975 |
maxlength="200" />
|
979 |
Minimum number of paragraphs
|
980 |
<input
|
981 |
type="text"
|
982 |
+
name="<?php echo AI_OPTION_MIN_PARAGRAPHS, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
983 |
default="<?php echo $default->get_paragraph_number_minimum(); ?>"
|
984 |
value="<?php echo $obj->get_paragraph_number_minimum() ?>"
|
985 |
size="2"
|
989 |
|
990 |
<div class="max-input" style="margin: 8px 0 0 0;">
|
991 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
992 |
+
<input type="hidden" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
993 |
+
<input id= "ignore_blockquote-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_COUNT_INSIDE_BLOCKQUOTE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_count_inside_blockquote(); ?>" <?php if ($obj->get_count_inside_blockquote()==AI_ENABLED) echo 'checked '; ?> />
|
994 |
+
<label for="ignore_blockquote-<?php echo $block; ?>" style="vertical-align: top;" title="Count also paragraphs inside <?php echo get_no_paragraph_counting_inside (); ?> elements - defined on general plugin settings page - Tab General">Count inside special elements</label>
|
995 |
</span>
|
996 |
|
997 |
<span class="small-input-tags" style="display: table-cell;">
|
1005 |
Minimum number of words in paragraphs above
|
1006 |
<input
|
1007 |
type="text"
|
1008 |
+
name="<?php echo AI_OPTION_MIN_WORDS_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1009 |
default="<?php echo $default->get_minimum_words_above(); ?>"
|
1010 |
value="<?php echo $obj->get_minimum_words_above() ?>"
|
1011 |
title="Used only with automatic insertion After paragraph and empty paragraph numbers"
|
1015 |
</div>
|
1016 |
</div>
|
1017 |
|
1018 |
+
<div id="paragraph-clearance-<?php echo $block; ?>" class="rounded" style="<?php echo $paragraph_clearance ? "" : "display: none;" ?>">
|
1019 |
<div class="max-input" style="margin: 0 0 8px 0">
|
1020 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1021 |
In
|
1022 |
<input
|
1023 |
type="text"
|
1024 |
+
name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1025 |
default="<?php echo $default->get_avoid_paragraphs_above(); ?>"
|
1026 |
value="<?php echo $obj->get_avoid_paragraphs_above(); ?>"
|
1027 |
title="Number of paragraphs above to check, leave empty to disable checking"
|
1034 |
style="width: 100%;"
|
1035 |
title="Comma separated text"
|
1036 |
type="text"
|
1037 |
+
name="<?php echo AI_OPTION_AVOID_TEXT_ABOVE, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1038 |
default="<?php echo $default->get_avoid_text_above(); ?>"
|
1039 |
value="<?php echo $obj->get_avoid_text_above(); ?>"
|
1040 |
maxlength="100" />
|
1046 |
In
|
1047 |
<input
|
1048 |
type="text"
|
1049 |
+
name="<?php echo AI_OPTION_AVOID_PARAGRAPHS_BELOW, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1050 |
default="<?php echo $default->get_avoid_paragraphs_below(); ?>"
|
1051 |
value="<?php echo $obj->get_avoid_paragraphs_below(); ?>"
|
1052 |
title="Number of paragraphs below to check, leave empty to disable checking"
|
1059 |
style="width: 100%;"
|
1060 |
title="Comma separated text"
|
1061 |
type="text"
|
1062 |
+
name="<?php echo AI_OPTION_AVOID_TEXT_BELOW, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1063 |
default="<?php echo $default->get_avoid_text_below(); ?>"
|
1064 |
value="<?php echo $obj->get_avoid_text_below(); ?>"
|
1065 |
maxlength="100" />
|
1068 |
|
1069 |
<div style="margin: 8px 0 0 0;">
|
1070 |
If text is found
|
1071 |
+
<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(); ?>">
|
1072 |
<option value="<?php echo AD_DO_NOT_INSERT; ?>" <?php echo ($obj->get_avoid_action() == AD_DO_NOT_INSERT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DO_NOT_INSERT; ?></option>
|
1073 |
<option value="<?php echo AD_TRY_TO_SHIFT_POSITION; ?>" <?php echo ($obj->get_avoid_action() == AD_TRY_TO_SHIFT_POSITION) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_TRY_TO_SHIFT_POSITION; ?></option>
|
1074 |
</select>
|
1075 |
+
<span id="check-up-to-<?php echo $block; ?>">
|
1076 |
— check up to
|
1077 |
<input
|
1078 |
type="text"
|
1079 |
+
name="<?php echo AI_OPTION_AVOID_TRY_LIMIT, WP_FORM_FIELD_POSTFIX, $block; ?>"
|
1080 |
default="<?php echo $default->get_avoid_try_limit(); ?>"
|
1081 |
value="<?php echo $obj->get_avoid_try_limit(); ?>"
|
1082 |
size="2"
|
1083 |
maxlength="3" />
|
1084 |
paragraphs
|
1085 |
+
<select style="margin-bottom: 3px;" name="<?php echo AI_OPTION_AVOID_DIRECTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_avoid_direction(); ?>">
|
1086 |
<option value="<?php echo AD_ABOVE; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE; ?></option>
|
1087 |
<option value="<?php echo AD_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_BELOW; ?></option>
|
1088 |
<option value="<?php echo AD_ABOVE_AND_THEN_BELOW; ?>" <?php echo ($obj->get_avoid_direction() == AD_ABOVE_AND_THEN_BELOW) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_ABOVE_AND_THEN_BELOW; ?></option>
|
1092 |
</div>
|
1093 |
</div>
|
1094 |
|
1095 |
+
<div class="responsive-table rounded" id="list-settings-<?php echo $block; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
|
1096 |
<table>
|
1097 |
<tbody>
|
1098 |
<tr>
|
1100 |
Categories
|
1101 |
</td>
|
1102 |
<td style="padding-right: 7px; width: 70%;">
|
1103 |
+
<input style="width: 100%;" title="Comma separated category slugs" 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="500" />
|
1104 |
</td>
|
1105 |
<td style="padding-right: 7px;">
|
1106 |
+
<input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="category-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1107 |
+
<label for="category-blacklist-<?php echo $block; ?>" title="Blacklist categories"><?php echo AD_BLACK_LIST; ?></label>
|
1108 |
</td>
|
1109 |
<td>
|
1110 |
+
<input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="category-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_cat_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1111 |
+
<label for="category-whitelist-<?php echo $block; ?>" title="Whitelist categories"><?php echo AD_WHITE_LIST; ?></label>
|
1112 |
</td>
|
1113 |
</tr>
|
1114 |
<tr>
|
1116 |
Tags
|
1117 |
</td>
|
1118 |
<td style="padding-right: 7px;">
|
1119 |
+
<input style="width: 100%;" title="Comma separated tags" 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="500"/>
|
1120 |
</td>
|
1121 |
<td style="padding-right: 7px;">
|
1122 |
+
<input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="tag-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1123 |
+
<label for="tag-blacklist-<?php echo $block; ?>" title="Blacklist tags"><?php echo AD_BLACK_LIST; ?></label>
|
1124 |
</td>
|
1125 |
<td>
|
1126 |
+
<input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="tag-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_tag_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1127 |
+
<label for="tag-whitelist-<?php echo $block; ?>" title="Whitelist tags"><?php echo AD_WHITE_LIST; ?></label>
|
1128 |
</td>
|
1129 |
</tr>
|
1130 |
<tr>
|
1132 |
Taxonomies
|
1133 |
</td>
|
1134 |
<td style="padding-right: 7px; width: 70%;">
|
1135 |
+
<input style="width: 100%;" title="Comma separated slugs: taxonomy, term or taxonomy:term" 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" />
|
1136 |
</td>
|
1137 |
<td style="padding-right: 7px;">
|
1138 |
+
<input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="taxonomy-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1139 |
+
<label for="category-blacklist-<?php echo $block; ?>" title="Blacklist taxonomies"><?php echo AD_BLACK_LIST; ?></label>
|
1140 |
</td>
|
1141 |
<td>
|
1142 |
+
<input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="taxonomy-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1143 |
+
<label for="category-whitelist-<?php echo $block; ?>" title="Whitelist taxonomies"><?php echo AD_WHITE_LIST; ?></label>
|
1144 |
</td>
|
1145 |
</tr>
|
1146 |
<tr>
|
1148 |
Post IDs
|
1149 |
</td>
|
1150 |
<td style="padding-right: 7px;">
|
1151 |
+
<input style="width: 100%;" title="Comma separated post/page IDs" 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="500"/>
|
1152 |
</td>
|
1153 |
<td style="padding-right: 7px;">
|
1154 |
+
<input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="id-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_id_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1155 |
+
<label for="id-blacklist-<?php echo $block; ?>" title="Blacklist IDs"><?php echo AD_BLACK_LIST; ?></label>
|
1156 |
</td>
|
1157 |
<td>
|
1158 |
+
<input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="id-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_id_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_id_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1159 |
+
<label for="id-whitelist-<?php echo $block; ?>" title="Whitelist IDs"><?php echo AD_WHITE_LIST; ?></label>
|
1160 |
</td>
|
1161 |
</tr>
|
1162 |
<tr>
|
1164 |
Urls
|
1165 |
</td>
|
1166 |
<td style="padding-right: 7px;">
|
1167 |
+
<input 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="500" title="SPACE 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)" />
|
1168 |
<br />
|
1169 |
+
<!-- <textarea id="urls2-<?php echo $block; ?>" style="width: 100%; height: 100px; font-family: Courier, 'Courier New', monospace; font-weight: bold;" name="XX_<?php echo AI_OPTION_CODE, WP_FORM_FIELD_POSTFIX, $block; ?>"><?php echo esc_textarea (str_replace (' ', "\n", $url_list)); ?></textarea>-->
|
1170 |
</td>
|
1171 |
<td style="padding-right: 7px;">
|
1172 |
+
<input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1173 |
+
<label for="url-blacklist-<?php echo $block; ?>" title="Blacklist urls"><?php echo AD_BLACK_LIST; ?></label>
|
1174 |
</td>
|
1175 |
<td>
|
1176 |
+
<input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_url_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1177 |
+
<label for="url-whitelist-<?php echo $block; ?>" title="Whitelist urls"><?php echo AD_WHITE_LIST; ?></label>
|
1178 |
</td>
|
1179 |
</tr>
|
1180 |
<tr>
|
1182 |
Url parameters
|
1183 |
</td>
|
1184 |
<td style="padding-right: 7px;">
|
1185 |
+
<input style="width: 100%;" title="Comma separated url query parameters or cookies with optional values (use 'prameter', 'prameter=value', 'cookie' or 'cookie=value')" 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="500"/>
|
1186 |
</td>
|
1187 |
<td style="padding-right: 7px;">
|
1188 |
+
<input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-parameter-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1189 |
+
<label for="url-parameter-blacklist-<?php echo $block; ?>" title="Blacklist url parameters"><?php echo AD_BLACK_LIST; ?></label>
|
1190 |
</td>
|
1191 |
<td>
|
1192 |
+
<input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-parameter-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_url_parameter_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1193 |
+
<label for="url-parameter-whitelist-<?php echo $block; ?>" title="Whitelist url parameters"><?php echo AD_WHITE_LIST; ?></label>
|
1194 |
</td>
|
1195 |
</tr>
|
1196 |
<tr>
|
1198 |
Referers
|
1199 |
</td>
|
1200 |
<td style="padding-right: 7px;">
|
1201 |
+
<input style="width: 100%;" title="Comma separated domains, use # for no referer" 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="500"/>
|
1202 |
</td>
|
1203 |
<td style="padding-right: 7px;">
|
1204 |
+
<input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="referer-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_BLACK_LIST; ?>" value="<?php echo AD_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_BLACK_LIST) echo 'checked '; ?> />
|
1205 |
+
<label for="referer-blacklist-<?php echo $block; ?>" title="Blacklist referers"><?php echo AD_BLACK_LIST; ?></label>
|
1206 |
</td>
|
1207 |
<td>
|
1208 |
+
<input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="referer-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_domain_list_type() == AD_WHITE_LIST; ?>" value="<?php echo AD_WHITE_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AD_WHITE_LIST) echo 'checked '; ?> />
|
1209 |
+
<label for="referer-whitelist-<?php echo $block; ?>" title="Whitelist referers"><?php echo AD_WHITE_LIST; ?></label>
|
1210 |
</td>
|
1211 |
</tr>
|
1212 |
+
<?php if (function_exists ('ai_list_rows')) ai_list_rows ($block, $default, $obj); ?>
|
1213 |
</tbody>
|
1214 |
</table>
|
1215 |
</div>
|
1216 |
|
1217 |
+
<div id="manual-settings-<?php echo $block; ?>" class="small-button rounded" style="text-align: left;<?php if (!$show_manual) echo ' display: none;'; ?>">
|
1218 |
<table>
|
1219 |
<tr>
|
1220 |
<td style="padding: 4px 10px 4px 0;">
|
1221 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_WIDGET, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1222 |
+
<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 '; ?> />
|
1223 |
+
<label for="enable-widget-<?php echo $block; ?>" title="Enable or disable widget for this code block">
|
1224 |
Widget
|
1225 |
</label>
|
1226 |
</td>
|
1227 |
<td>
|
1228 |
+
<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]) ? " " : ""; ?></pre>
|
1229 |
+
<button id="widgets-button-<?php echo $block; ?>" type="button" class='ai-button' style="display: none; width: 15px; height: 15px;" title="Manage Widgets"></button>
|
1230 |
</td>
|
1231 |
</tr>
|
1232 |
<tr>
|
1233 |
<td style="padding: 4px 10px 4px 0;">
|
1234 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_MANUAL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1235 |
+
<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 '; ?> />
|
1236 |
+
<label for="enable-shortcode-<?php echo $block; ?>" title="Enable or disable shortcode for manual insertion of this code block in posts and pages">
|
1237 |
Shortcode
|
1238 |
</label>
|
1239 |
</td>
|
1240 |
<td>
|
1241 |
+
<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>
|
1242 |
+
<div class="copy-blocker"></div>
|
1243 |
+
<span class="copy-blocker">or</span>
|
1244 |
+
<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>
|
1245 |
+
<div class="copy-blocker"></div>
|
1246 |
</td>
|
1247 |
</tr>
|
1248 |
<tr>
|
1249 |
<td style="padding: 4px 10px 4px 0;">
|
1250 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_PHP_CALL, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1251 |
+
<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 ($obj->get_enable_php_call () == AI_ENABLED) echo 'checked '; ?> />
|
1252 |
+
<label for="enable-php-call-<?php echo $block; ?>" title="Enable or disable PHP function call to insert this code block at any position in template file. If function is disabled for block it will return empty string.">
|
1253 |
PHP function
|
1254 |
</label>
|
1255 |
</td>
|
1256 |
<td class="select">
|
1257 |
+
<pre class="ai-block-number" style="margin: 0; display: inline; color: blue; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;"><?php if (function_exists ('adinserter')) echo adinserter (<?php echo $block; ?>); ?></pre>
|
1258 |
+
<div class="copy-blocker"></div>
|
1259 |
</td>
|
1260 |
</tr>
|
1261 |
</table>
|
1262 |
</div>
|
1263 |
|
1264 |
+
<div id="device-detection-settings-<?php echo $block; ?>" style="<?php if (!$show_devices) echo 'display: none;'; ?>">
|
1265 |
|
1266 |
+
<div id="ai-devices-container-<?php echo $block; ?>" style="padding: 0; margin 8px 0 0 0; border: 0;">
|
1267 |
+
<ul id="ai-devices-tabs-<?php echo $block; ?>" style="display: none;">
|
1268 |
+
<li id="ai-client-side-detection-<?php echo $block; ?>"><a href="#tab-client-side-<?php echo $block; ?>"><span style="<?php echo $client_side_style; ?>">Client-side device detection</span></a></li>
|
1269 |
+
<li id="ai-server-side-detection<?php echo $block; ?>"><a href="#tab-server-side-<?php echo $block; ?>"><span style="<?php echo $server_side_style; ?>">Server-side device detection</span></a></li>
|
1270 |
</ul>
|
1271 |
|
1272 |
+
<div id="tab-client-side-<?php echo $block; ?>" class="rounded">
|
1273 |
<div style="float: left; margin-top: 0px;">
|
1274 |
+
<input type="hidden" name="<?php echo AI_OPTION_DETECT_CLIENT_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1275 |
+
<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 '; ?> />
|
1276 |
+
<label for="client-side-detection-<?php echo $block; ?>" style="vertical-align: baseline;">Use client-side detection to show only on</label>
|
1277 |
</div>
|
1278 |
|
1279 |
<div style="float: left; margin: -5px 0 -2px 0;">
|
1301 |
}
|
1302 |
?>
|
1303 |
<td style='padding: 2px 0 0 20px;'>
|
1304 |
+
<input type="hidden" name="<?php echo AI_OPTION_DETECT_VIEWPORT, '_', $viewport, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1305 |
+
<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 '; ?> />
|
1306 |
+
<label for="viewport-<?php echo $viewport, "-", $block; ?>" title="Device min width <?php echo get_viewport_width ($viewport); ?> px"><?php echo $viewport_name; ?></label>
|
1307 |
</td>
|
1308 |
<?php
|
1309 |
$column ++;
|
1325 |
<div style="clear: both"></div>
|
1326 |
</div>
|
1327 |
|
1328 |
+
<div id="tab-server-side-<?php echo $block; ?>" class="rounded">
|
1329 |
+
<input type="hidden" name="<?php echo AI_OPTION_DETECT_SERVER_SIDE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1330 |
+
<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 '; ?> />
|
1331 |
+
<label for="server-side-detection-<?php echo $block; ?>" style="vertical-align: baseline;">Use server-side detection to insert code only for </label>
|
1332 |
|
1333 |
+
<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(); ?>">
|
1334 |
<option value="<?php echo AD_DISPLAY_DESKTOP_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_DESKTOP_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_DESKTOP_DEVICES; ?></option>
|
1335 |
<option value="<?php echo AD_DISPLAY_MOBILE_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_MOBILE_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_MOBILE_DEVICES; ?></option>
|
1336 |
<option value="<?php echo AD_DISPLAY_TABLET_DEVICES; ?>" <?php echo ($obj->get_display_for_devices() == AD_DISPLAY_TABLET_DEVICES) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_TABLET_DEVICES; ?></option>
|
1344 |
|
1345 |
</div>
|
1346 |
|
1347 |
+
<div id="misc-settings-<?php echo $block; ?>" style="<?php if (!$show_misc) echo 'display: none;'; ?>">
|
1348 |
+
<div id="ai-misc-container-<?php echo $block; ?>" style="padding: 0; margin 8px 0 0 0; border: 0;">
|
1349 |
+
<ul id="ai-misc-tabs-<?php echo $block; ?>" style="display: none;">
|
1350 |
+
<li id="ai-misc-insertion-<?php echo $block; ?>"><a href="#tab-insertion-<?php echo $block; ?>"><span style="<?php echo $insertion_style; ?>">Insertion</span></a></li>
|
1351 |
+
<li id="ai-misc-word-count-<?php echo $block; ?>"><a href="#tab-word-count-<?php echo $block; ?>"><span style="<?php echo $word_count_style; ?>">Word Count</span></a></li>
|
1352 |
+
<li id="ai-misc-filter-<?php echo $block; ?>"><a href="#tab-filter-<?php echo $block; ?>"><span style="<?php echo $filter_style; ?>">Filter</span></a></li>
|
1353 |
+
<li id="ai-misc-scheduling-<?php echo $block; ?>"><a href="#tab-scheduling-<?php echo $block; ?>"><span style="<?php echo $scheduling_style; ?>">Scheduling</span></a></li>
|
1354 |
+
<?php if (function_exists ('ai_adb_action_0')) ai_adb_action_0 ($block, $adb_style); ?>
|
1355 |
+
<li id="ai-misc-general-<?php echo $block; ?>"><a href="#tab-general-<?php echo $block; ?>">General</a></li>
|
1356 |
</ul>
|
1357 |
|
1358 |
+
<div id="tab-insertion-<?php echo $block; ?>" class="rounded">
|
1359 |
<div class="max-input">
|
1360 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1361 |
Insert for
|
1362 |
+
<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(); ?>">
|
1363 |
<option value="<?php echo AD_DISPLAY_ALL_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ALL_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ALL_USERS; ?></option>
|
1364 |
<option value="<?php echo AD_DISPLAY_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_LOGGED_IN_USERS; ?></option>
|
1365 |
<option value="<?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_NOT_LOGGED_IN_USERS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_NOT_LOGGED_IN_USERS; ?></option>
|
1368 |
</span>
|
1369 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1370 |
|
1371 |
+
Max <input type="text" style="width: 32px;" 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" title="Empty or 0 means no limit" /> insertions
|
1372 |
</span>
|
1373 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1374 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_AMP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1375 |
+
<input style="margin-left: 10px;" 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 '; ?> />
|
1376 |
+
<label for="enable-amp-<?php echo $block; ?>" style="vertical-align: top;<?php if (!$obj->get_enable_amp (true) && $obj->get_enable_amp ()) echo ' color: red;' ?>" title="<?php if (!$obj->get_enable_amp (true) && $obj->get_enable_amp ()) echo "Old settings for AMP pages detected. " ?>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).">AMP pages</label>
|
1377 |
</span>
|
1378 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1379 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_AJAX, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1380 |
+
<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 '; ?> />
|
1381 |
+
<label for="enable-ajax-<?php echo $block; ?>" style="vertical-align: top;" title="Enable or disable insertion for Ajax requests">Ajax</label>
|
1382 |
</span>
|
1383 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1384 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_FEED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1385 |
+
<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 '; ?> />
|
1386 |
+
<label for="enable-feed-<?php echo $block; ?>" style="vertical-align: top;" title="Enable or disable insertion in RSS feeds">RSS Feed</label>
|
1387 |
</span>
|
1388 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1389 |
+
<input type="hidden" name="<?php echo AI_OPTION_ENABLE_404, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1390 |
+
<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 '; ?> />
|
1391 |
+
<label for="enable-404-<?php echo $block; ?>" style="vertical-align: top;" title="Enable or disable insertion on page for Error 404: Page not found">Error page</label>
|
1392 |
</span>
|
1393 |
</div>
|
1394 |
</div>
|
1395 |
|
1396 |
+
<div id="tab-word-count-<?php echo $block; ?>" class="rounded">
|
1397 |
Post/Static page must have between
|
1398 |
+
<input type="text" name="<?php echo AI_OPTION_MIN_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_minimum_words(); ?>" value="<?php echo $obj->get_minimum_words() ?>" title="Minimum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
|
1399 |
and
|
1400 |
+
<input type="text" name="<?php echo AI_OPTION_MAX_WORDS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_maximum_words(); ?>" value="<?php echo $obj->get_maximum_words() ?>" title="Maximum number of post/static page words, leave empty for no limit" size="4" maxlength="6" />
|
1401 |
words
|
1402 |
</div>
|
1403 |
|
1404 |
+
<div id="tab-filter-<?php echo $block; ?>" class="rounded">
|
1405 |
<div class="max-input">
|
1406 |
<span style="display: table-cell;">
|
1407 |
Filter insertions
|
1408 |
</span>
|
1409 |
<span style="display: table-cell;">
|
1410 |
+
<input style="width: 100%; padding-right: 10px;" 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= "Filter insertions by specifying wanted calls for this block - single number or comma separated numbers, empty means all / no limits. Set Counter for filter to Auto if you are using only one insertion type." size="12" maxlength="24" />
|
1411 |
</span>
|
1412 |
<span style="display: table-cell;">
|
1413 |
using
|
1414 |
+
<select id="filter-type-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_FILTER_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_filter_type(); ?>" style="width:160px">
|
1415 |
<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; ?></option>
|
1416 |
<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; ?></option>
|
1417 |
<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; ?></option>
|
1427 |
counter
|
1428 |
</span>
|
1429 |
<span style="display: table-cell;">
|
1430 |
+
<input type="hidden" name="<?php echo AI_OPTION_INVERTED_FILTER, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1431 |
+
<input 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 '; ?> />
|
1432 |
+
<label for="enable-ajax-<?php echo $block; ?>" style="vertical-align: top;" title="If checked specified calls are unwanted">Invert filter</label>
|
1433 |
</span>
|
1434 |
</div>
|
1435 |
</div>
|
1436 |
|
1437 |
+
<div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
|
1438 |
+
<select id="scheduling-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
|
1439 |
<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_OFF; ?></option>
|
1440 |
<option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
|
1441 |
<?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
|
1442 |
</select>
|
1443 |
|
1444 |
+
<span id="scheduling-delay-<?php echo $block; ?>">
|
1445 |
+
for <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(); ?>" size="2" maxlength="3" /> days after publishing
|
1446 |
</span>
|
1447 |
+
<span id="scheduling-delay-warning-<?php echo $block; ?>" style="color: #d00; display: none;"> Not available</span>
|
1448 |
|
1449 |
+
<?php if (function_exists ('ai_scheduling_data')) ai_scheduling_data ($block, $obj, $default); ?>
|
1450 |
</div>
|
1451 |
|
1452 |
+
<?php if (function_exists ('ai_adb_action')) ai_adb_action ($block, $obj, $default); ?>
|
1453 |
|
1454 |
+
<div id="tab-general-<?php echo $block; ?>" class="rounded">
|
1455 |
<div class="max-input">
|
1456 |
<span style="display: table-cell; width: 1px; white-space: nowrap;">
|
1457 |
General tag
|
1458 |
|
1459 |
</span>
|
1460 |
<span style="display: table-cell;">
|
1461 |
+
<input style="width: 100%;" 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="8" maxlength="40" title="Used for {tags} when no page data is found" />
|
1462 |
</span>
|
1463 |
<span style="display: table-cell; width: 400px; white-space: nowrap;">
|
1464 |
</span>
|
1468 |
</div>
|
1469 |
</div>
|
1470 |
|
1471 |
+
<div id="no-wrapping-warning-<?php echo $block; ?>" class="rounded" style="display: none;">
|
1472 |
+
<span style="margin-top: 5px;"><strong><span style="color: red;">WARNING:</span> No Wrapping</strong> style has no HTML code for client-side device detection!</span>
|
1473 |
</div>
|
1474 |
|
1475 |
</div>
|
1728 |
<div style="margin: 8px 0;">
|
1729 |
<div style="float: right;">
|
1730 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1731 |
+
<input type="checkbox" value="0" id="simple-editor-h" class="simple-editor-button" style="display: none;" />
|
1732 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-h" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1733 |
<?php endif; ?>
|
1734 |
|
1784 |
<div style="margin: 8px 0;">
|
1785 |
<div style="float: right;">
|
1786 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1787 |
+
<input type="checkbox" value="0" id="simple-editor-f" class="simple-editor-button" style="display: none;" />
|
1788 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-f" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1789 |
<?php endif; ?>
|
1790 |
|
1891 |
<input style="width: 100%;" type="text" name="<?php echo AI_OPTION_ADB_SELECTORS; ?>" title="Comma seprarated list of CSS selectors (.class, #id) used for additional ad blocking detection. Invisible or zero height of the element means ad blocking is present." value="<?php echo get_adb_selectors (); ?>" default="" size="50" maxlength="200" />
|
1892 |
</td>
|
1893 |
</tr>
|
1894 |
+
<?php if (function_exists ('ai_adb_settings')) ai_adb_settings (); ?>
|
1895 |
</table>
|
1896 |
</div>
|
1897 |
|
1941 |
<div style="float: right;">
|
1942 |
|
1943 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
1944 |
+
<input type="checkbox" value="0" id="simple-editor-a" class="simple-editor-button" style="display: none;" />
|
1945 |
<label class="checkbox-button" style="margin-left: 10px;" for="simple-editor-a" title="Toggle Syntax Highlighting / Simple editor for mobile devices"><span class="checkbox-icon icon-tablet"></span></label>
|
1946 |
<?php endif; ?>
|
1947 |
|
1949 |
<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;" />
|
1950 |
<label class="checkbox-button" style="margin-left: 10px;" for="process-php-a" title="Process PHP code"><span class="checkbox-icon icon-php<?php if ($adA->get_process_php () == AI_ENABLED) echo ' on'; ?>"></span></label>
|
1951 |
|
1952 |
+
<button id="preview-button-adb" type="button" class='ai-button' style="display: none; margin: 0 4px 0 10px;" title="Preview message when ad blocking is detected" nonce="<?php echo wp_create_nonce ("adinserter_data"); ?>" site-url="<?php echo wp_make_link_relative (get_site_url()); ?>">Preview</button>
|
1953 |
</div>
|
1954 |
<div style="clear: both;"></div>
|
1955 |
</div>
|
2061 |
|
2062 |
</div> <!-- ai-tab-container -->
|
2063 |
|
2064 |
+
<?php if (!isset ($_GET ['settings'])): // start of code only for normal settings ?>
|
2065 |
|
2066 |
</div> <!-- ai-container -->
|
2067 |
|
2120 |
|
2121 |
</form>
|
2122 |
|
2123 |
+
</div> <!-- #ai-settings -->
|
2124 |
|
2125 |
<div id="ai-sidebar" style="float: left;">
|
2126 |
|
2195 |
replace_blocked_image ('ai-stars-img', 'stars.png', 'inline');
|
2196 |
replace_blocked_image ('ai-tw', 'twitter.png', 'inline');
|
2197 |
replace_blocked_image ('ai-fb', 'facebook.png', 'inline');
|
2198 |
+
replace_blocked_image ('ai-loading', 'loading.gif', 'none');
|
2199 |
if (blocking_counter > 5) {
|
2200 |
var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
|
2201 |
console.log ('AD INSERTER:', message);
|
2209 |
</script>
|
2210 |
|
2211 |
<?php
|
2212 |
+
|
2213 |
+
endif; // end of code only for normal settings
|
2214 |
+
|
2215 |
} // generate_settings_form ()
|
2216 |
|
2217 |
function get_sidebar_widgets () {
|
2219 |
$widget_options = get_option ('widget_ai_widget');
|
2220 |
|
2221 |
$sidebars_with_widgets = array ();
|
2222 |
+
// for ($block = $start; $block <= $end; $block ++){
|
2223 |
+
for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++){
|
2224 |
+
$sidebars_with_widget [$block]= array ();
|
2225 |
}
|
2226 |
foreach ($sidebar_widgets as $sidebar_index => $sidebar_widget) {
|
2227 |
if (is_array ($sidebar_widget) && isset ($GLOBALS ['wp_registered_sidebars'][$sidebar_index]['name'])) {
|
2250 |
?>
|
2251 |
<div id="ai-list-container" class="ai-form rounded" style="background: #fff; display: none;">
|
2252 |
<div id='list-controls' class='ui-widget' style='margin: 8px auto;'>
|
2253 |
+
<span class="ai-toolbar-button" style="vertical-align: middle; float: left;">
|
2254 |
<input type="checkbox" value="0" id="ai-load-all" style="display: none;" />
|
2255 |
<label class="checkbox-button" for="ai-load-all" title="Toggle active/all blocks"><span class="checkbox-icon icon-enabled-all on"></span></label>
|
2256 |
</span>
|
2257 |
+
<span class="ai-toolbar-button" style="vertical-align: middle; float: left;">
|
2258 |
<input id="ai-list-search" type="text" value="" size="40" maxlength="40" />
|
2259 |
</span>
|
2260 |
+
<span class="ai-toolbar-button" style="vertical-align: middle; float: right;">
|
2261 |
+
<input type="checkbox" value="0" id="ai-rearrange" style="display: none;" />
|
2262 |
+
<label class="checkbox-button" for="ai-rearrange" title="Rearrange block order"><span class="checkbox-icon icon-rearrange"></span></label>
|
2263 |
+
</span>
|
2264 |
+
<span id='list-rearrange-controls' style='float: right; display: none;'>
|
2265 |
+
<span id='list-save' class="ai-toolbar-button text" style="vertical-align: middle; display: none;">
|
2266 |
+
<input type="checkbox" value="0" id="ai-save-changes" style="display: none;" />
|
2267 |
+
<label class="checkbox-button" for="ai-save-changes" style="padding: 1px 5px 1px 4px; margin-top: 0px;" title="Save new block order">Save Changes</label>
|
2268 |
+
</span>
|
2269 |
+
</span>
|
2270 |
+
<div style="clear: both;"></div>
|
2271 |
</div>
|
2272 |
|
2273 |
<div id="ai-list-data">
|
2278 |
}
|
2279 |
|
2280 |
function code_block_list () {
|
2281 |
+
global $block_object, $wpdb;
|
2282 |
+
|
2283 |
+
if (isset ($_GET ["blocks-org"]) && isset ($_GET ["blocks-new"])) {
|
2284 |
+
$blocks_org = json_decode ($_GET ["blocks-org"]);
|
2285 |
+
$blocks_new = json_decode ($_GET ["blocks-new"]);
|
2286 |
+
|
2287 |
+
if (!empty ($blocks_org) && count ($blocks_org) == count ($blocks_new)) {
|
2288 |
+
// Uodate widgets
|
2289 |
+
$current_options = get_option (AI_OPTION_NAME);
|
2290 |
+
$new_options = $current_options;
|
2291 |
+
|
2292 |
+
$error = false;
|
2293 |
+
$block_indexes = array ();
|
2294 |
+
foreach ($blocks_org as $index => $block) {
|
2295 |
+
$new_block = $blocks_new [$index];
|
2296 |
+
if ($block >= 1 && $block <= AD_INSERTER_BLOCKS && $new_block >= 1 && $new_block <= AD_INSERTER_BLOCKS) {
|
2297 |
+
$block_indexes [$block] = $index;
|
2298 |
+
$new_options [$block] = $current_options [$new_block];
|
2299 |
+
} else $error = true;
|
2300 |
+
}
|
2301 |
|
2302 |
+
if (!$error) {
|
2303 |
+
update_option (AI_OPTION_NAME, $new_options);
|
2304 |
+
ai_load_settings ();
|
2305 |
+
|
2306 |
+
$ai_widgets = get_option ('widget_ai_widget');
|
2307 |
+
if (is_array ($ai_widgets))
|
2308 |
+
foreach ($ai_widgets as $widget_index => $ai_widget) {
|
2309 |
+
if (isset ($ai_widget ['block'])) {
|
2310 |
+
$widget_block = $ai_widget ['block'];
|
2311 |
+
if (isset ($blocks_org [$block_indexes [$widget_block]])) {
|
2312 |
+
$new_block = $blocks_new [$block_indexes [$widget_block]];
|
2313 |
+
$ai_widgets [$widget_index]['block'] = $new_block;
|
2314 |
+
}
|
2315 |
+
}
|
2316 |
+
}
|
2317 |
+
update_option ('widget_ai_widget', $ai_widgets);
|
2318 |
|
2319 |
+
// Update statistics
|
2320 |
+
$query = 'UPDATE ' . AI_STATISTICS_DB_TABLE . ' SET block= CASE ';
|
2321 |
+
|
2322 |
+
foreach ($blocks_org as $index => $block) {
|
2323 |
+
$new_block = $blocks_new [$index];
|
2324 |
+
$query .= "WHEN block= $block THEN $new_block ";
|
2325 |
+
}
|
2326 |
+
$query .= 'ELSE block END';
|
2327 |
+
|
2328 |
+
$update = $wpdb->query ($query);
|
2329 |
+
}
|
2330 |
+
}
|
2331 |
+
}
|
2332 |
+
|
2333 |
+
$sidebars_with_widget = get_sidebar_widgets ();
|
2334 |
+
|
2335 |
+
ob_start ();
|
2336 |
|
2337 |
$search_text = trim ($_GET ["list"]);
|
2338 |
|
2343 |
|
2344 |
if ($search_text != '') $search_array = explode (' ', $search_text); else $search_array = array ();
|
2345 |
|
2346 |
+
$blocks = array ();
|
2347 |
$row_counter = 0;
|
2348 |
for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
2349 |
$obj = $block_object [$block];
|
2367 |
if (stripos ($block_text, trim ($search_item)) === false) continue 2;
|
2368 |
}
|
2369 |
|
2370 |
+
$blocks []= $block;
|
2371 |
$row_counter ++;
|
2372 |
$row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
|
2373 |
|
2377 |
$visible_tab = $block >= $start && $block <= $end;
|
2378 |
|
2379 |
?>
|
2380 |
+
<tr style="background: <?php echo $row_color; ?>" data-block="<?php echo $block; ?>">
|
2381 |
+
<td style="min-width: 55px; text-align: right; color: <?php echo $block_used ? '#444' : '#ccc'; ?>">
|
2382 |
+
<span class="ai-toolbar-button" style="float: left; margin-right: 2px;">
|
2383 |
+
<label class="checkbox-button ai-load-settings" style="margin-top: -1px;" title="Copy block"><span class="checkbox-icon icon-none-small"></span></label>
|
2384 |
+
</span>
|
2385 |
+
<?php echo $block; ?>
|
2386 |
+
</td>
|
2387 |
<?php if ($visible_tab): ?>
|
2388 |
+
<td class="ai-tab-link" data-tab="<?php echo $block; ?>" style=" min-width: 120px; color: #0073aa; cursor: pointer; text-align: left; padding-left: 10px; max-width: 220px; white-space: nowrap; overflow: hidden;"><?php echo $obj->wp_options [AI_OPTION_BLOCK_NAME]; ?></td>
|
2389 |
<?php else: ?>
|
2390 |
+
<td style="min-width: 120px; text-align: left; padding-left: 10px; max-width: 280px; white-space: nowrap; overflow: hidden;"><a href="<?php echo $edit_url; ?>" style="text-decoration: none; box-shadow: 0 0 0;"><?php echo $obj->wp_options [AI_OPTION_BLOCK_NAME]; ?></a></td>
|
2391 |
<?php endif ?>
|
2392 |
+
<td style="min-width: 180px; text-align: left; padding-left: 10px; max-width: 130px; white-space: nowrap; overflow: hidden; color: <?php echo $automatic_insertion ? '#666' : '#ccc'; ?>"><?php echo $obj->get_automatic_insertion_text(); ?></td>
|
2393 |
+
<td style="min-width: 110px; text-align: left; padding-left: 10px; max-width: 80px; white-space: nowrap; overflow: hidden; color: <?php echo $block_used ? '#444' : '#ccc'; ?>"><?php echo $obj->get_alignment_type_text (); ?></td>
|
2394 |
+
<td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_php_function ? '#8080ff' : '#ddd'; ?>;">●</td>
|
2395 |
+
<td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_shortcode ? '#ff8b8b' : '#ddd'; ?>;">●</td>
|
2396 |
+
<td class="ai-dot" style="min-width: 15px; text-align: center; padding-left: 10px; vertical-align: top; color: <?php echo $manual_widget ? (count ($sidebars_with_widget [$block]) ? '#7cda7c' : '#666') : '#ddd'; ?>;">●</td>
|
2397 |
<td style="text-align: left; padding-left: 10px; max-width: 160px; white-space: nowrap; overflow: hidden; color: <?php echo $manual_widget ? '#666' : '#ccc'; ?>;"><?php echo implode (', ', $sidebars_with_widget [$block]); ?></td>
|
2398 |
</tr>
|
2399 |
<?php
|
2400 |
}
|
2401 |
+
$table_rows = ob_get_clean ();
|
2402 |
?>
|
2403 |
+
|
2404 |
+
<table id="ai-list-table" class="exceptions ai-sortable" cellspacing=0 cellpadding=0 style="width: 100%;" data-blocks="<?php echo json_encode ($blocks); ?>">
|
2405 |
+
<thead>
|
2406 |
+
<tr>
|
2407 |
+
<th style="text-align: right;">Block</th>
|
2408 |
+
<th style="text-align: left; padding-left: 10px;">Name</th>
|
2409 |
+
<th style="text-align: left; padding-left: 10px;">Automatic Insertion</th>
|
2410 |
+
<th style="text-align: left; padding-left: 10px;">Alignment</th>
|
2411 |
+
<th style="text-align: center; padding-left: 10px;" title="PHP function call">P</th>
|
2412 |
+
<th style="text-align: center; padding-left: 10px;" title="Shortcode">S</th>
|
2413 |
+
<th style="text-align: center; padding-left: 10px;" title="Widget">W</th>
|
2414 |
+
<th style="text-align: left; padding-left: 10px;">Widget Positions</th>
|
2415 |
+
</tr>
|
2416 |
+
</thead>
|
2417 |
+
<tbody>
|
2418 |
+
<?php echo $table_rows; ?>
|
2419 |
</tbody>
|
2420 |
</table>
|
2421 |
<?php
|
2526 |
<li>64 code (ad) blocks</li>
|
2527 |
<li>Syntax highlighting editor</li>
|
2528 |
<li><a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
|
2529 |
+
<li>Simple user interface - all settings on a single page</li>
|
2530 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
|
2531 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
|
2532 |
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
|
2533 |
+
<li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> below <code><body></code> or above <code></body></code> tags</li>
|
2534 |
<li>Automatic insertion at <a href="https://adinserter.pro/documentation#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
|
2535 |
<li><a href="https://adinserter.pro/exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
|
2536 |
<li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
|
2546 |
<li>Support for contextual <a href="https://adinserter.pro/settings#amazon" class="simple-link" target="_blank">Amazon Native Shopping Ads</a> (responsive)</li>
|
2547 |
<li>Custom CSS class name for wrapping divs to avoid ad blockers</li>
|
2548 |
<li>PHP code processing</li>
|
2549 |
+
<li>Banner code generator</li>
|
2550 |
<li>Support for <a href="http://adinserter.pro/documentation#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
|
2551 |
<li>Support for Google Analytics, Piwik or any other web analytics code</li>
|
2552 |
<li>Desktop, tablet and phone server-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a></li>
|
2563 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
|
2564 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
|
2565 |
<li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
|
2566 |
+
<li>Clipboard support to easily copy code blocks or settings</li>
|
2567 |
<li>Support via email</li>
|
2568 |
</ul>
|
2569 |
|