Version Description
- Improved code for client-side insertion
- Added support for usage tracking
- Fix for compatibility with older PHP versions (below 5.4)
- 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.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.21 to 2.4.0
- ad-inserter.php +47 -64
- constants.php +2 -2
- css/ad-inserter.css +1 -1
- includes/dst/dst.php +55 -14
- includes/editor.php +16 -142
- includes/js/ai-adb.js +637 -620
- includes/js/ai-adb.min.js +34 -42
- includes/js/ai-lists.js +8 -1
- includes/js/ai-lists.min.js +3 -2
- includes/preview-adb.php +16 -142
- js/ad-inserter.js +130 -113
- readme.txt +30 -1
- settings.php +1 -1
ad-inserter.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
-
Version: 2.
|
6 |
Description: Ad management plugin with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
@@ -13,6 +13,12 @@ Plugin URI: https://adinserter.pro/documentation
|
|
13 |
|
14 |
Change Log
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
Ad Inserter 2.3.21 - 2018-09-20
|
17 |
- Added option to force showing admin toolbar when viewing site
|
18 |
- Added additional debugging info for blocks in Ajax requests
|
@@ -214,7 +220,8 @@ function ai_toolbar_menu_items () {
|
|
214 |
$ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
|
215 |
'id' => 'ai-toolbar-settings',
|
216 |
// 'parent' => 'ai-toolbar',
|
217 |
-
'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME . (defined ('AI_DEBUGGING_DEMO') ? ' Debugging DEMO' : ($debug_settings_on ? ' Debugging' : '')),
|
|
|
218 |
'href' => $top_menu_url,
|
219 |
// 'meta' => $debug_settings_on ? array ('title' => 'Turn Debugging Off') : array (),
|
220 |
);
|
@@ -354,8 +361,6 @@ function set_user () {
|
|
354 |
|
355 |
if ($ai_wp_data [AI_WP_USER_SET]) return;
|
356 |
|
357 |
-
// $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
|
358 |
-
|
359 |
if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
|
360 |
if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
|
361 |
|
@@ -1091,18 +1096,6 @@ function ai_load_extract ($recreate = true) {
|
|
1091 |
|
1092 |
if (isset ($ai_db_options_extract)) return;
|
1093 |
|
1094 |
-
// if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
|
1095 |
-
//// isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
|
1096 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT]['VERSION']) && $ai_db_options [AI_OPTION_EXTRACT]['VERSION'] == $version_string . '-' . AD_INSERTER_BLOCKS &&
|
1097 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
|
1098 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
|
1099 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
|
1100 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
|
1101 |
-
// @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
|
1102 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
|
1103 |
-
// $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
|
1104 |
-
// $ai_db_options_extract = ai_generate_extract ($ai_db_options);
|
1105 |
-
|
1106 |
$expected_extract_version = $version_string . '-' . AD_INSERTER_BLOCKS;
|
1107 |
|
1108 |
if (isset ($ai_db_options [AI_OPTION_EXTRACT]['VERSION']) && $ai_db_options [AI_OPTION_EXTRACT]['VERSION'] == $expected_extract_version) {
|
@@ -1131,17 +1124,6 @@ function ai_wp_loaded_hook () {
|
|
1131 |
$start_time = microtime (true);
|
1132 |
}
|
1133 |
|
1134 |
-
// if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
|
1135 |
-
// isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
|
1136 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
|
1137 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
|
1138 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
|
1139 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
|
1140 |
-
// @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
|
1141 |
-
// isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
|
1142 |
-
// $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
|
1143 |
-
// $ai_db_options_extract = ai_generate_extract ($ai_db_options);
|
1144 |
-
|
1145 |
ai_load_extract ();
|
1146 |
|
1147 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
@@ -1244,7 +1226,7 @@ function ai_admin_referrer_policy ($policy) {
|
|
1244 |
}
|
1245 |
|
1246 |
function ai_wp_enqueue_scripts_hook () {
|
1247 |
-
global $ai_wp_data;
|
1248 |
|
1249 |
// TEST
|
1250 |
// wp_deregister_script('jquery');
|
@@ -1264,15 +1246,16 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1264 |
|
1265 |
if ($footer_inline_scripts ||
|
1266 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
|
|
1267 |
$ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
1268 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1269 |
get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 ||
|
1270 |
$ai_wp_data [AI_ANIMATION]) {
|
1271 |
|
1272 |
// force loading of jquery on frontend
|
1273 |
-
wp_enqueue_script ('ai-jquery-js', plugins_url ('includes/js/ai-jquery.js', __FILE__
|
1274 |
'jquery',
|
1275 |
-
));
|
1276 |
|
1277 |
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
1278 |
wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
@@ -1328,11 +1311,6 @@ function add_head_inline_styles_and_scripts () {
|
|
1328 |
if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION]) echo get_viewport_css ();
|
1329 |
|
1330 |
if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION])) {
|
1331 |
-
// echo ".ai-rotate {position: relative;}\n";
|
1332 |
-
// echo ".ai-rotate-hidden {visibility: hidden;}\n";
|
1333 |
-
// echo ".ai-rotate-hidden-2 {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n";
|
1334 |
-
// echo ".ai-ip-data, .ai-list-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
|
1335 |
-
|
1336 |
echo ai_get_client_side_styles ();
|
1337 |
|
1338 |
$ai_wp_data [AI_CLIENT_SIDE_CSS] = true;
|
@@ -1507,8 +1485,8 @@ function ai_replace_js_data ($js) {
|
|
1507 |
if (strpos ($js, 'AI_ADB_STATUS_MESSAGE') !== false) {
|
1508 |
$adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
1509 |
|
1510 |
-
$js = str_replace ('AI_ADB_OVERLAY_WINDOW', "jQuery ('<div>', {attr: {'style':
|
1511 |
-
$js = str_replace ('AI_ADB_MESSAGE_WINDOW', "jQuery ('<div>', {attr: {'style':
|
1512 |
base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ()))) . "')})", $js);
|
1513 |
|
1514 |
// $js = str_replace ('AI_ADB_SELECTORS', str_replace (' ', '', get_adb_selectors (true)), $js);
|
@@ -2772,7 +2750,7 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
2772 |
if ($default_settings && $settings == '') continue;
|
2773 |
$settings = ' [' . $insertion_settings . '][' . $alignment_settings . ']' . $settings;
|
2774 |
|
2775 |
-
echo sprintf ("%2d %-21s ", $block,
|
2776 |
|
2777 |
echo $obj->get_display_settings_post() ? "o" : ".", " ";
|
2778 |
echo $obj->get_display_settings_page() ? "o" : ".", " ";
|
@@ -4228,7 +4206,6 @@ function ai_generate_extract (&$settings) {
|
|
4228 |
|
4229 |
function ai_load_settings () {
|
4230 |
global $ai_db_options, $block_object, $ai_wp_data, $version_string, $ai_custom_hooks;
|
4231 |
-
// global $ai_db_options_extract;
|
4232 |
|
4233 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS START");
|
4234 |
|
@@ -6688,22 +6665,7 @@ if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
|
|
6688 |
|
6689 |
if (!function_exists ('ai_start_dst')) {
|
6690 |
function ai_start_dst () {
|
6691 |
-
global $
|
6692 |
-
|
6693 |
-
if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) {
|
6694 |
-
$used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
|
6695 |
-
} else $used_blocks = '';
|
6696 |
-
|
6697 |
-
$install_timestamp = get_option (AI_INSTALL_NAME);
|
6698 |
-
if ($install_timestamp) {
|
6699 |
-
$install_date = date ("Y-m-d", $install_timestamp + get_option ('gmt_offset') * 3600);
|
6700 |
-
} else $install_date = '';
|
6701 |
-
|
6702 |
-
if (isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'])) {
|
6703 |
-
$settings_date = date ("Y-m-d", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600);
|
6704 |
-
} else $settings_date = '';
|
6705 |
-
|
6706 |
-
$count_posts = wp_count_posts ();
|
6707 |
|
6708 |
$dst_settings = array (
|
6709 |
'main_file' => __FILE__,
|
@@ -6715,14 +6677,6 @@ if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
|
|
6715 |
'deactivation_form' => true,
|
6716 |
'admin_ip_tracking' => true,
|
6717 |
'notice_icon' => AD_INSERTER_PLUGIN_IMAGES_URL.'icon-50x50.jpg',
|
6718 |
-
'options' => array (
|
6719 |
-
'posts' => $count_posts->publish,
|
6720 |
-
'blocks' => $used_blocks,
|
6721 |
-
'installation' => $install_date,
|
6722 |
-
'settings' => $settings_date,
|
6723 |
-
'notice_review' => ($review = get_option ('ai-notice-review')) ? $review : '',
|
6724 |
-
'remote_debugging' => get_remote_debugging (),
|
6725 |
-
),
|
6726 |
);
|
6727 |
|
6728 |
if (function_exists ('ai_dst_settings')) ai_dst_settings ($dst_settings);
|
@@ -6732,12 +6686,41 @@ if (defined ('AI_PLUGIN_TRACKING') && AI_PLUGIN_TRACKING) {
|
|
6732 |
|
6733 |
function ai_notice_text ($text) {
|
6734 |
$text = __('Thank you for installing [STRONG][NAME][/STRONG]. We would like to track its usage on your site. This is completely optional and can be disabled at any time.[P]
|
6735 |
-
We don\'t record any sensitive data, only information regarding the WordPress environment and %1$s usage, which will help us to make improvements to the %1$s', 'ad-inserter');
|
6736 |
|
6737 |
return $text;
|
6738 |
}
|
6739 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6740 |
add_filter (DST_Client::DST_FILTER_OPTIN_NOTICE_TEXT . AD_INSERTER_SLUG, 'ai_notice_text');
|
|
|
6741 |
|
6742 |
ai_start_dst ();
|
6743 |
}
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
+
Version: 2.4.0
|
6 |
Description: Ad management plugin with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
13 |
|
14 |
Change Log
|
15 |
|
16 |
+
Ad Inserter 2.4.0 - 2018-09-26
|
17 |
+
- Improved code for client-side insertion
|
18 |
+
- Added support for usage tracking
|
19 |
+
- Fix for compatibility with older PHP versions (below 5.4)
|
20 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
21 |
+
|
22 |
Ad Inserter 2.3.21 - 2018-09-20
|
23 |
- Added option to force showing admin toolbar when viewing site
|
24 |
- Added additional debugging info for blocks in Ajax requests
|
220 |
$ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
|
221 |
'id' => 'ai-toolbar-settings',
|
222 |
// 'parent' => 'ai-toolbar',
|
223 |
+
// 'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME . (defined ('AI_DEBUGGING_DEMO') ? ' Debugging DEMO' : ($debug_settings_on ? ' Debugging' : '')),
|
224 |
+
'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME . (defined ('AI_DEBUGGING_DEMO') ? ' Debugging DEMO' : ($debug_settings_on ? '' : '')),
|
225 |
'href' => $top_menu_url,
|
226 |
// 'meta' => $debug_settings_on ? array ('title' => 'Turn Debugging Off') : array (),
|
227 |
);
|
361 |
|
362 |
if ($ai_wp_data [AI_WP_USER_SET]) return;
|
363 |
|
|
|
|
|
364 |
if (is_user_logged_in ()) $ai_wp_data [AI_WP_USER] |= AI_USER_LOGGED_IN;
|
365 |
if (current_user_role () >= 5) $ai_wp_data [AI_WP_USER] |= AI_USER_ADMINISTRATOR;
|
366 |
|
1096 |
|
1097 |
if (isset ($ai_db_options_extract)) return;
|
1098 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1099 |
$expected_extract_version = $version_string . '-' . AD_INSERTER_BLOCKS;
|
1100 |
|
1101 |
if (isset ($ai_db_options [AI_OPTION_EXTRACT]['VERSION']) && $ai_db_options [AI_OPTION_EXTRACT]['VERSION'] == $expected_extract_version) {
|
1124 |
$start_time = microtime (true);
|
1125 |
}
|
1126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1127 |
ai_load_extract ();
|
1128 |
|
1129 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
1226 |
}
|
1227 |
|
1228 |
function ai_wp_enqueue_scripts_hook () {
|
1229 |
+
global $ai_wp_data, $wp_version;
|
1230 |
|
1231 |
// TEST
|
1232 |
// wp_deregister_script('jquery');
|
1246 |
|
1247 |
if ($footer_inline_scripts ||
|
1248 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
1249 |
+
!empty ($_GET) ||
|
1250 |
$ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
1251 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1252 |
get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 ||
|
1253 |
$ai_wp_data [AI_ANIMATION]) {
|
1254 |
|
1255 |
// force loading of jquery on frontend
|
1256 |
+
wp_enqueue_script ('ai-jquery-js', plugins_url ('includes/js/ai-jquery.js', __FILE__), array (
|
1257 |
'jquery',
|
1258 |
+
), $wp_version . '+' . AD_INSERTER_VERSION);
|
1259 |
|
1260 |
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
1261 |
wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
1311 |
if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION]) echo get_viewport_css ();
|
1312 |
|
1313 |
if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT || isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION])) {
|
|
|
|
|
|
|
|
|
|
|
1314 |
echo ai_get_client_side_styles ();
|
1315 |
|
1316 |
$ai_wp_data [AI_CLIENT_SIDE_CSS] = true;
|
1485 |
if (strpos ($js, 'AI_ADB_STATUS_MESSAGE') !== false) {
|
1486 |
$adb = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
1487 |
|
1488 |
+
$js = str_replace ('AI_ADB_OVERLAY_WINDOW', "jQuery ('<div>', {attr: {'style': b64d ('" . base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_OVERLAY_CSS) . get_overlay_css ()) . "')}})", $js);
|
1489 |
+
$js = str_replace ('AI_ADB_MESSAGE_WINDOW', "jQuery ('<div>', {attr: {'style': b64d ('" . base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), AI_BASIC_ADB_MESSAGE_CSS) . get_message_css ()) . "')}, 'html': b64d ('" .
|
1490 |
base64_encode (str_replace (array ("'", "\r", "\n"), array ("\'", '', ''), do_shortcode ($adb->ai_getCode ()))) . "')})", $js);
|
1491 |
|
1492 |
// $js = str_replace ('AI_ADB_SELECTORS', str_replace (' ', '', get_adb_selectors (true)), $js);
|
2750 |
if ($default_settings && $settings == '') continue;
|
2751 |
$settings = ' [' . $insertion_settings . '][' . $alignment_settings . ']' . $settings;
|
2752 |
|
2753 |
+
echo sprintf ("%2d %-21s ", $block, mb_substr ($obj->get_ad_name(), 0, 21));
|
2754 |
|
2755 |
echo $obj->get_display_settings_post() ? "o" : ".", " ";
|
2756 |
echo $obj->get_display_settings_page() ? "o" : ".", " ";
|
4206 |
|
4207 |
function ai_load_settings () {
|
4208 |
global $ai_db_options, $block_object, $ai_wp_data, $version_string, $ai_custom_hooks;
|
|
|
4209 |
|
4210 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) ai_log ("LOAD SETTINGS START");
|
4211 |
|
6665 |
|
6666 |
if (!function_exists ('ai_start_dst')) {
|
6667 |
function ai_start_dst () {
|
6668 |
+
global $ai_dst;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6669 |
|
6670 |
$dst_settings = array (
|
6671 |
'main_file' => __FILE__,
|
6677 |
'deactivation_form' => true,
|
6678 |
'admin_ip_tracking' => true,
|
6679 |
'notice_icon' => AD_INSERTER_PLUGIN_IMAGES_URL.'icon-50x50.jpg',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6680 |
);
|
6681 |
|
6682 |
if (function_exists ('ai_dst_settings')) ai_dst_settings ($dst_settings);
|
6686 |
|
6687 |
function ai_notice_text ($text) {
|
6688 |
$text = __('Thank you for installing [STRONG][NAME][/STRONG]. We would like to track its usage on your site. This is completely optional and can be disabled at any time.[P]
|
6689 |
+
We don\'t record any sensitive data, only information regarding the WordPress environment and %1$s usage, which will help us to make improvements to the %1$s.', 'ad-inserter');
|
6690 |
|
6691 |
return $text;
|
6692 |
}
|
6693 |
|
6694 |
+
function ai_dst_options ($options) {
|
6695 |
+
global $ai_db_options, $ai_db_options_extract;
|
6696 |
+
|
6697 |
+
if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) {
|
6698 |
+
$used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
|
6699 |
+
} else $used_blocks = '';
|
6700 |
+
|
6701 |
+
$install_timestamp = get_option (AI_INSTALL_NAME);
|
6702 |
+
if ($install_timestamp) {
|
6703 |
+
$install_date = date ("Y-m-d", $install_timestamp + get_option ('gmt_offset') * 3600);
|
6704 |
+
} else $install_date = '';
|
6705 |
+
|
6706 |
+
if (isset ($ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'])) {
|
6707 |
+
$settings_date = date ("Y-m-d", $ai_db_options [AI_OPTION_GLOBAL]['TIMESTAMP'] + get_option ('gmt_offset') * 3600);
|
6708 |
+
} else $settings_date = '';
|
6709 |
+
|
6710 |
+
$count_posts = wp_count_posts ();
|
6711 |
+
|
6712 |
+
$options ['posts'] = is_numeric ($count_posts->publish) ? $count_posts->publish : 0;
|
6713 |
+
$options ['blocks'] = $used_blocks;
|
6714 |
+
$options ['installation'] = $install_date;
|
6715 |
+
$options ['settings'] = $settings_date;
|
6716 |
+
$options ['notice_review'] = ($review = get_option ('ai-notice-review')) ? $review : '';
|
6717 |
+
$options ['remote_debugging'] = get_remote_debugging ();
|
6718 |
+
$options ['block_class'] = get_block_class_name ();
|
6719 |
+
return ($options);
|
6720 |
+
}
|
6721 |
+
|
6722 |
add_filter (DST_Client::DST_FILTER_OPTIN_NOTICE_TEXT . AD_INSERTER_SLUG, 'ai_notice_text');
|
6723 |
+
add_filter (DST_Client::DST_FILTER_OPTIONS . AD_INSERTER_SLUG, 'ai_dst_options');
|
6724 |
|
6725 |
ai_start_dst ();
|
6726 |
}
|
constants.php
CHANGED
@@ -29,7 +29,7 @@ if (!defined( 'AD_INSERTER_NAME'))
|
|
29 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
30 |
|
31 |
if (!defined( 'AD_INSERTER_VERSION'))
|
32 |
-
define ('AD_INSERTER_VERSION', '2.
|
33 |
|
34 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
35 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -677,7 +677,7 @@ define ('AI_BUFFERING', true);
|
|
677 |
define ('AI_ADSENSE_API', true);
|
678 |
define ('AI_ADSENSE_OVERLAY', true);
|
679 |
define ('AI_STICKY_SETTINGS', true);
|
680 |
-
|
681 |
define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
|
682 |
define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
|
683 |
define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
|
29 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
30 |
|
31 |
if (!defined( 'AD_INSERTER_VERSION'))
|
32 |
+
define ('AD_INSERTER_VERSION', '2.4.0');
|
33 |
|
34 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
35 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
677 |
define ('AI_ADSENSE_API', true);
|
678 |
define ('AI_ADSENSE_OVERLAY', true);
|
679 |
define ('AI_STICKY_SETTINGS', true);
|
680 |
+
define ('AI_PLUGIN_TRACKING', true);
|
681 |
define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
|
682 |
define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
|
683 |
define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
|
css/ad-inserter.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#ai-data {
|
2 |
-
font-family: "2.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
1 |
#ai-data {
|
2 |
+
font-family: "2.4.0"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
includes/dst/dst.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* DST - WP theme and plugin usage tracking client
|
5 |
* Experimental
|
6 |
*
|
7 |
-
* @version 1.0.
|
8 |
* @author Igor Funa <igor.funa/gmail.com>
|
9 |
*/
|
10 |
|
@@ -12,6 +12,15 @@
|
|
12 |
|
13 |
Change Log
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
DST 1.0.0 - 2018-09-13
|
16 |
- Initial release
|
17 |
|
@@ -65,6 +74,8 @@ class DST_Client {
|
|
65 |
|
66 |
const DST_TRANSIENT_THEME_ACTIVATED = 'dst_theme_activated_';
|
67 |
const DST_TRANSIENT_ADMIN_IP = 'dst_admin_ip';
|
|
|
|
|
68 |
|
69 |
const DST_OPTION_OPTIN_TRACKING = 'dst_optin_tracking';
|
70 |
const DST_OPTION_OPTIN_NEWSLETTER = 'dst_optin_newsletter';
|
@@ -77,7 +88,8 @@ class DST_Client {
|
|
77 |
const DST_FILTER_OPTIN_NOTICE_TEXT = 'dst_optin_notice_text_';
|
78 |
const DST_FILTER_EMAIL_NOTICE_TEXT = 'dst_email_notice_text_';
|
79 |
const DST_FILTER_FORM_TEXT = 'dst_deactivation_form_text_';
|
80 |
-
const DST_FILTER_SCHEDULE = '
|
|
|
81 |
|
82 |
const DST_ACTION_NONE = 0;
|
83 |
const DST_ACTION_START_TRACKING = 1;
|
@@ -89,6 +101,8 @@ class DST_Client {
|
|
89 |
const DST_ACTION_OPTIN_NO_NEWSLETTER = 7;
|
90 |
const DST_ACTION_SCHEDULE = 8;
|
91 |
const DST_ACTION_LIVE = 9;
|
|
|
|
|
92 |
|
93 |
private $dst_default_settings = array (
|
94 |
'tracking_url' => '',
|
@@ -116,7 +130,7 @@ class DST_Client {
|
|
116 |
self::DST_OPTION_DEACTIVATION_DETAILS,
|
117 |
);
|
118 |
|
119 |
-
private $version = '1.0.
|
120 |
private $tracking_url;
|
121 |
private $main_file;
|
122 |
private $slug;
|
@@ -229,9 +243,10 @@ class DST_Client {
|
|
229 |
add_action ('admin_init', array ($this, 'update'));
|
230 |
}
|
231 |
|
232 |
-
add_action ('admin_init',
|
233 |
-
add_action ('admin_notices',
|
234 |
-
add_action ('
|
|
|
235 |
|
236 |
// Upgrade
|
237 |
add_action ('upgrader_process_complete', array ($this, 'dst_upgrader_process_complete'), 10, 2);
|
@@ -330,6 +345,7 @@ class DST_Client {
|
|
330 |
wp_clear_scheduled_hook (self::DST_TRACKING_ACTION_HOOK . $this->slug);
|
331 |
delete_transient (self::DST_TRANSIENT_THEME_ACTIVATED . $this->slug);
|
332 |
delete_transient (self::DST_TRANSIENT_ADMIN_IP);
|
|
|
333 |
|
334 |
if ($this->product_type == self::DST_PRODUCT_TYPE_THEME) {
|
335 |
remove_theme_mod (self::DST_THEME_MOD_ALLOW_TRACKING);
|
@@ -352,6 +368,8 @@ class DST_Client {
|
|
352 |
|
353 |
function dst_upgrader_process_complete ($upgrader_object, $options) {
|
354 |
$this->log_event ('', serialize ($options));
|
|
|
|
|
355 |
if (is_array ($options) && array_key_exists ('action', $options) && $options ['action'] == 'update' && array_key_exists ('type', $options)) {
|
356 |
if ($options ['type'] == 'plugin' && array_key_exists ('plugins', $options) && is_array ($options ['plugins']) && !empty ($options ['plugins'])) {
|
357 |
$this_plugin = plugin_basename ($this->main_file);
|
@@ -404,6 +422,8 @@ class DST_Client {
|
|
404 |
|
405 |
$this->log_event ('', serialize ($data));
|
406 |
|
|
|
|
|
407 |
$request = wp_remote_post (
|
408 |
esc_url ($this->tracking_url . '?' . self::DST_TRACKING_URL_PARAMETER . '=' . $this->slug),
|
409 |
array (
|
@@ -427,8 +447,6 @@ class DST_Client {
|
|
427 |
public function get_data () {
|
428 |
$data ['message'] = '';
|
429 |
|
430 |
-
|
431 |
-
|
432 |
$data = array (
|
433 |
'slug' => sanitize_text_field ($this->slug),
|
434 |
'url' => home_url (),
|
@@ -446,6 +464,7 @@ class DST_Client {
|
|
446 |
);
|
447 |
|
448 |
if ($this->admin_ip_tracking) {
|
|
|
449 |
$data ['admin_ip'] = get_transient (self::DST_TRANSIENT_ADMIN_IP) ? get_transient (self::DST_TRANSIENT_ADMIN_IP) : '';
|
450 |
}
|
451 |
|
@@ -496,7 +515,7 @@ class DST_Client {
|
|
496 |
$data ['plugin'] = 'theme';
|
497 |
}
|
498 |
|
499 |
-
$data ['options'] = json_encode ($this->options);
|
500 |
|
501 |
$theme = wp_get_theme ();
|
502 |
if ($theme->Name) {
|
@@ -516,10 +535,23 @@ class DST_Client {
|
|
516 |
} else {
|
517 |
$debug_backtrace = debug_backtrace (false, 3);
|
518 |
// get_data - update - call_user_func_array
|
|
|
519 |
|
520 |
-
if ($debug_backtrace [1]['function'] == 'update' && $debug_backtrace [2]['function'] == 'call_user_func_array') {
|
521 |
$this->action = self::DST_ACTION_SCHEDULE;
|
522 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
}
|
525 |
|
@@ -676,21 +708,30 @@ class DST_Client {
|
|
676 |
update_option (self::DST_OPTION_LAST_TRACK_TIMES, $track_times);
|
677 |
}
|
678 |
|
679 |
-
public function
|
680 |
if ($this->admin_ip_tracking && current_user_can ('administrator')) {
|
681 |
-
$admin_ip_address = $this->get_client_ip_address ();
|
682 |
$saved_admin_ip_address = get_transient (self::DST_TRANSIENT_ADMIN_IP);
|
683 |
-
|
684 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
}
|
686 |
}
|
|
|
687 |
|
|
|
688 |
$notification_times = get_option (self::DST_NOTIFICATION_TIMES, array ());
|
689 |
if (!isset ($notification_times [$this->slug])) {
|
690 |
$notification_time = time() + absint ($this->delay_notification);
|
691 |
$notification_times [$this->slug] = $notification_time;
|
692 |
update_option (self::DST_NOTIFICATION_TIMES, $notification_times);
|
693 |
}
|
|
|
694 |
}
|
695 |
|
696 |
public function get_is_notification_time () {
|
4 |
* DST - WP theme and plugin usage tracking client
|
5 |
* Experimental
|
6 |
*
|
7 |
+
* @version 1.0.2
|
8 |
* @author Igor Funa <igor.funa/gmail.com>
|
9 |
*/
|
10 |
|
12 |
|
13 |
Change Log
|
14 |
|
15 |
+
DST 1.0.2 - 2018-09-23
|
16 |
+
- Added transient for last action
|
17 |
+
- Added last action check for update when admin IP address is sent
|
18 |
+
- Added filter for options
|
19 |
+
|
20 |
+
DST 1.0.1 - 2018-09-22
|
21 |
+
- Fix for admin IP address
|
22 |
+
- Fix for compatibility with older PHP versions (below 5.4)
|
23 |
+
|
24 |
DST 1.0.0 - 2018-09-13
|
25 |
- Initial release
|
26 |
|
74 |
|
75 |
const DST_TRANSIENT_THEME_ACTIVATED = 'dst_theme_activated_';
|
76 |
const DST_TRANSIENT_ADMIN_IP = 'dst_admin_ip';
|
77 |
+
const DST_TRANSIENT_ADMIN_IP_CACHE_TIME = 10368000;
|
78 |
+
const DST_TRANSIENT_LAST_ACTION = 'dst_last_action_';
|
79 |
|
80 |
const DST_OPTION_OPTIN_TRACKING = 'dst_optin_tracking';
|
81 |
const DST_OPTION_OPTIN_NEWSLETTER = 'dst_optin_newsletter';
|
88 |
const DST_FILTER_OPTIN_NOTICE_TEXT = 'dst_optin_notice_text_';
|
89 |
const DST_FILTER_EMAIL_NOTICE_TEXT = 'dst_email_notice_text_';
|
90 |
const DST_FILTER_FORM_TEXT = 'dst_deactivation_form_text_';
|
91 |
+
const DST_FILTER_SCHEDULE = 'dst_schedule_';
|
92 |
+
const DST_FILTER_OPTIONS = 'dst_options_';
|
93 |
|
94 |
const DST_ACTION_NONE = 0;
|
95 |
const DST_ACTION_START_TRACKING = 1;
|
101 |
const DST_ACTION_OPTIN_NO_NEWSLETTER = 7;
|
102 |
const DST_ACTION_SCHEDULE = 8;
|
103 |
const DST_ACTION_LIVE = 9;
|
104 |
+
const DST_ACTION_LIVE_UPDATED = 10;
|
105 |
+
const DST_ACTION_ADMIN_IP_SET = 11;
|
106 |
|
107 |
private $dst_default_settings = array (
|
108 |
'tracking_url' => '',
|
130 |
self::DST_OPTION_DEACTIVATION_DETAILS,
|
131 |
);
|
132 |
|
133 |
+
private $version = '1.0.2';
|
134 |
private $tracking_url;
|
135 |
private $main_file;
|
136 |
private $slug;
|
243 |
add_action ('admin_init', array ($this, 'update'));
|
244 |
}
|
245 |
|
246 |
+
add_action ('admin_init', array ($this, 'init_data'));
|
247 |
+
add_action ('admin_notices', array ($this, 'optin_notice'));
|
248 |
+
add_action ('network_admin_notices', array ($this, 'optin_notice'));
|
249 |
+
add_action ('admin_footer', array ($this, 'admin_footer'));
|
250 |
|
251 |
// Upgrade
|
252 |
add_action ('upgrader_process_complete', array ($this, 'dst_upgrader_process_complete'), 10, 2);
|
345 |
wp_clear_scheduled_hook (self::DST_TRACKING_ACTION_HOOK . $this->slug);
|
346 |
delete_transient (self::DST_TRANSIENT_THEME_ACTIVATED . $this->slug);
|
347 |
delete_transient (self::DST_TRANSIENT_ADMIN_IP);
|
348 |
+
delete_transient (self::DST_TRANSIENT_LAST_ACTION . $this->slug);
|
349 |
|
350 |
if ($this->product_type == self::DST_PRODUCT_TYPE_THEME) {
|
351 |
remove_theme_mod (self::DST_THEME_MOD_ALLOW_TRACKING);
|
368 |
|
369 |
function dst_upgrader_process_complete ($upgrader_object, $options) {
|
370 |
$this->log_event ('', serialize ($options));
|
371 |
+
|
372 |
+
$this->update_admin_ip ();
|
373 |
if (is_array ($options) && array_key_exists ('action', $options) && $options ['action'] == 'update' && array_key_exists ('type', $options)) {
|
374 |
if ($options ['type'] == 'plugin' && array_key_exists ('plugins', $options) && is_array ($options ['plugins']) && !empty ($options ['plugins'])) {
|
375 |
$this_plugin = plugin_basename ($this->main_file);
|
422 |
|
423 |
$this->log_event ('', serialize ($data));
|
424 |
|
425 |
+
set_transient (self::DST_TRANSIENT_LAST_ACTION . $this->slug, $data ['action'], 365 * 24 * 3600);
|
426 |
+
|
427 |
$request = wp_remote_post (
|
428 |
esc_url ($this->tracking_url . '?' . self::DST_TRACKING_URL_PARAMETER . '=' . $this->slug),
|
429 |
array (
|
447 |
public function get_data () {
|
448 |
$data ['message'] = '';
|
449 |
|
|
|
|
|
450 |
$data = array (
|
451 |
'slug' => sanitize_text_field ($this->slug),
|
452 |
'url' => home_url (),
|
464 |
);
|
465 |
|
466 |
if ($this->admin_ip_tracking) {
|
467 |
+
$this->update_admin_ip ();
|
468 |
$data ['admin_ip'] = get_transient (self::DST_TRANSIENT_ADMIN_IP) ? get_transient (self::DST_TRANSIENT_ADMIN_IP) : '';
|
469 |
}
|
470 |
|
515 |
$data ['plugin'] = 'theme';
|
516 |
}
|
517 |
|
518 |
+
$data ['options'] = json_encode (apply_filters (self::DST_FILTER_OPTIONS . $this->slug, $this->options));
|
519 |
|
520 |
$theme = wp_get_theme ();
|
521 |
if ($theme->Name) {
|
535 |
} else {
|
536 |
$debug_backtrace = debug_backtrace (false, 3);
|
537 |
// get_data - update - call_user_func_array
|
538 |
+
// BACKTRACE: update - apply_filters - do_action - do_action_ref_array
|
539 |
|
540 |
+
if ($debug_backtrace [1]['function'] == 'update' && ($debug_backtrace [2]['function'] == 'call_user_func_array' || $debug_backtrace [2]['function'] == 'apply_filters')) {
|
541 |
$this->action = self::DST_ACTION_SCHEDULE;
|
542 |
}
|
543 |
+
else {
|
544 |
+
$debug_backtrace = debug_backtrace (false, 7);
|
545 |
+
$backtrace = array ();
|
546 |
+
foreach ($debug_backtrace as $index => $debug_backtrace_data) {
|
547 |
+
if ($index == 0) continue;
|
548 |
+
if (isset ($debug_backtrace_data ['function'])) {
|
549 |
+
$backtrace []= $debug_backtrace_data ['function'];
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
$data ['message'] = 'BACKTRACE: ' . implode (' - ', $backtrace);
|
554 |
+
}
|
555 |
}
|
556 |
}
|
557 |
|
708 |
update_option (self::DST_OPTION_LAST_TRACK_TIMES, $track_times);
|
709 |
}
|
710 |
|
711 |
+
public function update_admin_ip ($update_status = false) {
|
712 |
if ($this->admin_ip_tracking && current_user_can ('administrator')) {
|
|
|
713 |
$saved_admin_ip_address = get_transient (self::DST_TRANSIENT_ADMIN_IP);
|
714 |
+
$transient_timeout = get_option ('_transient_timeout_' . self::DST_TRANSIENT_ADMIN_IP);
|
715 |
+
if (!$saved_admin_ip_address || !($transient_timeout) || ($transient_timeout - time ()) < self::DST_TRANSIENT_ADMIN_IP_CACHE_TIME / 2) {
|
716 |
+
$admin_ip_address = $this->get_client_ip_address ();
|
717 |
+
set_transient (self::DST_TRANSIENT_ADMIN_IP, $admin_ip_address, self::DST_TRANSIENT_ADMIN_IP_CACHE_TIME);
|
718 |
+
|
719 |
+
if (!$saved_admin_ip_address && $update_status && get_transient (self::DST_TRANSIENT_LAST_ACTION . $this->slug) == self::DST_ACTION_SCHEDULE) {
|
720 |
+
$this->action = self::DST_ACTION_ADMIN_IP_SET;
|
721 |
+
$this->update (true);
|
722 |
+
}
|
723 |
}
|
724 |
}
|
725 |
+
}
|
726 |
|
727 |
+
public function init_data () {
|
728 |
$notification_times = get_option (self::DST_NOTIFICATION_TIMES, array ());
|
729 |
if (!isset ($notification_times [$this->slug])) {
|
730 |
$notification_time = time() + absint ($this->delay_notification);
|
731 |
$notification_times [$this->slug] = $notification_time;
|
732 |
update_option (self::DST_NOTIFICATION_TIMES, $notification_times);
|
733 |
}
|
734 |
+
$this->update_admin_ip (true);
|
735 |
}
|
736 |
|
737 |
public function get_is_notification_time () {
|
includes/editor.php
CHANGED
@@ -89,149 +89,23 @@ function generate_code_editor ($block, $client_code, $process_php) {
|
|
89 |
}
|
90 |
};
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
* <br />
|
100 |
-
* Decodes a base64 encoded data.
|
101 |
-
* String $.base64Decode ( String str )
|
102 |
-
* </code>
|
103 |
-
*
|
104 |
-
* Encodes and Decodes the given data in base64.
|
105 |
-
* This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
|
106 |
-
* Base64-encoded data takes about 33% more space than the original data.
|
107 |
-
* 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.
|
108 |
-
* 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).
|
109 |
-
* This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
|
110 |
-
*
|
111 |
-
* Example
|
112 |
-
* Code
|
113 |
-
* <code>
|
114 |
-
* $.base64Encode("I'm Persian.");
|
115 |
-
* </code>
|
116 |
-
* Result
|
117 |
-
* <code>
|
118 |
-
* "SSdtIFBlcnNpYW4u"
|
119 |
-
* </code>
|
120 |
-
* Code
|
121 |
-
* <code>
|
122 |
-
* $.base64Decode("SSdtIFBlcnNpYW4u");
|
123 |
-
* </code>
|
124 |
-
* Result
|
125 |
-
* <code>
|
126 |
-
* "I'm Persian."
|
127 |
-
* </code>
|
128 |
-
*
|
129 |
-
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
130 |
-
* @link http://www.semnanweb.com/jquery-plugin/base64.html (no longer available?)
|
131 |
-
* @link https://gist.github.com/gists/1602210
|
132 |
-
* @see http://www.webtoolkit.info/
|
133 |
-
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
134 |
-
* @param {jQuery} {base64Encode:function(input))
|
135 |
-
* @param {jQuery} {base64Decode:function(input))
|
136 |
-
* @return string
|
137 |
-
*/
|
138 |
-
|
139 |
-
(function($){
|
140 |
-
|
141 |
-
var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
142 |
-
|
143 |
-
var uTF8Encode = function(string) {
|
144 |
-
string = string.replace(/\x0d\x0a/g, "\x0a");
|
145 |
-
var output = "";
|
146 |
-
for (var n = 0; n < string.length; n++) {
|
147 |
-
var c = string.charCodeAt(n);
|
148 |
-
if (c < 128) {
|
149 |
-
output += String.fromCharCode(c);
|
150 |
-
} else if ((c > 127) && (c < 2048)) {
|
151 |
-
output += String.fromCharCode((c >> 6) | 192);
|
152 |
-
output += String.fromCharCode((c & 63) | 128);
|
153 |
-
} else {
|
154 |
-
output += String.fromCharCode((c >> 12) | 224);
|
155 |
-
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
156 |
-
output += String.fromCharCode((c & 63) | 128);
|
157 |
-
}
|
158 |
-
}
|
159 |
-
return output;
|
160 |
-
};
|
161 |
-
|
162 |
-
var uTF8Decode = function(input) {
|
163 |
-
var string = "";
|
164 |
-
var i = 0;
|
165 |
-
var c = c1 = c2 = 0;
|
166 |
-
while ( i < input.length ) {
|
167 |
-
c = input.charCodeAt(i);
|
168 |
-
if (c < 128) {
|
169 |
-
string += String.fromCharCode(c);
|
170 |
-
i++;
|
171 |
-
} else if ((c > 191) && (c < 224)) {
|
172 |
-
c2 = input.charCodeAt(i+1);
|
173 |
-
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
174 |
-
i += 2;
|
175 |
-
} else {
|
176 |
-
c2 = input.charCodeAt(i+1);
|
177 |
-
c3 = input.charCodeAt(i+2);
|
178 |
-
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
179 |
-
i += 3;
|
180 |
-
}
|
181 |
-
}
|
182 |
-
return string;
|
183 |
-
}
|
184 |
|
185 |
-
$.extend({
|
186 |
-
base64Encode: function(input) {
|
187 |
-
var output = "";
|
188 |
-
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
189 |
-
var i = 0;
|
190 |
-
input = uTF8Encode(input);
|
191 |
-
while (i < input.length) {
|
192 |
-
chr1 = input.charCodeAt(i++);
|
193 |
-
chr2 = input.charCodeAt(i++);
|
194 |
-
chr3 = input.charCodeAt(i++);
|
195 |
-
enc1 = chr1 >> 2;
|
196 |
-
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
197 |
-
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
198 |
-
enc4 = chr3 & 63;
|
199 |
-
if (isNaN(chr2)) {
|
200 |
-
enc3 = enc4 = 64;
|
201 |
-
} else if (isNaN(chr3)) {
|
202 |
-
enc4 = 64;
|
203 |
-
}
|
204 |
-
output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
|
205 |
-
}
|
206 |
-
return output;
|
207 |
-
},
|
208 |
-
base64Decode: function(input) {
|
209 |
-
var output = "";
|
210 |
-
var chr1, chr2, chr3;
|
211 |
-
var enc1, enc2, enc3, enc4;
|
212 |
-
var i = 0;
|
213 |
-
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
214 |
-
while (i < input.length) {
|
215 |
-
enc1 = keyString.indexOf(input.charAt(i++));
|
216 |
-
enc2 = keyString.indexOf(input.charAt(i++));
|
217 |
-
enc3 = keyString.indexOf(input.charAt(i++));
|
218 |
-
enc4 = keyString.indexOf(input.charAt(i++));
|
219 |
-
chr1 = (enc1 << 2) | (enc2 >> 4);
|
220 |
-
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
221 |
-
chr3 = ((enc3 & 3) << 6) | enc4;
|
222 |
-
output = output + String.fromCharCode(chr1);
|
223 |
-
if (enc3 != 64) {
|
224 |
-
output = output + String.fromCharCode(chr2);
|
225 |
-
}
|
226 |
-
if (enc4 != 64) {
|
227 |
-
output = output + String.fromCharCode(chr3);
|
228 |
-
}
|
229 |
-
}
|
230 |
-
output = uTF8Decode(output);
|
231 |
-
return output;
|
232 |
-
}
|
233 |
-
});
|
234 |
-
})(jQuery);
|
235 |
|
236 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
237 |
|
@@ -308,7 +182,7 @@ function generate_code_editor ($block, $client_code, $process_php) {
|
|
308 |
if (window.opener != null && !window.opener.closed) {
|
309 |
var settings = $(window.opener.document).contents();
|
310 |
|
311 |
-
tmce_setContent (
|
312 |
|
313 |
process_display_elements ();
|
314 |
}
|
89 |
}
|
90 |
};
|
91 |
|
92 |
+
function b64e (str) {
|
93 |
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
94 |
+
// then we convert the percent encodings into raw bytes which
|
95 |
+
// can be fed into btoa.
|
96 |
+
return btoa (encodeURIComponent (str).replace (/%([0-9A-F]{2})/g,
|
97 |
+
function toSolidBytes (match, p1) {
|
98 |
+
return String.fromCharCode ('0x' + p1);
|
99 |
+
}));
|
100 |
+
}
|
101 |
|
102 |
+
function b64d (str) {
|
103 |
+
// Going backwards: from bytestream, to percent-encoding, to original string.
|
104 |
+
return decodeURIComponent (atob (str).split ('').map (function(c) {
|
105 |
+
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
106 |
+
}).join (''));
|
107 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
111 |
|
182 |
if (window.opener != null && !window.opener.closed) {
|
183 |
var settings = $(window.opener.document).contents();
|
184 |
|
185 |
+
tmce_setContent (b64d ("<?php echo base64_encode ($code); ?>"));
|
186 |
|
187 |
process_display_elements ();
|
188 |
}
|
includes/js/ai-adb.js
CHANGED
@@ -1,620 +1,637 @@
|
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
if (ai_adb_debugging) console.log (
|
195 |
-
|
196 |
-
var
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
var
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
$(this).
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
}
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
}
|
326 |
-
|
327 |
-
if (
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
}
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
if (
|
444 |
-
|
445 |
-
if (
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
if (
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
});
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
}
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
}
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
}
|
620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
function b64e (str) {
|
145 |
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
146 |
+
// then we convert the percent encodings into raw bytes which
|
147 |
+
// can be fed into btoa.
|
148 |
+
return btoa (encodeURIComponent (str).replace (/%([0-9A-F]{2})/g,
|
149 |
+
function toSolidBytes (match, p1) {
|
150 |
+
return String.fromCharCode ('0x' + p1);
|
151 |
+
}));
|
152 |
+
}
|
153 |
+
|
154 |
+
function b64d (str) {
|
155 |
+
// Going backwards: from bytestream, to percent-encoding, to original string.
|
156 |
+
return decodeURIComponent (atob (str).split ('').map (function(c) {
|
157 |
+
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
158 |
+
}).join (''));
|
159 |
+
}
|
160 |
+
|
161 |
+
var ai_adb = false;
|
162 |
+
var ai_adb_debugging = typeof ai_debugging !== 'undefined';
|
163 |
+
var ai_adb_active = false;
|
164 |
+
var ai_adb_counter = 0;
|
165 |
+
var ai_adb_overlay = AI_ADB_OVERLAY_WINDOW;
|
166 |
+
var ai_adb_message_window = AI_ADB_MESSAGE_WINDOW;
|
167 |
+
var ai_adb_message_undismissible = AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE;
|
168 |
+
var ai_adb_act_cookie_name = "aiADB";
|
169 |
+
var ai_adb_pgv_cookie_name = "aiADB_PV";
|
170 |
+
var ai_adb_page_redirection_cookie_name = "aiADB_PR";
|
171 |
+
var ai_adb_message_cookie_lifetime = AI_FUNCT_GET_NO_ACTION_PERIOD;
|
172 |
+
var ai_adb_action = AI_FUNC_GET_ADB_ACTION;
|
173 |
+
var ai_adb_page_views = AI_FUNCT_GET_DELAY_ACTION;
|
174 |
+
var ai_adb_selectors = "AI_ADB_SELECTORS";
|
175 |
+
var ai_adb_redirection_url = "AI_ADB_REDIRECTION_PAGE";
|
176 |
+
|
177 |
+
function ai_adb_process_content () {
|
178 |
+
(function ($) {
|
179 |
+
|
180 |
+
if (ai_adb_debugging) console.log ('');
|
181 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING CONTENT PROCESSING");
|
182 |
+
|
183 |
+
$(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each (function () {
|
184 |
+
var ai_adb_parent = $(this).parent ();
|
185 |
+
|
186 |
+
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")+"\"");
|
187 |
+
|
188 |
+
var ai_adb_css = $(this).data ("css");
|
189 |
+
if (typeof ai_adb_css == "undefined") ai_adb_css = "display: none !important;";
|
190 |
+
|
191 |
+
var ai_adb_selectors = $(this).data ("selectors");
|
192 |
+
if (typeof ai_adb_selectors == "undefined" || ai_adb_selectors == '') ai_adb_selectors = "p";
|
193 |
+
|
194 |
+
if (ai_adb_debugging) console.log ('AI AD BLOCKING CSS, css=\'' + ai_adb_css +'\'', "selectors='" + ai_adb_selectors + "'");
|
195 |
+
|
196 |
+
var ai_adb_action = false;
|
197 |
+
$(ai_adb_parent).find ('.AI_ADB_CONTENT_CSS_BEGIN_CLASS, ' + ai_adb_selectors).each (function () {
|
198 |
+
if ($(this).hasClass ("AI_ADB_CONTENT_CSS_BEGIN_CLASS")) {$(this).remove (); ai_adb_action = true;}
|
199 |
+
else if ($(this).hasClass ("AI_ADB_CONTENT_CSS_END_CLASS")) {$(this).remove (); ai_adb_action = false;}
|
200 |
+
else if (ai_adb_action) {
|
201 |
+
var ai_adb_style = $(this).attr ("style");
|
202 |
+
if (typeof ai_adb_style == "undefined") ai_adb_style = "";
|
203 |
+
$(this).attr ("style", ai_adb_style + ";" + ai_adb_css);
|
204 |
+
}
|
205 |
+
});
|
206 |
+
});
|
207 |
+
|
208 |
+
$(".AI_ADB_CONTENT_DELETE_BEGIN_CLASS").each (function () {
|
209 |
+
var ai_adb_parent = $(this).parent ();
|
210 |
+
|
211 |
+
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")+"\"");
|
212 |
+
|
213 |
+
var ai_adb_selectors = $(this).data ("selectors");
|
214 |
+
if (typeof ai_adb_selectors == "undefined" || ai_adb_selectors == '') ai_adb_selectors = "p";
|
215 |
+
|
216 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING DELETE, selectors='" + ai_adb_selectors + "'");
|
217 |
+
|
218 |
+
var ai_adb_action = false;
|
219 |
+
$(ai_adb_parent).find ('.AI_ADB_CONTENT_DELETE_BEGIN_CLASS, ' + ai_adb_selectors).each (function () {
|
220 |
+
if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_BEGIN_CLASS")) {$(this).remove (); ai_adb_action = true;}
|
221 |
+
else if ($(this).hasClass ("AI_ADB_CONTENT_DELETE_END_CLASS")) {$(this).remove (); ai_adb_action = false;}
|
222 |
+
else if (ai_adb_action) {
|
223 |
+
$(this).remove ();
|
224 |
+
}
|
225 |
+
});
|
226 |
+
|
227 |
+
});
|
228 |
+
|
229 |
+
$(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS").each (function () {
|
230 |
+
var ai_adb_parent = $(this).parent ();
|
231 |
+
|
232 |
+
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")+"\"");
|
233 |
+
|
234 |
+
var ai_adb_text = $(this).data ("text");
|
235 |
+
if (typeof ai_adb_text == "undefined") ai_adb_text = "";
|
236 |
+
|
237 |
+
var ai_adb_css = $(this).data ("css");
|
238 |
+
if (typeof ai_adb_css == "undefined") ai_adb_css = "";
|
239 |
+
|
240 |
+
var ai_adb_selectors = $(this).data ("selectors");
|
241 |
+
if (typeof ai_adb_selectors == "undefined" || ai_adb_selectors == '') ai_adb_selectors = "p";
|
242 |
+
|
243 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING REPLACE, text=\'" + ai_adb_text + '\'', 'css=\'' + ai_adb_css +'\'', "selectors='" + ai_adb_selectors + "'");
|
244 |
+
|
245 |
+
var ai_adb_action = false;
|
246 |
+
$(ai_adb_parent).find ('.AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, ' + ai_adb_selectors).each (function () {
|
247 |
+
if ($(this).hasClass ("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS")) {$(this).remove (); ai_adb_action = true;}
|
248 |
+
else if ($(this).hasClass ("AI_ADB_CONTENT_REPLACE_END_CLASS")) {$(this).remove (); ai_adb_action = false;}
|
249 |
+
else if (ai_adb_action) {
|
250 |
+
if (ai_adb_text.length != 0) {
|
251 |
+
var n = Math.round ($(this).text ().length / (ai_adb_text.length + 1));
|
252 |
+
$(this).text (Array(n + 1).join(ai_adb_text + ' '));
|
253 |
+
} else $(this).text ('');
|
254 |
+
var ai_adb_style = $(this).attr ("style");
|
255 |
+
if (typeof ai_adb_style == "undefined") ai_adb_style = "";
|
256 |
+
$(this).attr ("style", ai_adb_style + ";" + ai_adb_css);
|
257 |
+
}
|
258 |
+
});
|
259 |
+
});
|
260 |
+
|
261 |
+
}(jQuery));
|
262 |
+
}
|
263 |
+
|
264 |
+
var ai_adb_detected = function(n) {
|
265 |
+
|
266 |
+
if (ai_adb_debugging && n == 0) console.log ('');
|
267 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING DETECTED", n);
|
268 |
+
|
269 |
+
if (!ai_adb_active) {
|
270 |
+
ai_adb_active = true;
|
271 |
+
|
272 |
+
(function ($) {
|
273 |
+
|
274 |
+
$(window).ready(function () {
|
275 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING block actions");
|
276 |
+
|
277 |
+
$(".ai-adb-hide").each (function () {
|
278 |
+
$(this).css ({"display": "none", "visibility": "hidden"});
|
279 |
+
|
280 |
+
var wrapping_div = $(this).closest ('div[data-ai]');
|
281 |
+
if (typeof wrapping_div.data ("ai") != "undefined") {
|
282 |
+
var data = JSON.parse (b64d (wrapping_div.data ("ai")));
|
283 |
+
if (typeof data !== "undefined" && data.constructor === Array) {
|
284 |
+
data [1] = "";
|
285 |
+
wrapping_div.data ("ai", b64e (JSON.stringify (data)));
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
if (ai_adb_debugging) {
|
290 |
+
var debug_info = $(this).data ("ai-debug");
|
291 |
+
console.log ("AI AD BLOCKING HIDE", typeof debug_info != "undefined" ? debug_info : "");
|
292 |
+
}
|
293 |
+
});
|
294 |
+
|
295 |
+
// after hide to update tracking data on replace
|
296 |
+
$(".ai-adb-show").each (function () {
|
297 |
+
$(this).css ({"display": "block", "visibility": "visible"});
|
298 |
+
|
299 |
+
var tracking_data = $(this).data ('ai-tracking');
|
300 |
+
if (typeof tracking_data != 'undefined') {
|
301 |
+
var wrapping_div = $(this).closest ('div[data-ai]');
|
302 |
+
if (typeof wrapping_div.data ("ai") != "undefined") {
|
303 |
+
|
304 |
+
if ($(this).hasClass ('ai-no-tracking')) {
|
305 |
+
var data = JSON.parse (b64d (wrapping_div.data ("ai")));
|
306 |
+
if (typeof data !== "undefined" && data.constructor === Array) {
|
307 |
+
data [1] = "";
|
308 |
+
tracking_data = b64e (JSON.stringify (data));
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
wrapping_div.data ("ai", tracking_data);
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
if (ai_adb_debugging) {
|
317 |
+
var debug_info = $(this).data ("ai-debug");
|
318 |
+
console.log ("AI AD BLOCKING SHOW", typeof debug_info != "undefined" ? debug_info : "");
|
319 |
+
}
|
320 |
+
});
|
321 |
+
|
322 |
+
// ai_adb_process_content ();
|
323 |
+
|
324 |
+
setTimeout (ai_adb_process_content, 10);
|
325 |
+
});
|
326 |
+
|
327 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING action check");
|
328 |
+
// $.removeCookie (ai_adb_pgv_cookie_name, {path: "/" });
|
329 |
+
|
330 |
+
if (ai_adb_page_views != 0) {
|
331 |
+
var ai_adb_page_view_counter = 1;
|
332 |
+
var cookie = $.cookie (ai_adb_pgv_cookie_name);
|
333 |
+
if (typeof cookie != "undefined") ai_adb_page_view_counter = parseInt (cookie) + 1;
|
334 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING page views cookie:", cookie, "- page view:", ai_adb_page_view_counter);
|
335 |
+
if (ai_adb_page_view_counter < ai_adb_page_views) {
|
336 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING", ai_adb_page_views, "page views not reached, no action");
|
337 |
+
var d1 = ai_adb_page_view_counter;
|
338 |
+
var AI_ADB_STATUS_MESSAGE=1;
|
339 |
+
$.cookie (ai_adb_pgv_cookie_name, ai_adb_page_view_counter, {expires: 365, path: "/"});
|
340 |
+
return;
|
341 |
+
}
|
342 |
+
}
|
343 |
+
|
344 |
+
if (ai_adb_message_cookie_lifetime != 0 && (ai_adb_action != 1 || !ai_adb_message_undismissible)) {
|
345 |
+
var cookie = $.cookie (ai_adb_act_cookie_name);
|
346 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING cookie:", cookie);
|
347 |
+
if (typeof cookie != "undefined" && cookie == "AI_CONST_AI_ADB_COOKIE_VALUE") {
|
348 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING valid cookie detected, no action");
|
349 |
+
var AI_ADB_STATUS_MESSAGE=2;
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
|
353 |
+
else if (ai_adb_debugging) console.log ("AI AD BLOCKING invalid cookie");
|
354 |
+
$.cookie (ai_adb_act_cookie_name, "AI_CONST_AI_ADB_COOKIE_VALUE", {expires: ai_adb_message_cookie_lifetime, path: "/"});
|
355 |
+
} else $.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
356 |
+
|
357 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING action", ai_adb_action);
|
358 |
+
|
359 |
+
if (ai_adb_action == 0) {
|
360 |
+
var AI_ADB_STATUS_MESSAGE=6;
|
361 |
+
} else {
|
362 |
+
var AI_ADB_STATUS_MESSAGE=3;
|
363 |
+
}
|
364 |
+
|
365 |
+
switch (ai_adb_action) {
|
366 |
+
case 1:
|
367 |
+
if (!ai_adb_message_undismissible) {
|
368 |
+
ai_adb_overlay.click (function () {
|
369 |
+
$(this).remove();
|
370 |
+
ai_adb_message_window.remove();
|
371 |
+
}).css ("cursor", "pointer");
|
372 |
+
ai_adb_message_window.click (function () {
|
373 |
+
$(this).remove();
|
374 |
+
ai_adb_overlay.remove();
|
375 |
+
}).css ("cursor", "pointer");
|
376 |
+
window.onkeydown = function( event ) {
|
377 |
+
if (event.keyCode === 27 ) {
|
378 |
+
ai_adb_overlay.click ();
|
379 |
+
ai_adb_message_window.click ();
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE click detection installed");
|
384 |
+
|
385 |
+
} else {
|
386 |
+
// $.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
387 |
+
}
|
388 |
+
|
389 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE");
|
390 |
+
$("body").prepend (ai_adb_overlay).prepend (ai_adb_message_window);
|
391 |
+
break;
|
392 |
+
case 2:
|
393 |
+
if (ai_adb_redirection_url != "") {
|
394 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING REDIRECTION to", ai_adb_redirection_url);
|
395 |
+
|
396 |
+
var redirect = true;
|
397 |
+
if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == "http") {
|
398 |
+
if (window.location.href == ai_adb_redirection_url) var redirect = false;
|
399 |
+
} else {
|
400 |
+
if (window.location.pathname == ai_adb_redirection_url) var redirect = false;
|
401 |
+
}
|
402 |
+
|
403 |
+
if (redirect) {
|
404 |
+
var cookie = $.cookie (ai_adb_page_redirection_cookie_name);
|
405 |
+
if (typeof cookie == "undefined") {
|
406 |
+
var date = new Date();
|
407 |
+
date.setTime (date.getTime() + (10 * 1000));
|
408 |
+
$.cookie (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: "/" });
|
409 |
+
|
410 |
+
window.location.replace (ai_adb_redirection_url)
|
411 |
+
} else {
|
412 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING no redirection, cookie:", cookie);
|
413 |
+
|
414 |
+
}
|
415 |
+
} else {
|
416 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING already on page", window.location.href);
|
417 |
+
jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
418 |
+
}
|
419 |
+
}
|
420 |
+
break;
|
421 |
+
}
|
422 |
+
|
423 |
+
}(jQuery));
|
424 |
+
|
425 |
+
ai_adb = true;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
var ai_adb_undetected = function(n) {
|
431 |
+
ai_adb_counter ++;
|
432 |
+
|
433 |
+
if (ai_adb_debugging && n == 1) console.log ('');
|
434 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING not detected", n, "- counter:", ai_adb_counter);
|
435 |
+
|
436 |
+
if (!ai_adb_active && ai_adb_counter == 3) {
|
437 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING NOT DETECTED");
|
438 |
+
|
439 |
+
var AI_ADB_STATUS_MESSAGE=4; // Check replacement code {}
|
440 |
+
|
441 |
+
// var redirected_page = false;
|
442 |
+
// if (ai_adb_redirection_url.toLowerCase().substring (0, 4) == "http") {
|
443 |
+
// if (window.location.href == ai_adb_redirection_url) var redirected_page = true;
|
444 |
+
// } else {
|
445 |
+
// if (window.location.pathname == ai_adb_redirection_url) var redirected_page = true;
|
446 |
+
// }
|
447 |
+
|
448 |
+
// if (redirected_page) {
|
449 |
+
// var cookie = jQuery.cookie (ai_adb_page_redirection_cookie_name);
|
450 |
+
// if (typeof cookie != "undefined" && cookie.toLowerCase().substring (0, 4) == "http") {
|
451 |
+
// if (ai_adb_debugging) console.log ("AI AD BLOCKING returning to", cookie);
|
452 |
+
// jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
453 |
+
// window.location.replace (cookie);
|
454 |
+
// }
|
455 |
+
// }
|
456 |
+
|
457 |
+
}
|
458 |
+
}
|
459 |
+
|
460 |
+
if (AI_DBG_AI_DEBUG_AD_BLOCKING) jQuery (document).ready (function () {ai_adb_detected (0)});
|
461 |
+
|
462 |
+
if (!document.getElementById ("AI_CONST_AI_ADB_1_NAME")){
|
463 |
+
jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (1)});
|
464 |
+
} else {
|
465 |
+
jQuery (document).ready (function () {ai_adb_undetected (1)});
|
466 |
+
}
|
467 |
+
|
468 |
+
if (typeof window.AI_CONST_AI_ADB_2_NAME == "undefined") {
|
469 |
+
jQuery (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (2)});
|
470 |
+
} else {
|
471 |
+
jQuery (document).ready (function () {ai_adb_undetected (2)});
|
472 |
+
}
|
473 |
+
|
474 |
+
jQuery (document).ready (function ($) {
|
475 |
+
$(window).ready (function () {
|
476 |
+
|
477 |
+
|
478 |
+
$("#ai-adb-bar").click (function () {
|
479 |
+
$.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
480 |
+
$.removeCookie (ai_adb_pgv_cookie_name, {path: "/" });
|
481 |
+
var AI_ADB_STATUS_MESSAGE=5;
|
482 |
+
});
|
483 |
+
|
484 |
+
if ($("#banner-advert-container img").length > 0) {
|
485 |
+
if ($("#banner-advert-container img").outerHeight() === 0) {
|
486 |
+
$(document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (3)});
|
487 |
+
} else $(document).ready (function () {ai_adb_undetected (3)});
|
488 |
+
$("#banner-advert-container img").remove();
|
489 |
+
}
|
490 |
+
|
491 |
+
if ((!ai_adb_active || ai_adb_debugging) && ai_adb_selectors != "") {
|
492 |
+
var ai_adb_el_counter = 0;
|
493 |
+
var ai_adb_el_zero = 0;
|
494 |
+
var ai_adb_selector = ai_adb_selectors.split (",");
|
495 |
+
$.each (ai_adb_selector, function (i) {
|
496 |
+
|
497 |
+
if (ai_adb_debugging) console.log ("AI AD BLOCKING selector", ai_adb_selector [i]);
|
498 |
+
|
499 |
+
if ($(ai_adb_selector [i]).length != 0) {
|
500 |
+
$(ai_adb_selector [i]).each (function (n) {
|
501 |
+
|
502 |
+
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 ());
|
503 |
+
|
504 |
+
ai_adb_el_counter ++;
|
505 |
+
if ($(this).outerHeight () === 0) {
|
506 |
+
$ (document).ready (function () {if (!ai_adb_active || ai_adb_debugging) ai_adb_detected (4)});
|
507 |
+
ai_adb_el_zero ++;
|
508 |
+
if (!ai_adb_debugging) return false;
|
509 |
+
}
|
510 |
+
|
511 |
+
});
|
512 |
+
|
513 |
+
}
|
514 |
+
});
|
515 |
+
if (ai_adb_el_counter != 0 && ai_adb_el_zero == 0) $(document).ready (function () {ai_adb_undetected (4)});
|
516 |
+
}
|
517 |
+
});
|
518 |
+
});
|
519 |
+
|
520 |
+
/*!
|
521 |
+
* jQuery Cookie Plugin v1.4.1
|
522 |
+
* https://github.com/carhartl/jquery-cookie
|
523 |
+
*
|
524 |
+
* Copyright 2013 Klaus Hartl
|
525 |
+
* Released under the MIT license
|
526 |
+
*/
|
527 |
+
(function (factory) {
|
528 |
+
if (typeof define === "function" && define.amd) {
|
529 |
+
// AMD
|
530 |
+
define(["jquery"], factory);
|
531 |
+
} else if (typeof exports === "object") {
|
532 |
+
// CommonJS
|
533 |
+
factory(require("jquery"));
|
534 |
+
} else {
|
535 |
+
// Browser globals
|
536 |
+
factory(jQuery);
|
537 |
+
}
|
538 |
+
}(function ($) {
|
539 |
+
|
540 |
+
var pluses = /\+/g;
|
541 |
+
|
542 |
+
function encode(s) {
|
543 |
+
return config.raw ? s : encodeURIComponent(s);
|
544 |
+
}
|
545 |
+
|
546 |
+
function decode(s) {
|
547 |
+
return config.raw ? s : decodeURIComponent(s);
|
548 |
+
}
|
549 |
+
|
550 |
+
function stringifyCookieValue(value) {
|
551 |
+
return encode(config.json ? JSON.stringify(value) : String(value));
|
552 |
+
}
|
553 |
+
|
554 |
+
function parseCookieValue(s) {
|
555 |
+
if (s.indexOf('"') === 0) {
|
556 |
+
// This is a quoted cookie as according to RFC2068, unescape...
|
557 |
+
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
558 |
+
}
|
559 |
+
|
560 |
+
try {
|
561 |
+
// Replace server-side written pluses with spaces.
|
562 |
+
// If we can\'t decode the cookie, ignore it, it\'s unusable.
|
563 |
+
// If we can\'t parse the cookie, ignore it, it\'s unusable.
|
564 |
+
s = decodeURIComponent(s.replace(pluses, " "));
|
565 |
+
return config.json ? JSON.parse(s) : s;
|
566 |
+
} catch(e) {}
|
567 |
+
}
|
568 |
+
|
569 |
+
function read(s, converter) {
|
570 |
+
var value = config.raw ? s : parseCookieValue(s);
|
571 |
+
return $.isFunction(converter) ? converter(value) : value;
|
572 |
+
}
|
573 |
+
|
574 |
+
var config = $.cookie = function (key, value, options) {
|
575 |
+
|
576 |
+
// Write
|
577 |
+
|
578 |
+
if (value !== undefined && !$.isFunction(value)) {
|
579 |
+
options = $.extend({}, config.defaults, options);
|
580 |
+
|
581 |
+
if (typeof options.expires === "number") {
|
582 |
+
var days = options.expires, t = options.expires = new Date();
|
583 |
+
t.setTime(+t + days * 864e+5);
|
584 |
+
}
|
585 |
+
|
586 |
+
return (document.cookie = [
|
587 |
+
encode(key), "=", stringifyCookieValue(value),
|
588 |
+
options.expires ? "; expires=" + options.expires.toUTCString() : "", // use expires attribute, max-age is not supported by IE
|
589 |
+
options.path ? "; path=" + options.path : "",
|
590 |
+
options.domain ? "; domain=" + options.domain : "",
|
591 |
+
options.secure ? "; secure" : ""
|
592 |
+
].join(""));
|
593 |
+
}
|
594 |
+
|
595 |
+
// Read
|
596 |
+
|
597 |
+
var result = key ? undefined : {};
|
598 |
+
|
599 |
+
// To prevent the for loop in the first place assign an empty array
|
600 |
+
// in case there are no cookies at all. Also prevents odd result when
|
601 |
+
// calling $.cookie().
|
602 |
+
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
603 |
+
|
604 |
+
for (var i = 0, l = cookies.length; i < l; i++) {
|
605 |
+
var parts = cookies[i].split("=");
|
606 |
+
var name = decode(parts.shift());
|
607 |
+
var cookie = parts.join("=");
|
608 |
+
|
609 |
+
if (key && key === name) {
|
610 |
+
// If second argument (value) is a function it\'s a converter...
|
611 |
+
result = read(cookie, value);
|
612 |
+
break;
|
613 |
+
}
|
614 |
+
|
615 |
+
// Prevent storing a cookie that we couldn\'t decode.
|
616 |
+
if (!key && (cookie = read(cookie)) !== undefined) {
|
617 |
+
result[name] = cookie;
|
618 |
+
}
|
619 |
+
}
|
620 |
+
|
621 |
+
return result;
|
622 |
+
};
|
623 |
+
|
624 |
+
config.defaults = {};
|
625 |
+
|
626 |
+
$.removeCookie = function (key, options) {
|
627 |
+
if ($.cookie(key) === undefined) {
|
628 |
+
return false;
|
629 |
+
}
|
630 |
+
|
631 |
+
// Must not alter options, thus extending a fresh object...
|
632 |
+
$.cookie(key, "", $.extend({}, options, { expires: -1 }));
|
633 |
+
return !$.cookie(key);
|
634 |
+
};
|
635 |
+
|
636 |
+
}));
|
637 |
+
|
includes/js/ai-adb.min.js
CHANGED
@@ -1,42 +1,34 @@
|
|
1 |
-
/*
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
(
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
var
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
"
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
"
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
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)});
|
36 |
-
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||
|
37 |
-
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());
|
38 |
-
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)})}})});
|
39 |
-
(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,
|
40 |
-
'"').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=
|
41 |
-
[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&&
|
42 |
-
(cookie=read(cookie))!==undefined)result[name]=cookie}return result};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined)return false;$.cookie(key,"",$.extend({},options,{expires:-1}));return!$.cookie(key)}});
|
1 |
+
/*
|
2 |
+
jQuery Cookie Plugin v1.4.1
|
3 |
+
https://github.com/carhartl/jquery-cookie
|
4 |
+
|
5 |
+
Copyright 2013 Klaus Hartl
|
6 |
+
Released under the MIT license
|
7 |
+
*/
|
8 |
+
function b64e(str){return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,function toSolidBytes(match,p1){return String.fromCharCode("0x"+p1)}))}function b64d(str){return decodeURIComponent(atob(str).split("").map(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)}).join(""))}var ai_adb=false;var ai_adb_debugging=typeof ai_debugging!=="undefined";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;
|
9 |
+
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;var ai_adb_selectors="AI_ADB_SELECTORS";var ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
|
10 |
+
function ai_adb_process_content(){(function($){if(ai_adb_debugging)console.log("");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;";
|
11 |
+
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 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();
|
12 |
+
ai_adb_action=false}else if(ai_adb_action){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)}})});$(".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==
|
13 |
+
"undefined"||ai_adb_selectors=="")ai_adb_selectors="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=
|
14 |
+
$(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='"+
|
15 |
+
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));
|
16 |
+
$(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)}
|
17 |
+
var ai_adb_detected=function(n){if(ai_adb_debugging&&n==0)console.log("");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-hide").each(function(){$(this).css({"display":"none","visibility":"hidden"});var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(b64d(wrapping_div.data("ai")));
|
18 |
+
if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";wrapping_div.data("ai",b64e(JSON.stringify(data)))}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI AD BLOCKING HIDE",typeof debug_info!="undefined"?debug_info:"")}});$(".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("div[data-ai]");if(typeof wrapping_div.data("ai")!=
|
19 |
+
"undefined"){if($(this).hasClass("ai-no-tracking")){var data=JSON.parse(b64d(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";tracking_data=b64e(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:"")}});setTimeout(ai_adb_process_content,10)});if(ai_adb_debugging)console.log("AI AD BLOCKING action check");if(ai_adb_page_views!=
|
20 |
+
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);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,
|
21 |
+
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!="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");
|
22 |
+
$.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);if(ai_adb_action==0)var AI_ADB_STATUS_MESSAGE=6;else var AI_ADB_STATUS_MESSAGE=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();
|
23 |
+
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");$("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);
|
24 |
+
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=="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:",
|
25 |
+
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}};
|
26 |
+
var ai_adb_undetected=function(n){ai_adb_counter++;if(ai_adb_debugging&&n==1)console.log("");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)});
|
27 |
+
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)});
|
28 |
+
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||
|
29 |
+
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());
|
30 |
+
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)})}})});
|
31 |
+
(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,
|
32 |
+
'"').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=
|
33 |
+
[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&&
|
34 |
+
(cookie=read(cookie))!==undefined)result[name]=cookie}return result};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined)return false;$.cookie(key,"",$.extend({},options,{expires:-1}));return!$.cookie(key)}});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/ai-lists.js
CHANGED
@@ -133,7 +133,14 @@ jQuery (function ($) {
|
|
133 |
block_wrapping_div.find ('.ai-debug-name.ai-list-status').text (enable_block ? 'VISIBLE' : 'HIDDEN');
|
134 |
if (!enable_block) {
|
135 |
$(this).hide ();
|
136 |
-
block_wrapping_div.removeAttr ('data-ai')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
} else {
|
138 |
block_wrapping_div.css ({"visibility": ""});
|
139 |
if (block_wrapping_div.hasClass ('ai-remove-position')) {
|
133 |
block_wrapping_div.find ('.ai-debug-name.ai-list-status').text (enable_block ? 'VISIBLE' : 'HIDDEN');
|
134 |
if (!enable_block) {
|
135 |
$(this).hide ();
|
136 |
+
block_wrapping_div.removeAttr ('data-ai');
|
137 |
+
|
138 |
+
if (block_wrapping_div.find ('.ai-debug-block')) {
|
139 |
+
block_wrapping_div.css ({"visibility": ""}).removeClass ('ai-close');
|
140 |
+
if (block_wrapping_div.hasClass ('ai-remove-position')) {
|
141 |
+
block_wrapping_div.css ({"position": ""});
|
142 |
+
}
|
143 |
+
} else block_wrapping_div.hide ();
|
144 |
} else {
|
145 |
block_wrapping_div.css ({"visibility": ""});
|
146 |
if (block_wrapping_div.hasClass ('ai-remove-position')) {
|
includes/js/ai-lists.min.js
CHANGED
@@ -3,5 +3,6 @@ function(){var ai_debug=typeof ai_debugging!=="undefined";var cookies=document.c
|
|
3 |
var referers_list_type=$(this).attr("referer-list-type");if(ai_debug)console.log("");if(ai_debug)console.log("AI LISTS referer: ",referrer);if(ai_debug)console.log("AI LISTS referer list:",b64d(referer_list),referers_list_type);$.each(referer_list_array,function(index,list_referer){if(list_referer=="")return true;if(list_referer=="#"){if(referrer==""){found=true;return false}}else if(list_referer==referrer){found=true;return false}});switch(referers_list_type){case "B":if(found)enable_block=false;
|
4 |
break;case "W":if(!found)enable_block=false;break}if(ai_debug)console.log("AI LISTS list found",found);if(ai_debug)console.log("AI LISTS list pass",enable_block)}if(enable_block){var parameter_list=$(this).attr("parameter-list");if(typeof parameter_list!="undefined"){var parameter_list_array=b64d(parameter_list).split(",");var parameter_list_type=$(this).attr("parameter-list-type");if(ai_debug)console.log("");if(ai_debug)console.log("AI LISTS cookies: ",cookies);if(ai_debug)console.log("AI LISTS parameter list:",
|
5 |
b64d(parameter_list),parameter_list_type);var found=false;$.each(parameter_list_array,function(index,list_parameter){if(list_parameter.indexOf("=")!=-1){if(cookies.indexOf(list_parameter)!=-1){found=true;return false}}else cookies.forEach(function(cookie){var cookie_data=cookie.split("=");if(list_parameter==cookie_data[0]){found=true;return false}})});switch(parameter_list_type){case "B":if(found)enable_block=false;break;case "W":if(!found)enable_block=false;break}if(ai_debug)console.log("AI LISTS list found",
|
6 |
-
found);if(ai_debug)console.log("AI LISTS list pass",enable_block)}}$(this).css({"visibility":"","position":"","width":"","height":"","z-index":""}).removeClass("ai-list-data");var block_wrapping_div=$(this).closest("div.ai-list-block");block_wrapping_div.removeClass("ai-list-block");block_wrapping_div.find(".ai-debug-name.ai-list-info").text(referrer);block_wrapping_div.find(".ai-debug-name.ai-list-status").text(enable_block?"VISIBLE":"HIDDEN");if(!enable_block){$(this).hide();block_wrapping_div.removeAttr("data-ai")
|
7 |
-
if(block_wrapping_div.hasClass("ai-remove-position"))block_wrapping_div.css({"position":""});if(typeof $(this).data("code")!="undefined"){var block_code=b64d($(this).data("code"));$(this).append(block_code);if(!ai_debug)$(this).attr("data-code",
|
|
3 |
var referers_list_type=$(this).attr("referer-list-type");if(ai_debug)console.log("");if(ai_debug)console.log("AI LISTS referer: ",referrer);if(ai_debug)console.log("AI LISTS referer list:",b64d(referer_list),referers_list_type);$.each(referer_list_array,function(index,list_referer){if(list_referer=="")return true;if(list_referer=="#"){if(referrer==""){found=true;return false}}else if(list_referer==referrer){found=true;return false}});switch(referers_list_type){case "B":if(found)enable_block=false;
|
4 |
break;case "W":if(!found)enable_block=false;break}if(ai_debug)console.log("AI LISTS list found",found);if(ai_debug)console.log("AI LISTS list pass",enable_block)}if(enable_block){var parameter_list=$(this).attr("parameter-list");if(typeof parameter_list!="undefined"){var parameter_list_array=b64d(parameter_list).split(",");var parameter_list_type=$(this).attr("parameter-list-type");if(ai_debug)console.log("");if(ai_debug)console.log("AI LISTS cookies: ",cookies);if(ai_debug)console.log("AI LISTS parameter list:",
|
5 |
b64d(parameter_list),parameter_list_type);var found=false;$.each(parameter_list_array,function(index,list_parameter){if(list_parameter.indexOf("=")!=-1){if(cookies.indexOf(list_parameter)!=-1){found=true;return false}}else cookies.forEach(function(cookie){var cookie_data=cookie.split("=");if(list_parameter==cookie_data[0]){found=true;return false}})});switch(parameter_list_type){case "B":if(found)enable_block=false;break;case "W":if(!found)enable_block=false;break}if(ai_debug)console.log("AI LISTS list found",
|
6 |
+
found);if(ai_debug)console.log("AI LISTS list pass",enable_block)}}$(this).css({"visibility":"","position":"","width":"","height":"","z-index":""}).removeClass("ai-list-data");var block_wrapping_div=$(this).closest("div.ai-list-block");block_wrapping_div.removeClass("ai-list-block");block_wrapping_div.find(".ai-debug-name.ai-list-info").text(referrer);block_wrapping_div.find(".ai-debug-name.ai-list-status").text(enable_block?"VISIBLE":"HIDDEN");if(!enable_block){$(this).hide();block_wrapping_div.removeAttr("data-ai");
|
7 |
+
if(block_wrapping_div.find(".ai-debug-block")){block_wrapping_div.css({"visibility":""}).removeClass("ai-close");if(block_wrapping_div.hasClass("ai-remove-position"))block_wrapping_div.css({"position":""})}else block_wrapping_div.hide()}else{block_wrapping_div.css({"visibility":""});if(block_wrapping_div.hasClass("ai-remove-position"))block_wrapping_div.css({"position":""});if(typeof $(this).data("code")!="undefined"){var block_code=b64d($(this).data("code"));$(this).append(block_code);if(!ai_debug)$(this).attr("data-code",
|
8 |
+
"");if(typeof aiLazyLoading=="function")$("div.ai-lazy",this).each(function(index,element){aiLazyLoading({lazyClass:"ai-lazy",lazyElement:this.element})})}}})};$(document).ready(function($){setTimeout(function(){ai_process_lists()},5)})});
|
includes/preview-adb.php
CHANGED
@@ -75,149 +75,23 @@ function generate_code_preview_adb ($client_code, $process_php) {
|
|
75 |
}
|
76 |
};
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
* <br />
|
86 |
-
* Decodes a base64 encoded data.
|
87 |
-
* String $.base64Decode ( String str )
|
88 |
-
* </code>
|
89 |
-
*
|
90 |
-
* Encodes and Decodes the given data in base64.
|
91 |
-
* This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
|
92 |
-
* Base64-encoded data takes about 33% more space than the original data.
|
93 |
-
* 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.
|
94 |
-
* 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).
|
95 |
-
* This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin.
|
96 |
-
*
|
97 |
-
* Example
|
98 |
-
* Code
|
99 |
-
* <code>
|
100 |
-
* $.base64Encode("I'm Persian.");
|
101 |
-
* </code>
|
102 |
-
* Result
|
103 |
-
* <code>
|
104 |
-
* "SSdtIFBlcnNpYW4u"
|
105 |
-
* </code>
|
106 |
-
* Code
|
107 |
-
* <code>
|
108 |
-
* $.base64Decode("SSdtIFBlcnNpYW4u");
|
109 |
-
* </code>
|
110 |
-
* Result
|
111 |
-
* <code>
|
112 |
-
* "I'm Persian."
|
113 |
-
* </code>
|
114 |
-
*
|
115 |
-
* @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com >
|
116 |
-
* @link http://www.semnanweb.com/jquery-plugin/base64.html (no longer available?)
|
117 |
-
* @link https://gist.github.com/gists/1602210
|
118 |
-
* @see http://www.webtoolkit.info/
|
119 |
-
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public License]
|
120 |
-
* @param {jQuery} {base64Encode:function(input))
|
121 |
-
* @param {jQuery} {base64Decode:function(input))
|
122 |
-
* @return string
|
123 |
-
*/
|
124 |
-
|
125 |
-
(function($){
|
126 |
-
|
127 |
-
var keyString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
128 |
-
|
129 |
-
var uTF8Encode = function(string) {
|
130 |
-
string = string.replace(/\x0d\x0a/g, "\x0a");
|
131 |
-
var output = "";
|
132 |
-
for (var n = 0; n < string.length; n++) {
|
133 |
-
var c = string.charCodeAt(n);
|
134 |
-
if (c < 128) {
|
135 |
-
output += String.fromCharCode(c);
|
136 |
-
} else if ((c > 127) && (c < 2048)) {
|
137 |
-
output += String.fromCharCode((c >> 6) | 192);
|
138 |
-
output += String.fromCharCode((c & 63) | 128);
|
139 |
-
} else {
|
140 |
-
output += String.fromCharCode((c >> 12) | 224);
|
141 |
-
output += String.fromCharCode(((c >> 6) & 63) | 128);
|
142 |
-
output += String.fromCharCode((c & 63) | 128);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
return output;
|
146 |
-
};
|
147 |
-
|
148 |
-
var uTF8Decode = function(input) {
|
149 |
-
var string = "";
|
150 |
-
var i = 0;
|
151 |
-
var c = c1 = c2 = 0;
|
152 |
-
while ( i < input.length ) {
|
153 |
-
c = input.charCodeAt(i);
|
154 |
-
if (c < 128) {
|
155 |
-
string += String.fromCharCode(c);
|
156 |
-
i++;
|
157 |
-
} else if ((c > 191) && (c < 224)) {
|
158 |
-
c2 = input.charCodeAt(i+1);
|
159 |
-
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
160 |
-
i += 2;
|
161 |
-
} else {
|
162 |
-
c2 = input.charCodeAt(i+1);
|
163 |
-
c3 = input.charCodeAt(i+2);
|
164 |
-
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
165 |
-
i += 3;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
return string;
|
169 |
-
}
|
170 |
|
171 |
-
$.extend({
|
172 |
-
base64Encode: function(input) {
|
173 |
-
var output = "";
|
174 |
-
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
175 |
-
var i = 0;
|
176 |
-
input = uTF8Encode(input);
|
177 |
-
while (i < input.length) {
|
178 |
-
chr1 = input.charCodeAt(i++);
|
179 |
-
chr2 = input.charCodeAt(i++);
|
180 |
-
chr3 = input.charCodeAt(i++);
|
181 |
-
enc1 = chr1 >> 2;
|
182 |
-
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
183 |
-
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
184 |
-
enc4 = chr3 & 63;
|
185 |
-
if (isNaN(chr2)) {
|
186 |
-
enc3 = enc4 = 64;
|
187 |
-
} else if (isNaN(chr3)) {
|
188 |
-
enc4 = 64;
|
189 |
-
}
|
190 |
-
output = output + keyString.charAt(enc1) + keyString.charAt(enc2) + keyString.charAt(enc3) + keyString.charAt(enc4);
|
191 |
-
}
|
192 |
-
return output;
|
193 |
-
},
|
194 |
-
base64Decode: function(input) {
|
195 |
-
var output = "";
|
196 |
-
var chr1, chr2, chr3;
|
197 |
-
var enc1, enc2, enc3, enc4;
|
198 |
-
var i = 0;
|
199 |
-
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
200 |
-
while (i < input.length) {
|
201 |
-
enc1 = keyString.indexOf(input.charAt(i++));
|
202 |
-
enc2 = keyString.indexOf(input.charAt(i++));
|
203 |
-
enc3 = keyString.indexOf(input.charAt(i++));
|
204 |
-
enc4 = keyString.indexOf(input.charAt(i++));
|
205 |
-
chr1 = (enc1 << 2) | (enc2 >> 4);
|
206 |
-
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
207 |
-
chr3 = ((enc3 & 3) << 6) | enc4;
|
208 |
-
output = output + String.fromCharCode(chr1);
|
209 |
-
if (enc3 != 64) {
|
210 |
-
output = output + String.fromCharCode(chr2);
|
211 |
-
}
|
212 |
-
if (enc4 != 64) {
|
213 |
-
output = output + String.fromCharCode(chr3);
|
214 |
-
}
|
215 |
-
}
|
216 |
-
output = uTF8Decode(output);
|
217 |
-
return output;
|
218 |
-
}
|
219 |
-
});
|
220 |
-
})(jQuery);
|
221 |
|
222 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
223 |
|
@@ -296,7 +170,7 @@ function generate_code_preview_adb ($client_code, $process_php) {
|
|
296 |
if (window.opener != null && !window.opener.closed) {
|
297 |
var settings = $(window.opener.document).contents();
|
298 |
|
299 |
-
tmce_setContent (
|
300 |
|
301 |
$("#message-css").val (settings.find ("#message-css").val ());
|
302 |
$("#overlay-css").val (settings.find ("#overlay-css").val ());
|
75 |
}
|
76 |
};
|
77 |
|
78 |
+
function b64e (str) {
|
79 |
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
80 |
+
// then we convert the percent encodings into raw bytes which
|
81 |
+
// can be fed into btoa.
|
82 |
+
return btoa (encodeURIComponent (str).replace (/%([0-9A-F]{2})/g,
|
83 |
+
function toSolidBytes (match, p1) {
|
84 |
+
return String.fromCharCode ('0x' + p1);
|
85 |
+
}));
|
86 |
+
}
|
87 |
|
88 |
+
function b64d (str) {
|
89 |
+
// Going backwards: from bytestream, to percent-encoding, to original string.
|
90 |
+
return decodeURIComponent (atob (str).split ('').map (function(c) {
|
91 |
+
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
92 |
+
}).join (''));
|
93 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
// https://gist.github.com/RadGH/523bed274f307830752c
|
97 |
|
170 |
if (window.opener != null && !window.opener.closed) {
|
171 |
var settings = $(window.opener.document).contents();
|
172 |
|
173 |
+
tmce_setContent (b64d ("<?php echo base64_encode ($adb_message); ?>"));
|
174 |
|
175 |
$("#message-css").val (settings.find ("#message-css").val ());
|
176 |
$("#overlay-css").val (settings.find ("#overlay-css").val ());
|
js/ad-inserter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var javascript_version = "2.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
@@ -131,102 +131,119 @@ var AI_STICK_TO_THE_BOTTOM = 3;
|
|
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 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
i
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
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 |
var shSettings = {
|
232 |
"tab_size":"4",
|
@@ -280,7 +297,7 @@ function SyntaxHighlight (id, block, settings) {
|
|
280 |
// if (textarea.val () == "") {
|
281 |
// textarea.removeAttr ("name");
|
282 |
// }
|
283 |
-
// else textarea.val (
|
284 |
|
285 |
var default_value = textarea.attr ("default");
|
286 |
var current_value = textarea.val ();
|
@@ -1545,7 +1562,7 @@ jQuery(document).ready(function($) {
|
|
1545 |
|
1546 |
$(this).blur ();
|
1547 |
|
1548 |
-
var code =
|
1549 |
var php = $("input#process-php-a").is(":checked") ? 1 : 0;
|
1550 |
|
1551 |
var window_width = 820;
|
@@ -2000,8 +2017,8 @@ jQuery(document).ready(function($) {
|
|
2000 |
'action': 'ai_ajax_backend',
|
2001 |
'preview': block,
|
2002 |
'ai_check': nonce,
|
2003 |
-
'name':
|
2004 |
-
'code':
|
2005 |
'alignment': btoa (alignment),
|
2006 |
'horizontal': btoa (horizontal),
|
2007 |
'vertical': btoa (vertical),
|
@@ -2099,7 +2116,7 @@ jQuery(document).ready(function($) {
|
|
2099 |
$("#visual-editor-"+tab).click (function () {
|
2100 |
var block = $(this).attr('id').replace ("visual-editor-", "");
|
2101 |
|
2102 |
-
var code =
|
2103 |
var php = $("input#process-php-" + block).is(":checked") ? 1 : 0;
|
2104 |
|
2105 |
var window_width = 820;
|
@@ -2212,7 +2229,7 @@ jQuery(document).ready(function($) {
|
|
2212 |
var block = $(this).attr('id').replace ("import-code-", "");
|
2213 |
var nonce = $("#ai-form").attr ('nonce');
|
2214 |
|
2215 |
-
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-code':
|
2216 |
).done (function (data) {
|
2217 |
if (data != '') {
|
2218 |
$('#ai-error-container').hide ();
|
@@ -2396,7 +2413,7 @@ jQuery(document).ready(function($) {
|
|
2396 |
var ul = option_tabs.find ("ul");
|
2397 |
|
2398 |
if (rotation_container.is(':visible')) {
|
2399 |
-
rotation_container.data ('code',
|
2400 |
rotation_container.data ('option', 1);
|
2401 |
|
2402 |
add_rotate_options (block, 1);
|
@@ -2407,7 +2424,7 @@ jQuery(document).ready(function($) {
|
|
2407 |
|
2408 |
setTimeout (function() {import_rotation_code (block);}, 5);
|
2409 |
} else {
|
2410 |
-
// set_editor_text (block,
|
2411 |
generate_rotatation_code (block);
|
2412 |
|
2413 |
ul.find ("li").remove ();
|
@@ -2551,7 +2568,7 @@ jQuery(document).ready(function($) {
|
|
2551 |
|
2552 |
var nonce = $("#ai-form").attr ('nonce');
|
2553 |
|
2554 |
-
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-rotation-code':
|
2555 |
).done (function (data) {
|
2556 |
if (data != '') {
|
2557 |
var code_data = JSON.parse (data);
|
@@ -2576,8 +2593,8 @@ jQuery(document).ready(function($) {
|
|
2576 |
add_rotate_options (block, tabs);
|
2577 |
|
2578 |
rotation_container.find ('ul li').each (function (index) {
|
2579 |
-
if (index < options) $(this).data ('code',
|
2580 |
-
$(this).data ('code',
|
2581 |
});
|
2582 |
|
2583 |
rotation_container.tabs ("option", "active", 0);
|
@@ -2600,7 +2617,7 @@ jQuery(document).ready(function($) {
|
|
2600 |
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2601 |
|
2602 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2603 |
-
set_editor_text (block,
|
2604 |
rotation_container.hide();
|
2605 |
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2606 |
|
@@ -2617,14 +2634,14 @@ jQuery(document).ready(function($) {
|
|
2617 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2618 |
var option = rotation_container.tabs ("option", "active") + 1;
|
2619 |
|
2620 |
-
$(('#option-' + block + '-' + option)).data ('code',
|
2621 |
|
2622 |
var nonce = $("#ai-form").attr ('nonce');
|
2623 |
|
2624 |
var rotation_data = [];
|
2625 |
rotation_container.find ("div.rounded").each (function (index) {
|
2626 |
var code_data = $('#option-' + block + '-' + (index + 1)).data ('code');
|
2627 |
-
var code = typeof code_data == 'undefined' ? '' :
|
2628 |
var option_data = {'name': $(this).find ('input.option-name').val (), 'share': $(this).find ('input.option-share').val (), 'time': $(this).find ('input.option-time').val (), 'code': code};
|
2629 |
|
2630 |
rotation_data.push (option_data);
|
@@ -2632,7 +2649,7 @@ jQuery(document).ready(function($) {
|
|
2632 |
|
2633 |
if (debug) console.log ('ROTATION DATA:', rotation_data);
|
2634 |
|
2635 |
-
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'generate-rotation-code':
|
2636 |
).done (function (data) {
|
2637 |
$('#ai-error-container').hide ();
|
2638 |
|
@@ -2649,7 +2666,7 @@ jQuery(document).ready(function($) {
|
|
2649 |
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2650 |
|
2651 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2652 |
-
set_editor_text (block,
|
2653 |
rotation_container.hide();
|
2654 |
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2655 |
|
@@ -2679,7 +2696,7 @@ jQuery(document).ready(function($) {
|
|
2679 |
|
2680 |
var new_li = li.clone ().show ();
|
2681 |
new_li.find ("a").attr ('href', '#tab-option-' + block + '-' + option).text (String.fromCharCode (64 + option));
|
2682 |
-
new_li.attr ('id', 'option-' + block + '-' + option).appendTo (ul).data ('code',
|
2683 |
|
2684 |
new_li.click (function () {
|
2685 |
var rotation_container = $(this).closest ('.ai-rotate');
|
@@ -2690,8 +2707,8 @@ jQuery(document).ready(function($) {
|
|
2690 |
|
2691 |
if (debug) console.log ('OPTION CHANGE:', old_option, '=>', new_option);
|
2692 |
|
2693 |
-
$(('#option-' + block + '-' + old_option)).data ('code',
|
2694 |
-
set_editor_text (block,
|
2695 |
});
|
2696 |
|
2697 |
div.clone ().show ().attr ('id', 'tab-option-' + block + '-' + option).appendTo (rotation_container);
|
@@ -2727,7 +2744,7 @@ jQuery(document).ready(function($) {
|
|
2727 |
|
2728 |
var new_option = option == 0 ? 0 : option - 1;
|
2729 |
active_li = $('#option-' + block + '-' + (new_option + 1));
|
2730 |
-
set_editor_text (block,
|
2731 |
ul.closest ('.ai-rotate').data ('option', new_option + 1);
|
2732 |
}
|
2733 |
|
1 |
+
var javascript_version = "2.4.0";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
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 |
+
function b64e (str) {
|
232 |
+
// first we use encodeURIComponent to get percent-encoded UTF-8,
|
233 |
+
// then we convert the percent encodings into raw bytes which
|
234 |
+
// can be fed into btoa.
|
235 |
+
return btoa (encodeURIComponent (str).replace (/%([0-9A-F]{2})/g,
|
236 |
+
function toSolidBytes (match, p1) {
|
237 |
+
return String.fromCharCode ('0x' + p1);
|
238 |
+
}));
|
239 |
+
}
|
240 |
|
241 |
+
function b64d (str) {
|
242 |
+
// Going backwards: from bytestream, to percent-encoding, to original string.
|
243 |
+
return decodeURIComponent (atob (str).split ('').map (function(c) {
|
244 |
+
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
245 |
+
}).join (''));
|
246 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
var shSettings = {
|
249 |
"tab_size":"4",
|
297 |
// if (textarea.val () == "") {
|
298 |
// textarea.removeAttr ("name");
|
299 |
// }
|
300 |
+
// else textarea.val (b64e (textarea.val ()));
|
301 |
|
302 |
var default_value = textarea.attr ("default");
|
303 |
var current_value = textarea.val ();
|
1562 |
|
1563 |
$(this).blur ();
|
1564 |
|
1565 |
+
var code = b64e (get_editor_text ('a'));
|
1566 |
var php = $("input#process-php-a").is(":checked") ? 1 : 0;
|
1567 |
|
1568 |
var window_width = 820;
|
2017 |
'action': 'ai_ajax_backend',
|
2018 |
'preview': block,
|
2019 |
'ai_check': nonce,
|
2020 |
+
'name': b64e (name),
|
2021 |
+
'code': b64e (code),
|
2022 |
'alignment': btoa (alignment),
|
2023 |
'horizontal': btoa (horizontal),
|
2024 |
'vertical': btoa (vertical),
|
2116 |
$("#visual-editor-"+tab).click (function () {
|
2117 |
var block = $(this).attr('id').replace ("visual-editor-", "");
|
2118 |
|
2119 |
+
var code = b64e (get_editor_text (block));
|
2120 |
var php = $("input#process-php-" + block).is(":checked") ? 1 : 0;
|
2121 |
|
2122 |
var window_width = 820;
|
2229 |
var block = $(this).attr('id').replace ("import-code-", "");
|
2230 |
var nonce = $("#ai-form").attr ('nonce');
|
2231 |
|
2232 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-code': b64e (get_editor_text (block))}
|
2233 |
).done (function (data) {
|
2234 |
if (data != '') {
|
2235 |
$('#ai-error-container').hide ();
|
2413 |
var ul = option_tabs.find ("ul");
|
2414 |
|
2415 |
if (rotation_container.is(':visible')) {
|
2416 |
+
rotation_container.data ('code', b64e (get_editor_text (block)));
|
2417 |
rotation_container.data ('option', 1);
|
2418 |
|
2419 |
add_rotate_options (block, 1);
|
2424 |
|
2425 |
setTimeout (function() {import_rotation_code (block);}, 5);
|
2426 |
} else {
|
2427 |
+
// set_editor_text (block, b64d (rotation_container.data ('code')));
|
2428 |
generate_rotatation_code (block);
|
2429 |
|
2430 |
ul.find ("li").remove ();
|
2568 |
|
2569 |
var nonce = $("#ai-form").attr ('nonce');
|
2570 |
|
2571 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'import-rotation-code': b64e (get_editor_text (block))}
|
2572 |
).done (function (data) {
|
2573 |
if (data != '') {
|
2574 |
var code_data = JSON.parse (data);
|
2593 |
add_rotate_options (block, tabs);
|
2594 |
|
2595 |
rotation_container.find ('ul li').each (function (index) {
|
2596 |
+
if (index < options) $(this).data ('code', b64e (code_data ['options'][index]['code'])); else
|
2597 |
+
$(this).data ('code', b64e (''));
|
2598 |
});
|
2599 |
|
2600 |
rotation_container.tabs ("option", "active", 0);
|
2617 |
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2618 |
|
2619 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2620 |
+
set_editor_text (block, b64d (rotation_container.data ('code')));
|
2621 |
rotation_container.hide();
|
2622 |
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2623 |
|
2634 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2635 |
var option = rotation_container.tabs ("option", "active") + 1;
|
2636 |
|
2637 |
+
$(('#option-' + block + '-' + option)).data ('code', b64e (get_editor_text (block)));
|
2638 |
|
2639 |
var nonce = $("#ai-form").attr ('nonce');
|
2640 |
|
2641 |
var rotation_data = [];
|
2642 |
rotation_container.find ("div.rounded").each (function (index) {
|
2643 |
var code_data = $('#option-' + block + '-' + (index + 1)).data ('code');
|
2644 |
+
var code = typeof code_data == 'undefined' ? '' : b64d (code_data);
|
2645 |
var option_data = {'name': $(this).find ('input.option-name').val (), 'share': $(this).find ('input.option-share').val (), 'time': $(this).find ('input.option-time').val (), 'code': code};
|
2646 |
|
2647 |
rotation_data.push (option_data);
|
2649 |
|
2650 |
if (debug) console.log ('ROTATION DATA:', rotation_data);
|
2651 |
|
2652 |
+
$.post (ajaxurl, {'action': 'ai_ajax_backend', 'ai_check': nonce, 'generate-rotation-code': b64e (JSON.stringify (rotation_data))}
|
2653 |
).done (function (data) {
|
2654 |
$('#ai-error-container').hide ();
|
2655 |
|
2666 |
$('#ai-error-container').text ('ERROR ' + xhr.status + ': ' + xhr.statusText).show ();
|
2667 |
|
2668 |
var rotation_container = $('#ai-rotation-container-' + block);
|
2669 |
+
set_editor_text (block, b64d (rotation_container.data ('code')));
|
2670 |
rotation_container.hide();
|
2671 |
$("#rotation-" + block).next ("label").find ('.checkbox-icon').removeClass("on");
|
2672 |
|
2696 |
|
2697 |
var new_li = li.clone ().show ();
|
2698 |
new_li.find ("a").attr ('href', '#tab-option-' + block + '-' + option).text (String.fromCharCode (64 + option));
|
2699 |
+
new_li.attr ('id', 'option-' + block + '-' + option).appendTo (ul).data ('code', b64e (''));
|
2700 |
|
2701 |
new_li.click (function () {
|
2702 |
var rotation_container = $(this).closest ('.ai-rotate');
|
2707 |
|
2708 |
if (debug) console.log ('OPTION CHANGE:', old_option, '=>', new_option);
|
2709 |
|
2710 |
+
$(('#option-' + block + '-' + old_option)).data ('code', b64e (get_editor_text (block)));
|
2711 |
+
set_editor_text (block, b64d ($(this).data ('code')));
|
2712 |
});
|
2713 |
|
2714 |
div.clone ().show ().attr ('id', 'tab-option-' + block + '-' + option).appendTo (rotation_container);
|
2744 |
|
2745 |
var new_option = option == 0 ? 0 : option - 1;
|
2746 |
active_li = $('#option-' + block + '-' + (new_option + 1));
|
2747 |
+
set_editor_text (block, b64d (active_li.data ('code')));
|
2748 |
ul.closest ('.ai-rotate').data ('option', new_option + 1);
|
2749 |
}
|
2750 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, adv
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.9
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.
|
10 |
License: GPLv3
|
11 |
|
12 |
Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
|
@@ -414,6 +414,23 @@ There are two modes for sticky widgets (or sticky sidebars) available as **Stick
|
|
414 |
* CSS mode - This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to `position: sticky`. This works with most themes but not all. If your widgets and sidebar aren't sticking as expected you can use **JavaScript mode** described below.
|
415 |
* JavaScript mode - This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized.
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
= Settings for contextual Amazon Native Shopping Ads =
|
419 |
|
@@ -679,6 +696,12 @@ AD CODE RIGHT
|
|
679 |
|
680 |
== Changelog ==
|
681 |
|
|
|
|
|
|
|
|
|
|
|
|
|
682 |
= 2.3.21 =
|
683 |
- Added option to force showing admin toolbar when viewing site
|
684 |
- Added additional debugging info for blocks in Ajax requests
|
@@ -812,6 +835,12 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
|
|
812 |
|
813 |
== Upgrade Notice ==
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
= 2.3.21 =
|
816 |
Added option to force showing admin toolbar when viewing site;
|
817 |
Added additional debugging info for blocks in Ajax requests;
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 4.9
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.4.0
|
10 |
License: GPLv3
|
11 |
|
12 |
Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
|
414 |
* CSS mode - This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to `position: sticky`. This works with most themes but not all. If your widgets and sidebar aren't sticking as expected you can use **JavaScript mode** described below.
|
415 |
* JavaScript mode - This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized.
|
416 |
|
417 |
+
= What is usage tracking? =
|
418 |
+
|
419 |
+
When enabled, the information regarding WordPress environment and Ad Inserter usage will be collected and sent to plugin developers (once per month and on events like plugin activation/deactivation).
|
420 |
+
|
421 |
+
This is completely optional and can be disabled at any time. So if you have opted in (by clicking Allow when asked for permission) and now you would like to disable tracking, you should go to tab ⚙ / tab General, select **Disable** for Plugin usage tracking and save settings.
|
422 |
+
|
423 |
+
If this setting is not available then you have not selected any option yet - **tracking is disabled unless explicitly enabled** by clicking Allow when asked for permission (or when this setiing is set to Enable).
|
424 |
+
|
425 |
+
What data is collected: Ad Inserter version, activation status, number of active blocks, date of installation, date of last saved settings, status of review notice and remote debugging, block class name, location, website url and name, WordPress version, language, text direction, charset, number of posts, active theme and version, list of installed plugins, PHP version, server name, IP address (used to determine country), site count for multisite installations, deactivation reasons and details (if provided).
|
426 |
+
|
427 |
+
Ad Inserter is only a plugin for WordPress content management software. It works together with WordPress, other installed plugins and selected theme.
|
428 |
+
|
429 |
+
This data provides information to make the plugin to be compatible with as many environments as possible, to test the plugin with commonly used plugins and themes, to understand why users deativate (and uninstall) the plugin and to get ideas to make improvements to the plugin.
|
430 |
+
|
431 |
+
If you are not happy to reveal this information and you have opted in, simply disable usage tracking as described above.
|
432 |
+
|
433 |
+
**Your decision will be respected.**
|
434 |
|
435 |
= Settings for contextual Amazon Native Shopping Ads =
|
436 |
|
696 |
|
697 |
== Changelog ==
|
698 |
|
699 |
+
= 2.4.0 =
|
700 |
+
- Improved code for client-side insertion
|
701 |
+
- Added support for usage tracking
|
702 |
+
- Fix for compatibility with older PHP versions (below 5.4)
|
703 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
704 |
+
|
705 |
= 2.3.21 =
|
706 |
- Added option to force showing admin toolbar when viewing site
|
707 |
- Added additional debugging info for blocks in Ajax requests
|
835 |
|
836 |
== Upgrade Notice ==
|
837 |
|
838 |
+
= 2.4.0 =
|
839 |
+
Improved code for client-side insertion;
|
840 |
+
Added support for usage tracking;
|
841 |
+
Fix for compatibility with older PHP versions (below 5.4);
|
842 |
+
Few minor bug fixes, cosmetic changes and code improvements
|
843 |
+
|
844 |
= 2.3.21 =
|
845 |
Added option to force showing admin toolbar when viewing site;
|
846 |
Added additional debugging info for blocks in Ajax requests;
|
settings.php
CHANGED
@@ -3632,7 +3632,7 @@ function sidebar_pro () {
|
|
3632 |
<li>64 code (ad) blocks</li>
|
3633 |
<li><a href="https://adinserter.pro/documentation/adsense-ads#integration" class="simple-link" target="_blank">AdSense Integration</a></li>
|
3634 |
<li>Syntax highlighting <a href="https://adinserter.pro/documentation/code-editing" class="simple-link" target="_blank">editor</a></li>
|
3635 |
-
<li><a href="https://adinserter.pro/documentation
|
3636 |
<li>Simple user interface - all settings on a single page</li>
|
3637 |
<li><a href="https://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>
|
3638 |
<li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
|
3632 |
<li>64 code (ad) blocks</li>
|
3633 |
<li><a href="https://adinserter.pro/documentation/adsense-ads#integration" class="simple-link" target="_blank">AdSense Integration</a></li>
|
3634 |
<li>Syntax highlighting <a href="https://adinserter.pro/documentation/code-editing" class="simple-link" target="_blank">editor</a></li>
|
3635 |
+
<li><a href="https://adinserter.pro/documentation/code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
|
3636 |
<li>Simple user interface - all settings on a single page</li>
|
3637 |
<li><a href="https://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>
|
3638 |
<li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
|