Version Description
- Optimized Javascript code to allow advanced optimizations
- Added support to wait for jQuery so it can be deferred
- Added support for children categories in lists
- Added support to load settings page in safe mode
- Added warning notice if PHP version is below 5.6
- Improved user interface for lists
- Modified Javascript code that was wrongly replaced by CDN url
- Fix for updates server access warning message (Pro only)
- 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.5.10 |
Comparing to | |
See all releases |
Code changes from version 2.5.9 to 2.5.10
- ad-inserter.php +555 -172
- class.php +212 -96
- constants.php +10 -4
- css/ai-settings.css +25 -2
- includes/js/ai-adb.js +52 -41
- includes/js/ai-adb.min.js +8 -9
- includes/js/ai-ads.js +6 -2
- includes/js/ai-ads.min.js +5 -9
- includes/js/ai-cookie.js +2 -2
- includes/js/ai-cookie.min.js +3 -3
- includes/js/ai-insert.js +8 -4
- includes/js/ai-insert.min.js +5 -5
- includes/js/ai-lists.js +9 -5
- includes/js/ai-lists.min.js +6 -8
- includes/js/ai-rotate.js +49 -3
- includes/js/ai-rotate.min.js +7 -15
- includes/js/ai-sidebar.js +58 -44
- includes/js/ai-sidebar.min.js +2 -4
- js/ad-inserter.js +51 -4
- readme.txt +23 -1
- settings.php +211 -133
- strings.php +1 -1
ad-inserter.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
-
Version: 2.5.
|
6 |
Description: Ad management with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
@@ -15,7 +15,18 @@ Domain Path: /languages
|
|
15 |
|
16 |
Change Log
|
17 |
|
18 |
-
Ad Inserter 2.5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
- Added support for block name class
|
20 |
- Added support for code generator for AdSense sticky AMP ads
|
21 |
- Fix for paragraph clearance issues
|
@@ -1516,7 +1527,8 @@ function ai_wp_hook () {
|
|
1516 |
// WP
|
1517 |
if ($automatic_insertion_footer_hook)
|
1518 |
add_action ('wp_footer', 'ai_hook_function_footer', 5);
|
1519 |
-
add_action ('wp_footer', '
|
|
|
1520 |
}
|
1521 |
|
1522 |
if ($ai_wp_data [AI_WP_AMP_PAGE]) {
|
@@ -1739,7 +1751,7 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
|
|
1739 |
'jquery-ui-datepicker',
|
1740 |
), AD_INSERTER_VERSION, false);
|
1741 |
|
1742 |
-
if (AI_SYNTAX_HIGHLIGHTING) {
|
1743 |
wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1744 |
// wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1745 |
wp_enqueue_script ('ai-ace-html', plugins_url ('includes/ace/mode-html.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
@@ -1844,14 +1856,18 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1844 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
1845 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
1846 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1847 |
-
$adb_code
|
|
|
|
|
|
|
|
|
1848 |
|
1849 |
if ($footer_inline_scripts ||
|
1850 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
1851 |
!empty ($_GET) ||
|
1852 |
-
$ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
1853 |
-
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1854 |
-
$ai_wp_data [AI_CHECK_BLOCK] ||
|
1855 |
get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 ||
|
1856 |
$ai_wp_data [AI_ANIMATION]) {
|
1857 |
|
@@ -1873,17 +1889,18 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1873 |
wp_enqueue_style ('ai-html-jquery-ui', plugins_url ('css/jquery-ui-1.10.3.custom.min.css', __FILE__), array (), null);
|
1874 |
}
|
1875 |
|
1876 |
-
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
1877 |
-
wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
if (!get_disable_js_code () && (($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) || $ai_wp_data [AI_CHECK_BLOCK] || ($ai_wp_data [AI_TRACKING] && !isset ($ai_wp_data [AI_TRACKING_SHORTCODE_DISABLED])) || $adb_code)) {
|
1881 |
-
wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-cookie', false));
|
1882 |
-
}
|
1883 |
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
|
|
1887 |
|
1888 |
if (!get_disable_css_code () && (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0)) {
|
1889 |
wp_enqueue_style ('dashicons');
|
@@ -1911,10 +1928,12 @@ function ai_get_client_side_styles () {
|
|
1911 |
".ai-rotate {position: relative;}\n" .
|
1912 |
".ai-rotate-hidden {visibility: hidden;}\n" .
|
1913 |
".ai-rotate-hidden-2 {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n" .
|
1914 |
-
".ai-list-data, .ai-ip-data, .ai-list-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
|
|
|
|
|
1915 |
}
|
1916 |
|
1917 |
-
function
|
1918 |
global $ai_wp_data;
|
1919 |
|
1920 |
$css = '';
|
@@ -2061,7 +2080,7 @@ function add_head_inline_styles () {
|
|
2061 |
|
2062 |
if ($ai_wp_data [AI_HTML_ELEMENT_SELECTION]) generate_selection_css ();
|
2063 |
|
2064 |
-
echo
|
2065 |
|
2066 |
echo "</style>\n";
|
2067 |
// No scripts on AMP pages
|
@@ -2221,6 +2240,10 @@ function ai_adb_code () {
|
|
2221 |
return ai_get_js ('ai-adb', false);
|
2222 |
}
|
2223 |
|
|
|
|
|
|
|
|
|
2224 |
function add_footer_inline_scripts () {
|
2225 |
global $ai_wp_data, $wp_version;
|
2226 |
|
@@ -2228,6 +2251,36 @@ function add_footer_inline_scripts () {
|
|
2228 |
|
2229 |
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
2230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2231 |
if ($adb_code) {
|
2232 |
if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
|
2233 |
echo '<!-- Code for ad blocking detection -->', "\n";
|
@@ -2244,47 +2297,97 @@ function add_footer_inline_scripts () {
|
|
2244 |
echo '<script async id="ai-adb-mn" src="//contextual.media.net/dmedianet.js"></script>', "\n";
|
2245 |
}
|
2246 |
if (!defined ('AI_ADB_NO_ADS_JS')) {
|
2247 |
-
echo '<script id="ai-adb-ads" src="', plugins_url ('js/ads.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, '"></script>', "\n";
|
2248 |
}
|
2249 |
if (!defined ('AI_ADB_NO_SPONSORS_JS')) {
|
2250 |
-
echo '<script id="ai-adb-sponsors" src="', plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, '"></script>', "\n";
|
2251 |
}
|
2252 |
echo '<!--/noptimize-->', "\n";
|
2253 |
echo '<!-- Code for ad blocking detection END -->', "\n";
|
2254 |
}
|
2255 |
}
|
2256 |
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
$
|
2266 |
-
|
2267 |
-
|
2268 |
-
$ai_wp_data [
|
2269 |
-
|
2270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2271 |
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2277 |
}
|
2278 |
|
|
|
|
|
2279 |
if ($ai_wp_data [AI_STICKY_WIDGETS] && get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS) {
|
2280 |
-
// echo
|
2281 |
-
echo
|
2282 |
}
|
2283 |
|
2284 |
-
if ($
|
|
|
|
|
2285 |
|
|
|
|
|
|
|
2286 |
|
2287 |
-
$
|
|
|
|
|
2288 |
|
2289 |
if (function_exists ('add_footer_inline_scripts_2') && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2290 |
if ($ai_wp_data [AI_LAZY_LOADING]) {
|
@@ -2307,10 +2410,6 @@ function add_footer_inline_scripts () {
|
|
2307 |
echo ai_get_js ('ai-lists');
|
2308 |
}
|
2309 |
|
2310 |
-
if ($ai_wp_data [AI_STICKY_WIDGETS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2311 |
-
echo ai_get_js ('ai-sidebar');
|
2312 |
-
}
|
2313 |
-
|
2314 |
if ($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2315 |
echo ai_get_js ('ai-close');
|
2316 |
}
|
@@ -2319,8 +2418,21 @@ function add_footer_inline_scripts () {
|
|
2319 |
echo ai_get_js ('ai-select');
|
2320 |
}
|
2321 |
|
2322 |
-
if ($ai_wp_data [
|
2323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2324 |
}
|
2325 |
|
2326 |
if ($adb_code) {
|
@@ -2331,7 +2443,48 @@ function add_footer_inline_scripts () {
|
|
2331 |
add_footer_inline_scripts_2 ();
|
2332 |
}
|
2333 |
|
2334 |
-
if ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2335 |
}
|
2336 |
|
2337 |
function ai_admin_notice_hook () {
|
@@ -2423,6 +2576,14 @@ function ai_admin_notice_hook () {
|
|
2423 |
sprintf (__('Warning: %1$s %3$s disabled %4$s %2$s on AMP pages.', 'ad-inserter'), 'AMPforWP Plugin Manager', AD_INSERTER_NAME, '<a href="https://adinserter.pro/documentation/amp-pages#ampforwp" target="_blank" style="text-decoration: none; box-shadow: 0 0 0;">', '</a>'),
|
2424 |
'</p></div>';
|
2425 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2426 |
}
|
2427 |
}
|
2428 |
|
@@ -2460,6 +2621,11 @@ function ai_set_plugin_meta ($links, $file) {
|
|
2460 |
}
|
2461 |
}
|
2462 |
|
|
|
|
|
|
|
|
|
|
|
2463 |
if (function_exists ('ai_set_plugin_meta_2')) {
|
2464 |
ai_set_plugin_meta_2 ($links);
|
2465 |
}
|
@@ -2610,9 +2776,8 @@ function ai_meta_box_callback ($post) {
|
|
2610 |
|
2611 |
if ($rows % 2 != 0) $background = "#F0F0F0"; else $background = "#FFF";
|
2612 |
echo '<tr style="background: ', $background, ';">';
|
2613 |
-
echo ' <td style="text-align: right;">', $obj->number, '</td>';
|
2614 |
-
|
2615 |
-
echo ' <td style="padding: 0 10px 0 10px;"><a href="', admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, '&tab=', $block, '" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">', $obj->get_ad_name(), '</a></td>';
|
2616 |
// echo ' <td style="padding: 0 10px 0 10px;">', $obj->get_automatic_insertion_text(), '</td>';
|
2617 |
echo ' <td style="padding: 0 10px 0 10px; text-align: left;">';
|
2618 |
|
@@ -2831,7 +2996,7 @@ function ai_http_header () {
|
|
2831 |
}
|
2832 |
|
2833 |
function ai_wp_head_hook () {
|
2834 |
-
global $block_object, $ai_wp_data, $ai_total_plugin_time
|
2835 |
|
2836 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
2837 |
ai_log ("HEAD HOOK START");
|
@@ -2909,7 +3074,23 @@ function ai_wp_head_hook () {
|
|
2909 |
}
|
2910 |
|
2911 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2912 |
-
if (!get_disable_js_code () && $ai_wp_data [AI_WP_DEBUGGING] != 0 && isset ($_GET ['ai-debug-code']) && !defined ('AI_DEBUGGING_DEMO')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2913 |
if (is_numeric ($_GET ['ai-debug-code']) && $_GET ['ai-debug-code'] >= 1 && $_GET ['ai-debug-code'] <= 96) {
|
2914 |
$obj = $block_object [$_GET ['ai-debug-code']];
|
2915 |
$block_name = $obj->number . ' ' . $obj->get_ad_name ();
|
@@ -2919,11 +3100,11 @@ function ai_wp_head_hook () {
|
|
2919 |
$code_for_insertion = $obj->get_code_for_insertion ();
|
2920 |
$ai_wp_data [AI_WP_DEBUGGING] = $ai_wp_debugging;
|
2921 |
} else $code_for_insertion = '';
|
2922 |
-
|
2923 |
-
|
2924 |
$('body').prepend (\"" . get_code_debug_block (' ' . $block_name, '', __('Code for insertion', 'ad-inserter') . ' ' . strlen ($code_for_insertion) . ' ' . _n('character', 'characters', strlen ($code_for_insertion), 'ad-inserter') . ' ', $obj->ai_getCode (), $code_for_insertion, true) . "\");
|
2925 |
-
|
2926 |
-
|
2927 |
}
|
2928 |
}
|
2929 |
|
@@ -2947,84 +3128,112 @@ function ai_wp_head_hook () {
|
|
2947 |
iframe.style.visibility = "visible";
|
2948 |
}
|
2949 |
|
2950 |
-
|
|
|
|
|
|
|
|
|
2951 |
}
|
2952 |
';
|
2953 |
echo "</script>\n";
|
2954 |
}
|
2955 |
|
2956 |
if (!get_disable_js_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
|
2957 |
-
echo '<script>
|
2958 |
-
jQuery(document).ready(function($) {
|
2959 |
-
setTimeout (function(){$(
|
2960 |
-
});
|
2961 |
-
|
|
|
|
|
|
|
|
|
2962 |
}
|
2963 |
|
2964 |
-
|
2965 |
-
|
2966 |
-
echo "
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2970 |
}
|
2971 |
}
|
2972 |
|
|
|
|
|
2973 |
// After Header code info
|
2974 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2975 |
if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
|
2976 |
// No scripts on AMP pages
|
2977 |
-
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
});
|
2983 |
-
</script>\n";
|
2984 |
}
|
2985 |
}
|
2986 |
}
|
2987 |
|
2988 |
-
if (!get_disable_js_code () && defined ('AI_ADSENSE_OVERLAY') && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !(isset ($_GET ["hide-debug-labels"]) && $_GET ["hide-debug-labels"] == 1)) {
|
2989 |
-
echo "<script>\n";
|
2990 |
-
echo ai_get_js ('ai-ads');
|
2991 |
-
echo "</script>\n";
|
2992 |
-
}
|
2993 |
|
2994 |
-
if (!get_disable_js_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
|
2995 |
-
echo "<script>
|
2996 |
-
jQuery(window).on ('load', function () {
|
2997 |
-
setTimeout (function() {
|
2998 |
-
|
2999 |
-
var google_auto_placed = jQuery ('.google-auto-placed ins ins ins, .google-auto-placed ins ins iframe');
|
3000 |
-
google_auto_placed.before ('<section class=\"ai-debug-bar ai-debug-adsense ai-adsense-auto-ads\">",
|
3001 |
-
__('Automatically placed by AdSense Auto ads code', 'ad-inserter'),
|
3002 |
-
"</section>');
|
3003 |
-
}, 50);
|
3004 |
-
});
|
3005 |
-
|
3006 |
-
}
|
3007 |
|
3008 |
if (!get_disable_js_code () && $ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3009 |
-
|
3010 |
-
$l10n = $ai_front_translations;
|
3011 |
|
3012 |
-
|
3013 |
-
|
3014 |
-
';
|
3015 |
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
';
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
|
|
|
|
|
|
|
|
3026 |
|
3027 |
-
echo '</script>', "\n";
|
3028 |
}
|
3029 |
|
3030 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
@@ -3101,6 +3310,28 @@ function ai_amp_head_hook () {
|
|
3101 |
}
|
3102 |
}
|
3103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3104 |
function ai_amp_css_hook () {
|
3105 |
global $ai_wp_data;
|
3106 |
|
@@ -3113,7 +3344,7 @@ function ai_amp_css_hook () {
|
|
3113 |
|
3114 |
echo get_alignment_css ();
|
3115 |
|
3116 |
-
echo str_replace ('!important', '',
|
3117 |
|
3118 |
echo ".ai-align-left * {margin: 0 auto 0 0; text-align: left;}\n";
|
3119 |
echo ".ai-align-right * {margin: 0 0 0 auto; text-align: right;}\n";
|
@@ -3130,11 +3361,11 @@ function ai_amp_css_hook_style () {
|
|
3130 |
echo "</style>\n";
|
3131 |
}
|
3132 |
|
3133 |
-
function
|
3134 |
-
global $
|
3135 |
|
3136 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3137 |
-
ai_log ("FOOTER HOOK START");
|
3138 |
$ai_wp_data [AI_PROCESSING_TIME] = true;
|
3139 |
$start_time = microtime (true);
|
3140 |
}
|
@@ -3147,6 +3378,30 @@ function ai_wp_footer_hook () {
|
|
3147 |
}
|
3148 |
}
|
3149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3150 |
if ($ai_wp_data [AI_DISABLE_CACHING]) ai_disable_caching ();
|
3151 |
|
3152 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
|
@@ -3184,43 +3439,37 @@ function ai_wp_footer_hook () {
|
|
3184 |
}
|
3185 |
}
|
3186 |
|
3187 |
-
if (!(defined ('DOING_AJAX') && DOING_AJAX) || $ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3188 |
-
add_footer_inline_scripts ();
|
3189 |
-
|
3190 |
-
if (function_exists ('ai_add_footer_html')) {
|
3191 |
-
ai_add_footer_html ();
|
3192 |
-
}
|
3193 |
-
}
|
3194 |
-
|
3195 |
-
if (function_exists ('ai_debug_header')) {
|
3196 |
-
$ai_option_footer = get_option ('ad_inserter' . '_' . base64_decode ('cHJvX2xp'.'Y2Vuc2U='));
|
3197 |
-
$ai_option_footer_name = implode ('_', array ('AI', 'STATUS'));
|
3198 |
-
if ($ai_option_footer !== false && is_string ($ai_option_footer) && isset ($ad_inserter_globals [$ai_option_footer_name]) && $ad_inserter_globals [$ai_option_footer_name] == 1) {
|
3199 |
-
echo '<div style="display: none;">', base64_decode ('RW5hYmxlIHJlZm'.'VycmVyIGFuZCBjbGljayBjb29ra'.'WUgdG8gc2Vhc'.'mNoIGZvciA='), substr ($ai_option_footer, 0, 14), "</div>\n";
|
3200 |
-
}
|
3201 |
-
}
|
3202 |
-
|
3203 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3204 |
if (!get_disable_footer_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
|
3205 |
echo get_code_debug_block (' ' . __('Footer code', 'ad-inserter') . ' ' . ($footer->get_enable_manual () ? '' : ' ' . _x('DISABLED', 'Footer code', 'ad-inserter')), '...</body>', strlen ($footer_code).' ' . _n('character inserted', 'characters inserted', strlen ($footer_code), 'ad-inserter'), $footer->ai_getCode (), $footer_code);
|
3206 |
}
|
3207 |
|
3208 |
-
if (
|
3209 |
$class_0 = AI_DEBUG_STATUS_CLASS.' status-error';
|
3210 |
$class_1 = AI_DEBUG_STATUS_CLASS.' status-ok';
|
3211 |
$javascript_text = "<section class='ai-js-0 $class_0'>" . __('JAVASCRIPT NOT WORKING', 'ad-inserter') . "</section><section class='ai-js-1 $class_1' style='display: none;'>" . __('NO JAVASCRIPT ERRORS', 'ad-inserter') . "</section><section class='ai-js-2 $class_0' style='display: none;'>" . __('JAVASCRIPT ERRORS', 'ad-inserter') . "</section>";
|
3212 |
|
3213 |
-
echo "<script>
|
3214 |
-
jQuery(document).ready(function($) {
|
3215 |
-
$('body').prepend (\"", $javascript_text, "\");
|
3216 |
-
$('.ai-js-0').hide ();
|
3217 |
-
if (ai_js_errors.length != 0) {
|
3218 |
-
$('.ai-js-2').show ();
|
3219 |
-
} else {
|
3220 |
-
$('.ai-js-1').show ();
|
3221 |
-
}
|
3222 |
-
});
|
3223 |
-
</script>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3224 |
|
3225 |
echo $javascript_text , "\n";
|
3226 |
echo get_page_type_debug_info () , "\n";
|
@@ -3231,7 +3480,22 @@ function ai_wp_footer_hook () {
|
|
3231 |
echo "\n</pre>\n";
|
3232 |
}
|
3233 |
}
|
|
|
3234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3235 |
}
|
3236 |
|
3237 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
@@ -3258,10 +3522,6 @@ function ai_amp_footer_hook () {
|
|
3258 |
}
|
3259 |
}
|
3260 |
|
3261 |
-
// if (!(defined ('DOING_AJAX') && DOING_AJAX) && !$ai_wp_data [AI_WP_AMP_PAGE]) {
|
3262 |
-
// add_footer_inline_scripts ();
|
3263 |
-
// }
|
3264 |
-
|
3265 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
|
3266 |
|
3267 |
$footer = $block_object [AI_FOOTER_OPTION_NAME];
|
@@ -3543,6 +3803,7 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
3543 |
}
|
3544 |
echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
|
3545 |
echo 'ADMIN DISABLE CACHING: ', get_disable_caching () ? 'ENABLED' : 'DISABLED', "\n";
|
|
|
3546 |
echo 'DO NOT CACHE CONSTANTS: ', defined ('DONOTCACHEPAGE') ? 'DONOTCACHEPAGE ' : '', defined ('DONOTCACHEOBJECT') ? 'DONOTCACHEOBJECT ' : '', defined ('DONOTCACHEDB') ? 'DONOTCACHEDB ' : '', "\n";
|
3547 |
echo 'HEADER: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
|
3548 |
echo 'FOOTER: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
|
@@ -4058,6 +4319,7 @@ function ai_check_plugin_options ($plugin_options = array ()) {
|
|
4058 |
if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
|
4059 |
if (!isset ($plugin_options ['OUTPUT_BUFFERING'])) $plugin_options ['OUTPUT_BUFFERING'] = DEFAULT_OUTPUT_BUFFERING;
|
4060 |
if (!isset ($plugin_options ['DISABLE_CACHING'])) $plugin_options ['DISABLE_CACHING'] = DEFAULT_DISABLE_CACHING;
|
|
|
4061 |
if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
|
4062 |
if (!isset ($plugin_options ['AD_LABEL'])) $plugin_options ['AD_LABEL'] = DEFAULT_AD_TITLE;
|
4063 |
if (!isset ($plugin_options ['MAIN_CONTENT_ELEMENT'])) $plugin_options ['MAIN_CONTENT_ELEMENT'] = DEFAULT_MAIN_CONTENT_ELEMENT;
|
@@ -4349,6 +4611,14 @@ function get_disable_caching (){
|
|
4349 |
return ($ai_db_options [AI_OPTION_GLOBAL]['DISABLE_CACHING']);
|
4350 |
}
|
4351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4352 |
function get_no_paragraph_counting_inside () {
|
4353 |
global $ai_db_options;
|
4354 |
|
@@ -5763,6 +6033,8 @@ a.ai-debug-center {text-align: center; cursor: default; font-size: 10px; text-de
|
|
5763 |
|
5764 |
.ai-debug-block {outline: 1px solid;}
|
5765 |
|
|
|
|
|
5766 |
.ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace, sans-serif; font-size: 12px; line-height: 13px; background: #fff; color: #000;}
|
5767 |
|
5768 |
.ai-debug-code.ai-code-org {float: left; max-width: 47%;}
|
@@ -6124,6 +6396,7 @@ function ai_settings () {
|
|
6124 |
if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
|
6125 |
if (isset ($_POST ['output-buffering'])) $options ['OUTPUT_BUFFERING'] = filter_option ('OUTPUT_BUFFERING', $_POST ['output-buffering']);
|
6126 |
if (isset ($_POST ['disable-caching-admin'])) $options ['DISABLE_CACHING'] = filter_option ('DISABLE_CACHING', $_POST ['disable-caching-admin']);
|
|
|
6127 |
if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
|
6128 |
if (isset ($_POST ['ad-label'])) $options ['AD_LABEL'] = filter_option ('AD_LABEL', $_POST ['ad-label']);
|
6129 |
if (isset ($_POST ['main-content-element'])) $options ['MAIN_CONTENT_ELEMENT'] = filter_option ('MAIN_CONTENT_ELEMENT', $_POST ['main-content-element']);
|
@@ -6438,7 +6711,9 @@ function ai_adinserter ($block_parameter = '', $ignore = '', &$block) {
|
|
6438 |
if (!$obj->check_number_of_words ()) return "";
|
6439 |
|
6440 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
6441 |
-
$meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
|
|
|
|
6442 |
$selected_blocks = explode (",", $meta_value);
|
6443 |
|
6444 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
@@ -6541,7 +6816,9 @@ function ai_content_hook ($content = '') {
|
|
6541 |
if ($debug_processing) ai_log_content ($content);
|
6542 |
|
6543 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
6544 |
-
$meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
|
|
|
|
6545 |
$selected_blocks = explode (",", $meta_value);
|
6546 |
} else $selected_blocks = array ();
|
6547 |
|
@@ -6934,6 +7211,13 @@ function ai_comment_callback ($comment, $args, $depth) {
|
|
6934 |
if (!$obj->check_server_side_detection ()) continue;
|
6935 |
if (!$obj->check_page_types_lists_users ()) continue;
|
6936 |
// No filter check
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6937 |
|
6938 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
6939 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
@@ -6963,9 +7247,11 @@ function ai_comment_callback ($comment, $args, $depth) {
|
|
6963 |
}
|
6964 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
6965 |
|
6966 |
-
|
6967 |
-
|
6968 |
-
|
|
|
|
|
6969 |
}
|
6970 |
|
6971 |
if ($debug_processing) {
|
@@ -7042,6 +7328,13 @@ function ai_comment_end_callback ($comment, $args, $depth) {
|
|
7042 |
if (!$obj->check_server_side_detection ()) continue;
|
7043 |
if (!$obj->check_page_types_lists_users ()) continue;
|
7044 |
// No filter check
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7045 |
|
7046 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
7047 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
@@ -7071,9 +7364,11 @@ function ai_comment_end_callback ($comment, $args, $depth) {
|
|
7071 |
}
|
7072 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
7073 |
|
7074 |
-
|
7075 |
-
|
7076 |
-
|
|
|
|
|
7077 |
} else {
|
7078 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BETWEEN_COMMENTS;
|
7079 |
|
@@ -7105,6 +7400,13 @@ function ai_comment_end_callback ($comment, $args, $depth) {
|
|
7105 |
if (!$obj->check_server_side_detection ()) continue;
|
7106 |
if (!$obj->check_page_types_lists_users ()) continue;
|
7107 |
if (!$obj->check_filter ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7108 |
|
7109 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
7110 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
@@ -7134,9 +7436,11 @@ function ai_comment_end_callback ($comment, $args, $depth) {
|
|
7134 |
}
|
7135 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
7136 |
|
7137 |
-
|
7138 |
-
|
7139 |
-
|
|
|
|
|
7140 |
}
|
7141 |
}
|
7142 |
|
@@ -7192,7 +7496,9 @@ function ai_custom_hook ($action, $insertion_type, $name, $translated_name = '',
|
|
7192 |
}
|
7193 |
|
7194 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7195 |
-
$meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
|
|
|
|
7196 |
$selected_blocks = explode (",", $meta_value);
|
7197 |
} else $selected_blocks = array ();
|
7198 |
|
@@ -7575,7 +7881,9 @@ function ai_process_shortcode (&$block, $atts) {
|
|
7575 |
|
7576 |
if (in_array ("exceptions", $check_array)) {
|
7577 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7578 |
-
$meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
|
|
|
|
7579 |
$selected_blocks = explode (",", $meta_value);
|
7580 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
7581 |
}
|
@@ -7760,7 +8068,9 @@ function ai_widget_draw ($args, $instance, &$block) {
|
|
7760 |
if (!$obj->check_number_of_words ()) return;
|
7761 |
|
7762 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7763 |
-
$meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
|
|
|
|
7764 |
$selected_blocks = explode (",", $meta_value);
|
7765 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return;
|
7766 |
}
|
@@ -7998,7 +8308,9 @@ function check_url_parameter_cookie_list ($list, $white_list, $parameters, &$fou
|
|
7998 |
$return = $white_list;
|
7999 |
$found = false;
|
8000 |
|
8001 |
-
if ($parameter_list == AD_EMPTY_DATA
|
|
|
|
|
8002 |
return !$return;
|
8003 |
}
|
8004 |
|
@@ -8055,7 +8367,7 @@ function check_referer_list ($referers, $white_list) {
|
|
8055 |
$return = $white_list;
|
8056 |
|
8057 |
$domains = strtolower (trim ($referers));
|
8058 |
-
if ($domains == AD_EMPTY_DATA) return
|
8059 |
$domains = explode (",", $domains);
|
8060 |
|
8061 |
foreach ($domains as $domain) {
|
@@ -8094,7 +8406,7 @@ function check_client_list ($clients, $white_list) {
|
|
8094 |
|
8095 |
$return = $white_list;
|
8096 |
|
8097 |
-
if ($clients == AD_EMPTY_DATA) return
|
8098 |
$clients = explode (",", $clients);
|
8099 |
|
8100 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
@@ -8438,6 +8750,66 @@ function ai_add_rewrite_rules () {
|
|
8438 |
if (function_exists ('ai_add_rewrite_rules_2')) ai_add_rewrite_rules_2 ();
|
8439 |
}
|
8440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8441 |
// ===========================================================================================
|
8442 |
|
8443 |
|
@@ -8481,7 +8853,15 @@ if (!is_admin()) {
|
|
8481 |
global $wp_version, $version_string, $subversion_string;
|
8482 |
|
8483 |
if (version_compare ($wp_version, "4.6", "<")) {
|
8484 |
-
exit ('Ad Inserter ' . __('requires WordPress 4.6 or newer', 'ad-inserter') . '. <a href="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8485 |
}
|
8486 |
|
8487 |
//include required files
|
@@ -8536,6 +8916,7 @@ $ai_wp_data [AI_HEAD_GROUPS] = array ();
|
|
8536 |
$ai_wp_data [AI_ACTIVE_GROUP_NAMES] = array ();
|
8537 |
$ai_wp_data [AI_CHECK_BLOCK] = false;
|
8538 |
$ai_wp_data [AI_POST_POSITION] = AI_POST_POSITION_BEFORE_POST;
|
|
|
8539 |
|
8540 |
ai_load_settings ();
|
8541 |
|
@@ -8653,7 +9034,7 @@ if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_ou
|
|
8653 |
//}
|
8654 |
|
8655 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output) {
|
8656 |
-
add_action ('shutdown', 'ai_shutdown_hook',
|
8657 |
}
|
8658 |
|
8659 |
register_activation_hook (AD_INSERTER_PLUGIN_DIR.'ad-inserter.php', 'ai_activation_hook');
|
@@ -8671,6 +9052,9 @@ add_action ('after_plugin_row_' . AD_INSERTER_SLUG . '/ad-inserter.php', 'ai_aft
|
|
8671 |
add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 99999, 2);
|
8672 |
//add_filter ('the_generator', 'ai_the_generator');
|
8673 |
|
|
|
|
|
|
|
8674 |
if (is_admin () === true) {
|
8675 |
add_action ('wp_ajax_ai_ajax_backend', 'ai_ajax_backend');
|
8676 |
add_action ('wp_ajax_ai_ajax', 'ai_ajax');
|
@@ -8837,8 +9221,7 @@ if (!class_exists ('ai_widget')) {
|
|
8837 |
if (!$obj->get_enable_widget ()) $title .= ' - ' . __('WIDGET DISABLED', 'ad-inserter');
|
8838 |
} else $title = __('Unknown block', 'ad-inserter');
|
8839 |
|
8840 |
-
$url_parameters =
|
8841 |
-
if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block);
|
8842 |
|
8843 |
?>
|
8844 |
<input id="<?php echo $this->get_field_id ('title'); ?>" name="<?php echo $this->get_field_name ('title'); ?>" type="hidden" value="<?php echo esc_attr ($title); ?>">
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
+
Version: 2.5.10
|
6 |
Description: Ad management with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
15 |
|
16 |
Change Log
|
17 |
|
18 |
+
Ad Inserter 2.5.10 - 2019-12-08
|
19 |
+
- Optimized Javascript code to allow advanced optimizations
|
20 |
+
- Added support to wait for jQuery so it can be deferred
|
21 |
+
- Added support for children categories in lists
|
22 |
+
- Added support to load settings page in safe mode
|
23 |
+
- Added warning notice if PHP version is below 5.6
|
24 |
+
- Improved user interface for lists
|
25 |
+
- Modified Javascript code that was wrongly replaced by CDN url
|
26 |
+
- Fix for updates server access warning message (Pro only)
|
27 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
28 |
+
|
29 |
+
Ad Inserter 2.5.9 - 2019-11-19
|
30 |
- Added support for block name class
|
31 |
- Added support for code generator for AdSense sticky AMP ads
|
32 |
- Fix for paragraph clearance issues
|
1527 |
// WP
|
1528 |
if ($automatic_insertion_footer_hook)
|
1529 |
add_action ('wp_footer', 'ai_hook_function_footer', 5);
|
1530 |
+
add_action ('wp_footer', 'ai_wp_footer_hook_end_buffering', 5);
|
1531 |
+
add_action ('wp_footer', 'ai_wp_footer_hook', 9999999);
|
1532 |
}
|
1533 |
|
1534 |
if ($ai_wp_data [AI_WP_AMP_PAGE]) {
|
1751 |
'jquery-ui-datepicker',
|
1752 |
), AD_INSERTER_VERSION, false);
|
1753 |
|
1754 |
+
if (AI_SYNTAX_HIGHLIGHTING && !defined ('AI_SAFE_MODE')) {
|
1755 |
wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1756 |
// wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1757 |
wp_enqueue_script ('ai-ace-html', plugins_url ('includes/ace/mode-html.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1856 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
1857 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
1858 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1859 |
+
$adb_code ||
|
1860 |
+
($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 ||
|
1861 |
+
$ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
1862 |
+
$ai_wp_data [AI_CHECK_BLOCK] ||
|
1863 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] != '';
|
1864 |
|
1865 |
if ($footer_inline_scripts ||
|
1866 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
1867 |
!empty ($_GET) ||
|
1868 |
+
// $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
1869 |
+
// $ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1870 |
+
// $ai_wp_data [AI_CHECK_BLOCK] ||
|
1871 |
get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 ||
|
1872 |
$ai_wp_data [AI_ANIMATION]) {
|
1873 |
|
1889 |
wp_enqueue_style ('ai-html-jquery-ui', plugins_url ('css/jquery-ui-1.10.3.custom.min.css', __FILE__), array (), null);
|
1890 |
}
|
1891 |
|
1892 |
+
// if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
1893 |
+
// wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
1894 |
+
// }
|
1895 |
+
// FOOTER
|
1896 |
+
// if (!get_disable_js_code () && (($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) || $ai_wp_data [AI_CHECK_BLOCK] || ($ai_wp_data [AI_TRACKING] && !isset ($ai_wp_data [AI_TRACKING_SHORTCODE_DISABLED])) || $adb_code)) {
|
1897 |
+
// wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-cookie', false));
|
1898 |
+
// }
|
1899 |
|
1900 |
+
// FOOTER ????????? FOOTER
|
1901 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_CLIENT_SIDE_INSERTION] || $ai_wp_data [AI_CLOSE_BUTTONS] || $ai_wp_data [AI_CHECK_BLOCK]) && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
1902 |
+
// wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-insert', false));
|
1903 |
+
// }
|
1904 |
|
1905 |
if (!get_disable_css_code () && (get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0)) {
|
1906 |
wp_enqueue_style ('dashicons');
|
1928 |
".ai-rotate {position: relative;}\n" .
|
1929 |
".ai-rotate-hidden {visibility: hidden;}\n" .
|
1930 |
".ai-rotate-hidden-2 {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}\n" .
|
1931 |
+
// ".ai-list-data, .ai-ip-data, .ai-list-block {visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;}\n";
|
1932 |
+
".ai-list-data, .ai-ip-data {min-width: 1px;}\n";
|
1933 |
+
"";
|
1934 |
}
|
1935 |
|
1936 |
+
function ai_get_admin_toolbar_debugging_styles () {
|
1937 |
global $ai_wp_data;
|
1938 |
|
1939 |
$css = '';
|
2080 |
|
2081 |
if ($ai_wp_data [AI_HTML_ELEMENT_SELECTION]) generate_selection_css ();
|
2082 |
|
2083 |
+
echo ai_get_admin_toolbar_debugging_styles ();
|
2084 |
|
2085 |
echo "</style>\n";
|
2086 |
// No scripts on AMP pages
|
2240 |
return ai_get_js ('ai-adb', false);
|
2241 |
}
|
2242 |
|
2243 |
+
//function ai_ao_override_js_replacetag ($replacetag) {
|
2244 |
+
// return array ("<span ai-ao></span>","replace");
|
2245 |
+
//}
|
2246 |
+
|
2247 |
function add_footer_inline_scripts () {
|
2248 |
global $ai_wp_data, $wp_version;
|
2249 |
|
2251 |
|
2252 |
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
2253 |
|
2254 |
+
// Update also $footer_inline_scripts in ai_wp_enqueue_scripts_hook
|
2255 |
+
$footer_inline_scripts =
|
2256 |
+
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
|
2257 |
+
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ||
|
2258 |
+
isset ($ai_wp_data [AI_CLIENT_SIDE_ROTATION]) ||
|
2259 |
+
($ai_wp_data [AI_TRACKING] && !isset ($ai_wp_data [AI_TRACKING_SHORTCODE_DISABLED])) ||
|
2260 |
+
$ai_wp_data [AI_STICKY_WIDGETS] ||
|
2261 |
+
$ai_wp_data [AI_STICK_TO_THE_CONTENT] ||
|
2262 |
+
$ai_wp_data [AI_ANIMATION] ||
|
2263 |
+
$ai_wp_data [AI_CLOSE_BUTTONS] ||
|
2264 |
+
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
2265 |
+
$ai_wp_data [AI_LAZY_LOADING] ||
|
2266 |
+
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
2267 |
+
$adb_code ||
|
2268 |
+
($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 ||
|
2269 |
+
$ai_wp_data [AI_FRONTEND_JS_DEBUGGING] ||
|
2270 |
+
$ai_wp_data [AI_CHECK_BLOCK] ||
|
2271 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] != '';
|
2272 |
+
|
2273 |
+
// if ($footer_inline_scripts && !wp_script_is ('jquery', 'done') && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2274 |
+
// // Should not insert as it is forced in the header if jquery needed in the footer
|
2275 |
+
// echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery.js'), "?ver=", $wp_version, "'></script>\n";
|
2276 |
+
// echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery-migrate.min.js'), "?ver=", $wp_version, "'></script>\n";
|
2277 |
+
// }
|
2278 |
+
|
2279 |
+
// if ($ai_wp_data [AI_STICKY_WIDGETS] && get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS) {
|
2280 |
+
//// echo "<script type='text/javascript' src='", plugins_url ('includes/js/ResizeSensor.min.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
|
2281 |
+
// echo "<script type='text/javascript' src='", plugins_url ('includes/js/theia-sticky-sidebar.min.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
|
2282 |
+
// }
|
2283 |
+
|
2284 |
if ($adb_code) {
|
2285 |
if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
|
2286 |
echo '<!-- Code for ad blocking detection -->', "\n";
|
2297 |
echo '<script async id="ai-adb-mn" src="//contextual.media.net/dmedianet.js"></script>', "\n";
|
2298 |
}
|
2299 |
if (!defined ('AI_ADB_NO_ADS_JS')) {
|
2300 |
+
echo '<script async id="ai-adb-ads" src="', plugins_url ('js/ads.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, '"></script>', "\n";
|
2301 |
}
|
2302 |
if (!defined ('AI_ADB_NO_SPONSORS_JS')) {
|
2303 |
+
echo '<script async id="ai-adb-sponsors" src="', plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, '"></script>', "\n";
|
2304 |
}
|
2305 |
echo '<!--/noptimize-->', "\n";
|
2306 |
echo '<!-- Code for ad blocking detection END -->', "\n";
|
2307 |
}
|
2308 |
}
|
2309 |
|
2310 |
+
if ($footer_inline_scripts) {
|
2311 |
+
// echo "<span ai-ao></span>\n";
|
2312 |
+
echo "<script>\n";
|
2313 |
+
|
2314 |
+
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
2315 |
+
echo "ai_debugging = true;\n";
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
$wait_for_jquery = get_wait_for_jquery ();
|
2319 |
+
|
2320 |
+
// Wait for jQuery
|
2321 |
+
if ($wait_for_jquery && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2322 |
+
|
2323 |
+
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
2324 |
+
$debug_js_0 = "var ai_debug = typeof ai_debugging !== 'undefined';";
|
2325 |
+
$debug_js_1 = "if (ai_debug) console.log ('AI jQuery READY');\n";
|
2326 |
+
$debug_js_2 = "if (ai_debug) console.log ('AI jQuery NOT READY:', ai_jquery_waiting_counter);";
|
2327 |
+
$debug_js_3 = "else if (ai_debug) console.log ('AI jQuery NOT LOADED');";
|
2328 |
+
$debug_js_4 = "if (ai_debug) console.log ('AI jQuery LOADING...');\n";
|
2329 |
+
$debug_js_5 = "if (ai_debug) console.log ('AI jQuery LOADED');\n";
|
2330 |
+
} else {
|
2331 |
+
$debug_js_0 = '';
|
2332 |
+
$debug_js_1 = '';
|
2333 |
+
$debug_js_2 = '';
|
2334 |
+
$debug_js_3 = '';
|
2335 |
+
$debug_js_4 = '';
|
2336 |
+
$debug_js_5 = '';
|
2337 |
+
}
|
2338 |
+
|
2339 |
+
echo "function ai_wait_for_jquery () {
|
2340 |
+
{$debug_js_0}
|
2341 |
+
|
2342 |
+
function ai_get_script (url, action) {
|
2343 |
+
var script = document.createElement ('script');
|
2344 |
+
script.src = url;
|
2345 |
|
2346 |
+
var head = document.getElementsByTagName ('head')[0],
|
2347 |
+
done = false;
|
2348 |
+
|
2349 |
+
// Attach handlers for all browsers
|
2350 |
+
script.onload = script.onreadystatechange = function () {
|
2351 |
+
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
|
2352 |
+
done = true;
|
2353 |
+
{$debug_js_5}
|
2354 |
+
|
2355 |
+
if (action) {
|
2356 |
+
action ();
|
2357 |
+
}
|
2358 |
+
|
2359 |
+
script.onload = script.onreadystatechange = null;
|
2360 |
+
head.removeChild (script);
|
2361 |
+
};
|
2362 |
+
};
|
2363 |
+
|
2364 |
+
head.appendChild (script);
|
2365 |
+
};
|
2366 |
+
|
2367 |
+
if (window.jQuery) {
|
2368 |
+
{$debug_js_1}
|
2369 |
+
";
|
2370 |
+
}
|
2371 |
}
|
2372 |
|
2373 |
+
$client_side_dynamic_blocks = get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT;
|
2374 |
+
|
2375 |
if ($ai_wp_data [AI_STICKY_WIDGETS] && get_sticky_widget_mode() == AI_STICKY_WIDGET_MODE_JS) {
|
2376 |
+
// echo ai_get_js ('ResizeSensor');
|
2377 |
+
echo ai_get_js ('theia-sticky-sidebar');
|
2378 |
}
|
2379 |
|
2380 |
+
if ($ai_wp_data [AI_STICKY_WIDGETS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2381 |
+
echo ai_get_js ('ai-sidebar');
|
2382 |
+
}
|
2383 |
|
2384 |
+
if (($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) || $ai_wp_data [AI_CHECK_BLOCK] || ($ai_wp_data [AI_TRACKING] && !isset ($ai_wp_data [AI_TRACKING_SHORTCODE_DISABLED])) || $adb_code) {
|
2385 |
+
echo ai_get_js ('ai-cookie');
|
2386 |
+
}
|
2387 |
|
2388 |
+
if (($ai_wp_data [AI_CLIENT_SIDE_INSERTION] /*|| $ai_wp_data [AI_CLOSE_BUTTONS] */|| $ai_wp_data [AI_CHECK_BLOCK]) /*&& !$ai_wp_data [AI_CODE_FOR_IFRAME]*/) {
|
2389 |
+
echo ai_get_js ('ai-insert', false);
|
2390 |
+
}
|
2391 |
|
2392 |
if (function_exists ('add_footer_inline_scripts_2') && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2393 |
if ($ai_wp_data [AI_LAZY_LOADING]) {
|
2410 |
echo ai_get_js ('ai-lists');
|
2411 |
}
|
2412 |
|
|
|
|
|
|
|
|
|
2413 |
if ($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2414 |
echo ai_get_js ('ai-close');
|
2415 |
}
|
2418 |
echo ai_get_js ('ai-select');
|
2419 |
}
|
2420 |
|
2421 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
|
2422 |
+
if (defined ('AI_ADSENSE_OVERLAY') && !(isset ($_GET ["hide-debug-labels"]) && $_GET ["hide-debug-labels"] == 1)) {
|
2423 |
+
echo ai_get_js ('ai-ads');
|
2424 |
+
}
|
2425 |
+
|
2426 |
+
echo "jQuery(window).on ('load', function () {
|
2427 |
+
setTimeout (function() {
|
2428 |
+
// var google_auto_placed = jQuery ('.google-auto-placed ins ins iframe');
|
2429 |
+
var google_auto_placed = jQuery ('.google-auto-placed ins ins ins, .google-auto-placed ins ins iframe');
|
2430 |
+
google_auto_placed.before ('<section class=\"ai-debug-bar ai-debug-adsense ai-adsense-auto-ads\">",
|
2431 |
+
__('Automatically placed by AdSense Auto ads code', 'ad-inserter'), "</section>');
|
2432 |
+
}, 50);
|
2433 |
+
});
|
2434 |
+
|
2435 |
+
";
|
2436 |
}
|
2437 |
|
2438 |
if ($adb_code) {
|
2443 |
add_footer_inline_scripts_2 ();
|
2444 |
}
|
2445 |
|
2446 |
+
// if ($ai_wp_data [AI_CLIENT_SIDE_INSERTION] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2447 |
+
// echo 'setTimeout (function() {Array.prototype.forEach.call (document.querySelectorAll (".ai-viewports"), function (element, index) {ai_insert_code (element);});}, 10);', PHP_EOL;
|
2448 |
+
// }
|
2449 |
+
|
2450 |
+
if ($ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] != '') {
|
2451 |
+
if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
2452 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] = " var ai_debug = typeof ai_debugging !== 'undefined';
|
2453 |
+
if (typeof ai_debugging !== 'undefined') console.log ('AI DOM READY JS CODE RUN');
|
2454 |
+
" . $ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] ." if (typeof ai_debugging !== 'undefined') console.log ('AI DOM READY JS CODE END');
|
2455 |
+
";
|
2456 |
+
}
|
2457 |
+
echo ai_js_dom_ready ("\n".$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY], false);
|
2458 |
+
}
|
2459 |
+
|
2460 |
+
if ($footer_inline_scripts) {
|
2461 |
+
// Wait for jQuery
|
2462 |
+
if ($wait_for_jquery && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2463 |
+
echo "
|
2464 |
+
} else {
|
2465 |
+
ai_jquery_waiting_counter ++;
|
2466 |
+
{$debug_js_2}
|
2467 |
+
if (ai_jquery_waiting_counter == 4) {
|
2468 |
+
{$debug_js_4}
|
2469 |
+
ai_get_script ('", includes_url ('js/jquery/jquery.js'), '?ver=', $wp_version, "', function () {
|
2470 |
+
ai_get_script ('", includes_url ('js/jquery/jquery-migrate.min.js'), '?ver=', $wp_version, "', null);
|
2471 |
+
});
|
2472 |
+
",
|
2473 |
+
ai_front_translations_code (), "
|
2474 |
+
}
|
2475 |
+
|
2476 |
+
if (ai_jquery_waiting_counter < 30) {
|
2477 |
+
setTimeout (function () {ai_wait_for_jquery ()}, 50);
|
2478 |
+
} {$debug_js_3}
|
2479 |
+
}
|
2480 |
+
}
|
2481 |
+
ai_jquery_waiting_counter = 0;
|
2482 |
+
ai_wait_for_jquery ();
|
2483 |
+
";
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
echo "\n</script>\n";
|
2487 |
+
}
|
2488 |
}
|
2489 |
|
2490 |
function ai_admin_notice_hook () {
|
2576 |
sprintf (__('Warning: %1$s %3$s disabled %4$s %2$s on AMP pages.', 'ad-inserter'), 'AMPforWP Plugin Manager', AD_INSERTER_NAME, '<a href="https://adinserter.pro/documentation/amp-pages#ampforwp" target="_blank" style="text-decoration: none; box-shadow: 0 0 0;">', '</a>'),
|
2577 |
'</p></div>';
|
2578 |
}
|
2579 |
+
|
2580 |
+
if (version_compare (phpversion (), "5.6", "<")) {
|
2581 |
+
echo '<div class="notice notice-warning is-dismissible" style="margin: 5px 15px 2px 0px;"><p>',
|
2582 |
+
/* translators: 1: Ad Inserter, 2, 3: HTML tags */
|
2583 |
+
sprintf (__('Warning: %1$s requires PHP 5.6 or newer. %2$s Please update! %3$s', 'ad-inserter'), AD_INSERTER_NAME, '<a href="https://wordpress.org/support/update-php/" target="_blank" style="text-decoration: none; box-shadow: 0 0 0;">', '</a>'),
|
2584 |
+
'</p></div>';
|
2585 |
+
}
|
2586 |
+
|
2587 |
}
|
2588 |
}
|
2589 |
|
2621 |
}
|
2622 |
}
|
2623 |
|
2624 |
+
if (!is_multisite () || is_main_site ()) {
|
2625 |
+
$inserted = '<a href="'.admin_url ('options-general.php?page=ad-inserter.php&ai-safe-mode').'" title="'.__('Load settings page in safe mode to avoid collisions with other plugins or theme', 'ad-inserter').'">' . __('Safe mode', 'ad-inserter') . '</a>';
|
2626 |
+
array_splice ($links, 4, 0, $inserted);
|
2627 |
+
}
|
2628 |
+
|
2629 |
if (function_exists ('ai_set_plugin_meta_2')) {
|
2630 |
ai_set_plugin_meta_2 ($links);
|
2631 |
}
|
2776 |
|
2777 |
if ($rows % 2 != 0) $background = "#F0F0F0"; else $background = "#FFF";
|
2778 |
echo '<tr style="background: ', $background, ';">';
|
2779 |
+
echo ' <td style="text-align: right; padding: 0 10px 0 0;">', $obj->number, '</td>';
|
2780 |
+
echo ' <td style="padding: 0 10px 0 10px;"><a href="', admin_url ('options-general.php?page=ad-inserter.php'), '&start=' . (intval (($block - 1) / 16) * 16 + 1), '&tab=', $block, '" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">', $obj->get_ad_name(), '</a></td>';
|
|
|
2781 |
// echo ' <td style="padding: 0 10px 0 10px;">', $obj->get_automatic_insertion_text(), '</td>';
|
2782 |
echo ' <td style="padding: 0 10px 0 10px; text-align: left;">';
|
2783 |
|
2996 |
}
|
2997 |
|
2998 |
function ai_wp_head_hook () {
|
2999 |
+
global $block_object, $ai_wp_data, $ai_total_plugin_time/*, $ai_front_translations*/;
|
3000 |
|
3001 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3002 |
ai_log ("HEAD HOOK START");
|
3074 |
}
|
3075 |
|
3076 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3077 |
+
// if (!get_disable_js_code () && $ai_wp_data [AI_WP_DEBUGGING] != 0 && isset ($_GET ['ai-debug-code']) && !defined ('AI_DEBUGGING_DEMO')) {
|
3078 |
+
// if (is_numeric ($_GET ['ai-debug-code']) && $_GET ['ai-debug-code'] >= 1 && $_GET ['ai-debug-code'] <= 96) {
|
3079 |
+
// $obj = $block_object [$_GET ['ai-debug-code']];
|
3080 |
+
// $block_name = $obj->number . ' ' . $obj->get_ad_name ();
|
3081 |
+
// if (!$header->get_debug_disable_insertion ()) {
|
3082 |
+
// $ai_wp_debugging = $ai_wp_data [AI_WP_DEBUGGING];
|
3083 |
+
// $ai_wp_data [AI_WP_DEBUGGING] = 0;
|
3084 |
+
// $code_for_insertion = $obj->get_code_for_insertion ();
|
3085 |
+
// $ai_wp_data [AI_WP_DEBUGGING] = $ai_wp_debugging;
|
3086 |
+
// } else $code_for_insertion = '';
|
3087 |
+
// echo "<script>\n";
|
3088 |
+
// echo " jQuery(document).ready(function($) {
|
3089 |
+
// $('body').prepend (\"" . get_code_debug_block (' ' . $block_name, '', __('Code for insertion', 'ad-inserter') . ' ' . strlen ($code_for_insertion) . ' ' . _n('character', 'characters', strlen ($code_for_insertion), 'ad-inserter') . ' ', $obj->ai_getCode (), $code_for_insertion, true) . "\");
|
3090 |
+
// });
|
3091 |
+
// </script>\n";
|
3092 |
+
// }
|
3093 |
+
if ($ai_wp_data [AI_WP_DEBUGGING] != 0 && isset ($_GET ['ai-debug-code']) && !defined ('AI_DEBUGGING_DEMO')) {
|
3094 |
if (is_numeric ($_GET ['ai-debug-code']) && $_GET ['ai-debug-code'] >= 1 && $_GET ['ai-debug-code'] <= 96) {
|
3095 |
$obj = $block_object [$_GET ['ai-debug-code']];
|
3096 |
$block_name = $obj->number . ' ' . $obj->get_ad_name ();
|
3100 |
$code_for_insertion = $obj->get_code_for_insertion ();
|
3101 |
$ai_wp_data [AI_WP_DEBUGGING] = $ai_wp_debugging;
|
3102 |
} else $code_for_insertion = '';
|
3103 |
+
|
3104 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= " jQuery(document).ready(function($) {
|
3105 |
$('body').prepend (\"" . get_code_debug_block (' ' . $block_name, '', __('Code for insertion', 'ad-inserter') . ' ' . strlen ($code_for_insertion) . ' ' . _n('character', 'characters', strlen ($code_for_insertion), 'ad-inserter') . ' ', $obj->ai_getCode (), $code_for_insertion, true) . "\");
|
3106 |
+
});
|
3107 |
+
";
|
3108 |
}
|
3109 |
}
|
3110 |
|
3128 |
iframe.style.visibility = "visible";
|
3129 |
}
|
3130 |
|
3131 |
+
if (typeof ai_iframe_resize_delay == "undefined") {
|
3132 |
+
ai_iframe_resize_delay = 200;
|
3133 |
+
}
|
3134 |
+
|
3135 |
+
setTimeout (function(){resizeIframe (iframe);}, ai_iframe_resize_delay);
|
3136 |
}
|
3137 |
';
|
3138 |
echo "</script>\n";
|
3139 |
}
|
3140 |
|
3141 |
if (!get_disable_js_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
|
3142 |
+
// echo '<script>
|
3143 |
+
// jQuery(document).ready(function($) {
|
3144 |
+
// setTimeout (function(){$('body').prepend ("', get_page_type_debug_info (), '");}, 1);
|
3145 |
+
// });
|
3146 |
+
//</script>', "\n";
|
3147 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= ' jQuery(document).ready(function($) {
|
3148 |
+
setTimeout (function(){$(\'body\').prepend ("' . get_page_type_debug_info () . '");}, 1);
|
3149 |
+
});
|
3150 |
+
';
|
3151 |
}
|
3152 |
|
3153 |
+
|
3154 |
+
// if (!get_disable_js_code () && !get_disable_header_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
|
3155 |
+
// echo "<script>\n";
|
3156 |
+
// echo " jQuery(document).ready(function($) {
|
3157 |
+
// $('body').prepend (\"" . get_code_debug_block (' ' . __('Header code', 'ad-inserter') . ' ' . ($header->get_enable_manual () ? '' : ' ' . _x('DISABLED', 'Header code', 'ad-inserter')), '<head>...</head>', strlen ($header_code) . ' ' . _n('character inserted', 'characters inserted', strlen ($header_code), 'ad-inserter') . ' ', $header->ai_getCode (), $header_code, true) . "\");
|
3158 |
+
// });
|
3159 |
+
//</script>\n";
|
3160 |
+
// }
|
3161 |
+
if (!get_disable_header_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
|
3162 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= " jQuery(document).ready(function($) {
|
3163 |
+
$('body').prepend (\"" . get_code_debug_block (' ' . __('Header code', 'ad-inserter') . ' ' . ($header->get_enable_manual () ? '' : ' ' . _x('DISABLED', 'Header code', 'ad-inserter')), '<head>...</head>', strlen ($header_code) . ' ' . _n('character inserted', 'characters inserted', strlen ($header_code), 'ad-inserter') . ' ', $header->ai_getCode (), $header_code, true) . "\");
|
3164 |
+
});
|
3165 |
+
";
|
3166 |
}
|
3167 |
}
|
3168 |
|
3169 |
+
|
3170 |
+
|
3171 |
// After Header code info
|
3172 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3173 |
+
// if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
|
3174 |
+
// // No scripts on AMP pages
|
3175 |
+
// // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_AD_BLOCKING_STATUS) != 0 && $ai_wp_data [AI_ADB_DETECTION] && !$ai_wp_data [AI_WP_AMP_PAGE]) {
|
3176 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_AD_BLOCKING_STATUS | AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 && $ai_wp_data [AI_ADB_DETECTION] /*&& !$ai_wp_data [AI_WP_AMP_PAGE]*/) {
|
3177 |
+
// echo "<script>
|
3178 |
+
// jQuery(document).ready(function($) {
|
3179 |
+
// $('body').prepend (\"", get_adb_status_debug_info () , "\");
|
3180 |
+
// });
|
3181 |
+
// </script>\n";
|
3182 |
+
// }
|
3183 |
+
// }
|
3184 |
if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
|
3185 |
// No scripts on AMP pages
|
3186 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_AD_BLOCKING_STATUS | AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 && $ai_wp_data [AI_ADB_DETECTION]) {
|
3187 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= " jQuery(document).ready(function($) {
|
3188 |
+
$('body').prepend (\"" . get_adb_status_debug_info () . "\");
|
3189 |
+
});
|
3190 |
+
";
|
|
|
|
|
3191 |
}
|
3192 |
}
|
3193 |
}
|
3194 |
|
3195 |
+
// if (!get_disable_js_code () && defined ('AI_ADSENSE_OVERLAY') && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !(isset ($_GET ["hide-debug-labels"]) && $_GET ["hide-debug-labels"] == 1)) {
|
3196 |
+
// echo "<script>\n";
|
3197 |
+
// echo ai_get_js ('ai-ads');
|
3198 |
+
// echo "</script>\n";
|
3199 |
+
// }
|
3200 |
|
3201 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
|
3202 |
+
// echo "<script>
|
3203 |
+
//jQuery(window).on ('load', function () {
|
3204 |
+
// setTimeout (function() {
|
3205 |
+
//// var google_auto_placed = jQuery ('.google-auto-placed ins ins iframe');
|
3206 |
+
// var google_auto_placed = jQuery ('.google-auto-placed ins ins ins, .google-auto-placed ins ins iframe');
|
3207 |
+
// google_auto_placed.before ('<section class=\"ai-debug-bar ai-debug-adsense ai-adsense-auto-ads\">",
|
3208 |
+
// __('Automatically placed by AdSense Auto ads code', 'ad-inserter'),
|
3209 |
+
// "</section>');
|
3210 |
+
// }, 50);
|
3211 |
+
//});
|
3212 |
+
//</script>\n";
|
3213 |
+
// }
|
3214 |
|
3215 |
if (!get_disable_js_code () && $ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3216 |
+
echo '<script type="text/javascript">', "\n", ai_front_translations_code (), '</script>', "\n";
|
|
|
3217 |
|
3218 |
+
// $object_name = 'ai_front';
|
3219 |
+
// $l10n = $ai_front_translations;
|
|
|
3220 |
|
3221 |
+
// echo '<script type="text/javascript">
|
3222 |
+
///* <![CDATA[ */
|
3223 |
+
//';
|
3224 |
+
|
3225 |
+
// foreach ($l10n as $key => $value) {
|
3226 |
+
// if (!is_scalar ($value)) continue;
|
3227 |
+
// $l10n [$key] = html_entity_decode ((string) $value, ENT_QUOTES, 'UTF-8');
|
3228 |
+
// }
|
3229 |
+
// echo "var $object_name = " . wp_json_encode ($l10n) . ";\n";
|
3230 |
+
// echo '/* ]]> */
|
3231 |
+
//';
|
3232 |
+
//// if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
3233 |
+
//// echo 'var ai_debugging = true;', "\n";
|
3234 |
+
//// }
|
3235 |
|
3236 |
+
// echo '</script>', "\n";
|
3237 |
}
|
3238 |
|
3239 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3310 |
}
|
3311 |
}
|
3312 |
|
3313 |
+
|
3314 |
+
function ai_front_translations_code () {
|
3315 |
+
global $ai_front_translations;
|
3316 |
+
|
3317 |
+
$object_name = 'ai_front';
|
3318 |
+
$l10n = $ai_front_translations;
|
3319 |
+
|
3320 |
+
$code = '/* <![CDATA[ */
|
3321 |
+
';
|
3322 |
+
|
3323 |
+
foreach ($l10n as $key => $value) {
|
3324 |
+
if (!is_scalar ($value)) continue;
|
3325 |
+
$l10n [$key] = html_entity_decode ((string) $value, ENT_QUOTES, 'UTF-8');
|
3326 |
+
}
|
3327 |
+
// $code .= "var $object_name = " . wp_json_encode ($l10n) . ";\n";
|
3328 |
+
$code .= "$object_name = " . wp_json_encode ($l10n) . ";\n";
|
3329 |
+
$code .= '/* ]]> */
|
3330 |
+
';
|
3331 |
+
|
3332 |
+
return ($code);
|
3333 |
+
}
|
3334 |
+
|
3335 |
function ai_amp_css_hook () {
|
3336 |
global $ai_wp_data;
|
3337 |
|
3344 |
|
3345 |
echo get_alignment_css ();
|
3346 |
|
3347 |
+
echo str_replace ('!important', '', ai_get_admin_toolbar_debugging_styles ());
|
3348 |
|
3349 |
echo ".ai-align-left * {margin: 0 auto 0 0; text-align: left;}\n";
|
3350 |
echo ".ai-align-right * {margin: 0 0 0 auto; text-align: right;}\n";
|
3361 |
echo "</style>\n";
|
3362 |
}
|
3363 |
|
3364 |
+
function ai_wp_footer_hook_end_buffering () {
|
3365 |
+
global $ai_wp_data, $ai_total_plugin_time;
|
3366 |
|
3367 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3368 |
+
ai_log ("FOOTER HOOK TO END BUFFERING START");
|
3369 |
$ai_wp_data [AI_PROCESSING_TIME] = true;
|
3370 |
$start_time = microtime (true);
|
3371 |
}
|
3378 |
}
|
3379 |
}
|
3380 |
|
3381 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3382 |
+
$ai_total_plugin_time += microtime (true) - $start_time;
|
3383 |
+
ai_log ("FOOTER HOOK TO END BUFFERING END: ". number_format (1000 * (microtime (true) - $start_time), 2)." ms\n");
|
3384 |
+
$ai_wp_data [AI_PROCESSING_TIME] = false;
|
3385 |
+
}
|
3386 |
+
}
|
3387 |
+
|
3388 |
+
function ai_wp_footer_hook () {
|
3389 |
+
global $block_object, $ai_wp_data, $ad_inserter_globals, $ai_total_plugin_time;
|
3390 |
+
|
3391 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3392 |
+
ai_log ("FOOTER HOOK START");
|
3393 |
+
$ai_wp_data [AI_PROCESSING_TIME] = true;
|
3394 |
+
$start_time = microtime (true);
|
3395 |
+
}
|
3396 |
+
|
3397 |
+
// if (defined ('AI_BUFFERING')) {
|
3398 |
+
// if (get_output_buffering ()) {
|
3399 |
+
// if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_AJAX && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3400 |
+
// ai_buffering_end ();
|
3401 |
+
// }
|
3402 |
+
// }
|
3403 |
+
// }
|
3404 |
+
|
3405 |
if ($ai_wp_data [AI_DISABLE_CACHING]) ai_disable_caching ();
|
3406 |
|
3407 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
|
3439 |
}
|
3440 |
}
|
3441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3442 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3443 |
if (!get_disable_footer_code () && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
|
3444 |
echo get_code_debug_block (' ' . __('Footer code', 'ad-inserter') . ' ' . ($footer->get_enable_manual () ? '' : ' ' . _x('DISABLED', 'Footer code', 'ad-inserter')), '...</body>', strlen ($footer_code).' ' . _n('character inserted', 'characters inserted', strlen ($footer_code), 'ad-inserter'), $footer->ai_getCode (), $footer_code);
|
3445 |
}
|
3446 |
|
3447 |
+
if (/*!get_disable_js_code () && */($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0) {
|
3448 |
$class_0 = AI_DEBUG_STATUS_CLASS.' status-error';
|
3449 |
$class_1 = AI_DEBUG_STATUS_CLASS.' status-ok';
|
3450 |
$javascript_text = "<section class='ai-js-0 $class_0'>" . __('JAVASCRIPT NOT WORKING', 'ad-inserter') . "</section><section class='ai-js-1 $class_1' style='display: none;'>" . __('NO JAVASCRIPT ERRORS', 'ad-inserter') . "</section><section class='ai-js-2 $class_0' style='display: none;'>" . __('JAVASCRIPT ERRORS', 'ad-inserter') . "</section>";
|
3451 |
|
3452 |
+
// echo "<script>
|
3453 |
+
// jQuery(document).ready(function($) {
|
3454 |
+
// $('body').prepend (\"", $javascript_text, "\");
|
3455 |
+
// $('.ai-js-0').hide ();
|
3456 |
+
// if (ai_js_errors.length != 0) {
|
3457 |
+
// $('.ai-js-2').show ();
|
3458 |
+
// } else {
|
3459 |
+
// $('.ai-js-1').show ();
|
3460 |
+
// }
|
3461 |
+
// });
|
3462 |
+
// </script>\n";
|
3463 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= " jQuery(document).ready(function($) {
|
3464 |
+
$('body').prepend (\"" . $javascript_text . "\");
|
3465 |
+
$('.ai-js-0').hide ();
|
3466 |
+
if (ai_js_errors.length != 0) {
|
3467 |
+
$('.ai-js-2').show ();
|
3468 |
+
} else {
|
3469 |
+
$('.ai-js-1').show ();
|
3470 |
+
}
|
3471 |
+
});
|
3472 |
+
";
|
3473 |
|
3474 |
echo $javascript_text , "\n";
|
3475 |
echo get_page_type_debug_info () , "\n";
|
3480 |
echo "\n</pre>\n";
|
3481 |
}
|
3482 |
}
|
3483 |
+
}
|
3484 |
|
3485 |
+
if (!(defined ('DOING_AJAX') && DOING_AJAX) || $ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3486 |
+
add_footer_inline_scripts ();
|
3487 |
+
|
3488 |
+
if (function_exists ('ai_add_footer_html')) {
|
3489 |
+
ai_add_footer_html ();
|
3490 |
+
}
|
3491 |
+
}
|
3492 |
+
|
3493 |
+
if (function_exists ('ai_debug_header')) {
|
3494 |
+
$ai_option_footer = get_option ('ad_inserter' . '_' . base64_decode ('cHJvX2xp'.'Y2Vuc2U='));
|
3495 |
+
$ai_option_footer_name = implode ('_', array ('AI', 'STATUS'));
|
3496 |
+
if ($ai_option_footer !== false && is_string ($ai_option_footer) && isset ($ad_inserter_globals [$ai_option_footer_name]) && $ad_inserter_globals [$ai_option_footer_name] == 1) {
|
3497 |
+
echo '<div style="display: none;">', base64_decode ('RW5hYmxlIHJlZm'.'VycmVyIGFuZCBjbGljayBjb29ra'.'WUgdG8gc2Vhc'.'mNoIGZvciA='), substr ($ai_option_footer, 0, 14), "</div>\n";
|
3498 |
+
}
|
3499 |
}
|
3500 |
|
3501 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
3522 |
}
|
3523 |
}
|
3524 |
|
|
|
|
|
|
|
|
|
3525 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
|
3526 |
|
3527 |
$footer = $block_object [AI_FOOTER_OPTION_NAME];
|
3803 |
}
|
3804 |
echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
|
3805 |
echo 'ADMIN DISABLE CACHING: ', get_disable_caching () ? 'ENABLED' : 'DISABLED', "\n";
|
3806 |
+
echo 'WAIT FOR JQUERY: ', get_wait_for_jquery () ? 'ENABLED' : 'DISABLED', "\n";
|
3807 |
echo 'DO NOT CACHE CONSTANTS: ', defined ('DONOTCACHEPAGE') ? 'DONOTCACHEPAGE ' : '', defined ('DONOTCACHEOBJECT') ? 'DONOTCACHEOBJECT ' : '', defined ('DONOTCACHEDB') ? 'DONOTCACHEDB ' : '', "\n";
|
3808 |
echo 'HEADER: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
|
3809 |
echo 'FOOTER: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
|
4319 |
if (!isset ($plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'])) $plugin_options ['PARAGRAPH_COUNTING_FUNCTIONS'] = DEFAULT_PARAGRAPH_COUNTING_FUNCTIONS;
|
4320 |
if (!isset ($plugin_options ['OUTPUT_BUFFERING'])) $plugin_options ['OUTPUT_BUFFERING'] = DEFAULT_OUTPUT_BUFFERING;
|
4321 |
if (!isset ($plugin_options ['DISABLE_CACHING'])) $plugin_options ['DISABLE_CACHING'] = DEFAULT_DISABLE_CACHING;
|
4322 |
+
if (!isset ($plugin_options ['WAIT_FOR_JQUERY'])) $plugin_options ['WAIT_FOR_JQUERY'] = DEFAULT_WAIT_FOR_JQUERY;
|
4323 |
if (!isset ($plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'])) $plugin_options ['NO_PARAGRAPH_COUNTING_INSIDE'] = DEFAULT_NO_PARAGRAPH_COUNTING_INSIDE;
|
4324 |
if (!isset ($plugin_options ['AD_LABEL'])) $plugin_options ['AD_LABEL'] = DEFAULT_AD_TITLE;
|
4325 |
if (!isset ($plugin_options ['MAIN_CONTENT_ELEMENT'])) $plugin_options ['MAIN_CONTENT_ELEMENT'] = DEFAULT_MAIN_CONTENT_ELEMENT;
|
4611 |
return ($ai_db_options [AI_OPTION_GLOBAL]['DISABLE_CACHING']);
|
4612 |
}
|
4613 |
|
4614 |
+
function get_wait_for_jquery (){
|
4615 |
+
global $ai_db_options;
|
4616 |
+
|
4617 |
+
if (!isset ($ai_db_options [AI_OPTION_GLOBAL]['WAIT_FOR_JQUERY'])) $ai_db_options [AI_OPTION_GLOBAL]['WAIT_FOR_JQUERY'] = AI_WAIT_FOR_JQUERY_DISABLED;
|
4618 |
+
|
4619 |
+
return ($ai_db_options [AI_OPTION_GLOBAL]['WAIT_FOR_JQUERY']);
|
4620 |
+
}
|
4621 |
+
|
4622 |
function get_no_paragraph_counting_inside () {
|
4623 |
global $ai_db_options;
|
4624 |
|
6033 |
|
6034 |
.ai-debug-block {outline: 1px solid;}
|
6035 |
|
6036 |
+
.ai-debug-block kbd kbd {font-weight: normal;}
|
6037 |
+
|
6038 |
.ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace, sans-serif; font-size: 12px; line-height: 13px; background: #fff; color: #000;}
|
6039 |
|
6040 |
.ai-debug-code.ai-code-org {float: left; max-width: 47%;}
|
6396 |
if (isset ($_POST ['paragraph_counting_functions'])) $options ['PARAGRAPH_COUNTING_FUNCTIONS'] = filter_option ('PARAGRAPH_COUNTING_FUNCTIONS', $_POST ['paragraph_counting_functions']);
|
6397 |
if (isset ($_POST ['output-buffering'])) $options ['OUTPUT_BUFFERING'] = filter_option ('OUTPUT_BUFFERING', $_POST ['output-buffering']);
|
6398 |
if (isset ($_POST ['disable-caching-admin'])) $options ['DISABLE_CACHING'] = filter_option ('DISABLE_CACHING', $_POST ['disable-caching-admin']);
|
6399 |
+
if (isset ($_POST ['wait-for-jquery'])) $options ['WAIT_FOR_JQUERY'] = filter_option ('WAIT_FOR_JQUERY', $_POST ['wait-for-jquery']);
|
6400 |
if (isset ($_POST ['no-paragraph-counting-inside'])) $options ['NO_PARAGRAPH_COUNTING_INSIDE'] = filter_option ('NO_PARAGRAPH_COUNTING_INSIDE', $_POST ['no-paragraph-counting-inside']);
|
6401 |
if (isset ($_POST ['ad-label'])) $options ['AD_LABEL'] = filter_option ('AD_LABEL', $_POST ['ad-label']);
|
6402 |
if (isset ($_POST ['main-content-element'])) $options ['MAIN_CONTENT_ELEMENT'] = filter_option ('MAIN_CONTENT_ELEMENT', $_POST ['main-content-element']);
|
6711 |
if (!$obj->check_number_of_words ()) return "";
|
6712 |
|
6713 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
6714 |
+
// $meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
6715 |
+
$meta_value = ai_get_post_meta ();
|
6716 |
+
|
6717 |
$selected_blocks = explode (",", $meta_value);
|
6718 |
|
6719 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
6816 |
if ($debug_processing) ai_log_content ($content);
|
6817 |
|
6818 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
6819 |
+
// $meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
6820 |
+
$meta_value = ai_get_post_meta ();
|
6821 |
+
|
6822 |
$selected_blocks = explode (",", $meta_value);
|
6823 |
} else $selected_blocks = array ();
|
6824 |
|
7211 |
if (!$obj->check_server_side_detection ()) continue;
|
7212 |
if (!$obj->check_page_types_lists_users ()) continue;
|
7213 |
// No filter check
|
7214 |
+
if (!$obj->check_number_of_words ()) continue;
|
7215 |
+
|
7216 |
+
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7217 |
+
$meta_value = ai_get_post_meta ();
|
7218 |
+
$selected_blocks = explode (",", $meta_value);
|
7219 |
+
if (!$obj->check_post_page_exceptions ($selected_blocks)) continue;
|
7220 |
+
}
|
7221 |
|
7222 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
7223 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
7247 |
}
|
7248 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
7249 |
|
7250 |
+
if ($ad_code != '') {
|
7251 |
+
echo "<$tag>\n";
|
7252 |
+
echo $ad_code;
|
7253 |
+
echo "</$tag>\n";
|
7254 |
+
}
|
7255 |
}
|
7256 |
|
7257 |
if ($debug_processing) {
|
7328 |
if (!$obj->check_server_side_detection ()) continue;
|
7329 |
if (!$obj->check_page_types_lists_users ()) continue;
|
7330 |
// No filter check
|
7331 |
+
if (!$obj->check_number_of_words ()) continue;
|
7332 |
+
|
7333 |
+
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7334 |
+
$meta_value = ai_get_post_meta ();
|
7335 |
+
$selected_blocks = explode (",", $meta_value);
|
7336 |
+
if (!$obj->check_post_page_exceptions ($selected_blocks)) continue;
|
7337 |
+
}
|
7338 |
|
7339 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
7340 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
7364 |
}
|
7365 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
7366 |
|
7367 |
+
if ($ad_code != '') {
|
7368 |
+
echo "<$tag>\n";
|
7369 |
+
echo $ad_code;
|
7370 |
+
echo "</$tag>\n";
|
7371 |
+
}
|
7372 |
} else {
|
7373 |
$ai_wp_data [AI_CONTEXT] = AI_CONTEXT_BETWEEN_COMMENTS;
|
7374 |
|
7400 |
if (!$obj->check_server_side_detection ()) continue;
|
7401 |
if (!$obj->check_page_types_lists_users ()) continue;
|
7402 |
if (!$obj->check_filter ($ad_inserter_globals [AI_COMMENT_COUNTER_NAME])) continue;
|
7403 |
+
if (!$obj->check_number_of_words ()) continue;
|
7404 |
+
|
7405 |
+
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7406 |
+
$meta_value = ai_get_post_meta ();
|
7407 |
+
$selected_blocks = explode (",", $meta_value);
|
7408 |
+
if (!$obj->check_post_page_exceptions ($selected_blocks)) continue;
|
7409 |
+
}
|
7410 |
|
7411 |
$ai_last_check = AI_CHECK_INSERTION_NOT_DISABLED;
|
7412 |
if ($obj->get_disable_insertion () || get_disable_block_insertions ()) continue;
|
7436 |
}
|
7437 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
7438 |
|
7439 |
+
if ($ad_code != '') {
|
7440 |
+
echo "<$tag>\n";
|
7441 |
+
echo $ad_code;
|
7442 |
+
echo "</$tag>\n";
|
7443 |
+
}
|
7444 |
}
|
7445 |
}
|
7446 |
|
7496 |
}
|
7497 |
|
7498 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7499 |
+
// $meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
7500 |
+
$meta_value = ai_get_post_meta ();
|
7501 |
+
|
7502 |
$selected_blocks = explode (",", $meta_value);
|
7503 |
} else $selected_blocks = array ();
|
7504 |
|
7881 |
|
7882 |
if (in_array ("exceptions", $check_array)) {
|
7883 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
7884 |
+
// $meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
7885 |
+
$meta_value = ai_get_post_meta ();
|
7886 |
+
|
7887 |
$selected_blocks = explode (",", $meta_value);
|
7888 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
7889 |
}
|
8068 |
if (!$obj->check_number_of_words ()) return;
|
8069 |
|
8070 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
8071 |
+
// $meta_value = get_post_meta (get_the_ID (), '_adinserter_block_exceptions', true);
|
8072 |
+
$meta_value = ai_get_post_meta ();
|
8073 |
+
|
8074 |
$selected_blocks = explode (",", $meta_value);
|
8075 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return;
|
8076 |
}
|
8308 |
$return = $white_list;
|
8309 |
$found = false;
|
8310 |
|
8311 |
+
if ($parameter_list == AD_EMPTY_DATA) return true;
|
8312 |
+
|
8313 |
+
if (/*$parameter_list == AD_EMPTY_DATA ||*/ count ($parameters) == 0) {
|
8314 |
return !$return;
|
8315 |
}
|
8316 |
|
8367 |
$return = $white_list;
|
8368 |
|
8369 |
$domains = strtolower (trim ($referers));
|
8370 |
+
if ($domains == AD_EMPTY_DATA) return true;
|
8371 |
$domains = explode (",", $domains);
|
8372 |
|
8373 |
foreach ($domains as $domain) {
|
8406 |
|
8407 |
$return = $white_list;
|
8408 |
|
8409 |
+
if ($clients == AD_EMPTY_DATA) return true;
|
8410 |
$clients = explode (",", $clients);
|
8411 |
|
8412 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
|
8750 |
if (function_exists ('ai_add_rewrite_rules_2')) ai_add_rewrite_rules_2 ();
|
8751 |
}
|
8752 |
|
8753 |
+
function ai_js_dom_ready ($js_code, $script_tag = true) {
|
8754 |
+
$id = rand (100000, 999999) . rand (100000, 999999);
|
8755 |
+
$code = '';
|
8756 |
+
|
8757 |
+
if ($script_tag) {
|
8758 |
+
$code .= "<!-- AI_JS --><script>
|
8759 |
+
";
|
8760 |
+
|
8761 |
+
$js_code = '/* AI_JS */' . $js_code . '/* AI_JS */';
|
8762 |
+
}
|
8763 |
+
|
8764 |
+
$code .= "var ai_run_{$id} = function(){{$js_code}};";
|
8765 |
+
|
8766 |
+
$code .= "
|
8767 |
+
";
|
8768 |
+
|
8769 |
+
if ($script_tag) {
|
8770 |
+
$code .= " ";
|
8771 |
+
}
|
8772 |
+
|
8773 |
+
$code .= "if (document.readyState === 'complete' || (document.readyState !== 'loading' && !document.documentElement.doScroll)) ai_run_{$id} (); else document.addEventListener ('DOMContentLoaded', ai_run_{$id});";
|
8774 |
+
|
8775 |
+
if ($script_tag) {
|
8776 |
+
$code .= "
|
8777 |
+
</script><!-- AI_JS -->
|
8778 |
+
";
|
8779 |
+
}
|
8780 |
+
return ($code);
|
8781 |
+
}
|
8782 |
+
|
8783 |
+
function ai_strip_js_markers ($code) {
|
8784 |
+
$code = preg_replace ('#<!-- AI_JS -->#s', '', $code);
|
8785 |
+
$code = preg_replace ('#/\* AI_JS \*/#s', '', $code);
|
8786 |
+
return ($code);
|
8787 |
+
}
|
8788 |
+
|
8789 |
+
function ai_get_post_id () {
|
8790 |
+
$queried_object = get_queried_object ();
|
8791 |
+
if ($queried_object) {
|
8792 |
+
$post_id = $queried_object->ID;
|
8793 |
+
} else $post_id = get_the_ID ();
|
8794 |
+
return $post_id;
|
8795 |
+
}
|
8796 |
+
|
8797 |
+
function ai_get_post_meta () {
|
8798 |
+
$meta_value = get_post_meta (ai_get_post_id (), '_adinserter_block_exceptions', true);
|
8799 |
+
return $meta_value;
|
8800 |
+
}
|
8801 |
+
|
8802 |
+
function ai_post_is_in_descendant_category ($category) {
|
8803 |
+
$category_to_check = get_term_by ('name', $category, 'category');
|
8804 |
+
if ($category_to_check) {
|
8805 |
+
$post_id = ai_get_post_id ();
|
8806 |
+
$descendants = get_term_children ($category_to_check->term_id, 'category');
|
8807 |
+
|
8808 |
+
if ($descendants && in_category ($descendants, $post_id)) return true;
|
8809 |
+
}
|
8810 |
+
return false;
|
8811 |
+
}
|
8812 |
+
|
8813 |
// ===========================================================================================
|
8814 |
|
8815 |
|
8853 |
global $wp_version, $version_string, $subversion_string;
|
8854 |
|
8855 |
if (version_compare ($wp_version, "4.6", "<")) {
|
8856 |
+
exit ('Ad Inserter ' . __('requires WordPress 4.6 or newer', 'ad-inserter') . '. <a href="https://wordpress.org/support/article/updating-wordpress/" target=_blank">'. __('Please update!', 'ad-inserter') . '</a>');
|
8857 |
+
}
|
8858 |
+
|
8859 |
+
//if (version_compare (phpversion (), "5.6", "<")) {
|
8860 |
+
// exit ('Ad Inserter ' . __('requires PHP 5.6 or newer', 'ad-inserter') . '. <a href="https://wordpress.org/support/update-php/" target=_blank">'. __('Please update!', 'ad-inserter') . '</a>');
|
8861 |
+
//}
|
8862 |
+
|
8863 |
+
if (isset ($_GET ['ai-safe-mode'])) {
|
8864 |
+
define ('AI_SAFE_MODE', 1);
|
8865 |
}
|
8866 |
|
8867 |
//include required files
|
8916 |
$ai_wp_data [AI_ACTIVE_GROUP_NAMES] = array ();
|
8917 |
$ai_wp_data [AI_CHECK_BLOCK] = false;
|
8918 |
$ai_wp_data [AI_POST_POSITION] = AI_POST_POSITION_BEFORE_POST;
|
8919 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] = '';
|
8920 |
|
8921 |
ai_load_settings ();
|
8922 |
|
9034 |
//}
|
9035 |
|
9036 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output) {
|
9037 |
+
add_action ('shutdown', 'ai_shutdown_hook', 1);
|
9038 |
}
|
9039 |
|
9040 |
register_activation_hook (AD_INSERTER_PLUGIN_DIR.'ad-inserter.php', 'ai_activation_hook');
|
9052 |
add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 99999, 2);
|
9053 |
//add_filter ('the_generator', 'ai_the_generator');
|
9054 |
|
9055 |
+
// If using Autoptimize plugin
|
9056 |
+
//add_filter ('autoptimize_filter_js_replacetag','ai_ao_override_js_replacetag', 10, 1);
|
9057 |
+
|
9058 |
if (is_admin () === true) {
|
9059 |
add_action ('wp_ajax_ai_ajax_backend', 'ai_ajax_backend');
|
9060 |
add_action ('wp_ajax_ai_ajax', 'ai_ajax');
|
9221 |
if (!$obj->get_enable_widget ()) $title .= ' - ' . __('WIDGET DISABLED', 'ad-inserter');
|
9222 |
} else $title = __('Unknown block', 'ad-inserter');
|
9223 |
|
9224 |
+
$url_parameters = '&start=' . (intval (($block - 1) / 16) * 16 + 1);
|
|
|
9225 |
|
9226 |
?>
|
9227 |
<input id="<?php echo $this->get_field_id ('title'); ?>" name="<?php echo $this->get_field_name ('title'); ?>" type="hidden" value="<?php echo esc_attr ($title); ?>">
|
class.php
CHANGED
@@ -1380,6 +1380,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1380 |
|
1381 |
public function get_html_element_insertion () {
|
1382 |
$option = isset ($this->wp_options [AI_OPTION_HTML_ELEMENT_INSERTION]) ? $this->wp_options [AI_OPTION_HTML_ELEMENT_INSERTION] : DEFAULT_HTML_ELEMENT_INSERTION;
|
|
|
|
|
|
|
|
|
|
|
1383 |
return $option;
|
1384 |
}
|
1385 |
|
@@ -1389,10 +1394,10 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1389 |
if (!$translate) return AI_TEXT_ENG_CLIENT_SIDE;
|
1390 |
return AI_TEXT_CLIENT_SIDE;
|
1391 |
break;
|
1392 |
-
case AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY:
|
1393 |
-
if (!$translate) return AI_TEXT_ENG_CLIENT_SIDE_DOM_READY;
|
1394 |
-
return AI_TEXT_CLIENT_SIDE_DOM_READY;
|
1395 |
-
break;
|
1396 |
case AI_HTML_INSERTION_SEREVR_SIDE:
|
1397 |
if (!$translate) return AI_TEXT_ENG_SERVER_SIDE;
|
1398 |
return AI_TEXT_SERVER_SIDE;
|
@@ -2855,7 +2860,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2855 |
$clients = base64_encode ($clients_raw);
|
2856 |
$client_list_type = isset ($this->check_client_list_type) ? $this->check_clients_list_type : $this->get_client_list_type ();
|
2857 |
|
2858 |
-
if ($this->client_side_cookie_check && ($url_parameters != ''
|
2859 |
switch ($dynamic_blocks) {
|
2860 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2861 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
@@ -2863,9 +2868,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2863 |
if ($referer_list_type == AI_BLACK_LIST) $referer_list_type = 'B'; else $referer_list_type = 'W';
|
2864 |
if ($client_list_type == AI_BLACK_LIST) $client_list_type = 'B'; else $client_list_type = 'W';
|
2865 |
|
2866 |
-
if ($this->client_side_cookie_check && ($url_parameters != ''
|
2867 |
-
if ( $referers != ''
|
2868 |
-
if ( $clients != ''
|
2869 |
|
2870 |
$this->client_side_list_detection = true;
|
2871 |
|
@@ -2873,7 +2878,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2873 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2874 |
if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
|
2875 |
$processed_code = "\n<div class='ai-dynamic ai-list-data' $referer_attributes $client_attributes $url_parameter_attributes>$processed_code</div>\n";
|
2876 |
-
} else $processed_code = "\n<div class='ai-dynamic ai-list-data' $referer_attributes $client_attributes $url_parameter_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
|
|
|
2877 |
break;
|
2878 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2879 |
$code_data = "data-code='".base64_encode ($processed_code)."'";
|
@@ -2884,11 +2890,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2884 |
|
2885 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
2886 |
// translators: %s: list parameters and type
|
2887 |
-
if ($this->client_side_cookie_check && ($url_parameters != ''
|
2888 |
// translators: %s: list parameters and type
|
2889 |
-
if ( $referers != ''
|
2890 |
// translators: %s: list parameters and type
|
2891 |
-
if ( $clients != ''
|
2892 |
|
2893 |
$debug_list = new ai_block_labels ('ai-debug-lists');
|
2894 |
$debug_processed_code = $debug_list->bar ($url_parameter_attributes_dbg . ' ' . $referer_attributes_dbg . ' ' . $client_attributes_dbg, 'B = ' . AI_TEXT_BLACK_LIST .', W = ' . AI_TEXT_WHITE_LIST, '<kbd class="ai-debug-name ai-list-status"></kbd>', '<kbd class="ai-debug-name ai-list-info"></kbd>');
|
@@ -2906,16 +2912,16 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2906 |
|
2907 |
if ($referers != '') {
|
2908 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_referer_list (base64_decode (\''.$referers.'\'), '.($referer_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2909 |
-
} elseif ($referer_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2910 |
|
2911 |
if ($clients != '') {
|
2912 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_client_list (base64_decode (\''.$clients.'\'), '.($client_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2913 |
-
} elseif ($client_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2914 |
|
2915 |
if ($this->client_side_cookie_check) {
|
2916 |
if ($url_parameters != '') {
|
2917 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_cookie_list (base64_decode (\''.$url_parameters.'\'), '.($url_parameter_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2918 |
-
} elseif ($url_parameter_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2919 |
}
|
2920 |
|
2921 |
$processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
@@ -2931,15 +2937,15 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2931 |
$ip_addresses = trim (str_replace (' ', '', strtolower (isset ($this->check_ip_addresses) ? $this->check_ip_addresses : $this->get_ad_ip_address_list ())));
|
2932 |
$ip_address_list_type = isset ($this->check_ip_addresses_list_type) ? $this->check_ip_addresses_list_type : $this->get_ad_ip_address_list_type ();
|
2933 |
|
2934 |
-
if ($countries != ''
|
2935 |
switch ($dynamic_blocks) {
|
2936 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2937 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2938 |
if ($country_list_type == AI_BLACK_LIST) $country_list_type = 'B'; else $country_list_type = 'W';
|
2939 |
if ($ip_address_list_type == AI_BLACK_LIST) $ip_address_list_type = 'B'; else $ip_address_list_type = 'W';
|
2940 |
|
2941 |
-
if ($countries != ''
|
2942 |
-
if ($ip_addresses != ''
|
2943 |
|
2944 |
$this->client_side_list_detection = true;
|
2945 |
|
@@ -2947,7 +2953,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2947 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2948 |
if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
|
2949 |
$processed_code = "\n<div class='ai-dynamic ai-ip-data' $ip_address_attributes $country_attributes>$processed_code</div>\n";
|
2950 |
-
} else $processed_code = "\n<div class='ai-dynamic ai-ip-data' $ip_address_attributes $country_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
|
|
|
2951 |
break;
|
2952 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2953 |
$code_data = "data-code='".base64_encode ($processed_code)."'";
|
@@ -2959,9 +2966,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2959 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
2960 |
|
2961 |
// translators: %s: list parameters and type
|
2962 |
-
if ($countries != ''
|
2963 |
// translators: %s: list parameters and type
|
2964 |
-
if ($ip_addresses != ''
|
2965 |
|
2966 |
$debug_ip = new ai_block_labels ('ai-debug-lists');
|
2967 |
$processed_code = $debug_ip->bar ($country_attributes_dbg . ' ' . $ip_address_attributes_dbg, 'B = ' . AI_TEXT_BLACK_LIST .', W = ' . AI_TEXT_WHITE_LIST, '<kbd class="ai-debug-name ai-ip-status"></kbd>', '<kbd class="ai-debug-name ai-ip-country"></kbd>') . $processed_code;
|
@@ -2975,11 +2982,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2975 |
|
2976 |
if ($ip_addresses != '') {
|
2977 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_ip_address_list (base64_decode (\''.base64_encode ($ip_addresses).'\'), '.($ip_address_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2978 |
-
} elseif ($ip_address_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2979 |
|
2980 |
if ($countries != '') {
|
2981 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_country_list (base64_decode (\''.base64_encode ($countries).'\'), '.($country_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2982 |
-
} elseif ($country_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2983 |
|
2984 |
$processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2985 |
$processed_code .= $this->w3tc_code.' if ($ai_enabled) echo $ai_code;';
|
@@ -3003,22 +3010,25 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3003 |
} else {
|
3004 |
$debug_html_code = '';
|
3005 |
$debug_js_code = '';
|
3006 |
-
$
|
3007 |
|
3008 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
3009 |
$debug_label = new ai_block_labels ('ai-debug-cookie');
|
3010 |
|
3011 |
$debug_html_code =
|
3012 |
$debug_label->block_start () .
|
3013 |
-
$debug_label->bar ('COOKIE CHECK', '', '<span class="ai-status"></span>', '<span class="ai-cookie-data"></span>', '', 'ai-check-'.$
|
3014 |
$debug_label->block_end ();
|
3015 |
|
3016 |
-
$debug_js_code = "
|
3017 |
}
|
3018 |
|
3019 |
-
$processed_code = $debug_html_code . "<div class='
|
3020 |
-
if (!get_disable_js_code ())
|
3021 |
-
$
|
|
|
|
|
|
|
3022 |
}
|
3023 |
}
|
3024 |
}
|
@@ -3083,19 +3093,18 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3083 |
|
3084 |
if ($hidden_widgets) return $this->hidden_viewports;
|
3085 |
|
|
|
3086 |
if ($this->client_side_list_detection && !$ai_wp_data [AI_WP_AMP_PAGE]) {
|
3087 |
-
if ($this->is_sticky ()) {
|
3088 |
-
$additional_block_style = 'visibility: hidden; ';
|
3089 |
-
} else {
|
3090 |
-
$additional_block_style = 'visibility: hidden; position: absolute; ';
|
3091 |
-
$classes [] = 'ai-remove-position';
|
3092 |
-
}
|
3093 |
|
3094 |
// Needed to locate wrapping div
|
3095 |
$classes [] = 'ai-list-block';
|
3096 |
-
|
3097 |
-
$additional_block_style = '';
|
3098 |
-
}
|
3099 |
|
3100 |
if (($this->get_close_button () || $this->get_auto_close_time ()) && !$ai_wp_data [AI_WP_AMP_PAGE] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3101 |
$classes [] = 'ai-close';
|
@@ -3223,7 +3232,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3223 |
return $code;
|
3224 |
}
|
3225 |
|
3226 |
-
public function
|
3227 |
global $ai_wp_data, $block_object;
|
3228 |
|
3229 |
$html_element_insertion = false;
|
@@ -3277,46 +3286,60 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3277 |
|
3278 |
if ($ai_wp_data [AI_WP_AMP_PAGE] || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_FEED || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_AJAX) return '';
|
3279 |
|
|
|
|
|
3280 |
if ($viewports_insertion && !$html_element_insertion) {
|
3281 |
-
$block_code = base64_encode ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only));
|
3282 |
$selector = $this->get_viewport_names ();
|
3283 |
$viewport_classes = trim ($this->get_viewport_classes ());
|
3284 |
|
3285 |
-
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3286 |
-
if (!get_disable_js_code ())
|
3287 |
-
$
|
|
|
|
|
|
|
3288 |
}
|
3289 |
elseif ($viewports_insertion && $html_element_insertion) {
|
3290 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3291 |
-
$block_code = base64_encode ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only));
|
3292 |
$selector = $this->get_html_selector (true);
|
3293 |
$viewport_classes = trim ($this->get_viewport_classes ());
|
3294 |
|
3295 |
-
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-insertion='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3296 |
-
if (!get_disable_js_code () && $this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE)
|
3297 |
// Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
|
3298 |
-
$serverside_insertion_code .= "<script>
|
|
|
|
|
|
|
3299 |
}
|
3300 |
else { // only HTML element insertion
|
3301 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3302 |
-
$block_code = base64_encode ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only));
|
3303 |
$selector = $this->get_html_selector (true);
|
3304 |
|
3305 |
-
$code_before = '';
|
3306 |
-
$code_after = '';
|
3307 |
|
3308 |
-
if ($this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY) {
|
3309 |
|
3310 |
-
$code_before = "var ai_insert_{$this->number} = function(){
|
3311 |
-
";
|
3312 |
-
$code_after = "\n };
|
3313 |
-
if (document.readyState === 'complete' || (document.readyState !== 'loading' && !document.documentElement.doScroll)) ai_insert_{$this->number} (); else document.addEventListener ('DOMContentLoaded', ai_insert_{$this->number});";
|
3314 |
-
}
|
3315 |
|
3316 |
-
if (get_disable_js_code ()) $serverside_insertion_code = ''; else
|
3317 |
-
$serverside_insertion_code = "<script>
|
3318 |
-
{$code_before}ai_insert ('$insertion', '$selector', b64d ('[#AI_CODE#]'));{$code_after}
|
3319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3320 |
}
|
3321 |
|
3322 |
if (!get_disable_js_code () && $ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) {
|
@@ -3332,7 +3355,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3332 |
|
3333 |
$version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
|
3334 |
|
3335 |
-
$tag =
|
3336 |
$debug_script = new ai_block_labels ('ai-debug-script');
|
3337 |
$serverside_insertion_code =
|
3338 |
$debug_script->bar (" $tag " . __('for block', 'ad-inserter') . " " . $this->number . ' ' . $this->get_ad_name () . $version_name . ' ' . $fallback_block_name, '', $insertion_name . ' ' . $selector, $counters, $title) .
|
@@ -3363,36 +3386,61 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3363 |
return $serverside_insertion_code;
|
3364 |
}
|
3365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3366 |
public function get_iframe_page () {
|
3367 |
-
global $ai_wp_data, $wp_version;
|
3368 |
|
3369 |
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
3370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3371 |
$ai_wp_data [AI_CODE_FOR_IFRAME] = true;
|
3372 |
ob_start ();
|
|
|
3373 |
echo '<!DOCTYPE>
|
3374 |
<html>
|
3375 |
<head>
|
3376 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
3377 |
';
|
3378 |
-
echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery.js'), "?ver=", $
|
3379 |
-
echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery-migrate.min.js'), "?ver=", $
|
3380 |
-
|
3381 |
-
echo "<script>\n";
|
3382 |
-
echo "var ai_iframe = true;\n";
|
3383 |
|
3384 |
-
|
3385 |
-
|
3386 |
-
}
|
3387 |
|
3388 |
-
if (
|
3389 |
-
echo
|
3390 |
-
}
|
|
|
|
|
|
|
|
|
3391 |
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
|
|
3396 |
|
3397 |
ai_wp_head_hook ();
|
3398 |
echo '<style>
|
@@ -3402,7 +3450,28 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3402 |
</head>
|
3403 |
<body>
|
3404 |
'; /* $include_viewport_classes = true, $hidden_widgets = false, $code_only = false */
|
3405 |
-
echo $this->get_code_for_insertion (false, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3406 |
ai_wp_footer_hook ();
|
3407 |
echo '</body>
|
3408 |
</html>';
|
@@ -3954,7 +4023,7 @@ echo '</body>
|
|
3954 |
|
3955 |
if ($name == '') return '';
|
3956 |
|
3957 |
-
return strtolower (str_replace ('--', '-', preg_replace ('/[^\-
|
3958 |
}
|
3959 |
|
3960 |
public function get_viewport_classes () {
|
@@ -5629,50 +5698,90 @@ echo '</body>
|
|
5629 |
$cat_type = $this->get_ad_block_cat_type();
|
5630 |
}
|
5631 |
|
|
|
|
|
5632 |
$wp_categories = get_the_category ();
|
5633 |
|
5634 |
if ($cat_type == AI_BLACK_LIST) {
|
5635 |
|
5636 |
-
if ($categories == AD_EMPTY_DATA) return true;
|
5637 |
|
5638 |
$cats_listed = explode (",", $categories);
|
5639 |
|
5640 |
foreach ($wp_categories as $wp_category) {
|
5641 |
-
|
5642 |
foreach ($cats_listed as $cat_disabled){
|
5643 |
|
|
|
|
|
|
|
5644 |
$cat_disabled = trim ($cat_disabled);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5645 |
|
5646 |
$wp_category_name = strtolower ($wp_category->cat_name);
|
5647 |
$wp_category_slug = strtolower ($wp_category->slug);
|
5648 |
|
5649 |
-
if ($
|
5650 |
-
|
5651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5652 |
}
|
|
|
5653 |
}
|
5654 |
}
|
5655 |
return true;
|
5656 |
|
5657 |
} else {
|
5658 |
|
5659 |
-
if ($categories == AD_EMPTY_DATA) return false;
|
5660 |
|
5661 |
$cats_listed = explode (",", $categories);
|
5662 |
|
5663 |
foreach ($wp_categories as $wp_category) {
|
5664 |
-
|
5665 |
foreach ($cats_listed as $cat_enabled) {
|
5666 |
|
|
|
|
|
|
|
5667 |
$cat_enabled = trim ($cat_enabled);
|
5668 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5669 |
$wp_category_name = strtolower ($wp_category->cat_name);
|
5670 |
$wp_category_slug = strtolower ($wp_category->slug);
|
5671 |
|
5672 |
-
if ($
|
5673 |
-
|
5674 |
-
|
5675 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5676 |
}
|
5677 |
}
|
5678 |
return false;
|
@@ -5687,6 +5796,9 @@ echo '</body>
|
|
5687 |
}
|
5688 |
|
5689 |
$tags = trim ($tags);
|
|
|
|
|
|
|
5690 |
$tags_listed = explode (",", $tags);
|
5691 |
foreach ($tags_listed as $index => $tag_listed) {
|
5692 |
$tags_listed [$index] = trim ($tag_listed);
|
@@ -5695,7 +5807,7 @@ echo '</body>
|
|
5695 |
|
5696 |
if ($tag_type == AI_BLACK_LIST) {
|
5697 |
|
5698 |
-
if ($tags == AD_EMPTY_DATA) return true;
|
5699 |
|
5700 |
if (is_tag()) {
|
5701 |
foreach ($tags_listed as $tag_listed) {
|
@@ -5708,7 +5820,7 @@ echo '</body>
|
|
5708 |
|
5709 |
} else {
|
5710 |
|
5711 |
-
if ($tags == AD_EMPTY_DATA) return false;
|
5712 |
|
5713 |
if (is_tag()) {
|
5714 |
foreach ($tags_listed as $tag_listed) {
|
@@ -5729,9 +5841,11 @@ echo '</body>
|
|
5729 |
$taxonomy_type = $this->get_ad_block_taxonomy_type();
|
5730 |
}
|
5731 |
|
|
|
|
|
5732 |
if ($taxonomy_type == AI_BLACK_LIST) {
|
5733 |
|
5734 |
-
if ($taxonomies == AD_EMPTY_DATA) return true;
|
5735 |
|
5736 |
$taxonomies_listed = explode (",", $taxonomies);
|
5737 |
$taxonomy_names = get_post_taxonomies ();
|
@@ -5791,7 +5905,7 @@ echo '</body>
|
|
5791 |
|
5792 |
} else {
|
5793 |
|
5794 |
-
if ($taxonomies == AD_EMPTY_DATA) return false;
|
5795 |
|
5796 |
$taxonomies_listed = explode (",", $taxonomies);
|
5797 |
$taxonomy_names = get_post_taxonomies ();
|
@@ -5859,11 +5973,13 @@ echo '</body>
|
|
5859 |
$id_type = $this->get_id_list_type();
|
5860 |
}
|
5861 |
|
|
|
|
|
5862 |
$page_id = get_the_ID();
|
5863 |
|
5864 |
if ($id_type == AI_BLACK_LIST) $return = false; else $return = true;
|
5865 |
|
5866 |
-
if (
|
5867 |
return !$return;
|
5868 |
}
|
5869 |
|
@@ -5905,7 +6021,7 @@ echo '</body>
|
|
5905 |
|
5906 |
if ($url_type == AI_BLACK_LIST) $return = false; else $return = true;
|
5907 |
|
5908 |
-
if ($urls == AD_EMPTY_DATA) return
|
5909 |
|
5910 |
$list_separator = ',';
|
5911 |
if (strpos ($urls, ' ') !== false && strpos ($urls, ',') === false) $list_separator = ' ';
|
@@ -6618,7 +6734,7 @@ echo '</body>
|
|
6618 |
|
6619 |
if ($this->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
|
6620 |
|
6621 |
-
if (trim ($this->get_client_list ()) != ''
|
6622 |
|
6623 |
if ($this->get_detection_client_side ()) {
|
6624 |
$ai_wp_data [AI_CLIENT_SIDE_DETECTION] = true;
|
1380 |
|
1381 |
public function get_html_element_insertion () {
|
1382 |
$option = isset ($this->wp_options [AI_OPTION_HTML_ELEMENT_INSERTION]) ? $this->wp_options [AI_OPTION_HTML_ELEMENT_INSERTION] : DEFAULT_HTML_ELEMENT_INSERTION;
|
1383 |
+
|
1384 |
+
if ($option == AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY) {
|
1385 |
+
$option = AI_HTML_INSERTION_CLIENT_SIDE;
|
1386 |
+
}
|
1387 |
+
|
1388 |
return $option;
|
1389 |
}
|
1390 |
|
1394 |
if (!$translate) return AI_TEXT_ENG_CLIENT_SIDE;
|
1395 |
return AI_TEXT_CLIENT_SIDE;
|
1396 |
break;
|
1397 |
+
// case AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY:
|
1398 |
+
// if (!$translate) return AI_TEXT_ENG_CLIENT_SIDE_DOM_READY;
|
1399 |
+
// return AI_TEXT_CLIENT_SIDE_DOM_READY;
|
1400 |
+
// break;
|
1401 |
case AI_HTML_INSERTION_SEREVR_SIDE:
|
1402 |
if (!$translate) return AI_TEXT_ENG_SERVER_SIDE;
|
1403 |
return AI_TEXT_SERVER_SIDE;
|
2860 |
$clients = base64_encode ($clients_raw);
|
2861 |
$client_list_type = isset ($this->check_client_list_type) ? $this->check_clients_list_type : $this->get_client_list_type ();
|
2862 |
|
2863 |
+
if ($this->client_side_cookie_check && ($url_parameters != '' /*|| $url_parameter_list_type == AI_WHITE_LIST*/) || $referers != '' /*|| $referer_list_type == AI_WHITE_LIST*/ || $clients != '' /*|| $client_list_type == AI_WHITE_LIST*/) {
|
2864 |
switch ($dynamic_blocks) {
|
2865 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2866 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2868 |
if ($referer_list_type == AI_BLACK_LIST) $referer_list_type = 'B'; else $referer_list_type = 'W';
|
2869 |
if ($client_list_type == AI_BLACK_LIST) $client_list_type = 'B'; else $client_list_type = 'W';
|
2870 |
|
2871 |
+
if ($this->client_side_cookie_check && ($url_parameters != '' /*|| $url_parameter_list_type == 'W'*/)) $url_parameter_attributes = "parameter-list='$url_parameters' parameter-list-type='$url_parameter_list_type'"; else $url_parameter_attributes = '';
|
2872 |
+
if ( $referers != '' /*|| $referer_list_type == 'W'*/) $referer_attributes = "referer-list='$referers' referer-list-type='$referer_list_type'"; else $referer_attributes = '';
|
2873 |
+
if ( $clients != '' /*|| $client_list_type == 'W'*/) $client_attributes = "client-list='$clients' client-list-type='$client_list_type'"; else $client_attributes = '';
|
2874 |
|
2875 |
$this->client_side_list_detection = true;
|
2876 |
|
2878 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2879 |
if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
|
2880 |
$processed_code = "\n<div class='ai-dynamic ai-list-data' $referer_attributes $client_attributes $url_parameter_attributes>$processed_code</div>\n";
|
2881 |
+
// } else $processed_code = "\n<div class='ai-dynamic ai-list-data' $referer_attributes $client_attributes $url_parameter_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
|
2882 |
+
} else $processed_code = "\n<div class='ai-dynamic ai-list-data' $referer_attributes $client_attributes $url_parameter_attributes>$processed_code</div>\n";
|
2883 |
break;
|
2884 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2885 |
$code_data = "data-code='".base64_encode ($processed_code)."'";
|
2890 |
|
2891 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
2892 |
// translators: %s: list parameters and type
|
2893 |
+
if ($this->client_side_cookie_check && ($url_parameters != '' /*|| $url_parameter_list_type == 'W'*/)) $url_parameter_attributes_dbg = sprintf (__ ("parameters='%s' type='%s'", 'ad-inserter'), $url_parameters_raw, $url_parameter_list_type); else $url_parameter_attributes_dbg = '';
|
2894 |
// translators: %s: list parameters and type
|
2895 |
+
if ( $referers != '' /*|| $referer_list_type == 'W'*/) $referer_attributes_dbg = sprintf (__ ("referers='%s' type='%s'", 'ad-inserter'), $referers_raw, $referer_list_type); else $referer_attributes_dbg = '';
|
2896 |
// translators: %s: list parameters and type
|
2897 |
+
if ( $clients != '' /*|| $client_list_type == 'W'*/) $client_attributes_dbg = sprintf (__ ("clients='%s' type='%s'", 'ad-inserter'), $clients_raw, $client_list_type); else $client_attributes_dbg = '';
|
2898 |
|
2899 |
$debug_list = new ai_block_labels ('ai-debug-lists');
|
2900 |
$debug_processed_code = $debug_list->bar ($url_parameter_attributes_dbg . ' ' . $referer_attributes_dbg . ' ' . $client_attributes_dbg, 'B = ' . AI_TEXT_BLACK_LIST .', W = ' . AI_TEXT_WHITE_LIST, '<kbd class="ai-debug-name ai-list-status"></kbd>', '<kbd class="ai-debug-name ai-list-info"></kbd>');
|
2912 |
|
2913 |
if ($referers != '') {
|
2914 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_referer_list (base64_decode (\''.$referers.'\'), '.($referer_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2915 |
+
} //elseif ($referer_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2916 |
|
2917 |
if ($clients != '') {
|
2918 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_client_list (base64_decode (\''.$clients.'\'), '.($client_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2919 |
+
} //elseif ($client_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2920 |
|
2921 |
if ($this->client_side_cookie_check) {
|
2922 |
if ($url_parameters != '') {
|
2923 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_cookie_list (base64_decode (\''.$url_parameters.'\'), '.($url_parameter_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2924 |
+
} //elseif ($url_parameter_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2925 |
}
|
2926 |
|
2927 |
$processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2937 |
$ip_addresses = trim (str_replace (' ', '', strtolower (isset ($this->check_ip_addresses) ? $this->check_ip_addresses : $this->get_ad_ip_address_list ())));
|
2938 |
$ip_address_list_type = isset ($this->check_ip_addresses_list_type) ? $this->check_ip_addresses_list_type : $this->get_ad_ip_address_list_type ();
|
2939 |
|
2940 |
+
if ($countries != '' /*|| $country_list_type == AI_WHITE_LIST*/ || $ip_addresses != '' /*|| $ip_address_list_type == AI_WHITE_LIST*/) {
|
2941 |
switch ($dynamic_blocks) {
|
2942 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2943 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2944 |
if ($country_list_type == AI_BLACK_LIST) $country_list_type = 'B'; else $country_list_type = 'W';
|
2945 |
if ($ip_address_list_type == AI_BLACK_LIST) $ip_address_list_type = 'B'; else $ip_address_list_type = 'W';
|
2946 |
|
2947 |
+
if ($countries != '' /*|| $country_list_type == 'W'*/) $country_attributes = "countries='$countries' country-list='$country_list_type'"; else $country_attributes = '';
|
2948 |
+
if ($ip_addresses != '' /*|| $ip_address_list_type == 'W'*/) $ip_address_attributes = "ip-addresses='$ip_addresses' ip-address-list='$ip_address_list_type'"; else $ip_address_attributes = '';
|
2949 |
|
2950 |
$this->client_side_list_detection = true;
|
2951 |
|
2953 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW:
|
2954 |
if (defined ('AI_NORMAL_HEADER_STYLES') && AI_NORMAL_HEADER_STYLES && !get_inline_styles ()) {
|
2955 |
$processed_code = "\n<div class='ai-dynamic ai-ip-data' $ip_address_attributes $country_attributes>$processed_code</div>\n";
|
2956 |
+
// } else $processed_code = "\n<div class='ai-dynamic ai-ip-data' $ip_address_attributes $country_attributes style='visibility: hidden; position: absolute; width: 100%; height: 100%; z-index: -9999;'>$processed_code</div>\n";
|
2957 |
+
} else $processed_code = "\n<div class='ai-dynamic ai-ip-data' $ip_address_attributes $country_attributes>$processed_code</div>\n";
|
2958 |
break;
|
2959 |
case AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT:
|
2960 |
$code_data = "data-code='".base64_encode ($processed_code)."'";
|
2966 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
2967 |
|
2968 |
// translators: %s: list parameters and type
|
2969 |
+
if ($countries != '' /*|| $country_list_type == 'W'*/) $country_attributes_dbg = sprintf (__ ("countries='%s' type='%s'", 'ad-inserter'), $countries, $country_list_type); else $country_attributes_dbg = '';
|
2970 |
// translators: %s: list parameters and type
|
2971 |
+
if ($ip_addresses != '' /*|| $ip_address_list_type == 'W'*/) $ip_address_attributes_dbg = sprintf (__ ("ip addresses='%s' type='%s'", 'ad-inserter'), $ip_addresses, $ip_address_list_type); else $ip_address_attributes_dbg = '';
|
2972 |
|
2973 |
$debug_ip = new ai_block_labels ('ai-debug-lists');
|
2974 |
$processed_code = $debug_ip->bar ($country_attributes_dbg . ' ' . $ip_address_attributes_dbg, 'B = ' . AI_TEXT_BLACK_LIST .', W = ' . AI_TEXT_WHITE_LIST, '<kbd class="ai-debug-name ai-ip-status"></kbd>', '<kbd class="ai-debug-name ai-ip-country"></kbd>') . $processed_code;
|
2982 |
|
2983 |
if ($ip_addresses != '') {
|
2984 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_ip_address_list (base64_decode (\''.base64_encode ($ip_addresses).'\'), '.($ip_address_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2985 |
+
} //elseif ($ip_address_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2986 |
|
2987 |
if ($countries != '') {
|
2988 |
$this->w3tc_code .= ' if ($ai_enabled) $ai_enabled = check_country_list (base64_decode (\''.base64_encode ($countries).'\'), '.($country_list_type == AI_WHITE_LIST ? 'true':'false').');';
|
2989 |
+
} //elseif ($country_list_type == AI_WHITE_LIST) $this->w3tc_code .= ' $ai_enabled = false;';
|
2990 |
|
2991 |
$processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2992 |
$processed_code .= $this->w3tc_code.' if ($ai_enabled) echo $ai_code;';
|
3010 |
} else {
|
3011 |
$debug_html_code = '';
|
3012 |
$debug_js_code = '';
|
3013 |
+
$block_id = $this->number . '-' . rand (1000, 9999) . rand (1000, 9999);
|
3014 |
|
3015 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !$this->hide_debug_labels) {
|
3016 |
$debug_label = new ai_block_labels ('ai-debug-cookie');
|
3017 |
|
3018 |
$debug_html_code =
|
3019 |
$debug_label->block_start () .
|
3020 |
+
$debug_label->bar ('COOKIE CHECK', '', '<span class="ai-status"></span>', '<span class="ai-cookie-data"></span>', '', 'ai-dbg-check-'.$block_id) .
|
3021 |
$debug_label->block_end ();
|
3022 |
|
3023 |
+
$debug_js_code = "\n var ai_debug_bars = document.querySelectorAll ('.ai-dbg-check-{$block_id}'); for (let ai_debug_bar of ai_debug_bars) {ai_debug_bar.querySelector ('.ai-status').textContent = ai_debug_cookie_status; ai_debug_bar.querySelector ('.ai-cookie-data').textContent = ai_get_cookie_text ({$this->number}); ai_debug_bar.classList.remove ('ai-dbg-check-{$block_id}');}";
|
3024 |
}
|
3025 |
|
3026 |
+
$processed_code = $debug_html_code . "<div class='no-visibility-check ai-check-{$block_id}' data-insertion='after' data-selector='.ai-check-{$block_id}' data-code='".base64_encode (ai_strip_js_markers ($processed_code))."' data-block='{$this->number}'>{$ai_check_block_html_code}</div>\n";
|
3027 |
+
if (!get_disable_js_code ()) {
|
3028 |
+
$js_code = "{$ai_check_block_js_code}var ai_block_div = document.getElementsByClassName ('ai-check-{$block_id}') [0]; if (ai_check_block ({$this->number})) {ai_insert_code (ai_block_div);} else {var ai_block_div_data = ai_block_div.closest ('div[data-ai]'); if (ai_block_div_data) {ai_block_div.closest ('div[data-ai]').removeAttribute ('data-ai');} var wrapping_div = ai_block_div.closest ('.ai-list-block'); if (wrapping_div) {wrapping_div.classList.remove ('ai-list-block'); wrapping_div.style.visibility = ''; if (wrapping_div.classList.contains ('ai-remove-position')) {wrapping_div.style.position = '';}}} ai_block_div.classList.remove ('ai-check-{$block_id}'); {$debug_js_code}";
|
3029 |
+
// $processed_code .= "<script>{$js_code}</script>\n";
|
3030 |
+
$processed_code .= ai_js_dom_ready ($js_code);
|
3031 |
+
}
|
3032 |
}
|
3033 |
}
|
3034 |
}
|
3093 |
|
3094 |
if ($hidden_widgets) return $this->hidden_viewports;
|
3095 |
|
3096 |
+
$additional_block_style = '';
|
3097 |
if ($this->client_side_list_detection && !$ai_wp_data [AI_WP_AMP_PAGE]) {
|
3098 |
+
// if ($this->is_sticky ()) {
|
3099 |
+
// $additional_block_style = 'visibility: hidden; ';
|
3100 |
+
// } else {
|
3101 |
+
// $additional_block_style = 'visibility: hidden; position: absolute; ';
|
3102 |
+
// $classes [] = 'ai-remove-position';
|
3103 |
+
// }
|
3104 |
|
3105 |
// Needed to locate wrapping div
|
3106 |
$classes [] = 'ai-list-block';
|
3107 |
+
}
|
|
|
|
|
3108 |
|
3109 |
if (($this->get_close_button () || $this->get_auto_close_time ()) && !$ai_wp_data [AI_WP_AMP_PAGE] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
3110 |
$classes [] = 'ai-close';
|
3232 |
return $code;
|
3233 |
}
|
3234 |
|
3235 |
+
public function get_html_js_code_for_serverside_insertion ($include_viewport_classes = true, $hidden_widgets = false, $code_only = false) {
|
3236 |
global $ai_wp_data, $block_object;
|
3237 |
|
3238 |
$html_element_insertion = false;
|
3286 |
|
3287 |
if ($ai_wp_data [AI_WP_AMP_PAGE] || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_FEED || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_AJAX) return '';
|
3288 |
|
3289 |
+
$block_id = 'ai-insert-' . $this->number . '-' . rand (1000, 9999) . rand (1000, 9999);
|
3290 |
+
|
3291 |
if ($viewports_insertion && !$html_element_insertion) {
|
3292 |
+
$block_code = base64_encode (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
|
3293 |
$selector = $this->get_viewport_names ();
|
3294 |
$viewport_classes = trim ($this->get_viewport_classes ());
|
3295 |
|
3296 |
+
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' data-insertion='after' data-selector='.{$block_id}' data-insertion-no-dbg data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3297 |
+
if (!get_disable_js_code ()) {
|
3298 |
+
$js_code = "ai_insert_code (document.getElementsByClassName ('$block_id') [0]);";
|
3299 |
+
// $serverside_insertion_code .= "<script>$js_code</script>\n";
|
3300 |
+
$serverside_insertion_code .= ai_js_dom_ready ($js_code);
|
3301 |
+
}
|
3302 |
}
|
3303 |
elseif ($viewports_insertion && $html_element_insertion) {
|
3304 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3305 |
+
$block_code = base64_encode (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
|
3306 |
$selector = $this->get_html_selector (true);
|
3307 |
$viewport_classes = trim ($this->get_viewport_classes ());
|
3308 |
|
3309 |
+
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes $block_id' data-insertion='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3310 |
+
if (!get_disable_js_code () && $this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE) {
|
3311 |
// Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
|
3312 |
+
// $serverside_insertion_code .= "<script>ai_insert_code (document.getElementsByClassName ('$block_id') [0]);</script>\n";
|
3313 |
+
$js_code = "var ai_block_div = document.getElementsByClassName ('$block_id') [0]; ai_insert_code (ai_block_div); ai_block_div.classList.remove ('$block_id')";
|
3314 |
+
$serverside_insertion_code .= ai_js_dom_ready ($js_code);
|
3315 |
+
}
|
3316 |
}
|
3317 |
else { // only HTML element insertion
|
3318 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3319 |
+
$block_code = base64_encode (ai_strip_js_markers ($this->get_code_for_insertion ($include_viewport_classes, $hidden_widgets, $code_only)));
|
3320 |
$selector = $this->get_html_selector (true);
|
3321 |
|
3322 |
+
// $code_before = '';
|
3323 |
+
// $code_after = '';
|
3324 |
|
3325 |
+
// if ($this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY) {
|
3326 |
|
3327 |
+
// $code_before = "var ai_insert_{$this->number} = function(){
|
3328 |
+
// ";
|
3329 |
+
// $code_after = "\n };
|
3330 |
+
// if (document.readyState === 'complete' || (document.readyState !== 'loading' && !document.documentElement.doScroll)) ai_insert_{$this->number} (); else document.addEventListener ('DOMContentLoaded', ai_insert_{$this->number});";
|
3331 |
+
// }
|
3332 |
|
3333 |
+
// if (get_disable_js_code ()) $serverside_insertion_code = ''; else
|
3334 |
+
// $serverside_insertion_code = "<script>
|
3335 |
+
// {$code_before}ai_insert ('$insertion', '$selector', b64d ('[#AI_CODE#]'));{$code_after}
|
3336 |
+
//</script>\n";
|
3337 |
+
|
3338 |
+
$serverside_insertion_code = '';
|
3339 |
+
if (!get_disable_js_code ()) {
|
3340 |
+
$js_code = "ai_insert ('$insertion', '$selector', b64d ('[#AI_CODE#]'));";
|
3341 |
+
$serverside_insertion_code .= ai_js_dom_ready ($js_code);
|
3342 |
+
}
|
3343 |
}
|
3344 |
|
3345 |
if (!get_disable_js_code () && $ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) {
|
3355 |
|
3356 |
$version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
|
3357 |
|
3358 |
+
$tag = __('Code', 'ad-inserter');
|
3359 |
$debug_script = new ai_block_labels ('ai-debug-script');
|
3360 |
$serverside_insertion_code =
|
3361 |
$debug_script->bar (" $tag " . __('for block', 'ad-inserter') . " " . $this->number . ' ' . $this->get_ad_name () . $version_name . ' ' . $fallback_block_name, '', $insertion_name . ' ' . $selector, $counters, $title) .
|
3386 |
return $serverside_insertion_code;
|
3387 |
}
|
3388 |
|
3389 |
+
public function get_code_for_serverside_insertion ($include_viewport_classes = true, $hidden_widgets = false, $code_only = false) {
|
3390 |
+
global $ai_wp_data;
|
3391 |
+
|
3392 |
+
$code = $this->get_html_js_code_for_serverside_insertion ($include_viewport_classes, $hidden_widgets, $code_only);
|
3393 |
+
if (preg_match ('#<!-- AI_JS -->(.+?)<!-- AI_JS -->#s', $code, $script_matches)) {
|
3394 |
+
if (preg_match ('#/\* AI_JS \*/(.+?)/\* AI_JS \*/#s', $script_matches [1], $js_matches)) {
|
3395 |
+
$js_code = $js_matches [1];
|
3396 |
+
$ai_wp_data [AI_FOOTER_JS_CODE_DOM_READY] .= ' ' . $js_code."\n";
|
3397 |
+
}
|
3398 |
+
|
3399 |
+
$code = trim (preg_replace ('#<!-- AI_JS -->(.+?)<!-- AI_JS -->#s', '', $code));
|
3400 |
+
}
|
3401 |
+
return $code;
|
3402 |
+
}
|
3403 |
+
|
3404 |
public function get_iframe_page () {
|
3405 |
+
global $ai_wp_data, $wp_version, $wp_scripts;
|
3406 |
|
3407 |
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
3408 |
|
3409 |
+
if (isset ($wp_scripts->registered ['jquery']->ver)) {
|
3410 |
+
$jquery_version = $wp_jquery_ver = $wp_scripts->registered ['jquery']->ver;
|
3411 |
+
} else $jquery_version = $wp_version;
|
3412 |
+
|
3413 |
+
if (isset ($wp_scripts->registered ['jquery-migrate']->ver)) {
|
3414 |
+
$jquery_migrate_version = $wp_jquery_ver = $wp_scripts->registered ['jquery-migrate']->ver;
|
3415 |
+
} else $jquery_migrate_version = $wp_version;
|
3416 |
+
|
3417 |
$ai_wp_data [AI_CODE_FOR_IFRAME] = true;
|
3418 |
ob_start ();
|
3419 |
+
|
3420 |
echo '<!DOCTYPE>
|
3421 |
<html>
|
3422 |
<head>
|
3423 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
3424 |
';
|
3425 |
+
echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery.js'), "?ver=", $jquery_version, "'></script>\n";
|
3426 |
+
echo "<script type='text/javascript' src='", includes_url ('js/jquery/jquery-migrate.min.js'), "?ver=", $jquery_migrate_version, "'></script>\n";
|
|
|
|
|
|
|
3427 |
|
3428 |
+
// echo "<script>\n";
|
3429 |
+
// echo "var ai_iframe = true;\n";
|
|
|
3430 |
|
3431 |
+
// if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
3432 |
+
// echo "ai_debugging = true;\n";
|
3433 |
+
// }
|
3434 |
+
// // FOOTER
|
3435 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_CHECK_BLOCK] || $adb_code)) {
|
3436 |
+
// echo ai_get_js ('ai-cookie', false);
|
3437 |
+
// }
|
3438 |
|
3439 |
+
// // FOOTER
|
3440 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_CHECK_BLOCK])) {
|
3441 |
+
// echo ai_get_js ('ai-insert', false);
|
3442 |
+
// }
|
3443 |
+
// echo "</script>\n";
|
3444 |
|
3445 |
ai_wp_head_hook ();
|
3446 |
echo '<style>
|
3450 |
</head>
|
3451 |
<body>
|
3452 |
'; /* $include_viewport_classes = true, $hidden_widgets = false, $code_only = false */
|
3453 |
+
echo ai_strip_js_markers ($this->get_code_for_insertion (false, false, false));
|
3454 |
+
|
3455 |
+
// echo "DELA\n";
|
3456 |
+
|
3457 |
+
echo "<script>\n";
|
3458 |
+
echo "var ai_iframe = true;\n";
|
3459 |
+
|
3460 |
+
// if ($ai_wp_data [AI_FRONTEND_JS_DEBUGGING]) {
|
3461 |
+
// echo "ai_debugging = true;\n";
|
3462 |
+
// }
|
3463 |
+
// FOOTER
|
3464 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_CHECK_BLOCK] || $adb_code)) {
|
3465 |
+
// echo ai_get_js ('ai-cookie', false);
|
3466 |
+
// }
|
3467 |
+
|
3468 |
+
// FOOTER
|
3469 |
+
// if (!get_disable_js_code () && ($ai_wp_data [AI_CHECK_BLOCK])) {
|
3470 |
+
// echo ai_get_js ('ai-insert', false);
|
3471 |
+
// }
|
3472 |
+
echo "</script>\n";
|
3473 |
+
|
3474 |
+
ai_wp_footer_hook_end_buffering ();
|
3475 |
ai_wp_footer_hook ();
|
3476 |
echo '</body>
|
3477 |
</html>';
|
4023 |
|
4024 |
if ($name == '') return '';
|
4025 |
|
4026 |
+
return strtolower (str_replace ('--', '-', preg_replace ('/[^\-_a-zA-Z0-9]/', '', str_replace (' ', '-', html_entity_decode ($name)))));
|
4027 |
}
|
4028 |
|
4029 |
public function get_viewport_classes () {
|
5698 |
$cat_type = $this->get_ad_block_cat_type();
|
5699 |
}
|
5700 |
|
5701 |
+
if ($categories == AD_EMPTY_DATA) return true;
|
5702 |
+
|
5703 |
$wp_categories = get_the_category ();
|
5704 |
|
5705 |
if ($cat_type == AI_BLACK_LIST) {
|
5706 |
|
5707 |
+
// if ($categories == AD_EMPTY_DATA) return true;
|
5708 |
|
5709 |
$cats_listed = explode (",", $categories);
|
5710 |
|
5711 |
foreach ($wp_categories as $wp_category) {
|
|
|
5712 |
foreach ($cats_listed as $cat_disabled){
|
5713 |
|
5714 |
+
$check_parent = true;
|
5715 |
+
$check_childern = false;
|
5716 |
+
|
5717 |
$cat_disabled = trim ($cat_disabled);
|
5718 |
+
if (substr ($cat_disabled, - 1) == '*') {
|
5719 |
+
$check_childern = true;
|
5720 |
+
$cat_disabled = rtrim ($cat_disabled, '*');
|
5721 |
+
}
|
5722 |
+
elseif (substr ($cat_disabled, - 1) == '+') {
|
5723 |
+
$check_parent = false;
|
5724 |
+
$check_childern = true;
|
5725 |
+
$cat_disabled = rtrim ($cat_disabled, '+');
|
5726 |
+
}
|
5727 |
|
5728 |
$wp_category_name = strtolower ($wp_category->cat_name);
|
5729 |
$wp_category_slug = strtolower ($wp_category->slug);
|
5730 |
|
5731 |
+
if ($check_parent) {
|
5732 |
+
if ($wp_category_name == $cat_disabled || $wp_category_slug == $cat_disabled) {
|
5733 |
+
return false;
|
5734 |
+
}
|
5735 |
+
}
|
5736 |
+
|
5737 |
+
if ($check_childern) {
|
5738 |
+
if (ai_post_is_in_descendant_category ($cat_disabled)) {
|
5739 |
+
return false;
|
5740 |
}
|
5741 |
+
}
|
5742 |
}
|
5743 |
}
|
5744 |
return true;
|
5745 |
|
5746 |
} else {
|
5747 |
|
5748 |
+
// if ($categories == AD_EMPTY_DATA) return false;
|
5749 |
|
5750 |
$cats_listed = explode (",", $categories);
|
5751 |
|
5752 |
foreach ($wp_categories as $wp_category) {
|
|
|
5753 |
foreach ($cats_listed as $cat_enabled) {
|
5754 |
|
5755 |
+
$check_parent = true;
|
5756 |
+
$check_childern = false;
|
5757 |
+
|
5758 |
$cat_enabled = trim ($cat_enabled);
|
5759 |
|
5760 |
+
if (substr ($cat_enabled, - 1) == '*') {
|
5761 |
+
$check_childern = true;
|
5762 |
+
$cat_enabled = rtrim ($cat_enabled, '*');
|
5763 |
+
}
|
5764 |
+
elseif (substr ($cat_enabled, - 1) == '+') {
|
5765 |
+
$check_parent = false;
|
5766 |
+
$check_childern = true;
|
5767 |
+
$cat_enabled = rtrim ($cat_enabled, '+');
|
5768 |
+
}
|
5769 |
+
|
5770 |
$wp_category_name = strtolower ($wp_category->cat_name);
|
5771 |
$wp_category_slug = strtolower ($wp_category->slug);
|
5772 |
|
5773 |
+
if ($check_parent) {
|
5774 |
+
if ($wp_category_name == $cat_enabled || $wp_category_slug == $cat_enabled) {
|
5775 |
+
return true;
|
5776 |
}
|
5777 |
+
}
|
5778 |
+
|
5779 |
+
if ($check_childern) {
|
5780 |
+
if (ai_post_is_in_descendant_category ($cat_enabled)) {
|
5781 |
+
return true;
|
5782 |
+
}
|
5783 |
+
}
|
5784 |
+
|
5785 |
}
|
5786 |
}
|
5787 |
return false;
|
5796 |
}
|
5797 |
|
5798 |
$tags = trim ($tags);
|
5799 |
+
|
5800 |
+
if ($tags == AD_EMPTY_DATA) return true;
|
5801 |
+
|
5802 |
$tags_listed = explode (",", $tags);
|
5803 |
foreach ($tags_listed as $index => $tag_listed) {
|
5804 |
$tags_listed [$index] = trim ($tag_listed);
|
5807 |
|
5808 |
if ($tag_type == AI_BLACK_LIST) {
|
5809 |
|
5810 |
+
// if ($tags == AD_EMPTY_DATA) return true;
|
5811 |
|
5812 |
if (is_tag()) {
|
5813 |
foreach ($tags_listed as $tag_listed) {
|
5820 |
|
5821 |
} else {
|
5822 |
|
5823 |
+
// if ($tags == AD_EMPTY_DATA) return false;
|
5824 |
|
5825 |
if (is_tag()) {
|
5826 |
foreach ($tags_listed as $tag_listed) {
|
5841 |
$taxonomy_type = $this->get_ad_block_taxonomy_type();
|
5842 |
}
|
5843 |
|
5844 |
+
if ($taxonomies == AD_EMPTY_DATA) return true;
|
5845 |
+
|
5846 |
if ($taxonomy_type == AI_BLACK_LIST) {
|
5847 |
|
5848 |
+
// if ($taxonomies == AD_EMPTY_DATA) return true;
|
5849 |
|
5850 |
$taxonomies_listed = explode (",", $taxonomies);
|
5851 |
$taxonomy_names = get_post_taxonomies ();
|
5905 |
|
5906 |
} else {
|
5907 |
|
5908 |
+
// if ($taxonomies == AD_EMPTY_DATA) return false;
|
5909 |
|
5910 |
$taxonomies_listed = explode (",", $taxonomies);
|
5911 |
$taxonomy_names = get_post_taxonomies ();
|
5973 |
$id_type = $this->get_id_list_type();
|
5974 |
}
|
5975 |
|
5976 |
+
if ($ids == AD_EMPTY_DATA) return true;
|
5977 |
+
|
5978 |
$page_id = get_the_ID();
|
5979 |
|
5980 |
if ($id_type == AI_BLACK_LIST) $return = false; else $return = true;
|
5981 |
|
5982 |
+
if (/*$ids == AD_EMPTY_DATA ||*/ $page_id === false) {
|
5983 |
return !$return;
|
5984 |
}
|
5985 |
|
6021 |
|
6022 |
if ($url_type == AI_BLACK_LIST) $return = false; else $return = true;
|
6023 |
|
6024 |
+
if ($urls == AD_EMPTY_DATA) return true;
|
6025 |
|
6026 |
$list_separator = ',';
|
6027 |
if (strpos ($urls, ' ') !== false && strpos ($urls, ',') === false) $list_separator = ' ';
|
6734 |
|
6735 |
if ($this->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
|
6736 |
|
6737 |
+
if (trim ($this->get_client_list ()) != '' /*|| $this->get_client_list_type () == AI_WHITE_LIST*/) $ai_wp_data [AI_MOBILE_DETECT_JS] = true;
|
6738 |
|
6739 |
if ($this->get_detection_client_side ()) {
|
6740 |
$ai_wp_data [AI_CLIENT_SIDE_DETECTION] = true;
|
constants.php
CHANGED
@@ -31,7 +31,7 @@ if (!defined( 'AD_INSERTER_NAME'))
|
|
31 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
32 |
|
33 |
if (!defined( 'AD_INSERTER_VERSION'))
|
34 |
-
define ('AD_INSERTER_VERSION', '2.5.
|
35 |
|
36 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
37 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -658,6 +658,10 @@ define ('AI_OUTPUT_BUFFERING_ENABLED', 1);
|
|
658 |
define ('AI_DISABLE_CACHING_DISABLED', 0);
|
659 |
define ('AI_DISABLE_CACHING_ENABLED', 1);
|
660 |
|
|
|
|
|
|
|
|
|
661 |
// Click detection
|
662 |
define ('AI_CLICK_DETECTION_STANDARD', 0);
|
663 |
define ('AI_CLICK_DETECTION_ADVANCED', 1);
|
@@ -696,10 +700,10 @@ define ('AI_CLIENT_SIDE_ACTION_INSERT', 1);
|
|
696 |
define ('AI_TEXT_ENG_INSERT', 'Insert');
|
697 |
|
698 |
define ('AI_HTML_INSERTION_CLIENT_SIDE', 0);
|
699 |
-
define ('AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY', 1);
|
700 |
define ('AI_HTML_INSERTION_SEREVR_SIDE', 2);
|
701 |
|
702 |
-
define('AI_TEXT_ENG_CLIENT_SIDE_DOM_READY', 'Client-side when DOM ready');
|
703 |
|
704 |
define ('AI_HTML_PREPEND_CONTENT', 1);
|
705 |
define ('AI_HTML_APPEND_CONTENT', 2);
|
@@ -793,13 +797,14 @@ define ('DEFAULT_ADB_DETECTION', AI_ADB_DETECTION_ADVANCED);
|
|
793 |
define ('DEFAULT_CUSTOM_HOOK_PRIORITY', 10);
|
794 |
define ('DEFAULT_OUTPUT_BUFFERING', AI_OUTPUT_BUFFERING_DISABLED);
|
795 |
define ('DEFAULT_DISABLE_CACHING', AI_DISABLE_CACHING_ENABLED);
|
|
|
796 |
define ('DEFAULT_GEO_DB', AI_GEO_DB_WEBNET77);
|
797 |
define ('DEFAULT_GEO_DB_UPDATES', AI_DISABLED);
|
798 |
define ('DEFAULT_CLOSE_BUTTON', AI_CLOSE_NONE);
|
799 |
define ('DEFAULT_AUTO_CLOSE_TIME', '');
|
800 |
define ('DEFAULT_STAY_CLOSED_TIME', '');
|
801 |
define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
|
802 |
-
define ('DEFAULT_HTML_ELEMENT_INSERTION',
|
803 |
define ('DEFAULT_INSIDE_ELEMENT', AI_HTML_PREPEND_CONTENT);
|
804 |
define ('DEFAULT_CLIENT_SIDE_ACTION', AI_CLIENT_SIDE_ACTION_SHOW);
|
805 |
define ('DEFAULT_HORIZONTAL_POSITION', AI_STICK_TO_THE_LEFT);
|
@@ -1050,6 +1055,7 @@ define ('AI_CLIENTS', 56);
|
|
1050 |
define ('AI_MOBILE_DETECT_JS', 57);
|
1051 |
define ('AI_POST_POSITION', 58);
|
1052 |
define ('AI_TRACKING_SHORTCODE_DISABLED',59);
|
|
|
1053 |
|
1054 |
define ('AI_CONTEXT_NONE', 0);
|
1055 |
define ('AI_CONTEXT_CONTENT', 1);
|
31 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
32 |
|
33 |
if (!defined( 'AD_INSERTER_VERSION'))
|
34 |
+
define ('AD_INSERTER_VERSION', '2.5.10');
|
35 |
|
36 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
37 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
658 |
define ('AI_DISABLE_CACHING_DISABLED', 0);
|
659 |
define ('AI_DISABLE_CACHING_ENABLED', 1);
|
660 |
|
661 |
+
// Wait for jQuery
|
662 |
+
define ('AI_WAIT_FOR_JQUERY_DISABLED', 0);
|
663 |
+
define ('AI_WAIT_FOR_JQUERY_ENABLED', 1);
|
664 |
+
|
665 |
// Click detection
|
666 |
define ('AI_CLICK_DETECTION_STANDARD', 0);
|
667 |
define ('AI_CLICK_DETECTION_ADVANCED', 1);
|
700 |
define ('AI_TEXT_ENG_INSERT', 'Insert');
|
701 |
|
702 |
define ('AI_HTML_INSERTION_CLIENT_SIDE', 0);
|
703 |
+
define ('AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY', 1); // Deprecated
|
704 |
define ('AI_HTML_INSERTION_SEREVR_SIDE', 2);
|
705 |
|
706 |
+
//define('AI_TEXT_ENG_CLIENT_SIDE_DOM_READY', 'Client-side when DOM ready');
|
707 |
|
708 |
define ('AI_HTML_PREPEND_CONTENT', 1);
|
709 |
define ('AI_HTML_APPEND_CONTENT', 2);
|
797 |
define ('DEFAULT_CUSTOM_HOOK_PRIORITY', 10);
|
798 |
define ('DEFAULT_OUTPUT_BUFFERING', AI_OUTPUT_BUFFERING_DISABLED);
|
799 |
define ('DEFAULT_DISABLE_CACHING', AI_DISABLE_CACHING_ENABLED);
|
800 |
+
define ('DEFAULT_WAIT_FOR_JQUERY', AI_WAIT_FOR_JQUERY_DISABLED);
|
801 |
define ('DEFAULT_GEO_DB', AI_GEO_DB_WEBNET77);
|
802 |
define ('DEFAULT_GEO_DB_UPDATES', AI_DISABLED);
|
803 |
define ('DEFAULT_CLOSE_BUTTON', AI_CLOSE_NONE);
|
804 |
define ('DEFAULT_AUTO_CLOSE_TIME', '');
|
805 |
define ('DEFAULT_STAY_CLOSED_TIME', '');
|
806 |
define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
|
807 |
+
define ('DEFAULT_HTML_ELEMENT_INSERTION', AI_HTML_INSERTION_CLIENT_SIDE);
|
808 |
define ('DEFAULT_INSIDE_ELEMENT', AI_HTML_PREPEND_CONTENT);
|
809 |
define ('DEFAULT_CLIENT_SIDE_ACTION', AI_CLIENT_SIDE_ACTION_SHOW);
|
810 |
define ('DEFAULT_HORIZONTAL_POSITION', AI_STICK_TO_THE_LEFT);
|
1055 |
define ('AI_MOBILE_DETECT_JS', 57);
|
1056 |
define ('AI_POST_POSITION', 58);
|
1057 |
define ('AI_TRACKING_SHORTCODE_DISABLED',59);
|
1058 |
+
define ('AI_FOOTER_JS_CODE_DOM_READY', 60);
|
1059 |
|
1060 |
define ('AI_CONTEXT_NONE', 0);
|
1061 |
define ('AI_CONTEXT_CONTENT', 1);
|
css/ai-settings.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#ai-data {
|
2 |
-
font-family: "2.5.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
@@ -484,6 +484,29 @@ div.automatic-insertion img {
|
|
484 |
vertical-align: top;
|
485 |
}
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
.checkbox-button.dashicons.on {
|
488 |
color: #5f76ff;
|
489 |
}
|
@@ -1553,7 +1576,7 @@ table.check-pages a span.dashicons {
|
|
1553 |
/* Fix for some themes */
|
1554 |
#ai-settings select {
|
1555 |
/* padding: 2px;*/
|
1556 |
-
padding: 2px 24px 2px
|
1557 |
min-height: 26px;
|
1558 |
}
|
1559 |
|
1 |
#ai-data {
|
2 |
+
font-family: "2.5.10"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
484 |
vertical-align: top;
|
485 |
}
|
486 |
|
487 |
+
.checkbox-list-button.dashicons {
|
488 |
+
width: 20px;
|
489 |
+
height: 22px;
|
490 |
+
line-height: 20px;
|
491 |
+
padding: 0;
|
492 |
+
background: #fff;
|
493 |
+
color: #333;
|
494 |
+
border: 0;
|
495 |
+
}
|
496 |
+
|
497 |
+
table.ai-lists td {
|
498 |
+
padding: 1px 0;
|
499 |
+
}
|
500 |
+
|
501 |
+
table.ai-lists .ai-button {
|
502 |
+
display: none;
|
503 |
+
outline: transparent;
|
504 |
+
float: right;
|
505 |
+
margin: 1px 3px 0 5px;
|
506 |
+
width: 15px;
|
507 |
+
height: 15px;
|
508 |
+
}
|
509 |
+
|
510 |
.checkbox-button.dashicons.on {
|
511 |
color: #5f76ff;
|
512 |
}
|
1576 |
/* Fix for some themes */
|
1577 |
#ai-settings select {
|
1578 |
/* padding: 2px;*/
|
1579 |
+
padding: 2px 24px 2px 5px;
|
1580 |
min-height: 26px;
|
1581 |
}
|
1582 |
|
includes/js/ai-adb.js
CHANGED
@@ -174,7 +174,13 @@ ai_adb_detection_type = function (n) {
|
|
174 |
}
|
175 |
}
|
176 |
|
177 |
-
var ai_adb_detected = function(n) {
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
var ai_adb_debugging = typeof ai_debugging !== 'undefined'; // 2
|
180 |
// var ai_adb_debugging = false;
|
@@ -188,6 +194,7 @@ var ai_adb_detected = function(n) {
|
|
188 |
(function ($) {
|
189 |
|
190 |
$(window).ready(function () {
|
|
|
191 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING block actions");
|
192 |
|
193 |
$(".ai-adb-hide").each (function () {
|
@@ -384,22 +391,6 @@ var ai_adb_undetected = function(n) {
|
|
384 |
|
385 |
if (AI_DBG_AI_DEBUG_AD_BLOCKING) jQuery (document).ready (function () {ai_adb_detected (0)});
|
386 |
|
387 |
-
if (jQuery("#ai-adb-ads").length) {
|
388 |
-
if (!document.getElementById ("AI_CONST_AI_ADB_1_NAME")){
|
389 |
-
jQuery (document).ready (function () {if (!ai_adb_active || (typeof ai_debugging !== 'undefined')) ai_adb_detected (1)});
|
390 |
-
} else {
|
391 |
-
jQuery (document).ready (function () {ai_adb_undetected (1)});
|
392 |
-
}
|
393 |
-
}
|
394 |
-
|
395 |
-
if (jQuery("#ai-adb-sponsors").length) {
|
396 |
-
if (typeof window.AI_CONST_AI_ADB_2_NAME == "undefined") {
|
397 |
-
jQuery (document).ready (function () {if (!ai_adb_active || (typeof ai_debugging !== 'undefined')) ai_adb_detected (2)});
|
398 |
-
} else {
|
399 |
-
jQuery (document).ready (function () {ai_adb_undetected (2)});
|
400 |
-
}
|
401 |
-
}
|
402 |
-
|
403 |
jQuery (document).ready (function ($) {
|
404 |
$(window).ready (function () {
|
405 |
|
@@ -408,20 +399,20 @@ jQuery (document).ready (function ($) {
|
|
408 |
|
409 |
var ai_debugging_active = typeof ai_debugging !== 'undefined';
|
410 |
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
});
|
419 |
|
420 |
if (jQuery("#banner-advert-container").length) {
|
421 |
if ($("#banner-advert-container img").length > 0) {
|
422 |
if ($("#banner-advert-container img").outerHeight() === 0) {
|
423 |
-
|
424 |
-
} else
|
425 |
$("#banner-advert-container img").remove();
|
426 |
}
|
427 |
}
|
@@ -479,22 +470,42 @@ jQuery (window).on ('load', function () {
|
|
479 |
|
480 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING window load");
|
481 |
|
482 |
-
|
483 |
-
if (!(typeof ga == 'function' && ga.toString().length > 30) &&
|
484 |
-
!(typeof __gaTracker == 'function' && __gaTracker.toString ().length > 30)) {
|
485 |
-
jQuery (document).ready (function () {if (!ai_adb_active || ai_debugging_active) ai_adb_detected (5)});
|
486 |
-
} else {
|
487 |
-
jQuery (document).ready (function () {ai_adb_undetected (5)});
|
488 |
-
}
|
489 |
-
}
|
490 |
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
}
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
}, 100);
|
499 |
});
|
500 |
|
174 |
}
|
175 |
}
|
176 |
|
177 |
+
var ai_adb_detected = function (n) {
|
178 |
+
setTimeout (function() {
|
179 |
+
ai_adb_detected_actions (n);
|
180 |
+
}, 2);
|
181 |
+
}
|
182 |
+
|
183 |
+
var ai_adb_detected_actions = function(n) {
|
184 |
|
185 |
var ai_adb_debugging = typeof ai_debugging !== 'undefined'; // 2
|
186 |
// var ai_adb_debugging = false;
|
194 |
(function ($) {
|
195 |
|
196 |
$(window).ready(function () {
|
197 |
+
|
198 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING block actions");
|
199 |
|
200 |
$(".ai-adb-hide").each (function () {
|
391 |
|
392 |
if (AI_DBG_AI_DEBUG_AD_BLOCKING) jQuery (document).ready (function () {ai_adb_detected (0)});
|
393 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
jQuery (document).ready (function ($) {
|
395 |
$(window).ready (function () {
|
396 |
|
399 |
|
400 |
var ai_debugging_active = typeof ai_debugging !== 'undefined';
|
401 |
|
402 |
+
setTimeout (function() {
|
403 |
+
$("#ai-adb-bar").click (function () {
|
404 |
+
AiCookies.remove (ai_adb_act_cookie_name, {path: "/" });
|
405 |
+
AiCookies.remove (ai_adb_pgv_cookie_name, {path: "/" });
|
406 |
+
window.AI_ADB_STATUS_MESSAGE=5;
|
407 |
+
ai_dummy = 15; // Do not remove - to prevent optimization
|
408 |
+
});
|
409 |
+
}, 2);
|
410 |
|
411 |
if (jQuery("#banner-advert-container").length) {
|
412 |
if ($("#banner-advert-container img").length > 0) {
|
413 |
if ($("#banner-advert-container img").outerHeight() === 0) {
|
414 |
+
if (!ai_adb_active || ai_debugging_active) ai_adb_detected (3);
|
415 |
+
} else ai_adb_undetected (3);
|
416 |
$("#banner-advert-container img").remove();
|
417 |
}
|
418 |
}
|
470 |
|
471 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING window load");
|
472 |
|
473 |
+
jQuery (document).ready (function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
|
475 |
+
if (jQuery("#ai-adb-ads").length) {
|
476 |
+
if (!document.getElementById ("AI_CONST_AI_ADB_1_NAME")){
|
477 |
+
if (!ai_adb_active || (typeof ai_debugging !== 'undefined')) ai_adb_detected (1);
|
478 |
+
} else {
|
479 |
+
ai_adb_undetected (1);
|
480 |
}
|
481 |
+
}
|
482 |
+
|
483 |
+
if (jQuery("#ai-adb-sponsors").length) {
|
484 |
+
if (typeof window.AI_CONST_AI_ADB_2_NAME == "undefined") {
|
485 |
+
if (!ai_adb_active || (typeof ai_debugging !== 'undefined')) ai_adb_detected (2);
|
486 |
+
} else {
|
487 |
+
ai_adb_undetected (2);
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
if (jQuery("#ai-adb-ga").length) {
|
492 |
+
if (!(typeof ga == 'function' && ga.toString().length > 30) &&
|
493 |
+
!(typeof __gaTracker == 'function' && __gaTracker.toString ().length > 30)) {
|
494 |
+
if (!ai_adb_active || ai_debugging_active) ai_adb_detected (5);
|
495 |
+
} else {
|
496 |
+
ai_adb_undetected (5);
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
if (jQuery("#ai-adb-mn").length) {
|
501 |
+
if (!(typeof _mNDetails == 'object' && JSON.stringify (_mNDetails).length > 400)) {
|
502 |
+
if (!ai_adb_active || ai_debugging_active) ai_adb_detected (6);
|
503 |
+
} else {
|
504 |
+
ai_adb_undetected (6);
|
505 |
+
}
|
506 |
+
}
|
507 |
+
});
|
508 |
+
|
509 |
}, 100);
|
510 |
});
|
511 |
|
includes/js/ai-adb.min.js
CHANGED
@@ -6,14 +6,13 @@ a(this).attr("style");"undefined"==typeof c&&(c="");a(this).attr("style",c+";"+b
|
|
6 |
a(this).parent(),b=a(this).data("text");"undefined"==typeof b&&(b="");var c=a(this).data("css");"undefined"==typeof c&&(c="");var e=a(this).data("selectors");if("undefined"==typeof e||""==e)e="p";var f=!1;a(d).find(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, "+e).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS"))a(this).remove(),f=!0;else if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_END_CLASS"))a(this).remove(),f=!1;else if(f){if(0!=b.length){var d=Math.round(a(this).text().length/
|
7 |
(b.length+1));a(this).text(Array(d+1).join(b+" "))}else a(this).text("");d=a(this).attr("style");"undefined"==typeof d&&(d="");a(this).attr("style",d+";"+c)}})})})(jQuery)}ai_adb_detection_type_log=function(a){var d=ai_adb_detection_type(a),b=jQuery("#ai-adb-events");if(0!=b.count){var c=b.text();b.text((""!=c?c+", ":c+", EVENTS: ")+a)}return d};
|
8 |
ai_adb_detection_type=function(a){switch(a){case 0:return"0 debugging";case 1:return"1 ads create element";case 2:return"2 sponsors window var";case 3:return"3 banner element";case 4:return"4 custom selectors";case 5:return"5 ga";case 6:return"6 media.net";case 7:return"7 adsense";case 8:return"8 chitika";case 9:return"9 fun adblock 3";case 10:return"10 fun adblock 4";default:return a}};
|
9 |
-
var ai_adb_detected=function(a){ai_adb_active||(ai_adb_active=!0,function(a){a(window).ready(function(){a(".ai-adb-hide").each(function(){a(this).css({display:"none",visibility:"hidden"});var b=a(this).closest("div[data-ai]");if("undefined"!=typeof b.data("ai")){var c=JSON.parse(b64d(b.data("ai")));"undefined"!==typeof c&&c.constructor===Array&&(c[1]="",b.data("ai",b64e(JSON.stringify(c))))}});a(".ai-adb-show").each(function(){a(this).css({display:"block",
|
10 |
-
if("undefined"!=typeof b){var c=a(this).closest("div[data-ai]");if("undefined"!=typeof c.data("ai")){if(a(this).hasClass("ai-no-tracking")){var d=JSON.parse(b64d(c.data("ai")));"undefined"!==typeof d&&d.constructor===Array&&(d[1]="",b=b64e(JSON.stringify(d)))}c.data("ai",b)}}});setTimeout(ai_adb_process_content,10)});if(0!=ai_adb_page_views){var b=1,c=AiCookies.get(ai_adb_pgv_cookie_name);"undefined"!=typeof c&&(b=parseInt(c)+1);if(b<=ai_adb_page_views){AiCookies.set(ai_adb_pgv_cookie_name,
|
11 |
-
path:"/"});window.ai_d1=b;window.AI_ADB_STATUS_MESSAGE=1;return}}if(0==ai_adb_message_cookie_lifetime||1==ai_adb_action&&ai_adb_message_undismissible)AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});else{c=AiCookies.get(ai_adb_act_cookie_name);if("undefined"!=typeof c&&"AI_CONST_AI_ADB_COOKIE_VALUE"==c){window.AI_ADB_STATUS_MESSAGE=2;return}AiCookies.set(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}0==ai_adb_action?(ai_dummy=
|
12 |
-
window.AI_ADB_STATUS_MESSAGE=6):(window.AI_ADB_STATUS_MESSAGE=3,ai_dummy=13);switch(ai_adb_action){case 1:ai_adb_message_undismissible||(ai_adb_overlay.click(function(){a(this).remove();ai_adb_message_window.remove()}).css("cursor","pointer"),ai_adb_message_window.click(function(){a(this).remove();ai_adb_overlay.remove()}).css("cursor","pointer"),window.onkeydown=function(a){27===a.keyCode&&(ai_adb_overlay.click(),ai_adb_message_window.click())});a("body").prepend(ai_adb_overlay).prepend(ai_adb_message_window);
|
13 |
break;case 2:""!=ai_adb_redirection_url&&(b=!0,"http"==ai_adb_redirection_url.toLowerCase().substring(0,4)?window.location.href==ai_adb_redirection_url&&(b=!1):window.location.pathname==ai_adb_redirection_url&&(b=!1),b?(c=AiCookies.get(ai_adb_page_redirection_cookie_name),"undefined"==typeof c&&(b=new Date,b.setTime(b.getTime()+1E4),AiCookies.set(ai_adb_page_redirection_cookie_name,window.location.href,{expires:b,path:"/"}),window.location.replace(ai_adb_redirection_url))):AiCookies.remove(ai_adb_page_redirection_cookie_name,
|
14 |
-
{path:"/"}))}}(jQuery),ai_adb=!0)},ai_adb_undetected=function(a){ai_adb_counter++;ai_adb_active||4!=ai_adb_counter||(window.AI_ADB_STATUS_MESSAGE=4,ai_dummy=14)};AI_DBG_AI_DEBUG_AD_BLOCKING&&jQuery(document).ready(function(){ai_adb_detected(0)});
|
15 |
-
jQuery(
|
16 |
-
jQuery(document).ready(function(a){a(window).ready(function(){var d="undefined"!==typeof ai_debugging;a("#ai-adb-bar").click(function(){AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});AiCookies.remove(ai_adb_pgv_cookie_name,{path:"/"});window.AI_ADB_STATUS_MESSAGE=5;ai_dummy=15});jQuery("#banner-advert-container").length&&0<a("#banner-advert-container img").length&&(0===a("#banner-advert-container img").outerHeight()?a(document).ready(function(){ai_adb_active&&!d||ai_adb_detected(3)}):a(document).ready(function(){ai_adb_undetected(3)}),
|
17 |
a("#banner-advert-container img").remove());if((!ai_adb_active||d)&&""!=ai_adb_selectors){var b=0,c=0,e=ai_adb_selectors.split(",");a.each(e,function(f){e[f]=e[f].trim();0!=a(e[f]).length&&a(e[f]).each(function(e){var f=a(this).outerHeight();e=a(this).find(".ai-attributes");e.length&&e.each(function(){f>=a(this).outerHeight()&&(f-=a(this).outerHeight())});b++;if(0===f&&(a(document).ready(function(){ai_adb_active&&!d||ai_adb_detected(4)}),c++,!d))return!1})});0!=b&&0==c&&a(document).ready(function(){ai_adb_undetected(4)})}})});
|
18 |
-
jQuery(window).on("load",function(){setTimeout(function(){var a="undefined"!==typeof ai_debugging;jQuery("#ai-adb-
|
19 |
-
jQuery(
|
6 |
a(this).parent(),b=a(this).data("text");"undefined"==typeof b&&(b="");var c=a(this).data("css");"undefined"==typeof c&&(c="");var e=a(this).data("selectors");if("undefined"==typeof e||""==e)e="p";var f=!1;a(d).find(".AI_ADB_CONTENT_REPLACE_BEGIN_CLASS, "+e).each(function(){if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_BEGIN_CLASS"))a(this).remove(),f=!0;else if(a(this).hasClass("AI_ADB_CONTENT_REPLACE_END_CLASS"))a(this).remove(),f=!1;else if(f){if(0!=b.length){var d=Math.round(a(this).text().length/
|
7 |
(b.length+1));a(this).text(Array(d+1).join(b+" "))}else a(this).text("");d=a(this).attr("style");"undefined"==typeof d&&(d="");a(this).attr("style",d+";"+c)}})})})(jQuery)}ai_adb_detection_type_log=function(a){var d=ai_adb_detection_type(a),b=jQuery("#ai-adb-events");if(0!=b.count){var c=b.text();b.text((""!=c?c+", ":c+", EVENTS: ")+a)}return d};
|
8 |
ai_adb_detection_type=function(a){switch(a){case 0:return"0 debugging";case 1:return"1 ads create element";case 2:return"2 sponsors window var";case 3:return"3 banner element";case 4:return"4 custom selectors";case 5:return"5 ga";case 6:return"6 media.net";case 7:return"7 adsense";case 8:return"8 chitika";case 9:return"9 fun adblock 3";case 10:return"10 fun adblock 4";default:return a}};
|
9 |
+
var ai_adb_detected=function(a){setTimeout(function(){ai_adb_detected_actions(a)},2)},ai_adb_detected_actions=function(a){ai_adb_active||(ai_adb_active=!0,function(a){a(window).ready(function(){a(".ai-adb-hide").each(function(){a(this).css({display:"none",visibility:"hidden"});var b=a(this).closest("div[data-ai]");if("undefined"!=typeof b.data("ai")){var c=JSON.parse(b64d(b.data("ai")));"undefined"!==typeof c&&c.constructor===Array&&(c[1]="",b.data("ai",b64e(JSON.stringify(c))))}});a(".ai-adb-show").each(function(){a(this).css({display:"block",
|
10 |
+
visibility:"visible"});var b=a(this).data("ai-tracking");if("undefined"!=typeof b){var c=a(this).closest("div[data-ai]");if("undefined"!=typeof c.data("ai")){if(a(this).hasClass("ai-no-tracking")){var d=JSON.parse(b64d(c.data("ai")));"undefined"!==typeof d&&d.constructor===Array&&(d[1]="",b=b64e(JSON.stringify(d)))}c.data("ai",b)}}});setTimeout(ai_adb_process_content,10)});if(0!=ai_adb_page_views){var b=1,c=AiCookies.get(ai_adb_pgv_cookie_name);"undefined"!=typeof c&&(b=parseInt(c)+1);if(b<=ai_adb_page_views){AiCookies.set(ai_adb_pgv_cookie_name,
|
11 |
+
b,{expires:365,path:"/"});window.ai_d1=b;window.AI_ADB_STATUS_MESSAGE=1;return}}if(0==ai_adb_message_cookie_lifetime||1==ai_adb_action&&ai_adb_message_undismissible)AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});else{c=AiCookies.get(ai_adb_act_cookie_name);if("undefined"!=typeof c&&"AI_CONST_AI_ADB_COOKIE_VALUE"==c){window.AI_ADB_STATUS_MESSAGE=2;return}AiCookies.set(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}0==ai_adb_action?(ai_dummy=
|
12 |
+
16,ai_dummy++,window.AI_ADB_STATUS_MESSAGE=6):(window.AI_ADB_STATUS_MESSAGE=3,ai_dummy=13);switch(ai_adb_action){case 1:ai_adb_message_undismissible||(ai_adb_overlay.click(function(){a(this).remove();ai_adb_message_window.remove()}).css("cursor","pointer"),ai_adb_message_window.click(function(){a(this).remove();ai_adb_overlay.remove()}).css("cursor","pointer"),window.onkeydown=function(a){27===a.keyCode&&(ai_adb_overlay.click(),ai_adb_message_window.click())});a("body").prepend(ai_adb_overlay).prepend(ai_adb_message_window);
|
13 |
break;case 2:""!=ai_adb_redirection_url&&(b=!0,"http"==ai_adb_redirection_url.toLowerCase().substring(0,4)?window.location.href==ai_adb_redirection_url&&(b=!1):window.location.pathname==ai_adb_redirection_url&&(b=!1),b?(c=AiCookies.get(ai_adb_page_redirection_cookie_name),"undefined"==typeof c&&(b=new Date,b.setTime(b.getTime()+1E4),AiCookies.set(ai_adb_page_redirection_cookie_name,window.location.href,{expires:b,path:"/"}),window.location.replace(ai_adb_redirection_url))):AiCookies.remove(ai_adb_page_redirection_cookie_name,
|
14 |
+
{path:"/"}))}}(jQuery),ai_adb=!0)},ai_adb_undetected=function(a){ai_adb_counter++;ai_adb_active||4!=ai_adb_counter||(window.AI_ADB_STATUS_MESSAGE=4,ai_dummy=14)};AI_DBG_AI_DEBUG_AD_BLOCKING&&jQuery(document).ready(function(){ai_adb_detected(0)});
|
15 |
+
jQuery(document).ready(function(a){a(window).ready(function(){var d="undefined"!==typeof ai_debugging;setTimeout(function(){a("#ai-adb-bar").click(function(){AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});AiCookies.remove(ai_adb_pgv_cookie_name,{path:"/"});window.AI_ADB_STATUS_MESSAGE=5;ai_dummy=15})},2);jQuery("#banner-advert-container").length&&0<a("#banner-advert-container img").length&&(0===a("#banner-advert-container img").outerHeight()?(!ai_adb_active||d)&&ai_adb_detected(3):ai_adb_undetected(3),
|
|
|
16 |
a("#banner-advert-container img").remove());if((!ai_adb_active||d)&&""!=ai_adb_selectors){var b=0,c=0,e=ai_adb_selectors.split(",");a.each(e,function(f){e[f]=e[f].trim();0!=a(e[f]).length&&a(e[f]).each(function(e){var f=a(this).outerHeight();e=a(this).find(".ai-attributes");e.length&&e.each(function(){f>=a(this).outerHeight()&&(f-=a(this).outerHeight())});b++;if(0===f&&(a(document).ready(function(){ai_adb_active&&!d||ai_adb_detected(4)}),c++,!d))return!1})});0!=b&&0==c&&a(document).ready(function(){ai_adb_undetected(4)})}})});
|
17 |
+
jQuery(window).on("load",function(){setTimeout(function(){var a="undefined"!==typeof ai_debugging;jQuery(document).ready(function(){jQuery("#ai-adb-ads").length&&(document.getElementById("AI_CONST_AI_ADB_1_NAME")?ai_adb_undetected(1):ai_adb_active&&"undefined"===typeof ai_debugging||ai_adb_detected(1));jQuery("#ai-adb-sponsors").length&&("undefined"==typeof window.AI_CONST_AI_ADB_2_NAME?ai_adb_active&&"undefined"===typeof ai_debugging||ai_adb_detected(2):ai_adb_undetected(2));jQuery("#ai-adb-ga").length&&
|
18 |
+
("function"==typeof ga&&30<ga.toString().length||"function"==typeof __gaTracker&&30<__gaTracker.toString().length?ai_adb_undetected(5):ai_adb_active&&!a||ai_adb_detected(5));jQuery("#ai-adb-mn").length&&("object"==typeof _mNDetails&&400<JSON.stringify(_mNDetails).length?ai_adb_undetected(6):ai_adb_active&&!a||ai_adb_detected(6))})},100)});
|
includes/js/ai-ads.js
CHANGED
@@ -2,7 +2,9 @@ var adsense_ad_names = [];
|
|
2 |
var ai_preview_window = typeof ai_preview !== 'undefined';
|
3 |
|
4 |
function ai_process_adsense_ad (element) {
|
5 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
|
|
6 |
var adsense_iframe = jQuery(element);
|
7 |
var adsense_width = adsense_iframe.attr ('width');
|
8 |
var adsense_height = adsense_iframe.attr ('height');
|
@@ -54,7 +56,9 @@ function ai_process_adsense_ads () {
|
|
54 |
}
|
55 |
|
56 |
jQuery(document).ready(function($) {
|
57 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
|
|
58 |
var ajaxurl = 'AI_AJAXURL';
|
59 |
var nonce = 'AI_NONCE';
|
60 |
var adsense_data = {'ai': 1}; // dummy
|
2 |
var ai_preview_window = typeof ai_preview !== 'undefined';
|
3 |
|
4 |
function ai_process_adsense_ad (element) {
|
5 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
6 |
+
// var ai_debug = false;
|
7 |
+
|
8 |
var adsense_iframe = jQuery(element);
|
9 |
var adsense_width = adsense_iframe.attr ('width');
|
10 |
var adsense_height = adsense_iframe.attr ('height');
|
56 |
}
|
57 |
|
58 |
jQuery(document).ready(function($) {
|
59 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
60 |
+
// var ai_debug = false;
|
61 |
+
|
62 |
var ajaxurl = 'AI_AJAXURL';
|
63 |
var nonce = 'AI_NONCE';
|
64 |
var adsense_data = {'ai': 1}; // dummy
|
includes/js/ai-ads.min.js
CHANGED
@@ -1,9 +1,5 @@
|
|
1 |
-
var adsense_ad_names=[]
|
2 |
-
function ai_process_adsense_ad(
|
3 |
-
"")
|
4 |
-
|
5 |
-
|
6 |
-
jQuery(document).ready(function($){var ai_debug=typeof ai_debugging!=="undefined";var ajaxurl="AI_AJAXURL";var nonce="AI_NONCE";var adsense_data={"ai":1};$.post(ajaxurl,{"action":"ai_ajax","ai_check":nonce,"adsense-ad-units":adsense_data}).done(function(data){if(data!="")try{adsense_ad_names=JSON.parse(data);if(ai_debug)console.log("");if(ai_debug)console.log("AI ADSENSE DATA:",Object.keys(adsense_ad_names).length-1,"ad units")}catch(error){if(ai_debug)console.log("AI ADSENSE DATA ERROR:",data)}}).fail(function(xhr,
|
7 |
-
status,error){if(ai_debug)console.log("AI ADSENSE DATA ERROR:",xhr.status,xhr.statusText)}).always(function(data){if(ai_debug)console.log("AI ADSENSE DATA","END")});$(window).on("load",function(){if(!ai_preview_window)setTimeout(function(){ai_process_adsense_ads(jQuery)},50)})});
|
8 |
-
function getAllUrlParams(url){var queryString=url?url.split("?")[1]:window.location.search.slice(1);var obj={};if(queryString){queryString=queryString.split("#")[0];var arr=queryString.split("&");for(var i=0;i<arr.length;i++){var a=arr[i].split("=");var paramNum=undefined;var paramName=a[0].replace(/\[\d*\]/,function(v){paramNum=v.slice(1,-1);return""});var paramValue=typeof a[1]==="undefined"?"":a[1];paramName=paramName.toLowerCase();paramValue=paramValue.toLowerCase();if(obj[paramName]){if(typeof obj[paramName]===
|
9 |
-
"string")obj[paramName]=[obj[paramName]];if(typeof paramNum==="undefined")obj[paramName].push(paramValue);else obj[paramName][paramNum]=paramValue}else obj[paramName]=paramValue}}return obj};
|
1 |
+
var adsense_ad_names=[],ai_preview_window="undefined"!==typeof ai_preview;
|
2 |
+
function ai_process_adsense_ad(a){a=jQuery(a);var e=a.attr("width"),f=a.attr("height"),b=a.contents().find("iframe[allowtransparency]"),d=getAllUrlParams(b.attr("src"));if("undefined"!==typeof d.client){b=d.client.replace("ca-","");var c=d.slotname,h=d.ifi;d=jQuery('<div class="ai-debug-ad-overlay"></div>');var g="";"undefined"!==typeof c?(g="","undefined"!==typeof adsense_ad_names.publisher_id&&adsense_ad_names.publisher_id==b&&"undefined"!==typeof adsense_ad_names[c]&&(g='<div class="ai-info ai-info-2">'+
|
3 |
+
adsense_ad_names[c]+"</div>"),g='<div class="ai-info ai-info-1">'+c+"</div>"+g):0!=a.closest("div.google-auto-placed").length?(d.addClass("ai-auto-ads"),g='<div class="ai-info ai-info-1">Auto ads</div>'):d.addClass("ai-no-slot");e=jQuery('<div class="ai-debug-ad-info"><div class="ai-info ai-info-1">AdSense #'+h+'</div><div class="ai-info ai-info-2">'+e+"x"+f+"</div>"+g+"</div>");a.after(e);ai_preview_window||a.after(d)}}
|
4 |
+
function ai_process_adsense_ads(){jQuery("ins ins iframe").each(function(){jQuery(this).closest(".ai-dummy-ad").length||ai_process_adsense_ad(this)})}jQuery(document).ready(function(a){a.post("AI_AJAXURL",{action:"ai_ajax",ai_check:"AI_NONCE","adsense-ad-units":{ai:1}}).done(function(a){if(""!=a)try{adsense_ad_names=JSON.parse(a)}catch(f){}}).fail(function(a,f,b){}).always(function(a){});a(window).on("load",function(){ai_preview_window||setTimeout(function(){ai_process_adsense_ads(jQuery)},50)})});
|
5 |
+
function getAllUrlParams(a){var e=a?a.split("?")[1]:window.location.search.slice(1);a={};if(e){e=e.split("#")[0];e=e.split("&");for(var f=0;f<e.length;f++){var b=e[f].split("="),d=void 0,c=b[0].replace(/\[\d*\]/,function(a){d=a.slice(1,-1);return""});b="undefined"===typeof b[1]?"":b[1];c=c.toLowerCase();b=b.toLowerCase();a[c]?("string"===typeof a[c]&&(a[c]=[a[c]]),"undefined"===typeof d?a[c].push(b):a[c][d]=b):a[c]=b}}return a};
|
|
|
|
|
|
|
|
includes/js/ai-cookie.js
CHANGED
@@ -167,7 +167,7 @@
|
|
167 |
AiCookies = Cookies.noConflict();
|
168 |
|
169 |
|
170 |
-
function
|
171 |
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
172 |
// var ai_debug = false;
|
173 |
|
@@ -500,7 +500,7 @@ function ai_set_cookie (block, property, value) {
|
|
500 |
return ai_cookie;
|
501 |
}
|
502 |
|
503 |
-
function
|
504 |
var ai_cookie_name = 'aiBLOCKS';
|
505 |
var ai_cookie = AiCookies.getJSON (ai_cookie_name);
|
506 |
|
167 |
AiCookies = Cookies.noConflict();
|
168 |
|
169 |
|
170 |
+
ai_check_block = function (block) {
|
171 |
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
172 |
// var ai_debug = false;
|
173 |
|
500 |
return ai_cookie;
|
501 |
}
|
502 |
|
503 |
+
ai_get_cookie_text = function (block) {
|
504 |
var ai_cookie_name = 'aiBLOCKS';
|
505 |
var ai_cookie = AiCookies.getJSON (ai_cookie_name);
|
506 |
|
includes/js/ai-cookie.min.js
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
new Date+864E5*e.expires));e.expires=e.expires?e.expires.toUTCString():"";try{var g=JSON.stringify(c);/^[\{\[]/.test(g)&&(c=g)}catch(n){}c=f.write?f.write(c,b):encodeURIComponent(String(c)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);b=encodeURIComponent(String(b)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);g="";for(var k in e)e[k]&&(g+="; "+k,!0!==e[k]&&(g+="="+e[k].split(";")[0]));return document.cookie=b+"="+c+g}}
|
3 |
function c(a,b){if("undefined"!==typeof document){for(var c={},d=document.cookie?document.cookie.split("; "):[],e=0;e<d.length;e++){var g=d[e].split("="),h=g.slice(1).join("=");b||'"'!==h.charAt(0)||(h=h.slice(1,-1));try{var l=g[0].replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);h=(f.read||f)(h,l)||h.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);if(b)try{h=JSON.parse(h)}catch(m){}c[l]=h;if(a===l)break}catch(m){}}return a?c[a]:c}}d.set=e;d.get=function(a){return c(a,!1)};d.getJSON=function(a){return c(a,
|
4 |
!0)};d.remove=function(b,c){e(b,"",a(c,{expires:-1}))};d.defaults={};d.withConverter=b;return d}return b(function(){})});AiCookies=Cookies.noConflict();
|
5 |
-
function
|
6 |
a="closed for "+c+" s = "+Math.round(1E4*c/3600/24)/1E4+" days",!1;ai_set_cookie(a,"x","");b[a].hasOwnProperty("i")||b[a].hasOwnProperty("c")||ai_set_cookie(a,"h","")}else if("d"==f){if(0!=b[a][f])return ai_debug_cookie_status=a="delayed for "+b[a][f]+" pageviews",!1}else if("i"==f){d=document.querySelectorAll('span[data-ai-block="'+a+'"]')[0].dataset.aiHash;e="";b[a].hasOwnProperty("h")&&(e=b[a].h);if(0==b[a][f]&&e==d)return ai_debug_cookie_status=a="max impressions reached",!1;if(0>b[a][f]&&e==
|
7 |
d){c=new Date;c=-b[a][f]-Math.round(c.getTime()/1E3);if(0<c)return ai_debug_cookie_status=a="max imp. reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;ai_set_cookie(a,"i","");b[a].hasOwnProperty("c")||b[a].hasOwnProperty("x")||ai_set_cookie(a,"h","")}}if("ipt"==f&&0==b[a][f]&&(c=new Date,d=Math.round(c.getTime()/1E3),c=b[a].it-d,0<c))return ai_debug_cookie_status=a="max imp. per time reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;if("c"==f){d=document.querySelectorAll('span[data-ai-block="'+
|
8 |
a+'"]')[0].dataset.aiHash;e="";b[a].hasOwnProperty("h")&&(e=b[a].h);if(0==b[a][f]&&e==d)return ai_debug_cookie_status=a="max clicks reached",!1;if(0>b[a][f]&&e==d){c=new Date;c=-b[a][f]-Math.round(c.getTime()/1E3);if(0<c)return ai_debug_cookie_status=a="max clicks reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;ai_set_cookie(a,"c","");b[a].hasOwnProperty("i")||b[a].hasOwnProperty("x")||ai_set_cookie(a,"h","")}}if("cpt"==f&&0==b[a][f]&&(c=new Date,d=Math.round(c.getTime()/1E3),c=b[a].ct-
|
9 |
-
d,0<c))return ai_debug_cookie_status=a="max clicks per time reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1}ai_debug_cookie_status="OK";return!0}function ai_load_cookie(){var a=AiCookies.getJSON("aiBLOCKS");null==a&&(a={});return a}function ai_get_cookie(a,b){var f="",d=ai_load_cookie();d.hasOwnProperty(a)&&d[a].hasOwnProperty(b)&&(f=d[a][b]);return f}
|
10 |
function ai_set_cookie(a,b,f){var d=ai_load_cookie();if(""===f){if(d.hasOwnProperty(a)){delete d[a][b];a:{b=d[a];for(e in b)if(b.hasOwnProperty(e)){var e=!1;break a}e=!0}e&&delete d[a]}}else d.hasOwnProperty(a)||(d[a]={}),d[a][b]=f;0===Object.keys(d).length&&d.constructor===Object?AiCookies.remove("aiBLOCKS"):AiCookies.set("aiBLOCKS",d,{expires:365,path:"/"});return d}
|
11 |
-
function
|
2 |
new Date+864E5*e.expires));e.expires=e.expires?e.expires.toUTCString():"";try{var g=JSON.stringify(c);/^[\{\[]/.test(g)&&(c=g)}catch(n){}c=f.write?f.write(c,b):encodeURIComponent(String(c)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);b=encodeURIComponent(String(b)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);g="";for(var k in e)e[k]&&(g+="; "+k,!0!==e[k]&&(g+="="+e[k].split(";")[0]));return document.cookie=b+"="+c+g}}
|
3 |
function c(a,b){if("undefined"!==typeof document){for(var c={},d=document.cookie?document.cookie.split("; "):[],e=0;e<d.length;e++){var g=d[e].split("="),h=g.slice(1).join("=");b||'"'!==h.charAt(0)||(h=h.slice(1,-1));try{var l=g[0].replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);h=(f.read||f)(h,l)||h.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);if(b)try{h=JSON.parse(h)}catch(m){}c[l]=h;if(a===l)break}catch(m){}}return a?c[a]:c}}d.set=e;d.get=function(a){return c(a,!1)};d.getJSON=function(a){return c(a,
|
4 |
!0)};d.remove=function(b,c){e(b,"",a(c,{expires:-1}))};d.defaults={};d.withConverter=b;return d}return b(function(){})});AiCookies=Cookies.noConflict();
|
5 |
+
ai_check_block=function(a){var b=AiCookies.getJSON("aiBLOCKS");ai_debug_cookie_status="";null==b&&(b={});"undefined"!==typeof ai_delay_showing_pageviews&&(b.hasOwnProperty(a)||(b[a]={}),b[a].hasOwnProperty("d")||(b[a].d=ai_delay_showing_pageviews));if(b.hasOwnProperty(a))for(var f in b[a]){if("x"==f){var d=document.querySelectorAll('span[data-ai-block="'+a+'"]')[0].dataset.aiHash,e="";b[a].hasOwnProperty("h")&&(e=b[a].h);var c=new Date;c=b[a][f]-Math.round(c.getTime()/1E3);if(0<c&&e==d)return ai_debug_cookie_status=
|
6 |
a="closed for "+c+" s = "+Math.round(1E4*c/3600/24)/1E4+" days",!1;ai_set_cookie(a,"x","");b[a].hasOwnProperty("i")||b[a].hasOwnProperty("c")||ai_set_cookie(a,"h","")}else if("d"==f){if(0!=b[a][f])return ai_debug_cookie_status=a="delayed for "+b[a][f]+" pageviews",!1}else if("i"==f){d=document.querySelectorAll('span[data-ai-block="'+a+'"]')[0].dataset.aiHash;e="";b[a].hasOwnProperty("h")&&(e=b[a].h);if(0==b[a][f]&&e==d)return ai_debug_cookie_status=a="max impressions reached",!1;if(0>b[a][f]&&e==
|
7 |
d){c=new Date;c=-b[a][f]-Math.round(c.getTime()/1E3);if(0<c)return ai_debug_cookie_status=a="max imp. reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;ai_set_cookie(a,"i","");b[a].hasOwnProperty("c")||b[a].hasOwnProperty("x")||ai_set_cookie(a,"h","")}}if("ipt"==f&&0==b[a][f]&&(c=new Date,d=Math.round(c.getTime()/1E3),c=b[a].it-d,0<c))return ai_debug_cookie_status=a="max imp. per time reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;if("c"==f){d=document.querySelectorAll('span[data-ai-block="'+
|
8 |
a+'"]')[0].dataset.aiHash;e="";b[a].hasOwnProperty("h")&&(e=b[a].h);if(0==b[a][f]&&e==d)return ai_debug_cookie_status=a="max clicks reached",!1;if(0>b[a][f]&&e==d){c=new Date;c=-b[a][f]-Math.round(c.getTime()/1E3);if(0<c)return ai_debug_cookie_status=a="max clicks reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1;ai_set_cookie(a,"c","");b[a].hasOwnProperty("i")||b[a].hasOwnProperty("x")||ai_set_cookie(a,"h","")}}if("cpt"==f&&0==b[a][f]&&(c=new Date,d=Math.round(c.getTime()/1E3),c=b[a].ct-
|
9 |
+
d,0<c))return ai_debug_cookie_status=a="max clicks per time reached ("+Math.round(1E4*c/24/3600)/1E4+" days = "+c+" s)",!1}ai_debug_cookie_status="OK";return!0};function ai_load_cookie(){var a=AiCookies.getJSON("aiBLOCKS");null==a&&(a={});return a}function ai_get_cookie(a,b){var f="",d=ai_load_cookie();d.hasOwnProperty(a)&&d[a].hasOwnProperty(b)&&(f=d[a][b]);return f}
|
10 |
function ai_set_cookie(a,b,f){var d=ai_load_cookie();if(""===f){if(d.hasOwnProperty(a)){delete d[a][b];a:{b=d[a];for(e in b)if(b.hasOwnProperty(e)){var e=!1;break a}e=!0}e&&delete d[a]}}else d.hasOwnProperty(a)||(d[a]={}),d[a][b]=f;0===Object.keys(d).length&&d.constructor===Object?AiCookies.remove("aiBLOCKS"):AiCookies.set("aiBLOCKS",d,{expires:365,path:"/"});return d}
|
11 |
+
ai_get_cookie_text=function(a){var b=AiCookies.getJSON("aiBLOCKS");null==b&&(b={});return b.hasOwnProperty(a)?JSON.stringify(b[a]).replace(/"/g,"").replace("{","").replace("}",""):""};
|
includes/js/ai-insert.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
function
|
2 |
if (selector.indexOf (':eq') != - 1) {
|
3 |
var elements = jQuery (selector);
|
4 |
} else var elements = document.querySelectorAll (selector);
|
@@ -48,7 +48,9 @@ function ai_insert (insertion, selector, insertion_code) {
|
|
48 |
insertion_name = ai_front.insertion_replace_element;
|
49 |
}
|
50 |
|
51 |
-
|
|
|
|
|
52 |
}
|
53 |
|
54 |
var range = document.createRange ();
|
@@ -76,7 +78,7 @@ function ai_insert (insertion, selector, insertion_code) {
|
|
76 |
});
|
77 |
}
|
78 |
|
79 |
-
function
|
80 |
|
81 |
function hasClass (element, cls) {
|
82 |
if (element == null) return false;
|
@@ -99,6 +101,8 @@ function ai_insert_code (element) {
|
|
99 |
element.className = element.className.replace (new RegExp ('(^|\\b)' + cls.split (' ').join ('|') + '(\\b|$)', 'gi'), ' ');
|
100 |
}
|
101 |
|
|
|
|
|
102 |
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
103 |
// var ai_debug = false;
|
104 |
|
@@ -173,5 +177,5 @@ function b64d (str) {
|
|
173 |
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
174 |
}).join (''));
|
175 |
}
|
176 |
-
|
177 |
|
1 |
+
ai_insert = function (insertion, selector, insertion_code) {
|
2 |
if (selector.indexOf (':eq') != - 1) {
|
3 |
var elements = jQuery (selector);
|
4 |
} else var elements = document.querySelectorAll (selector);
|
48 |
insertion_name = ai_front.insertion_replace_element;
|
49 |
}
|
50 |
|
51 |
+
if (selector_string.indexOf ('.ai-viewports') == - 1) {
|
52 |
+
ai_debug_name_ai_main.innerText = insertion_name + ' ' + selector + ' (' + element.tagName.toLowerCase() + selector_string + ')';
|
53 |
+
}
|
54 |
}
|
55 |
|
56 |
var range = document.createRange ();
|
78 |
});
|
79 |
}
|
80 |
|
81 |
+
ai_insert_code = function (element) {
|
82 |
|
83 |
function hasClass (element, cls) {
|
84 |
if (element == null) return false;
|
101 |
element.className = element.className.replace (new RegExp ('(^|\\b)' + cls.split (' ').join ('|') + '(\\b|$)', 'gi'), ' ');
|
102 |
}
|
103 |
|
104 |
+
if (typeof element == 'undefined') return;
|
105 |
+
|
106 |
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
107 |
// var ai_debug = false;
|
108 |
|
177 |
return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2);
|
178 |
}).join (''));
|
179 |
}
|
180 |
+
|
181 |
|
includes/js/ai-insert.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
function
|
2 |
-
a?g=ai_front.insertion_before:"after"==a?g=ai_front.insertion_after:"prepend"==a?g=ai_front.insertion_prepend:"append"==a?g=ai_front.insertion_append:"replace-content"==a?g=ai_front.insertion_replace_content:"replace-element"==a&&(g=ai_front.insertion_replace_element)
|
3 |
-
a?b.insertBefore(c,b.firstChild):"append"==a?b.insertBefore(c,null):"replace-content"==a?b.innerHTML=d.innerHTML:"replace-element"==a&&(b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b))})}
|
4 |
-
function
|
5 |
if(b){b=a.getAttribute("data-code");var k=a.getAttribute("data-insertion"),d=a.getAttribute("data-selector");null!=b&&(null!=k&&null!=d?document.querySelectorAll(d).length&&(ai_insert(k,d,b64d(b)),f(a,"ai-viewports")):(b=document.createRange().createContextualFragment(b64d(b)),a.parentNode.insertBefore(b,a.nextSibling),f(a,"ai-viewports")));a=a.getElementsByClassName("ai-check-block");"undefined"!=typeof a[0]&&a[0].parentNode.removeChild(a[0])}else b=a.previousElementSibling,e(b,"ai-debug-bar")&&
|
6 |
-
e(b,"ai-debug-script")&&(f(b,"ai-debug-script"),h(b,"ai-debug-viewport-invisible")),f(a,"ai-viewports")}function b64e(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,h){return String.fromCharCode("0x"+h)}))}function b64d(a){return decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""))};
|
1 |
+
ai_insert=function(a,e,h){var f=-1!=e.indexOf(":eq")?jQuery(e):document.querySelectorAll(e);Array.prototype.forEach.call(f,function(b,f){selector_string=b.hasAttribute("id")?"#"+b.getAttribute("id"):b.hasAttribute("class")?"."+b.getAttribute("class").replace(RegExp(" ","g"),"."):"";var d=document.createElement("div");d.innerHTML=h;var c=d.getElementsByClassName("ai-selector-counter")[0];null!=c&&(c.innerText=f+1);c=d.getElementsByClassName("ai-debug-name ai-main")[0];if(null!=c){var g="";"before"==
|
2 |
+
a?g=ai_front.insertion_before:"after"==a?g=ai_front.insertion_after:"prepend"==a?g=ai_front.insertion_prepend:"append"==a?g=ai_front.insertion_append:"replace-content"==a?g=ai_front.insertion_replace_content:"replace-element"==a&&(g=ai_front.insertion_replace_element);-1==selector_string.indexOf(".ai-viewports")&&(c.innerText=g+" "+e+" ("+b.tagName.toLowerCase()+selector_string+")")}c=document.createRange().createContextualFragment(d.innerHTML);"before"==a?b.parentNode.insertBefore(c,b):"after"==
|
3 |
+
a?b.parentNode.insertBefore(c,b.nextSibling):"prepend"==a?b.insertBefore(c,b.firstChild):"append"==a?b.insertBefore(c,null):"replace-content"==a?b.innerHTML=d.innerHTML:"replace-element"==a&&(b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b))})};
|
4 |
+
ai_insert_code=function(a){function e(a,b){return null==a?!1:a.classList?a.classList.contains(b):-1<(" "+a.className+" ").indexOf(" "+b+" ")}function h(a,b){null!=a&&(a.classList?a.classList.add(b):a.className+=" "+b)}function f(a,b){null!=a&&(a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," "))}if("undefined"!=typeof a){var b=e(a,"no-visibility-check")?!0:!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length);a.getAttribute("data-block");
|
5 |
if(b){b=a.getAttribute("data-code");var k=a.getAttribute("data-insertion"),d=a.getAttribute("data-selector");null!=b&&(null!=k&&null!=d?document.querySelectorAll(d).length&&(ai_insert(k,d,b64d(b)),f(a,"ai-viewports")):(b=document.createRange().createContextualFragment(b64d(b)),a.parentNode.insertBefore(b,a.nextSibling),f(a,"ai-viewports")));a=a.getElementsByClassName("ai-check-block");"undefined"!=typeof a[0]&&a[0].parentNode.removeChild(a[0])}else b=a.previousElementSibling,e(b,"ai-debug-bar")&&
|
6 |
+
e(b,"ai-debug-script")&&(f(b,"ai-debug-script"),h(b,"ai-debug-viewport-invisible")),f(a,"ai-viewports")}};function b64e(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,h){return String.fromCharCode("0x"+h)}))}function b64d(a){return decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""))};
|
includes/js/ai-lists.js
CHANGED
@@ -17,10 +17,14 @@ jQuery (function ($) {
|
|
17 |
}).join (''));
|
18 |
}
|
19 |
|
|
|
|
|
|
|
20 |
function getHostName (url) {
|
21 |
-
var match = url.match (/:\/\/(.[^/:]+)/i);
|
|
|
22 |
if (match != null && match.length > 1 && typeof match [1] === 'string' && match [1].length > 0) {
|
23 |
-
return match [1];
|
24 |
} else {
|
25 |
return null;
|
26 |
}
|
@@ -32,7 +36,7 @@ jQuery (function ($) {
|
|
32 |
}
|
33 |
if (ai_list_blocks.length) {
|
34 |
|
35 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
36 |
// var ai_debug = false;
|
37 |
|
38 |
var cookies = document.cookie.split (";");
|
@@ -198,8 +202,8 @@ jQuery (function ($) {
|
|
198 |
}
|
199 |
}
|
200 |
|
201 |
-
$(this).css ({"visibility": "", "position": "", "width": "", "height": "", "z-index": ""}).removeClass ('ai-list-data');
|
202 |
-
|
203 |
block_wrapping_div.removeClass ('ai-list-block');
|
204 |
block_wrapping_div.find ('.ai-debug-name.ai-list-info').text (referrer);
|
205 |
block_wrapping_div.find ('.ai-debug-name.ai-user-agent').text (window.navigator.userAgent);
|
17 |
}).join (''));
|
18 |
}
|
19 |
|
20 |
+
// To prevent replacement of regexp pattern with CDN url (CDN code bug)
|
21 |
+
var host_regexp = new RegExp (':' + '\\/' + '\\/(.[^/:]+)', 'i');
|
22 |
+
|
23 |
function getHostName (url) {
|
24 |
+
// var match = url.match (/:\/\/(.[^/:]+)/i);
|
25 |
+
var match = url.match (host_regexp);
|
26 |
if (match != null && match.length > 1 && typeof match [1] === 'string' && match [1].length > 0) {
|
27 |
+
return match [1].toLowerCase();
|
28 |
} else {
|
29 |
return null;
|
30 |
}
|
36 |
}
|
37 |
if (ai_list_blocks.length) {
|
38 |
|
39 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
40 |
// var ai_debug = false;
|
41 |
|
42 |
var cookies = document.cookie.split (";");
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
// $(this).css ({"visibility": "", "position": "", "width": "", "height": "", "z-index": ""}).removeClass ('ai-list-data');
|
206 |
+
$(this).removeClass ('ai-list-data');
|
207 |
block_wrapping_div.removeClass ('ai-list-block');
|
208 |
block_wrapping_div.find ('.ai-debug-name.ai-list-info').text (referrer);
|
209 |
block_wrapping_div.find ('.ai-debug-name.ai-user-agent').text (window.navigator.userAgent);
|
includes/js/ai-lists.min.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
-
jQuery(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
"
|
6 |
-
|
7 |
-
c&&console.log("AI INSERT CODE",a(e).attr("class")),c&&console.log(""))):(a(this).hide(),e.removeAttr("data-ai"),e.find(".ai-debug-block")?(e.css({visibility:""}).removeClass("ai-close"),e.hasClass("ai-remove-position")&&e.css({position:""})):e.hide())})}};a(document).ready(function(a){setTimeout(function(){ai_process_lists()},5)})});
|
8 |
-
function getAllUrlParams(a){var f=a?a.split("?")[1]:window.location.search.slice(1);a={};if(f){f=f.split("#")[0];f=f.split("&");for(var h=0;h<f.length;h++){var b=f[h].split("="),c=void 0,g=b[0].replace(/\[\d*\]/,function(a){c=a.slice(1,-1);return""});b="undefined"===typeof b[1]?"":b[1];g=g.toLowerCase();b=b.toLowerCase();a[g]?("string"===typeof a[g]&&(a[g]=[a[g]]),"undefined"===typeof c?a[g].push(b):a[g][c]=b):a[g]=b}}return a};
|
1 |
+
jQuery(function(b){function f(b){return decodeURIComponent(atob(b).split("").map(function(b){return"%"+("00"+b.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function l(b){b=b.match(a);return null!=b&&1<b.length&&"string"===typeof b[1]&&0<b[1].length?b[1].toLowerCase():null}var a=/:\/\/(.[^/:]+)/i;ai_process_lists=function(a){null==a&&(a=b("div.ai-list-data"));if(a.length){var d=document.cookie.split(";");d.forEach(function(b,a){d[a]=b.trim()});var g=getAllUrlParams(window.location.search);if(null!=
|
2 |
+
g.referrer)var h=g.referrer;else h=document.referrer,""!=h&&(h=l(h));if("undefined"!==typeof MobileDetect)var m=new MobileDetect(window.navigator.userAgent);a.each(function(){var a=b(this).closest("div.ai-list-block"),k=!0,c=!1,e=b(this).attr("referer-list");if("undefined"!=typeof e){e=f(e).split(",");var g=b(this).attr("referer-list-type");b.each(e,function(b,a){if(""==a)return!0;if("*"==a.charAt(0))if("*"==a.charAt(a.length-1)){if(a=a.substr(1,a.length-2),-1!=h.indexOf(a))return c=!0,!1}else{if(a=
|
3 |
+
a.substr(1),h.substr(-a.length)==a)return c=!0,!1}else if("*"==a.charAt(a.length-1)){if(a=a.substr(0,a.length-1),0==h.indexOf(a))return c=!0,!1}else if("#"==a){if(""==h)return c=!0,!1}else if(a==h)return c=!0,!1});switch(g){case "B":c&&(k=!1);break;case "W":c||(k=!1)}}e=b(this).attr("client-list");if("undefined"!=typeof e&&"undefined"!==typeof m)switch(e=f(e).split(","),g=b(this).attr("client-list-type"),b.each(e,function(a,b){if(""==b)return!0;if(m.is(b))return c=!0,!1}),g){case "B":c&&(k=!1);break;
|
4 |
+
case "W":c||(k=!1)}if(k&&(e=b(this).attr("parameter-list"),"undefined"!=typeof e))switch(e=f(e).split(","),g=b(this).attr("parameter-list-type"),c=!1,b.each(e,function(a,b){if(-1!=b.indexOf("=")){if(-1!=d.indexOf(b))return c=!0,!1}else d.forEach(function(a){a=a.split("=");if(b==a[0])return c=!0,!1})}),g){case "B":c&&(k=!1);break;case "W":c||(k=!1)}b(this).removeClass("ai-list-data");a.removeClass("ai-list-block");a.find(".ai-debug-name.ai-list-info").text(h);a.find(".ai-debug-name.ai-user-agent").text(window.navigator.userAgent);
|
5 |
+
a.find(".ai-debug-name.ai-list-status").text(k?ai_front.visible:ai_front.hidden);k?(a.css({visibility:""}),a.hasClass("ai-remove-position")&&a.css({position:""}),"undefined"!=typeof b(this).data("code")&&(a=f(b(this).data("code")),b(this).append(a),b(this).attr("data-code",""))):(b(this).hide(),a.removeAttr("data-ai"),a.find(".ai-debug-block")?(a.css({visibility:""}).removeClass("ai-close"),a.hasClass("ai-remove-position")&&a.css({position:""})):a.hide())})}};b(document).ready(function(a){setTimeout(function(){ai_process_lists()},
|
6 |
+
5)})});function getAllUrlParams(b){var f=b?b.split("?")[1]:window.location.search.slice(1);b={};if(f){f=f.split("#")[0];f=f.split("&");for(var l=0;l<f.length;l++){var a=f[l].split("="),g=void 0,d=a[0].replace(/\[\d*\]/,function(a){g=a.slice(1,-1);return""});a="undefined"===typeof a[1]?"":a[1];d=d.toLowerCase();a=a.toLowerCase();b[d]?("string"===typeof b[d]&&(b[d]=[b[d]]),"undefined"===typeof g?b[d].push(a):b[d][g]=a):b[d]=a}}return b};
|
|
|
|
includes/js/ai-rotate.js
CHANGED
@@ -17,11 +17,20 @@ jQuery (function ($) {
|
|
17 |
}).join (''));
|
18 |
}
|
19 |
|
|
|
|
|
20 |
ai_process_rotation = function (rotation_block) {
|
21 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
22 |
|
23 |
if (ai_debug) console.log ('');
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
if (typeof rotation_block.length == 'number') {
|
26 |
if (ai_debug) console.log ('AI ROTATE process rotation:', rotation_block.length, 'rotation blocks');
|
27 |
for (var index = 0; index < rotation_block.length; index ++) {
|
@@ -37,7 +46,9 @@ jQuery (function ($) {
|
|
37 |
}
|
38 |
|
39 |
ai_process_single_rotation = function (rotation_block, trigger_rotation) {
|
40 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
|
|
41 |
var rotate_options = $(".ai-rotate-option", rotation_block);
|
42 |
|
43 |
if (rotate_options.length == 0) return;
|
@@ -184,8 +195,19 @@ jQuery (function ($) {
|
|
184 |
var rotation_id = block_info [0];
|
185 |
|
186 |
$(rotation_block).attr ('data-next', next_random_index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
if (trigger_rotation) {
|
188 |
-
|
|
|
|
|
|
|
|
|
189 |
// setTimeout (function() {ai_process_rotation ($(rotation_block));}, rotation_time * 1000);
|
190 |
}
|
191 |
option_time_text = ' (' + rotation_time + ' s)';
|
@@ -290,6 +312,18 @@ jQuery (function ($) {
|
|
290 |
function ai_process_rotations () {
|
291 |
$("div.ai-rotate").each (function (index, element) {
|
292 |
ai_process_rotation (this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
});
|
294 |
}
|
295 |
|
@@ -302,6 +336,18 @@ jQuery (function ($) {
|
|
302 |
ai_process_rotations_in_element = function (el) {
|
303 |
$("div.ai-rotate", el).each (function (index, element) {
|
304 |
ai_process_rotation (this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
});
|
306 |
}
|
307 |
|
17 |
}).join (''));
|
18 |
}
|
19 |
|
20 |
+
var ai_rotation_triggers = new Array ();
|
21 |
+
|
22 |
ai_process_rotation = function (rotation_block) {
|
23 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
24 |
+
// var ai_debug = false;
|
25 |
|
26 |
if (ai_debug) console.log ('');
|
27 |
|
28 |
+
if (ai_rotation_triggers.includes (rotation_block.selector)) {
|
29 |
+
ai_rotation_triggers.splice (ai_rotation_triggers.indexOf (rotation_block.selector), 1 );
|
30 |
+
|
31 |
+
if (ai_debug) console.log ('AI TIMED ROTATE TRIGGERS', ai_rotation_triggers);
|
32 |
+
}
|
33 |
+
|
34 |
if (typeof rotation_block.length == 'number') {
|
35 |
if (ai_debug) console.log ('AI ROTATE process rotation:', rotation_block.length, 'rotation blocks');
|
36 |
for (var index = 0; index < rotation_block.length; index ++) {
|
46 |
}
|
47 |
|
48 |
ai_process_single_rotation = function (rotation_block, trigger_rotation) {
|
49 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
50 |
+
// var ai_debug = false;
|
51 |
+
|
52 |
var rotate_options = $(".ai-rotate-option", rotation_block);
|
53 |
|
54 |
if (rotate_options.length == 0) return;
|
195 |
var rotation_id = block_info [0];
|
196 |
|
197 |
$(rotation_block).attr ('data-next', next_random_index);
|
198 |
+
|
199 |
+
var rotaion_selector = "div.ai-rotate.ai-" + rotation_id;
|
200 |
+
|
201 |
+
if (ai_rotation_triggers.includes (rotaion_selector)) {
|
202 |
+
var trigger_rotation = false;
|
203 |
+
}
|
204 |
+
|
205 |
if (trigger_rotation) {
|
206 |
+
ai_rotation_triggers.push (rotaion_selector);
|
207 |
+
|
208 |
+
if (ai_debug) console.log ('AI TIMED ROTATE TRIGGERS', ai_rotation_triggers);
|
209 |
+
|
210 |
+
setTimeout (function() {ai_process_rotation ($(rotaion_selector));}, rotation_time * 1000);
|
211 |
// setTimeout (function() {ai_process_rotation ($(rotation_block));}, rotation_time * 1000);
|
212 |
}
|
213 |
option_time_text = ' (' + rotation_time + ' s)';
|
312 |
function ai_process_rotations () {
|
313 |
$("div.ai-rotate").each (function (index, element) {
|
314 |
ai_process_rotation (this);
|
315 |
+
// if (typeof $(this).data ('info') != 'undefined') {
|
316 |
+
// var block_info = JSON.parse (atob ($(this).data ('info')));
|
317 |
+
// var rotation_id = block_info [0];
|
318 |
+
|
319 |
+
// if (!ai_rotation_triggers.includes (rotation_id)) {
|
320 |
+
// ai_rotation_triggers.push (rotation_id);
|
321 |
+
|
322 |
+
// console.log ('ai_rotation_triggers', ai_rotation_triggers);
|
323 |
+
|
324 |
+
// ai_process_rotation (this);
|
325 |
+
// }
|
326 |
+
// }
|
327 |
});
|
328 |
}
|
329 |
|
336 |
ai_process_rotations_in_element = function (el) {
|
337 |
$("div.ai-rotate", el).each (function (index, element) {
|
338 |
ai_process_rotation (this);
|
339 |
+
// if (typeof $(this).data ('info') != 'undefined') {
|
340 |
+
// var block_info = JSON.parse (atob ($(this).data ('info')));
|
341 |
+
// var rotation_id = block_info [0];
|
342 |
+
|
343 |
+
// if (!ai_rotation_triggers.includes (rotation_id)) {
|
344 |
+
// ai_rotation_triggers.push (rotation_id);
|
345 |
+
|
346 |
+
// console.log ('ai_rotation_triggers', ai_rotation_triggers);
|
347 |
+
|
348 |
+
// ai_process_rotation (this);
|
349 |
+
// }
|
350 |
+
// }
|
351 |
});
|
352 |
}
|
353 |
|
includes/js/ai-rotate.min.js
CHANGED
@@ -1,15 +1,7 @@
|
|
1 |
-
jQuery(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
console.log("AI TIMED ROTATE index:",random_index+",","name:",'"'+option_name+'",',"time:",rotation_time)}if(rotation_time==0&&rotate_options.length>1){var next_random_index=random_index;do{next_random_index++;if(next_random_index>=rotate_options.length)next_random_index=0;var next_option=$(rotate_options[next_random_index]);if(typeof next_option.data("time")=="undefined"){random_index=next_random_index;option=$(rotate_options[random_index]);rotation_time=0;if(ai_debug)console.log("AI TIMED ROTATE next option has no time: ",
|
9 |
-
next_random_index);break}var next_rotation_time=atob(next_option.data("time"));if(ai_debug)console.log("AI TIMED ROTATE check:",next_random_index,"time:",next_rotation_time)}while(next_rotation_time==0&&next_random_index!=random_index);if(rotation_time!=0){random_index=next_random_index;option=$(rotate_options[random_index]);rotation_time=atob(option.data("time"))}if(ai_debug)console.log("AI TIMED ROTATE index:",random_index,"time:",rotation_time)}if(rotation_time>0){var next_random_index=random_index+
|
10 |
-
1;if(next_random_index>=rotate_options.length)next_random_index=0;if(typeof $(rotation_block).data("info")!="undefined"){var block_info=JSON.parse(atob($(rotation_block).data("info")));var rotation_id=block_info[0];$(rotation_block).attr("data-next",next_random_index);if(trigger_rotation)setTimeout(function(){ai_process_rotation($("div.ai-rotate.ai-"+rotation_id))},rotation_time*1E3);option_time_text=" ("+rotation_time+" s)"}}}else if(typeof option.data("group")!="undefined"){if(ai_debug){var option_name=
|
11 |
-
b64d(option.data("name"));console.log("AI ROTATE GROUP",'"'+option_name+'",',"index:",random_index)}}else{if(!ai_debug)rotate_options.each(function(index){if(index!=random_index)$(this).remove()});if(ai_debug)console.log("AI ROTATE no time");if(ai_debug)console.log("AI ROTATE index:",random_index)}option.css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""}).removeClass("ai-rotate-hidden").removeClass("ai-rotate-hidden-2");$(rotation_block).css({"position":""});
|
12 |
-
if(typeof option.data("code")!="undefined"){rotate_options.empty();var option_code=b64d(option.data("code"));option.append(option_code)}var option_name="";var debug_block_frame=$(rotation_block).closest(".ai-debug-block");if(debug_block_frame.length!=0){var option_name=b64d(option.data("name"));var name_tag=debug_block_frame.find("kbd.ai-option-name");var nested_debug_block=debug_block_frame.find(".ai-debug-block");if(typeof nested_debug_block!="undefined"){var name_tag2=nested_debug_block.find("kbd.ai-option-name");
|
13 |
-
name_tag=name_tag.slice(0,name_tag.length-name_tag2.length)}if(typeof name_tag!="undefined"){var separator=name_tag.first().data("separator");if(typeof separator=="undefined")separator="";name_tag.html(separator+option_name+option_time_text)}}var tracking_updated=false;var adb_show_wrapping_div=$(rotation_block).closest(".ai-adb-show");if(adb_show_wrapping_div.length!=0)if(adb_show_wrapping_div.data("ai-tracking")){var data=JSON.parse(b64d(adb_show_wrapping_div.data("ai-tracking")));if(typeof data!==
|
14 |
-
"undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;adb_show_wrapping_div.data("ai-tracking",b64e(JSON.stringify(data)));tracking_updated=true}}if(!tracking_updated){var wrapping_div=$(rotation_block).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(b64d(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]=random_index+1;data[3]=option_name;wrapping_div.data("ai",b64e(JSON.stringify(data)))}}}};
|
15 |
-
function ai_process_rotations(){$("div.ai-rotate").each(function(index,element){ai_process_rotation(this)})}function ai_process_group_rotations(){$("div.ai-rotate.ai-rotation-groups").each(function(index,element){ai_process_rotation(this)})}ai_process_rotations_in_element=function(el){$("div.ai-rotate",el).each(function(index,element){ai_process_rotation(this)})};$(document).ready(function($){setTimeout(function(){ai_process_rotations()},10)})});
|
1 |
+
jQuery(function(a){function r(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,e){return String.fromCharCode("0x"+e)}))}function k(a){return decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function t(){a("div.ai-rotate").each(function(a,m){ai_process_rotation(this)})}function u(){a("div.ai-rotate.ai-rotation-groups").each(function(a,m){ai_process_rotation(this)})}var l=[];ai_process_rotation=function(a){l.includes(a.selector)&&
|
2 |
+
l.splice(l.indexOf(a.selector),1);if("number"==typeof a.length)for(var e=0;e<a.length;e++)0==e?ai_process_single_rotation(a[e],!0):ai_process_single_rotation(a[e],!1);else ai_process_single_rotation(a,!0)};ai_process_single_rotation=function(e,m){var g=a(".ai-rotate-option",e);if(0!=g.length){g.hide();if("undefined"==typeof a(e).data("next"))if("undefined"!=typeof a(g[0]).data("group")){var f=-1,p=[];a("span[data-ai-groups]").each(function(b){(a(this)[0].offsetWidth||a(this)[0].offsetHeight||a(this)[0].getClientRects().length)&&
|
3 |
+
p.push(this)});1<=p.length&&JSON.parse(k(a(p).first().data("ai-groups"))).forEach(function(b,c){-1==f&&g.each(function(c){if(k(a(this).data("group"))==b)return f=c,!1})})}else{var d=a(e).data("shares");if("string"===typeof d){d=JSON.parse(atob(d));var h=Math.round(100*Math.random());for(var b=0;b<d.length&&(f=b,0>d[b]||!(h<=d[b]));b++);}else f=Math.floor(Math.random()*g.length),(new Date).getMilliseconds()%2&&(f=g.length-f-1)}else f=parseInt(a(e).attr("data-next")),b=a(g[f]),"undefined"!=typeof b.data("code")&&
|
4 |
+
(b=a(k(b.data("code")))),0!=b.find("span[data-ai-groups]").addBack("span[data-ai-groups]").length&&0!=a(".ai-rotation-groups").length&&setTimeout(function(){u()},5);if(!(0>f||f>=g.length)){b=a(g[f]);d="";if("undefined"!=typeof b.data("time")){h=atob(b.data("time"));if(0==h&&1<g.length){var c=f;do{c++;c>=g.length&&(c=0);var n=a(g[c]);if("undefined"==typeof n.data("time")){f=c;b=a(g[f]);h=0;break}n=atob(n.data("time"))}while(0==n&&c!=f);0!=h&&(f=c,b=a(g[f]),h=atob(b.data("time")))}if(0<h&&(c=f+1,c>=
|
5 |
+
g.length&&(c=0),"undefined"!=typeof a(e).data("info"))){d=JSON.parse(atob(a(e).data("info")))[0];a(e).attr("data-next",c);var q="div.ai-rotate.ai-"+d;l.includes(q)&&(m=!1);m&&(l.push(q),setTimeout(function(){ai_process_rotation(a(q))},1E3*h));d=" ("+h+" s)"}}else"undefined"==typeof b.data("group")&&g.each(function(b){b!=f&&a(this).remove()});b.css({display:"",visibility:"",position:"",width:"",height:"",top:"",left:""}).removeClass("ai-rotate-hidden").removeClass("ai-rotate-hidden-2");a(e).css({position:""});
|
6 |
+
"undefined"!=typeof b.data("code")&&(g.empty(),h=k(b.data("code")),b.append(h));h="";c=a(e).closest(".ai-debug-block");0!=c.length&&(h=k(b.data("name")),b=c.find("kbd.ai-option-name"),c=c.find(".ai-debug-block"),"undefined"!=typeof c&&(c=c.find("kbd.ai-option-name"),b=b.slice(0,b.length-c.length)),"undefined"!=typeof b&&(c=b.first().data("separator"),"undefined"==typeof c&&(c=""),b.html(c+h+d)));b=!1;c=a(e).closest(".ai-adb-show");0!=c.length&&c.data("ai-tracking")&&(d=JSON.parse(k(c.data("ai-tracking"))),
|
7 |
+
"undefined"!==typeof d&&d.constructor===Array&&(d[1]=f+1,d[3]=h,c.data("ai-tracking",r(JSON.stringify(d))),b=!0));b||(b=a(e).closest("div[data-ai]"),"undefined"!=typeof b.data("ai")&&(d=JSON.parse(k(b.data("ai"))),"undefined"!==typeof d&&d.constructor===Array&&(d[1]=f+1,d[3]=h,b.data("ai",r(JSON.stringify(d))))))}}};ai_process_rotations_in_element=function(e){a("div.ai-rotate",e).each(function(a,e){ai_process_rotation(this)})};a(document).ready(function(a){setTimeout(function(){t()},10)})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/ai-sidebar.js
CHANGED
@@ -1,59 +1,73 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
-
var sticky_widget_mode = AI_FUNC_GET_STICKY_WIDGET_MODE;
|
3 |
-
var sticky_widget_margin = AI_FUNC_GET_STICKY_WIDGET_MARGIN;
|
4 |
-
var document_width = $(document).width();
|
5 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
6 |
|
7 |
-
|
8 |
-
var
|
9 |
-
var
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
if (
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
var parent_element_width = parent_element.width();
|
27 |
-
if (parent_element_width > widget_width * 1.2 || parent_element_width > document_width / 2) break;
|
28 |
-
sidebar = parent_element;
|
29 |
-
}
|
30 |
-
if (already_sticky_js) {
|
31 |
-
if (ai_debug) console.log ("JS STICKY SIDEBAR ALREADY SET");
|
32 |
-
return;
|
33 |
-
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
sidebar.css ("position", "sticky").css ("position", "-webkit-sticky").css ("top", new_sidebar_top);
|
43 |
|
44 |
-
|
45 |
-
}
|
46 |
-
else if (ai_debug) console.log ("CSS STICKY SIDEBAR ALREADY SET");
|
47 |
-
} else {
|
48 |
-
// Javascript
|
49 |
-
sidebar.theiaStickySidebar({
|
50 |
-
additionalMarginTop: new_sidebar_top,
|
51 |
-
sidebarBehavior: 'stick-to-top',
|
52 |
-
});
|
53 |
-
|
54 |
-
if (ai_debug) console.log ("JS STICKY SIDEBAR, TOP:", new_sidebar_top);
|
55 |
-
}
|
56 |
-
});
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
});
|
59 |
|
|
1 |
jQuery(document).ready(function($) {
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
var ai_set_sidebars = function ($) {
|
4 |
+
var sticky_widget_mode = AI_FUNC_GET_STICKY_WIDGET_MODE;
|
5 |
+
var sticky_widget_margin = AI_FUNC_GET_STICKY_WIDGET_MARGIN;
|
6 |
+
var document_width = $(document).width();
|
7 |
|
8 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
9 |
+
// var ai_debug = false;
|
10 |
|
11 |
+
$(".ai-sticky-widget").each (function () {
|
12 |
+
var widget = $(this);
|
13 |
+
var widget_width = widget.width();
|
14 |
|
15 |
+
if (ai_debug) console.log ('');
|
16 |
+
if (ai_debug) console.log ("WIDGET:", widget.width (), widget.prop ("tagName"), widget.attr ("id"));
|
17 |
+
|
18 |
+
var already_sticky_js = false;
|
19 |
+
var sidebar = widget.parent ();
|
20 |
+
while (sidebar.prop ("tagName") != "BODY") {
|
21 |
+
|
22 |
+
if (sidebar.hasClass ('theiaStickySidebar')) {
|
23 |
+
already_sticky_js = true;
|
24 |
+
break;
|
25 |
+
}
|
26 |
+
|
27 |
+
if (ai_debug) console.log ("SIDEBAR:", sidebar.width (), sidebar.prop ("tagName"), sidebar.attr ("id"));
|
28 |
+
|
29 |
+
var parent_element = sidebar.parent ();
|
30 |
+
var parent_element_width = parent_element.width();
|
31 |
+
if (parent_element_width > widget_width * 1.2 || parent_element_width > document_width / 2) break;
|
32 |
+
sidebar = parent_element;
|
33 |
+
}
|
34 |
+
if (already_sticky_js) {
|
35 |
+
if (ai_debug) console.log ("JS STICKY SIDEBAR ALREADY SET");
|
36 |
+
return;
|
37 |
}
|
38 |
|
39 |
+
var new_sidebar_top = sidebar.offset ().top - widget.offset ().top + sticky_widget_margin;
|
40 |
|
41 |
+
if (ai_debug) console.log ("NEW SIDEBAR TOP:", new_sidebar_top);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
if (sticky_widget_mode == 0) {
|
44 |
+
// CSS
|
45 |
+
if (sidebar.css ("position") != "sticky" || isNaN (parseInt (sidebar.css ("top"))) || sidebar.css ("top") < new_sidebar_top) {
|
46 |
+
sidebar.css ("position", "sticky").css ("position", "-webkit-sticky").css ("top", new_sidebar_top);
|
47 |
|
48 |
+
if (ai_debug) console.log ("CSS STICKY SIDEBAR, TOP:", new_sidebar_top);
|
49 |
+
}
|
50 |
+
else if (ai_debug) console.log ("CSS STICKY SIDEBAR ALREADY SET");
|
51 |
+
} else {
|
52 |
+
// Javascript
|
53 |
+
sidebar.theiaStickySidebar({
|
54 |
+
additionalMarginTop: new_sidebar_top,
|
55 |
+
sidebarBehavior: 'stick-to-top',
|
56 |
+
});
|
57 |
|
58 |
+
if (ai_debug) console.log ("JS STICKY SIDEBAR, TOP:", new_sidebar_top);
|
59 |
+
}
|
60 |
+
});
|
|
|
61 |
|
62 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
if (typeof ai_sticky_sidebar_delay == 'undefined') {
|
65 |
+
ai_sticky_sidebar_delay = 20;
|
66 |
+
}
|
67 |
+
|
68 |
+
setTimeout (function() {
|
69 |
+
ai_set_sidebars (jQuery);
|
70 |
+
}, ai_sticky_sidebar_delay);
|
71 |
});
|
72 |
|
73 |
+
|
includes/js/ai-sidebar.min.js
CHANGED
@@ -1,4 +1,2 @@
|
|
1 |
-
jQuery(document).ready(function(
|
2 |
-
"
|
3 |
-
sticky_widget_margin;if(ai_debug)console.log("NEW SIDEBAR TOP:",new_sidebar_top);if(sticky_widget_mode==0)if(sidebar.css("position")!="sticky"||isNaN(parseInt(sidebar.css("top")))||sidebar.css("top")<new_sidebar_top){sidebar.css("position","sticky").css("position","-webkit-sticky").css("top",new_sidebar_top);if(ai_debug)console.log("CSS STICKY SIDEBAR, TOP:",new_sidebar_top)}else{if(ai_debug)console.log("CSS STICKY SIDEBAR ALREADY SET")}else{sidebar.theiaStickySidebar({additionalMarginTop:new_sidebar_top,
|
4 |
-
sidebarBehavior:"stick-to-top"});if(ai_debug)console.log("JS STICKY SIDEBAR, TOP:",new_sidebar_top)}})});
|
1 |
+
jQuery(document).ready(function(m){var d=function(c){var d=AI_FUNC_GET_STICKY_WIDGET_MODE,h=AI_FUNC_GET_STICKY_WIDGET_MARGIN,k=c(document).width();c(".ai-sticky-widget").each(function(){for(var b=c(this),l=b.width(),e=!1,a=b.parent();"BODY"!=a.prop("tagName");){if(a.hasClass("theiaStickySidebar")){e=!0;break}var f=a.parent(),g=f.width();if(g>1.2*l||g>k/2)break;a=f}e||(b=a.offset().top-b.offset().top+h,0==d?("sticky"!=a.css("position")||isNaN(parseInt(a.css("top")))||a.css("top")<b)&&a.css("position",
|
2 |
+
"sticky").css("position","-webkit-sticky").css("top",b):a.theiaStickySidebar({additionalMarginTop:b,sidebarBehavior:"stick-to-top"}))})};"undefined"==typeof ai_sticky_sidebar_delay&&(ai_sticky_sidebar_delay=20);setTimeout(function(){d(jQuery)},ai_sticky_sidebar_delay)});
|
|
|
|
js/ad-inserter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var javascript_version = "2.5.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
@@ -80,7 +80,7 @@ var AI_ADSENSE_SIZE_RESPONSIVE = 1;
|
|
80 |
var AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT = 2;
|
81 |
|
82 |
var AI_HTML_INSERTION_CLIENT_SIDE = 0;
|
83 |
-
var AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY = 1;
|
84 |
var AI_HTML_INSERTION_SEREVR_SIDE = 2;
|
85 |
|
86 |
var AI_STICK_TO_THE_TOP = 0;
|
@@ -2694,7 +2694,47 @@ jQuery(document).ready(function($) {
|
|
2694 |
}).show ().click (function () {
|
2695 |
var block = $(this).attr ("id");
|
2696 |
block = block.replace ("lists-button-","");
|
2697 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2698 |
});
|
2699 |
|
2700 |
$("#manual-button-"+tab).button ({
|
@@ -3830,6 +3870,11 @@ jQuery(document).ready(function($) {
|
|
3830 |
list_items [i] = list_items [i].replace (/ /g , '-').replace (/[\!\@\#\$%\^&\*\(\)\=\+\{\}\|\[\]\\\;\'\:\"\.\/\?]/g , '');
|
3831 |
}
|
3832 |
|
|
|
|
|
|
|
|
|
|
|
3833 |
if (list_element.hasClass ('ai-list-uppercase')) list_items = list_items.map (Function.prototype.call, String.prototype.toUpperCase); else
|
3834 |
if (list_element.hasClass ('ai-list-lowercase')) list_items = list_items.map (Function.prototype.call, String.prototype.toLowerCase); else
|
3835 |
if (list_element.hasClass ('ai-list-country-case')) {
|
@@ -4462,8 +4507,10 @@ jQuery(document).ready(function($) {
|
|
4462 |
}
|
4463 |
|
4464 |
var data_container = $("#ai-list-data");
|
|
|
|
|
4465 |
|
4466 |
-
data_container.load (ajaxurl+"?action=ai_ajax_backend&list=" + list + "&all=" + all + "&start=" + start + "&end=" + end + rearrange_data + "&ai_check=" + ai_nonce, function (response, status, xhr) {
|
4467 |
if (status == "error") {
|
4468 |
var message = "Error downloading list data: " + xhr.status + " " + xhr.statusText;
|
4469 |
data_container.html (message);
|
1 |
+
var javascript_version = "2.5.10";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
80 |
var AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT = 2;
|
81 |
|
82 |
var AI_HTML_INSERTION_CLIENT_SIDE = 0;
|
83 |
+
//var AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY = 1;
|
84 |
var AI_HTML_INSERTION_SEREVR_SIDE = 2;
|
85 |
|
86 |
var AI_STICK_TO_THE_TOP = 0;
|
2694 |
}).show ().click (function () {
|
2695 |
var block = $(this).attr ("id");
|
2696 |
block = block.replace ("lists-button-","");
|
2697 |
+
|
2698 |
+
if ($("#list-settings-" + block).is(':visible')) {
|
2699 |
+
if ($("#list-settings-" + block).hasClass ('ai-expaned')) {
|
2700 |
+
$("#list-settings-" + block).hide ();
|
2701 |
+
$("#list-settings-" + block).removeClass ('ai-expaned');
|
2702 |
+
} else {
|
2703 |
+
var lists = $("#list-settings-" + block + ' tr');
|
2704 |
+
var list_items = $("#list-settings-" + block + ' tr.list-items');
|
2705 |
+
|
2706 |
+
if (list_items.length != lists.length) {
|
2707 |
+
$("#list-settings-" + block + ' tr').show ();
|
2708 |
+
$("#list-settings-" + block).addClass ('ai-expaned');
|
2709 |
+
} else {
|
2710 |
+
$("#list-settings-" + block).hide ();
|
2711 |
+
$("#list-settings-" + block).removeClass ('ai-expaned');
|
2712 |
+
}
|
2713 |
+
}
|
2714 |
+
} else {
|
2715 |
+
$("#list-settings-" + block).show ();
|
2716 |
+
$("#list-settings-" + block).removeClass ('ai-expaned');
|
2717 |
+
$("#list-settings-" + block + ' tr').hide ();
|
2718 |
+
|
2719 |
+
var list_items = $("#list-settings-" + block + ' tr.list-items');
|
2720 |
+
if (list_items.length) {
|
2721 |
+
list_items.show ();
|
2722 |
+
} else {
|
2723 |
+
$("#list-settings-" + block + ' tr').show ();
|
2724 |
+
$("#list-settings-" + block).addClass ('ai-expaned');
|
2725 |
+
}
|
2726 |
+
}
|
2727 |
+
});
|
2728 |
+
|
2729 |
+
$("#list-settings-"+tab+' span.checkbox-list-button').click (function () {
|
2730 |
+
var on = $(this).hasClass ('dashicons-yes');
|
2731 |
+
if (on) {
|
2732 |
+
$(this).removeClass ('dashicons-yes').addClass ('dashicons-no');
|
2733 |
+
$(this).prev ().removeAttr ('checked');
|
2734 |
+
} else {
|
2735 |
+
$(this).removeClass ('dashicons-no').addClass ('dashicons-yes');
|
2736 |
+
$(this).prev ().attr ('checked', '1');
|
2737 |
+
}
|
2738 |
});
|
2739 |
|
2740 |
$("#manual-button-"+tab).button ({
|
3870 |
list_items [i] = list_items [i].replace (/ /g , '-').replace (/[\!\@\#\$%\^&\*\(\)\=\+\{\}\|\[\]\\\;\'\:\"\.\/\?]/g , '');
|
3871 |
}
|
3872 |
|
3873 |
+
if (list_element.hasClass ('ai-list-filter-cat'))
|
3874 |
+
for (var i = 0; i < list_items.length; i++) {
|
3875 |
+
list_items [i] = list_items [i].replace (/ /g , '-').replace (/[\!\@\#\$%\^&\(\)\=\{\}\|\[\]\\\;\'\:\"\.\/\?]/g , '');
|
3876 |
+
}
|
3877 |
+
|
3878 |
if (list_element.hasClass ('ai-list-uppercase')) list_items = list_items.map (Function.prototype.call, String.prototype.toUpperCase); else
|
3879 |
if (list_element.hasClass ('ai-list-lowercase')) list_items = list_items.map (Function.prototype.call, String.prototype.toLowerCase); else
|
3880 |
if (list_element.hasClass ('ai-list-country-case')) {
|
4507 |
}
|
4508 |
|
4509 |
var data_container = $("#ai-list-data");
|
4510 |
+
var safe_mode = Boolean (parseInt ($('#ai-data').attr ('safe-mode')));
|
4511 |
+
var safe_mode_url = safe_mode ? '&safe-mode' : '';
|
4512 |
|
4513 |
+
data_container.load (ajaxurl+"?action=ai_ajax_backend&list=" + list + "&all=" + all + "&start=" + start + "&end=" + end + rearrange_data + safe_mode_url + "&ai_check=" + ai_nonce, function (response, status, xhr) {
|
4514 |
if (status == "error") {
|
4515 |
var message = "Error downloading list data: " + xhr.status + " " + xhr.statusText;
|
4516 |
data_container.html (message);
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection,
|
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.3
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.5.
|
10 |
License: GPLv3
|
11 |
|
12 |
Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
|
@@ -315,6 +315,17 @@ If you are not happy to reveal this information and you have opted in, simply di
|
|
315 |
|
316 |
== Changelog ==
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
= 2.5.9 =
|
319 |
- Added support for block name class
|
320 |
- Added support for code generator for AdSense sticky AMP ads
|
@@ -518,6 +529,17 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
|
|
518 |
|
519 |
== Upgrade Notice ==
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
= 2.5.9 =
|
522 |
Added support for block name class;
|
523 |
Added support for code generator for AdSense sticky AMP ads;
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.3
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.5.10
|
10 |
License: GPLv3
|
11 |
|
12 |
Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
|
315 |
|
316 |
== Changelog ==
|
317 |
|
318 |
+
= 2.5.10 =
|
319 |
+
- Optimized Javascript code to allow advanced optimizations
|
320 |
+
- Added support to wait for jQuery so it can be deferred
|
321 |
+
- Added support for children categories in lists
|
322 |
+
- Added support to load settings page in safe mode
|
323 |
+
- Added warning notice if PHP version is below 5.6
|
324 |
+
- Improved user interface for lists
|
325 |
+
- Modified Javascript code that was wrongly replaced by CDN url
|
326 |
+
- Fix for updates server access warning message (Pro only)
|
327 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
328 |
+
|
329 |
= 2.5.9 =
|
330 |
- Added support for block name class
|
331 |
- Added support for code generator for AdSense sticky AMP ads
|
529 |
|
530 |
== Upgrade Notice ==
|
531 |
|
532 |
+
= 2.5.10 =
|
533 |
+
Optimized Javascript code to allow advanced optimizations;
|
534 |
+
Added support to wait for jQuery so it can be deferred;
|
535 |
+
Added support for children categories in lists;
|
536 |
+
Added support to load settings page in safe mode;
|
537 |
+
Added warning notice if PHP version is below 5.6;
|
538 |
+
Improved user interface for lists;
|
539 |
+
Modified Javascript code that was wrongly replaced by CDN url;
|
540 |
+
Fix for updates server access warning message (Pro only);
|
541 |
+
Few minor bug fixes, cosmetic changes and code improvements
|
542 |
+
|
543 |
= 2.5.9 =
|
544 |
Added support for block name class;
|
545 |
Added support for code generator for AdSense sticky AMP ads;
|
settings.php
CHANGED
@@ -9,6 +9,10 @@ require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
|
|
9 |
|
10 |
function generate_settings_form (){
|
11 |
|
|
|
|
|
|
|
|
|
12 |
if (defined ('AI_ADSENSE_API')) {
|
13 |
require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
|
14 |
}
|
@@ -93,7 +97,7 @@ function generate_settings_form (){
|
|
93 |
$adA = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
94 |
}
|
95 |
|
96 |
-
$syntax_highlighter_theme = get_syntax_highlighter_theme ();
|
97 |
$block_class_name = get_block_class_name ();
|
98 |
$block_class = get_block_class ();
|
99 |
$block_number_class = get_block_number_class ();
|
@@ -179,7 +183,7 @@ function generate_settings_form (){
|
|
179 |
|
180 |
?>
|
181 |
|
182 |
-
<div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" js_debugging="<?php echo $ai_wp_data [AI_BACKEND_JS_DEBUGGING] ? '1' : '0'; ?>" api_debugging="<?php echo strlen ($api = get_option ('ad_inserter' . '_' . base64_decode ('cHJvX2xpY2Vuc2U='), '')); ?>" <?php if ($default_sidebar && strlen ($api) != 0) echo 'api_string="', base64_encode ($api), '"'; ?>></div>
|
183 |
<?php
|
184 |
if (function_exists ('ai_data_2')) ai_data_2 ();
|
185 |
?>
|
@@ -204,7 +208,7 @@ function generate_settings_form (){
|
|
204 |
if ($range_end > 96) $range_end = 96;
|
205 |
if (($active_tab >= $range_start && $active_tab <= $range_end) || ($start == $range_start && $active_tab == 0)) $style = "font-weight: bold; color: #44e; "; else $style = "";
|
206 |
?>
|
207 |
-
<button type="button" class="ai-top-button" id="button-range-<?php echo $range; ?>" style="margin-right: 0px; outline-color: transparent;" onclick="window.location.href='<?php echo admin_url('options-general.php?page=ad-inserter.php&start='.$range_start); ?>'">
|
208 |
<span style="<?php echo $style; ?>"><?php echo $range_start, " - ", $range_end; ?></span>
|
209 |
</button>
|
210 |
<?php } ?>
|
@@ -265,6 +269,20 @@ function generate_settings_form (){
|
|
265 |
<div style="clear: both;"></div>
|
266 |
</div>
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
<?php
|
269 |
if ($insertion_disabled):
|
270 |
?>
|
@@ -505,32 +523,27 @@ function generate_settings_form (){
|
|
505 |
$domain_list = $obj->get_ad_domain_list();
|
506 |
$client_list = $obj->get_client_list();
|
507 |
if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
|
508 |
-
$show_lists =
|
509 |
-
$cat_list != '' ||
|
510 |
-
$obj->get_ad_block_cat_type() == AI_WHITE_LIST ||
|
511 |
-
|
512 |
-
$tag_list != '' ||
|
513 |
-
$obj->get_ad_block_tag_type() == AI_WHITE_LIST ||
|
514 |
-
|
515 |
-
$taxonomy_list != '' ||
|
516 |
-
$obj->get_ad_block_taxonomy_type() == AI_WHITE_LIST ||
|
517 |
-
|
518 |
-
$id_list != '' ||
|
519 |
-
$obj->get_id_list_type() == AI_WHITE_LIST ||
|
520 |
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
$client_list != '' ||
|
531 |
-
$obj->get_client_list_type() == AI_WHITE_LIST ||
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
$lists;
|
|
|
534 |
if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
|
535 |
|
536 |
$show_manual = $manual [$block] ||!empty ($sidebars_with_widget [$block]);
|
@@ -682,8 +695,8 @@ function generate_settings_form (){
|
|
682 |
|
683 |
<div id="ai-main-toolbar-<?php echo $block; ?>" class="max-input" style="margin: 8px 0 0 2px; height: 28px; width: 731px;">
|
684 |
<span id="name-label-container-<?php echo $block; ?>" style="display: table-cell; width: 100%; padding: 0; font-weight: bold; cursor: pointer;">
|
685 |
-
<input id="name-edit-<?php echo $block; ?>" style="width: 100%; vertical-align: middle; font-size: 14px; display: none;" type="text" name="<?php echo AI_OPTION_BLOCK_NAME, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
|
686 |
-
<span id="name-label-<?php echo $block; ?>" class="no-select" style="width: 100%; max-width: 490px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top:
|
687 |
</span>
|
688 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
689 |
<span class="ai-toolbar-button ai-settings">
|
@@ -1118,7 +1131,7 @@ function generate_settings_form (){
|
|
1118 |
|
1119 |
<div id="block-exceptions-<?php echo $block; ?>" class="responsive-table rounded" style="<?php echo $exceptions_shown ? '' : 'display: none;'; ?>">
|
1120 |
|
1121 |
-
<div style="min-height:
|
1122 |
<div style="float: left">
|
1123 |
<span style="display: table-cell;">
|
1124 |
<input type="hidden" name="<?php echo AI_OPTION_EXCEPTIONS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
@@ -1281,7 +1294,7 @@ function generate_settings_form (){
|
|
1281 |
<div id="automatic-insertion-<?php echo $block; ?>"></div>
|
1282 |
<div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
|
1283 |
|
1284 |
-
<?php if (function_exists ('
|
1285 |
|
1286 |
<div class="max-input">
|
1287 |
<span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
|
@@ -1339,16 +1352,16 @@ function generate_settings_form (){
|
|
1339 |
<?php _e ('Insertion', 'ad-inserter'); ?>
|
1340 |
<select id="html-element-insertion-<?php echo $block; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_HTML_ELEMENT_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_html_element_insertion (); ?>" title="<?php _e ('Client-side insertion uses JavaScript to insert block when the page loads. Server-side insertion inserts block when the page is generated but needs Output buffering enabled.', 'ad-inserter'); ?>">
|
1341 |
<option value="<?php echo AI_HTML_INSERTION_CLIENT_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
|
1342 |
-
<option value="<?php echo AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_DOM_READY; ?></option
|
1343 |
<?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
|
1344 |
<option value="<?php echo AI_HTML_INSERTION_SEREVR_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
|
1345 |
<?php endif; ?>
|
1346 |
</select>
|
1347 |
</span>
|
1348 |
-
<span id="server-side-insertion-<?php echo $block; ?>" style="display: table-cell; white-space: nowrap;<?php if ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) echo 'display: none;'; ?>">
|
1349 |
|
1350 |
-
<?php _e ('
|
1351 |
-
<select style="max-width: 140px; margin-bottom: 3px;" name="<?php echo AI_OPTION_SERVER_SIDE_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_server_side_insertion (); ?>" title="<?php _e ('Page position where the
|
1352 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
|
1353 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
|
1354 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
|
@@ -1609,215 +1622,255 @@ function generate_settings_form (){
|
|
1609 |
</div>
|
1610 |
|
1611 |
<div class="responsive-table rounded" id="list-settings-<?php echo $block; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
|
1612 |
-
<table>
|
1613 |
<tbody>
|
1614 |
-
<tr>
|
1615 |
<td>
|
1616 |
<?php _e ('Categories', 'ad-inserter'); ?>
|
1617 |
</td>
|
1618 |
<td>
|
1619 |
-
<button id="category-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1620 |
</td>
|
1621 |
-
<td style="padding-right: 7px; width:
|
1622 |
-
<input id="category-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated category slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="
|
1623 |
-
</td>
|
1624 |
-
<td style="padding-right: 7px;">
|
1625 |
-
<input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="category-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_cat_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1626 |
-
<label for="category-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist categories', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1627 |
</td>
|
1628 |
<td>
|
1629 |
-
<input type="
|
1630 |
-
<
|
1631 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1632 |
</tr>
|
1633 |
-
<tr>
|
1634 |
<td colspan="5">
|
1635 |
<select id="category-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1636 |
</select>
|
1637 |
</td>
|
1638 |
</tr>
|
1639 |
|
1640 |
-
<tr>
|
1641 |
<td>
|
1642 |
<?php _e ('Tags', 'ad-inserter'); ?>
|
1643 |
</td>
|
1644 |
<td>
|
1645 |
-
<button id="tag-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1646 |
</td>
|
1647 |
-
<td style="padding-right: 7px;">
|
1648 |
-
<input id="tag-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated tag slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="
|
1649 |
-
</td>
|
1650 |
-
<td style="padding-right: 7px;">
|
1651 |
-
<input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="tag-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_tag_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1652 |
-
<label for="tag-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist tags', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1653 |
</td>
|
1654 |
<td>
|
1655 |
-
<input type="
|
1656 |
-
<
|
1657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
</tr>
|
1659 |
-
<tr>
|
1660 |
<td colspan="5">
|
1661 |
<select id="tag-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1662 |
</select>
|
1663 |
</td>
|
1664 |
</tr>
|
1665 |
|
1666 |
-
<tr>
|
1667 |
<td>
|
1668 |
<?php _e ('Taxonomies', 'ad-inserter'); ?>
|
1669 |
</td>
|
1670 |
<td>
|
1671 |
-
<button id="taxonomy-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1672 |
</td>
|
1673 |
-
<td style="padding-right: 7px;">
|
1674 |
<input id="taxonomy-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated slugs: taxonomy, term or taxonomy:term', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_taxonomy(); ?>" value="<?php echo $taxonomy_list; ?>" size="54" maxlength="500" />
|
1675 |
</td>
|
1676 |
-
<td style="padding-right: 7px;">
|
1677 |
-
<input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="taxonomy-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1678 |
-
<label for="category-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist taxonomies', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1679 |
-
</td>
|
1680 |
<td>
|
1681 |
-
<input type="
|
1682 |
-
<
|
1683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1684 |
</tr>
|
1685 |
-
<tr>
|
1686 |
<td colspan="5">
|
1687 |
<select id="taxonomy-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1688 |
</select>
|
1689 |
</td>
|
1690 |
</tr>
|
1691 |
|
1692 |
-
<tr>
|
1693 |
<td>
|
1694 |
<?php _e ('Post IDs', 'ad-inserter'); ?>
|
1695 |
</td>
|
1696 |
<td>
|
1697 |
-
<button id="id-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1698 |
</td>
|
1699 |
-
<td style="padding-right: 7px;">
|
1700 |
<input id="id-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated post/page IDs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_id_list(); ?>" value="<?php echo $id_list; ?>" size="54" maxlength="2500"/>
|
1701 |
</td>
|
1702 |
-
<td style="padding-right: 7px;">
|
1703 |
-
<input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="id-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_id_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_id_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1704 |
-
<label for="id-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist IDs', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1705 |
-
</td>
|
1706 |
<td>
|
1707 |
-
<input type="
|
1708 |
-
<
|
1709 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1710 |
</tr>
|
1711 |
-
<tr>
|
1712 |
<td colspan="5">
|
1713 |
<select id="id-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1714 |
</select>
|
1715 |
</td>
|
1716 |
</tr>
|
1717 |
|
1718 |
-
<tr>
|
1719 |
<td>
|
1720 |
<?php _e ('Urls', 'ad-inserter'); ?>
|
1721 |
</td>
|
1722 |
<td>
|
1723 |
-
<button id="url-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1724 |
</td>
|
1725 |
-
<td style="padding-right: 7px;">
|
1726 |
<input id="url-list-<?php echo $block; ?>" class="ai-list-space ai-clean-protocol ai-clean-domain" style="width: 100%;" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="2500" title="<?php _e ('Comma separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)', 'ad-inserter'); ?>" />
|
1727 |
</td>
|
1728 |
-
<td style="padding-right: 7px;">
|
1729 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_url_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1730 |
-
<label for="url-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist urls', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1731 |
-
</td>
|
1732 |
<td>
|
1733 |
-
<input type="
|
1734 |
-
<
|
1735 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1736 |
</tr>
|
1737 |
-
<tr>
|
1738 |
<td colspan="5">
|
1739 |
<textarea id="url-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1740 |
</td>
|
1741 |
</tr>
|
1742 |
|
1743 |
-
<tr>
|
1744 |
<td>
|
1745 |
<?php _e ('Url parameters', 'ad-inserter'); ?>
|
1746 |
|
1747 |
</td>
|
1748 |
<td>
|
1749 |
-
<button id="url-parameter-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1750 |
</td>
|
1751 |
-
<td style="padding-right: 7px;">
|
1752 |
-
<input id="url-parameter-list-<?php echo $block; ?>" style="width: 100%;" title="<?php _e ("Comma separated url query parameters or cookies with optional values (use 'prameter', 'prameter=value', 'cookie' or 'cookie=value')", 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="
|
1753 |
-
</td>
|
1754 |
-
<td style="padding-right: 7px;">
|
1755 |
-
<input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-parameter-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_url_parameter_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1756 |
-
<label for="url-parameter-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist url parameters', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1757 |
</td>
|
1758 |
<td>
|
1759 |
-
<input type="
|
1760 |
-
<
|
1761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1762 |
</tr>
|
1763 |
-
<tr>
|
1764 |
<td colspan="5">
|
1765 |
<textarea id="url-parameter-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1766 |
</td>
|
1767 |
</tr>
|
1768 |
|
1769 |
-
<tr>
|
1770 |
<td>
|
1771 |
<?php _e ('Referrers', 'ad-inserter'); ?>
|
1772 |
</td>
|
1773 |
<td>
|
1774 |
-
<button id="referer-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1775 |
</td>
|
1776 |
-
<td style="padding-right: 7px;">
|
1777 |
-
<input id="referer-list-<?php echo $block; ?>" class="ai-clean-protocol ai-only-domain ai-list-sort" style="width: 100%;" title="<?php _e ('Comma separated domains, use # for no referrer, you can also use partial domains with * (domain-start*. *domain-pattern*, *domain-end)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="
|
1778 |
-
</td>
|
1779 |
-
<td style="padding-right: 7px;">
|
1780 |
-
<input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="referer-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_domain_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />
|
1781 |
-
<label for="referer-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist referers', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1782 |
</td>
|
1783 |
<td>
|
1784 |
-
<input type="
|
1785 |
-
<
|
1786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1787 |
</tr>
|
1788 |
-
<tr>
|
1789 |
<td colspan="5">
|
1790 |
<textarea id="referer-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1791 |
</td>
|
1792 |
</tr>
|
1793 |
|
1794 |
-
<tr>
|
1795 |
<td>
|
1796 |
<?php _e ('Clients', 'ad-inserter'); ?>
|
1797 |
</td>
|
1798 |
<td>
|
1799 |
-
<button id="client-button-<?php echo $block; ?>" type="button" class='ai-button'
|
1800 |
-
</td>
|
1801 |
-
<td style="padding-right: 7px;">
|
1802 |
-
<input id="client-list-<?php echo $block; ?>" style="width: 100%;" title="<?php _e ('Comma separated names (operating systems, browsers, devices)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CLIENT_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_client_list(); ?>" value="<?php echo $client_list; ?>" size="54" maxlength="500"/>
|
1803 |
</td>
|
1804 |
-
<td style="padding-right: 7px;">
|
1805 |
-
<input
|
1806 |
-
<label for="client-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist clients', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>
|
1807 |
</td>
|
1808 |
<td>
|
1809 |
-
<input type="
|
1810 |
-
<
|
1811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1812 |
</tr>
|
1813 |
-
<tr>
|
1814 |
<td colspan="5">
|
1815 |
<select id="client-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1816 |
</select>
|
1817 |
</td>
|
1818 |
</tr>
|
1819 |
|
1820 |
-
<?php if (function_exists ('
|
1821 |
</tbody>
|
1822 |
</table>
|
1823 |
</div>
|
@@ -2317,6 +2370,17 @@ function generate_settings_form (){
|
|
2317 |
</select>
|
2318 |
</td>
|
2319 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2320 |
<tr>
|
2321 |
<td>
|
2322 |
<?php _e ('Sticky widget mode', 'ad-inserter'); ?>
|
@@ -3843,6 +3907,10 @@ function ads_txt ($action) {
|
|
3843 |
function code_block_list ($start, $end, $search_text, $show_all_blocks) {
|
3844 |
global $block_object, $wpdb, $ai_db_options_extract;
|
3845 |
|
|
|
|
|
|
|
|
|
3846 |
if (isset ($_GET ["blocks-org"]) && isset ($_GET ["blocks-new"])) {
|
3847 |
$blocks_org = json_decode ($_GET ["blocks-org"]);
|
3848 |
$blocks_new = json_decode ($_GET ["blocks-new"]);
|
@@ -4020,8 +4088,7 @@ function code_block_list ($start, $end, $search_text, $show_all_blocks) {
|
|
4020 |
$row_counter ++;
|
4021 |
$row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
|
4022 |
|
4023 |
-
|
4024 |
-
$edit_url = admin_url ('options-general.php?page=ad-inserter.php') . $url_parameters . '&tab=' . $block;
|
4025 |
|
4026 |
$visible_tab = $block >= $start && $block <= $end;
|
4027 |
|
@@ -4450,6 +4517,17 @@ function generate_list_options ($options) {
|
|
4450 |
// $category_data = array_slice ($category_data, 0, $max_items);
|
4451 |
foreach ($category_data as $category) {
|
4452 |
echo " <option value='{$category->slug}'>{$category->slug} ({$category->name})</option>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4453 |
}
|
4454 |
break;
|
4455 |
|
@@ -4812,12 +4890,12 @@ function sidebar_support_review () {
|
|
4812 |
switch ($text = rand (1,2)) {
|
4813 |
case 1:
|
4814 |
?>
|
4815 |
-
<button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 124px; width: 124px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Review', 'Review Ad Inserter', 'ad-inserter'); ?>
|
4816 |
<?php
|
4817 |
break;
|
4818 |
default:
|
4819 |
?>
|
4820 |
-
<button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 124px; width: 124px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by rating the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Rate', 'Rate Ad Inserter', 'ad-inserter'); ?>
|
4821 |
<?php
|
4822 |
break;
|
4823 |
}
|
9 |
|
10 |
function generate_settings_form (){
|
11 |
|
12 |
+
if (defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode'])) {
|
13 |
+
$url_safe_mode = '&ai-safe-mode';
|
14 |
+
} else $url_safe_mode = '';
|
15 |
+
|
16 |
if (defined ('AI_ADSENSE_API')) {
|
17 |
require_once AD_INSERTER_PLUGIN_DIR.'includes/adsense-api.php';
|
18 |
}
|
97 |
$adA = $block_object [AI_ADB_MESSAGE_OPTION_NAME];
|
98 |
}
|
99 |
|
100 |
+
$syntax_highlighter_theme = defined ('AI_SAFE_MODE') ? 'disabled' : get_syntax_highlighter_theme ();
|
101 |
$block_class_name = get_block_class_name ();
|
102 |
$block_class = get_block_class ();
|
103 |
$block_number_class = get_block_number_class ();
|
183 |
|
184 |
?>
|
185 |
|
186 |
+
<div id="ai-data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" safe-mode="<?php echo defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode']) ? '1' : '0'; ?>" js_debugging="<?php echo $ai_wp_data [AI_BACKEND_JS_DEBUGGING] ? '1' : '0'; ?>" api_debugging="<?php echo strlen ($api = get_option ('ad_inserter' . '_' . base64_decode ('cHJvX2xpY2Vuc2U='), '')); ?>" <?php if ($default_sidebar && strlen ($api) != 0) echo 'api_string="', base64_encode ($api), '"'; ?>></div>
|
187 |
<?php
|
188 |
if (function_exists ('ai_data_2')) ai_data_2 ();
|
189 |
?>
|
208 |
if ($range_end > 96) $range_end = 96;
|
209 |
if (($active_tab >= $range_start && $active_tab <= $range_end) || ($start == $range_start && $active_tab == 0)) $style = "font-weight: bold; color: #44e; "; else $style = "";
|
210 |
?>
|
211 |
+
<button type="button" class="ai-top-button" id="button-range-<?php echo $range; ?>" style="margin-right: 0px; outline-color: transparent;" onclick="window.location.href='<?php echo admin_url('options-general.php?page=ad-inserter.php&start='.$range_start.$url_safe_mode); ?>'">
|
212 |
<span style="<?php echo $style; ?>"><?php echo $range_start, " - ", $range_end; ?></span>
|
213 |
</button>
|
214 |
<?php } ?>
|
269 |
<div style="clear: both;"></div>
|
270 |
</div>
|
271 |
|
272 |
+
<?php
|
273 |
+
if (defined ('AI_SAFE_MODE') || isset ($_GET ['ai-safe-mode'])) {
|
274 |
+
?>
|
275 |
+
<div class="ai-form warning-enabled rounded">
|
276 |
+
<h2 class="blocked-warning-text" style="float: left; color: blue; margin: 7px 0;"><?php _e ('SAFE MODE', 'ad-inserter'); ?></h2>
|
277 |
+
<div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
|
278 |
+
<?php /* translators: %s: HTML tags */ printf (__ ('Page is loaded in %s safe mode. %s Not all scripts are loaded.', 'ad-inserter'), '<a href="https://adinserter.pro/documentation/troubleshooting#safe-mode" class="simple-link" target="_blank">', '</a>'); ?>
|
279 |
+
</div>
|
280 |
+
<div style="clear: both;"></div>
|
281 |
+
</div>
|
282 |
+
<?php
|
283 |
+
}
|
284 |
+
?>
|
285 |
+
|
286 |
<?php
|
287 |
if ($insertion_disabled):
|
288 |
?>
|
523 |
$domain_list = $obj->get_ad_domain_list();
|
524 |
$client_list = $obj->get_client_list();
|
525 |
if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
|
527 |
+
$show_cat_list = $cat_list != '';
|
528 |
+
$show_tag_list = $tag_list != '';
|
529 |
+
$show_taxonomy_list = $taxonomy_list != '';
|
530 |
+
$show_id_list = $id_list != '';
|
531 |
+
$show_url_list = $url_list != '';
|
532 |
+
$show_url_parameter_list = $url_parameter_list != '';
|
533 |
+
$show_domain_list = $domain_list != '';
|
534 |
+
$show_client_list = $client_list != '';
|
|
|
|
|
|
|
535 |
|
536 |
+
$show_lists =
|
537 |
+
$show_cat_list ||
|
538 |
+
$show_tag_list ||
|
539 |
+
$show_taxonomy_list ||
|
540 |
+
$show_id_list ||
|
541 |
+
$show_url_list ||
|
542 |
+
$show_url_parameter_list ||
|
543 |
+
$show_domain_list ||
|
544 |
+
$show_client_list ||
|
545 |
$lists;
|
546 |
+
|
547 |
if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
|
548 |
|
549 |
$show_manual = $manual [$block] ||!empty ($sidebars_with_widget [$block]);
|
695 |
|
696 |
<div id="ai-main-toolbar-<?php echo $block; ?>" class="max-input" style="margin: 8px 0 0 2px; height: 28px; width: 731px;">
|
697 |
<span id="name-label-container-<?php echo $block; ?>" style="display: table-cell; width: 100%; padding: 0; font-weight: bold; cursor: pointer;">
|
698 |
+
<input id="name-edit-<?php echo $block; ?>" style="width: 100%; height: 20px; padding-left: 5px; vertical-align: middle; font-size: 14px; display: none;" type="text" name="<?php echo AI_OPTION_BLOCK_NAME, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_name(); ?>" value="<?php echo $obj->get_ad_name() ?>" size="56" maxlength="120" />
|
699 |
+
<span id="name-label-<?php echo $block; ?>" class="no-select" style="width: 100%; max-width: 490px; vertical-align: middle; font-size: 14px; display: inline-block; margin-top: 5px; margin-left: 7px; white-space: nowrap; overflow: hidden;"><?php echo $obj->get_ad_name() ?></span>
|
700 |
</span>
|
701 |
<?php if (AI_SYNTAX_HIGHLIGHTING) : ?>
|
702 |
<span class="ai-toolbar-button ai-settings">
|
1131 |
|
1132 |
<div id="block-exceptions-<?php echo $block; ?>" class="responsive-table rounded" style="<?php echo $exceptions_shown ? '' : 'display: none;'; ?>">
|
1133 |
|
1134 |
+
<div style="min-height: 25px;">
|
1135 |
<div style="float: left">
|
1136 |
<span style="display: table-cell;">
|
1137 |
<input type="hidden" name="<?php echo AI_OPTION_EXCEPTIONS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1294 |
<div id="automatic-insertion-<?php echo $block; ?>"></div>
|
1295 |
<div id="alignment-style-<?php echo $block; ?>" style="margin-bottom: 4px;"></div>
|
1296 |
|
1297 |
+
<?php if (function_exists ('ai_sticky_positions')) ai_sticky_positions ($block, $obj, $default); ?>
|
1298 |
|
1299 |
<div class="max-input">
|
1300 |
<span id="css-label-<?php echo $block; ?>" style="display: table-cell; width: 36px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0; font-size: 14px; font-weight: bold;">CSS</span>
|
1352 |
<?php _e ('Insertion', 'ad-inserter'); ?>
|
1353 |
<select id="html-element-insertion-<?php echo $block; ?>" style="margin-bottom: 3px;" name="<?php echo AI_OPTION_HTML_ELEMENT_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_html_element_insertion (); ?>" title="<?php _e ('Client-side insertion uses JavaScript to insert block when the page loads. Server-side insertion inserts block when the page is generated but needs Output buffering enabled.', 'ad-inserter'); ?>">
|
1354 |
<option value="<?php echo AI_HTML_INSERTION_CLIENT_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE; ?></option>
|
1355 |
+
<!-- <option value="<?php echo AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CLIENT_SIDE_DOM_READY; ?></option>-->
|
1356 |
<?php if (defined ('AI_BUFFERING') && get_output_buffering ()) : ?>
|
1357 |
<option value="<?php echo AI_HTML_INSERTION_SEREVR_SIDE; ?>" <?php echo ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_SERVER_SIDE; ?></option>
|
1358 |
<?php endif; ?>
|
1359 |
</select>
|
1360 |
</span>
|
1361 |
+
<span id="server-side-insertion-<?php echo $block; ?>" style="display: table-cell; text-align: right; white-space: nowrap;<?php if ($html_element_insertion == AI_HTML_INSERTION_SEREVR_SIDE) echo 'display: none;'; ?>">
|
1362 |
|
1363 |
+
<?php _e ('Code position', 'ad-inserter'); ?>
|
1364 |
+
<select style="max-width: 140px; margin-bottom: 3px;" name="<?php echo AI_OPTION_SERVER_SIDE_INSERTION, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_server_side_insertion (); ?>" title="<?php _e ('Page position where the code for client-side insertion will be inserted.', 'ad-inserter'); ?>">
|
1365 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
|
1366 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
|
1367 |
<option value="<?php echo AI_AUTOMATIC_INSERTION_FOOTER; ?>" <?php echo ($server_side_insertion == AI_AUTOMATIC_INSERTION_FOOTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FOOTER; ?></option>
|
1622 |
</div>
|
1623 |
|
1624 |
<div class="responsive-table rounded" id="list-settings-<?php echo $block; ?>" style="<?php if (!$show_lists) echo ' display: none;'; ?>">
|
1625 |
+
<table class="ai-lists" style="border-spacing: 0;">
|
1626 |
<tbody>
|
1627 |
+
<tr class="<?php if ($show_cat_list) echo 'list-items'; ?>" style="<?php if (!$show_cat_list) echo ' display: none;'; ?>">
|
1628 |
<td>
|
1629 |
<?php _e ('Categories', 'ad-inserter'); ?>
|
1630 |
</td>
|
1631 |
<td>
|
1632 |
+
<button id="category-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle category editor', 'ad-inserter'); ?>"></button>
|
1633 |
</td>
|
1634 |
+
<td style="padding-right: 7px; width: 90%;">
|
1635 |
+
<input id="category-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter-cat ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated category slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CATEGORY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_cat(); ?>" value="<?php echo $cat_list; ?>" size="54" maxlength="1500" />
|
|
|
|
|
|
|
|
|
1636 |
</td>
|
1637 |
<td>
|
1638 |
+
<input type="hidden" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1639 |
+
<input type="checkbox" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="category-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_cat_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1640 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_cat_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1641 |
+
</td>
|
1642 |
+
<!-- <td style="padding-right: 7px;">-->
|
1643 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="category-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_cat_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1644 |
+
<!-- <label for="category-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist categories', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1645 |
+
<!-- </td>-->
|
1646 |
+
<!-- <td>-->
|
1647 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_CATEGORY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="category-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_cat_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_cat_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1648 |
+
<!-- <label for="category-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist categories', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1649 |
+
<!-- </td>-->
|
1650 |
</tr>
|
1651 |
+
<tr class="<?php if ($show_cat_list) echo 'list-items'; ?>" style="<?php if (!$show_cat_list) echo ' display: none;'; ?>">
|
1652 |
<td colspan="5">
|
1653 |
<select id="category-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1654 |
</select>
|
1655 |
</td>
|
1656 |
</tr>
|
1657 |
|
1658 |
+
<tr class="<?php if ($show_tag_list) echo 'list-items'; ?>" style="<?php if (!$show_tag_list) echo ' display: none;'; ?>">
|
1659 |
<td>
|
1660 |
<?php _e ('Tags', 'ad-inserter'); ?>
|
1661 |
</td>
|
1662 |
<td>
|
1663 |
+
<button id="tag-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle tag editor', 'ad-inserter'); ?>"></button>
|
1664 |
</td>
|
1665 |
+
<td style="padding-right: 7px; width: 90%;">
|
1666 |
+
<input id="tag-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-filter ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated tag slugs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAG_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_tag(); ?>" value="<?php echo $tag_list; ?>" size="54" maxlength="1500"/>
|
|
|
|
|
|
|
|
|
1667 |
</td>
|
1668 |
<td>
|
1669 |
+
<input type="hidden" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1670 |
+
<input type="checkbox" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_tag_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1671 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_tag_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1672 |
+
</td>
|
1673 |
+
<!-- <td style="padding-right: 7px;">-->
|
1674 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="tag-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_tag_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1675 |
+
<!-- <label for="tag-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist tags', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1676 |
+
<!-- </td>-->
|
1677 |
+
<!-- <td>-->
|
1678 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_TAG_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="tag-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_tag_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_tag_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1679 |
+
<!-- <label for="tag-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist tags', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1680 |
+
<!-- </td>-->
|
1681 |
</tr>
|
1682 |
+
<tr class="<?php if ($show_tag_list) echo 'list-items'; ?>" style="<?php if (!$show_tag_list) echo ' display: none;'; ?>">
|
1683 |
<td colspan="5">
|
1684 |
<select id="tag-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1685 |
</select>
|
1686 |
</td>
|
1687 |
</tr>
|
1688 |
|
1689 |
+
<tr class="<?php if ($show_taxonomy_list) echo 'list-items'; ?>" style="<?php if (!$show_taxonomy_list) echo ' display: none;'; ?>">
|
1690 |
<td>
|
1691 |
<?php _e ('Taxonomies', 'ad-inserter'); ?>
|
1692 |
</td>
|
1693 |
<td>
|
1694 |
+
<button id="taxonomy-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle taxonomy editor', 'ad-inserter'); ?>"></button>
|
1695 |
</td>
|
1696 |
+
<td style="padding-right: 7px; width: 90%;">
|
1697 |
<input id="taxonomy-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated slugs: taxonomy, term or taxonomy:term', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_TAXONOMY_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_block_taxonomy(); ?>" value="<?php echo $taxonomy_list; ?>" size="54" maxlength="500" />
|
1698 |
</td>
|
|
|
|
|
|
|
|
|
1699 |
<td>
|
1700 |
+
<input type="hidden" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1701 |
+
<input type="checkbox" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1702 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_block_taxonomy_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1703 |
+
</td>
|
1704 |
+
<!-- <td style="padding-right: 7px;">-->
|
1705 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="taxonomy-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1706 |
+
<!-- <label for="category-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist taxonomies', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1707 |
+
<!-- </td>-->
|
1708 |
+
<!-- <td>-->
|
1709 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_TAXONOMY_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="taxonomy-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_block_taxonomy_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_ad_block_taxonomy_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1710 |
+
<!-- <label for="category-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist taxonomies', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1711 |
+
<!-- </td>-->
|
1712 |
</tr>
|
1713 |
+
<tr class="<?php if ($show_taxonomy_list) echo 'list-items'; ?>" style="<?php if (!$show_taxonomy_list) echo ' display: none;'; ?>">
|
1714 |
<td colspan="5">
|
1715 |
<select id="taxonomy-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1716 |
</select>
|
1717 |
</td>
|
1718 |
</tr>
|
1719 |
|
1720 |
+
<tr class="<?php if ($show_id_list) echo 'list-items'; ?>" style="<?php if (!$show_id_list) echo ' display: none;'; ?>">
|
1721 |
<td>
|
1722 |
<?php _e ('Post IDs', 'ad-inserter'); ?>
|
1723 |
</td>
|
1724 |
<td>
|
1725 |
+
<button id="id-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle post/page ID editor', 'ad-inserter'); ?>"></button>
|
1726 |
</td>
|
1727 |
+
<td style="padding-right: 7px; width: 90%;">
|
1728 |
<input id="id-list-<?php echo $block; ?>" class="ai-list-lowercase ai-list-custom" style="width: 100%;" title="<?php _e ('Comma separated post/page IDs', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_ID_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_id_list(); ?>" value="<?php echo $id_list; ?>" size="54" maxlength="2500"/>
|
1729 |
</td>
|
|
|
|
|
|
|
|
|
1730 |
<td>
|
1731 |
+
<input type="hidden" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1732 |
+
<input type="checkbox" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_id_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1733 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_id_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1734 |
+
</td>
|
1735 |
+
<!-- <td style="padding-right: 7px;">-->
|
1736 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="id-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_id_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_id_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1737 |
+
<!-- <label for="id-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist IDs', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1738 |
+
<!-- </td>-->
|
1739 |
+
<!-- <td>-->
|
1740 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_ID_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="id-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_id_list_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_id_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1741 |
+
<!-- <label for="id-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist IDs', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1742 |
+
<!-- </td>-->
|
1743 |
</tr>
|
1744 |
+
<tr class="<?php if ($show_id_list) echo 'list-items'; ?>" style="<?php if (!$show_id_list) echo ' display: none;'; ?>">
|
1745 |
<td colspan="5">
|
1746 |
<select id="id-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1747 |
</select>
|
1748 |
</td>
|
1749 |
</tr>
|
1750 |
|
1751 |
+
<tr class="<?php if ($show_url_list) echo 'list-items'; ?>" style="<?php if (!$show_url_list) echo ' display: none;'; ?>">
|
1752 |
<td>
|
1753 |
<?php _e ('Urls', 'ad-inserter'); ?>
|
1754 |
</td>
|
1755 |
<td>
|
1756 |
+
<button id="url-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle url editor', 'ad-inserter'); ?>"></button>
|
1757 |
</td>
|
1758 |
+
<td style="padding-right: 7px; width: 90%;">
|
1759 |
<input id="url-list-<?php echo $block; ?>" class="ai-list-space ai-clean-protocol ai-clean-domain" style="width: 100%;" type="text" name="<?php echo AI_OPTION_URL_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_url_list(); ?>" value="<?php echo $url_list; ?>" size="54" maxlength="2500" title="<?php _e ('Comma separated urls (page addresses) starting with / after domain name (e.g. /permalink-url, use only when you need to taget a specific url not accessible by other means). You can also use partial urls with * (/url-start*. *url-pattern*, *url-end)', 'ad-inserter'); ?>" />
|
1760 |
</td>
|
|
|
|
|
|
|
|
|
1761 |
<td>
|
1762 |
+
<input type="hidden" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1763 |
+
<input type="checkbox" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_url_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1764 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_url_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1765 |
+
</td>
|
1766 |
+
<!-- <td style="padding-right: 7px;">-->
|
1767 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_url_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1768 |
+
<!-- <label for="url-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist urls', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1769 |
+
<!-- </td>-->
|
1770 |
+
<!-- <td>-->
|
1771 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_URL_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_url_list_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_ad_url_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1772 |
+
<!-- <label for="url-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist urls', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1773 |
+
<!-- </td>-->
|
1774 |
</tr>
|
1775 |
+
<tr class="<?php if ($show_url_list) echo 'list-items'; ?>" style="<?php if (!$show_url_list) echo ' display: none;'; ?>">
|
1776 |
<td colspan="5">
|
1777 |
<textarea id="url-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1778 |
</td>
|
1779 |
</tr>
|
1780 |
|
1781 |
+
<tr class="<?php if ($show_url_parameter_list) echo 'list-items'; ?>" style="<?php if (!$show_url_parameter_list) echo ' display: none;'; ?>">
|
1782 |
<td>
|
1783 |
<?php _e ('Url parameters', 'ad-inserter'); ?>
|
1784 |
|
1785 |
</td>
|
1786 |
<td>
|
1787 |
+
<button id="url-parameter-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle url parameter and cookie editor', 'ad-inserter'); ?>"></button>
|
1788 |
</td>
|
1789 |
+
<td style="padding-right: 7px; width: 90%;">
|
1790 |
+
<input id="url-parameter-list-<?php echo $block; ?>" style="width: 100%;" title="<?php _e ("Comma separated url query parameters or cookies with optional values (use 'prameter', 'prameter=value', 'cookie' or 'cookie=value')", 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_URL_PARAMETER_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_url_parameter_list(); ?>" value="<?php echo $url_parameter_list; ?>" size="54" maxlength="1500"/>
|
|
|
|
|
|
|
|
|
1791 |
</td>
|
1792 |
<td>
|
1793 |
+
<input type="hidden" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1794 |
+
<input type="checkbox" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_url_parameter_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1795 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_url_parameter_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1796 |
+
</td>
|
1797 |
+
<!-- <td style="padding-right: 7px;">-->
|
1798 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-parameter-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_url_parameter_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1799 |
+
<!-- <label for="url-parameter-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist url parameters', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1800 |
+
<!-- </td>-->
|
1801 |
+
<!-- <td>-->
|
1802 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_URL_PARAMETER_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="url-parameter-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_url_parameter_list_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_url_parameter_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1803 |
+
<!-- <label for="url-parameter-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist url parameters', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1804 |
+
<!-- </td>-->
|
1805 |
</tr>
|
1806 |
+
<tr class="<?php if ($show_url_parameter_list) echo 'list-items'; ?>" style="<?php if (!$show_url_parameter_list) echo ' display: none;'; ?>">
|
1807 |
<td colspan="5">
|
1808 |
<textarea id="url-parameter-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1809 |
</td>
|
1810 |
</tr>
|
1811 |
|
1812 |
+
<tr class="<?php if ($show_domain_list) echo 'list-items'; ?>" style="<?php if (!$show_domain_list) echo ' display: none;'; ?>">
|
1813 |
<td>
|
1814 |
<?php _e ('Referrers', 'ad-inserter'); ?>
|
1815 |
</td>
|
1816 |
<td>
|
1817 |
+
<button id="referer-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle referer editor', 'ad-inserter'); ?>"></button>
|
1818 |
</td>
|
1819 |
+
<td style="padding-right: 7px; width: 90%;">
|
1820 |
+
<input id="referer-list-<?php echo $block; ?>" class="ai-clean-protocol ai-only-domain ai-list-sort" style="width: 100%;" title="<?php _e ('Comma separated domains, use # for no referrer, you can also use partial domains with * (domain-start*. *domain-pattern*, *domain-end)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_DOMAIN_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_ad_domain_list(); ?>" value="<?php echo $domain_list; ?>" size="54" maxlength="1500"/>
|
|
|
|
|
|
|
|
|
1821 |
</td>
|
1822 |
<td>
|
1823 |
+
<input type="hidden" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1824 |
+
<input type="checkbox" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_ad_domain_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1825 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_ad_domain_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1826 |
+
</td>
|
1827 |
+
<!-- <td style="padding-right: 7px;">-->
|
1828 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="referer-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_ad_domain_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1829 |
+
<!-- <label for="referer-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist referers', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1830 |
+
<!-- </td>-->
|
1831 |
+
<!-- <td>-->
|
1832 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_DOMAIN_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="referer-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_ad_domain_list_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_ad_domain_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1833 |
+
<!-- <label for="referer-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist referers', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1834 |
+
<!-- </td>-->
|
1835 |
</tr>
|
1836 |
+
<tr class="<?php if ($show_domain_list) echo 'list-items'; ?>" style="<?php if (!$show_domain_list) echo ' display: none;'; ?>">
|
1837 |
<td colspan="5">
|
1838 |
<textarea id="referer-editor-<?php echo $block; ?>" style="width: 100%; height: 220px; font-family: monospace, Courier, 'Courier New'; font-weight: bold; display: none;"></textarea>
|
1839 |
</td>
|
1840 |
</tr>
|
1841 |
|
1842 |
+
<tr class="<?php if ($show_client_list) echo 'list-items'; ?>" style="<?php if (!$show_client_list) echo ' display: none;'; ?>">
|
1843 |
<td>
|
1844 |
<?php _e ('Clients', 'ad-inserter'); ?>
|
1845 |
</td>
|
1846 |
<td>
|
1847 |
+
<button id="client-button-<?php echo $block; ?>" type="button" class='ai-button' title="<?php _e ('Toggle client editor', 'ad-inserter'); ?>"></button>
|
|
|
|
|
|
|
1848 |
</td>
|
1849 |
+
<td style="padding-right: 7px; width: 90%;">
|
1850 |
+
<input id="client-list-<?php echo $block; ?>" style="width: 100%;" title="<?php _e ('Comma separated names (operating systems, browsers, devices)', 'ad-inserter'); ?>" type="text" name="<?php echo AI_OPTION_CLIENT_LIST, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_client_list(); ?>" value="<?php echo $client_list; ?>" size="54" maxlength="1500"/>
|
|
|
1851 |
</td>
|
1852 |
<td>
|
1853 |
+
<input type="hidden" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
|
1854 |
+
<input type="checkbox" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo AI_BLACK_LIST; ?>" id="tag-list-input-<?php echo $block; ?>" <?php if ($obj->get_client_list_type() == AI_WHITE_LIST) echo 'checked '; ?> style="display: none;" />
|
1855 |
+
<span class="checkbox-button checkbox-list-button dashicons dashicons-<?php echo $obj->get_client_list_type() == AI_BLACK_LIST ? 'no' : 'yes'; ?>" title="<?php _e ('Click to select black or white list', 'ad-inserter'); ?>"></span>
|
1856 |
+
</td>
|
1857 |
+
<!-- <td style="padding-right: 7px;">-->
|
1858 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="client-blacklist-<?php echo $block; ?>" default="<?php echo $default->get_client_list_type() == AI_BLACK_LIST; ?>" value="<?php echo AI_BLACK_LIST; ?>" <?php if ($obj->get_client_list_type() == AI_BLACK_LIST) echo 'checked '; ?> />-->
|
1859 |
+
<!-- <label for="client-blacklist-<?php echo $block; ?>" title="<?php _e ('Blacklist clients', 'ad-inserter'); ?>"><?php echo AI_TEXT_BLACK_LIST; ?></label>-->
|
1860 |
+
<!-- </td>-->
|
1861 |
+
<!-- <td>-->
|
1862 |
+
<!-- <input type="radio" name="<?php echo AI_OPTION_CLIENT_LIST_TYPE, WP_FORM_FIELD_POSTFIX, $block; ?>" id="client-whitelist-<?php echo $block; ?>" default="<?php echo $default->get_client_list_type() == AI_WHITE_LIST; ?>" value="<?php echo AI_WHITE_LIST; ?>" <?php if ($obj->get_client_list_type() == AI_WHITE_LIST) echo 'checked '; ?> />-->
|
1863 |
+
<!-- <label for="client-whitelist-<?php echo $block; ?>" title="<?php _e ('Whitelist clients', 'ad-inserter'); ?>"><?php echo AI_TEXT_WHITE_LIST; ?></label>-->
|
1864 |
+
<!-- </td>-->
|
1865 |
</tr>
|
1866 |
+
<tr class="<?php if ($show_client_list) echo 'list-items'; ?>" style="<?php if (!$show_client_list) echo ' display: none;'; ?>">
|
1867 |
<td colspan="5">
|
1868 |
<select id="client-select-<?php echo $block; ?>" multiple="multiple" style="display: none;">
|
1869 |
</select>
|
1870 |
</td>
|
1871 |
</tr>
|
1872 |
|
1873 |
+
<?php if (function_exists ('ai_list_rows_2')) ai_list_rows_2 ($block, $default, $obj); ?>
|
1874 |
</tbody>
|
1875 |
</table>
|
1876 |
</div>
|
2370 |
</select>
|
2371 |
</td>
|
2372 |
</tr>
|
2373 |
+
<tr>
|
2374 |
+
<td>
|
2375 |
+
<?php _e ('Wait for jQuery', 'ad-inserter'); ?>
|
2376 |
+
</td>
|
2377 |
+
<td>
|
2378 |
+
<select id="wait-for-jquery" name="wait-for-jquery" default="<?php echo DEFAULT_WAIT_FOR_JQUERY; ?>" title="<?php _e ('When enabled, Ad Inserter will wait for jQuery library to be loaded before it will run the scripts that may need it', 'ad-inserter'); ?>">
|
2379 |
+
<option value="<?php echo AI_WAIT_FOR_JQUERY_DISABLED; ?>" <?php echo get_wait_for_jquery () == AI_WAIT_FOR_JQUERY_DISABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
|
2380 |
+
<option value="<?php echo AI_WAIT_FOR_JQUERY_ENABLED; ?>" <?php echo get_wait_for_jquery () == AI_WAIT_FOR_JQUERY_ENABLED ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_ENABLED; ?></option>
|
2381 |
+
</select>
|
2382 |
+
</td>
|
2383 |
+
</tr>
|
2384 |
<tr>
|
2385 |
<td>
|
2386 |
<?php _e ('Sticky widget mode', 'ad-inserter'); ?>
|
3907 |
function code_block_list ($start, $end, $search_text, $show_all_blocks) {
|
3908 |
global $block_object, $wpdb, $ai_db_options_extract;
|
3909 |
|
3910 |
+
if (defined ('AI_SAFE_MODE') || isset ($_GET ['safe-mode'])) {
|
3911 |
+
$url_safe_mode = '&ai-safe-mode';
|
3912 |
+
} else $url_safe_mode = '';
|
3913 |
+
|
3914 |
if (isset ($_GET ["blocks-org"]) && isset ($_GET ["blocks-new"])) {
|
3915 |
$blocks_org = json_decode ($_GET ["blocks-org"]);
|
3916 |
$blocks_new = json_decode ($_GET ["blocks-new"]);
|
4088 |
$row_counter ++;
|
4089 |
$row_color = $row_counter % 2 == 0 ? '#eee' : '#fff';
|
4090 |
|
4091 |
+
$edit_url = admin_url ('options-general.php?page=ad-inserter.php') . '&start=' . (intval (($block - 1) / 16) * 16 + 1) . '&tab=' . $block . $url_safe_mode;
|
|
|
4092 |
|
4093 |
$visible_tab = $block >= $start && $block <= $end;
|
4094 |
|
4517 |
// $category_data = array_slice ($category_data, 0, $max_items);
|
4518 |
foreach ($category_data as $category) {
|
4519 |
echo " <option value='{$category->slug}'>{$category->slug} ({$category->name})</option>\n";
|
4520 |
+
|
4521 |
+
$category_to_check = get_term_by ('slug', $category->slug, 'category');
|
4522 |
+
if ($category_to_check) {
|
4523 |
+
$descendants = get_term_children ($category_to_check->term_id, 'category');
|
4524 |
+
if ($descendants) {
|
4525 |
+
// Translators: %s: category name
|
4526 |
+
echo " <option value='{$category->slug}*'>{$category->slug}* ("._x(sprintf ('%s or children', $category->name), 'Category children', 'ad-inserter').")</option>\n";
|
4527 |
+
// Translators: %s: category name
|
4528 |
+
echo " <option value='{$category->slug}+'>{$category->slug}+ ("._x(sprintf ('%s children only', $category->name), 'Category children', 'ad-inserter').")</option>\n";
|
4529 |
+
}
|
4530 |
+
}
|
4531 |
}
|
4532 |
break;
|
4533 |
|
4890 |
switch ($text = rand (1,2)) {
|
4891 |
case 1:
|
4892 |
?>
|
4893 |
+
<button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 124px; width: 124px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Review', 'Review Ad Inserter', 'ad-inserter'); ?> Ad Inserter</button>
|
4894 |
<?php
|
4895 |
break;
|
4896 |
default:
|
4897 |
?>
|
4898 |
+
<button type="button" class="ai-top-button" style="display: none; margin: -5px 0px 0px 15px; min-width; 124px; width: 124px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/#new-post')" title="<?php _e ('If you like Ad Inserter and have a moment, please help me spread the word by rating the plugin on WordPres', 'ad-inserter'); ?>"><?php _ex ('Rate', 'Rate Ad Inserter', 'ad-inserter'); ?> Ad Inserter</button>
|
4899 |
<?php
|
4900 |
break;
|
4901 |
}
|
strings.php
CHANGED
@@ -98,7 +98,7 @@ define ('AI_TEXT_CLIENT_SIDE', _x('Client-side', 'Insertion', 'ad-ins
|
|
98 |
define ('AI_TEXT_CLIENT_SIDE_SHOW', _x('Client-side show', 'Dynamic blocks', 'ad-inserter'));
|
99 |
define ('AI_TEXT_CLIENT_SIDE_INSERT', _x('Client-side insert', 'Dynamic blocks', 'ad-inserter'));
|
100 |
define ('AI_TEXT_SERVER_SIDE_W3TC', _x('Server-side using W3 Total Cache', 'Insertion', 'ad-inserter'));
|
101 |
-
define ('AI_TEXT_CLIENT_SIDE_DOM_READY', _x('Client-side when DOM ready', 'Insertion', 'ad-inserter'));
|
102 |
|
103 |
define ('AI_TEXT_PREPEND_CONTENT', __('Prepend content', 'ad-inserter'));
|
104 |
define ('AI_TEXT_APPEND_CONTENT', __('Append content', 'ad-inserter'));
|
98 |
define ('AI_TEXT_CLIENT_SIDE_SHOW', _x('Client-side show', 'Dynamic blocks', 'ad-inserter'));
|
99 |
define ('AI_TEXT_CLIENT_SIDE_INSERT', _x('Client-side insert', 'Dynamic blocks', 'ad-inserter'));
|
100 |
define ('AI_TEXT_SERVER_SIDE_W3TC', _x('Server-side using W3 Total Cache', 'Insertion', 'ad-inserter'));
|
101 |
+
//define ('AI_TEXT_CLIENT_SIDE_DOM_READY', _x('Client-side when DOM ready', 'Insertion', 'ad-inserter'));
|
102 |
|
103 |
define ('AI_TEXT_PREPEND_CONTENT', __('Prepend content', 'ad-inserter'));
|
104 |
define ('AI_TEXT_APPEND_CONTENT', __('Append content', 'ad-inserter'));
|