Ad Inserter – WordPress Ads Management with AdSense Header Integration - Version 2.3.18

Version Description

  • Added support to schedule insertion for N days after publishing
  • Added support to schedule insertion only for posts published inside/outside time period (Pro only)
  • Added support to prevent activation of free Ad Inserter while Pro is active
  • Added url parameter to show block code
  • Improved Header/Footer code debugging
  • Few minor bug fixes, cosmetic changes and code improvements
Download this release

Release Info

Developer spacetime
Plugin Icon 128x128 Ad Inserter – WordPress Ads Management with AdSense Header Integration
Version 2.3.18
Comparing to
See all releases

Code changes from version 2.3.17 to 2.3.18

Files changed (8) hide show
  1. ad-inserter.php +507 -876
  2. class.php +117 -41
  3. constants.php +17 -8
  4. css/ad-inserter.css +1 -1
  5. css/ai-admin.css +4 -1
  6. js/ad-inserter.js +17 -15
  7. readme.txt +22 -4
  8. settings.php +97 -89
ad-inserter.php CHANGED
@@ -2,17 +2,25 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.17
6
- Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
9
- Plugin URI: http://adinserter.pro/documentation
10
  */
11
 
12
  /*
13
 
14
  Change Log
15
 
 
 
 
 
 
 
 
 
16
  Ad Inserter 2.3.17 - 2018-08-03
17
  - Added shortcode for ad blocking detection action
18
  - Few minor bug fixes, cosmetic changes and code improvements
@@ -114,716 +122,12 @@ Ad Inserter 2.3.0 - 2018-01-21
114
  - Fix for errors when importing code
115
  - Few minor bug fixes, cosmetic changes and code improvements
116
 
117
- Ad Inserter 2.2.16 - 2018-01-04
118
- - Fix for error when saving settings on multisite installation
119
-
120
- Ad Inserter 2.2.15 - 2018-01-04
121
- - Fix for responsive AMP ads using center alignment
122
-
123
- Ad Inserter 2.2.14 - 2018-01-04
124
- - Added code generator for placeholders
125
- - Added option to disable caching (works with WP Super Cache, W3 Total Cache and WP Rocket)
126
- - Added shortcut option to generate only block code (no wrapping div)
127
- - Added options to configure classes for wrapping div
128
- - Added support for external tracking via Google Analytics and Piwik (Pro only)
129
- - Added support for MaxMind geolocation databases (Pro only)
130
- - Added option for close button on sticky ads (Pro only)
131
- - Fix for no paragraph counting inside nested elements
132
- - Few minor bug fixes, cosmetic changes and code improvements
133
-
134
- Ad Inserter 2.2.13 - 2017-12-25
135
- - Added option to disable inline alignment styles for code blocks (using alignment classes)
136
- - Fix for custom CSS codes with single quotation marks
137
-
138
- Ad Inserter 2.2.12 - 2017-12-25
139
- - Fix for code block styles when block class name was not set
140
-
141
- Ad Inserter 2.2.11 - 2017-12-25
142
- - Code block styles moved to classes
143
- - Code block list moved to the sidebar
144
- - Added preview buttons in code block list
145
- - Fix for ad blocking detection when using https (Pro only)
146
- - Few minor bug fixes, cosmetic changes and code improvements
147
-
148
- Ad Inserter 2.2.10 - 2017-12-10
149
- - Fix for rotation editor code import/export
150
- - Fix for errors when using old |rotate| separator
151
- - Few minor bug fixes, cosmetic changes and code improvements
152
-
153
- Ad Inserter 2.2.9 - 2017-12-09
154
- - Output buffering is now disabled by default (for position Above header you need to enable it)
155
- - Fix for min. paragraph number not processed
156
-
157
- Ad Inserter 2.2.8 - 2017-12-08
158
- - Added position for automatic insertion Above header (after `<body>` tag)
159
- - Added rotation code editor
160
- - Added support to name rotation options
161
- - Added code generator for banners
162
- - Added code generator for AdSense
163
- - Added support to rearrange code blocks
164
- - Added support to copy any block settings
165
- - Added support for clipboard to copy/paste block settings
166
- - Added option to select ad blocking detection mode (Pro only)
167
- - Delayed insertion on posts now available for all insertion positions
168
- - Few minor bug fixes, cosmetic changes and code improvements
169
-
170
- Ad Inserter 2.2.7 - 2017-11-08
171
- - Fix for duplicate amp-custom tag on AMP pages
172
-
173
- Ad Inserter 2.2.6 - 2017-11-07
174
- - Fix for posts filter counter not counting
175
- - Added list with short overview of all code blocks
176
- - Added support for word count on blog pages
177
- - Added support for client code preview (no need to save it for preview)
178
- - Improved compatibility on AMP pages
179
- - Few minor bug fixes, cosmetic changes and code improvements
180
-
181
- Ad Inserter 2.2.5 - 2017-10-15
182
- - Fix for issue with Ajax requests
183
-
184
- Ad Inserter 2.2.4 - 2017-10-14
185
- - Added support to insert raw HTTP response header lines
186
- - Added support to check for individual exceptions for shortcodes
187
- - Added support to trigger ad blocking detection action only on individual pages
188
- - Added support for automatic insertion position Footer
189
- - Added support for custom hooks
190
- - Url parameter list now checks url parameters ($_GET) and cookies ($_COOKIE)
191
- - Fix for |count| separator not processed
192
-
193
- Ad Inserter 2.2.3 - 2017-09-26
194
- - Added support to insert custom fields via shortcode [adinserter custom-field='CUSTOM_FIELD_NAME']
195
- - Added support for user:USERNAME and user-role:USER_ROLE taxonomy list items
196
- - Added support for post-type:POST_TYPE taxonomy list items
197
- - Added support for JavaScript based sticky widgets
198
- - Added support for ad blocking statistics (Pro only)
199
- - Added support for WP AMP and WP AMP Ninja plugins
200
- - Post/Page Word Count moved to Misc section (now works also on widgets)
201
- - Few minor bug fixes, cosmetic changes and code improvements
202
-
203
- Ad Inserter 2.2.2 - 2017-08-28
204
- - Fix for mobile admin layout
205
- - Few other minor bug fixes
206
-
207
- Ad Inserter 2.2.1 - 2017-08-27
208
- - Fix for header/footer scripts on AMP pages
209
-
210
- Ad Inserter 2.2.0 - 2017-08-27
211
- - Added support for ad blocking detection (experimental)
212
- - Added support for [ADINSERTER AMP] shortcode to separate code for AMP pages
213
- - Added support for [ADINSERTER ROTATE] and [ADINSERTER COUNT] shortcodes
214
- - Added syntax highlighting for shortcodes and separators
215
- - Added style `clear: both;` to Default, Left, Right and Center alignments
216
- - Bug fix for errors when loading tracking charts (Pro only)
217
- - Many minor bug fixes, cosmetic changes and code improvements
218
-
219
- Ad Inserter 2.1.14 - 2017-08-07
220
- - Fix for error when using older PHP versions (prior to 5.5)
221
-
222
- Ad Inserter 2.1.13 - 2017-08-07
223
- - Fix for Fatal error: Can't use method return value in write context
224
-
225
- Ad Inserter 2.1.12 - 2017-08-07
226
- - Added option to define tags inside which paragraphs are not counted
227
- - Added max insertions check when inserting for all paragraphs
228
- - Added support for inverted filter
229
- - Added option to define minimum number of words in paragraphs above (experimental)
230
- - Added support for %N filter item to filter every N-th insertion (experimental)
231
- - Added filter support when inserting for all paragraphs (experimental)
232
- - Increased nonce lifespan to 48 hours when using tracking (Pro only)
233
- - Fixed wrong urls in debug menu when behind proxy
234
-
235
- Ad Inserter 2.1.11 - 2017-07-21
236
- - Improved support for sticky widgets
237
- - Added support for ad counting (|count| separator)
238
- - Added support to black/white-list arbitrary taxonomies (taxonomy, term or taxonomy:term)
239
- - Added support for automatic insertion before, between and after comments
240
- - Added processing of shortcodes in the header and footer code
241
- - Debugging function Show positions shows also page type
242
- - Fixed page type detection when Post page was set to static page and it was not homepage
243
- - Few minor bug fixes, cosmetic changes and code improvements
244
-
245
- Ad Inserter 2.1.10 - 2017-07-01
246
- - Fix for shifted sidebars in some themes
247
-
248
- Ad Inserter 2.1.9 - 2017-06-30
249
- - Added support for sticky widgets
250
- - Added support to insert code after images (Automatic Insertion: After Paragraph, Paragraphs with tags: img)
251
- - Impression and click tracking (beta, Pro only)
252
- - Few minor bug fixes, cosmetic changes and code improvements
253
-
254
- Ad Inserter 2.1.8 - 2017-05-18
255
- - Fixed error when using server-side device detection
256
-
257
- Ad Inserter 2.1.7 - 2017-05-13
258
- - Fixed error when using PHP 5.4 or earlier
259
-
260
- Ad Inserter 2.1.6 - 2017-05-12
261
- - Added support for insertion before/after multiple paragraphs
262
- - Added initial support for impression and click tracking (Pro only)
263
- - Few bug fixes and cosmetic changes
264
-
265
- Ad Inserter 2.1.5 - 6 April 2017
266
- - Added support to avoid insertion inside <figure> and <li> elements (image captions, lists)
267
- - Added support for exceptions for custom post types
268
- - Few minor bug fixes and code improvements
269
-
270
- Ad Inserter 2.1.4 - 12 March 2017
271
- - Paragraph counting restored to standard functions
272
- - Added option to select paragraph counting functions with multibyte support (unicode characters)
273
- - Fixed bug for wrong paragraph counting in posts with blockquote sections in some cases
274
- - Fixed bug for wrong measuring of plugin processing time in some cases
275
- - Fixed bug for "Empty delimiter" warning
276
-
277
- Ad Inserter 2.1.3 - 11 March 2017
278
- - Added support for counting paragraphs with multibyte (unicode) characters
279
- - Fixed bug for class name not saved
280
- - Few minor bug fixes and cosmetic changes
281
-
282
- Ad Inserter 2.1.2 - 1 March 2017
283
- - Fixed bug for disabled settings page on multisite blogs
284
-
285
- Ad Inserter 2.1.1 - 26 February 2017
286
- - Changes for compatibility with PHP 7.1
287
- - Automatic rename of old pro plugin slug (Pro only)
288
- - Added support for additional Pro features (Pro only)
289
- - Few bug fixes and cosmetic changes
290
-
291
- Ad Inserter 2.1.0 - 10 February 2017
292
- - Added support to insert ads in Ajax requests (e.g. in infinite scroll)
293
- - Added support to not include block classes when class name is empty
294
- - Added sticky positions (Pro only)
295
- - Bug fix for minimum user role not taken into account for exceptions list
296
- - Bug fix for IP database update cron event (Pro only)
297
-
298
- Ad Inserter 2.0.14 - 2 February 2017
299
- - Fixed issue for responsive ads not displayed when using Left, Center or Right alignment
300
-
301
- Ad Inserter 2.0.13 - 1 February 2017
302
- - Added icons for Automatic insertion and alignment
303
- - Automatic insertion None changed to Disabled
304
- - Alignment None changed to Default
305
- - Changed database option data for Automatic insertion and Alignment settings
306
- - Improved CSS 3 code for Left, Center and Right alignment
307
- - Click on CSS code starts editing
308
- - Page/Post exceptions listed in debug output
309
- - Different plugin slug for Pro version
310
- - Few minor bug fixes and cosmetic changes
311
-
312
- Ad Inserter 2.0.12 - 29 January 2017
313
- - Bug fix for page/post exceptions list
314
-
315
- Ad Inserter 2.0.11 - 29 January 2017
316
- - Bug fix for settings page not loading
317
-
318
- Ad Inserter 2.0.10 - 26 January 2017
319
- - Added option to insert ads between posts on blog pages
320
- - Added option to check and manage post/page exceptions for each block
321
- - Added option to check and manage all post/page exceptions (Pro only)
322
- - Added option for multisite installations to disable PHP processing on sub-sites (Pro only)
323
- - Added license status notifications (Pro only)
324
-
325
- Ad Inserter 2.0.9 - 8 January 2017
326
- - Added support for uppercase {country_ISO2} and lowercase {country_iso2} tag (Pro only)
327
- - Removed inclusion of dummy css and js file
328
- - Bug fix: Client-side dynamic blocks were not enabled if not using W3 Total Cache
329
-
330
- Ad Inserter 2.0.8 - 6 January 2017
331
- - Added support for client-side rotation (works with caching)
332
- - Added support for server-side rotation with W3 Total Cache
333
- - Added support for client-side country detection (works with caching, Pro only)
334
- - Added support for server-side country detection with W3 Total Cache (Pro only)
335
- - Added debugging functions to measure plugin processing time
336
- - Added option to black/white-list IP addresses (Pro only)
337
- - Added option for fallback code when scheduling between dates expires (Pro only)
338
- - On multisite installations Ad Inserter debug menu item on sites is available only if settings page is enabled
339
- - Added option for multisite installations to use Ad Inserter settings of main site for all blogs
340
- - Added flags to country list (Pro only)
341
- - Bug fix: Code preview did not work if Wordpress was installed in a folder
342
- - Few minor bug fixes and cosmetic changes
343
-
344
- Ad Inserter 2.0.7 - 23 December 2016
345
- - Delayed display moved to Misc group
346
- - Added option for scheduling to insert code only between specified dates (Pro only)
347
- - Added option for Geo targeting (Pro only)
348
- - Few minor bug fixes and cosmetic changes
349
-
350
- Ad Inserter 2.0.6 - 25 November 2016
351
- - Added support to filter subpages created by the <!--nextpage--> tag
352
- - Added option to import block name (Pro only)
353
- - Cookie deleted only when it exists and debugging is disabled
354
- - Few minor bug fixes
355
-
356
- Ad Inserter 2.0.5 - 8 october 2016
357
- - Cookie created only when debugging is enabled
358
- - Few minor bug fixes
359
-
360
- Ad Inserter 2.0.4 - 30 September 2016
361
- - Bug fix: Cursor position always at the end of block name
362
- - State of debugging functions saved to cookie
363
- - Few minor bug fixes
364
-
365
- Ad Inserter 2.0.3 - 26 September 2016
366
- - Debugging functions in admin toolbar available only for administrators
367
- - Added option to hide debugging functions in admin toolbar
368
- - Added shortcode for debugger
369
- - Few minor bug fixes
370
-
371
- Ad Inserter 2.0.2 - 25 September 2016
372
- - Changed javascript version check to get plugin version from the HTML page
373
- - Added warning if old cached version of CSS file is loaded on the settings page
374
- - Added warning if version query parameter for js/css files is removed due to inappropriate caching
375
-
376
- Ad Inserter 2.0.1 - 24 September 2016
377
- - Bug fix: Shortcodes called by name were not displayed
378
-
379
- Ad Inserter 2.0.0 - 23 September 2016
380
- - Redesigned user interface
381
- - Added many debugging tools for easier troubleshooting
382
- - New feature: Code preview tool with visual CSS editor
383
- - New feature: Label inserted blocks
384
- - New feature: Show available positions for automatic insertion
385
- - New feature: Show HTML tags in posts/static pages
386
- - New feature: Log Ad Inserter processing
387
- - Improved loading speed of the settings page
388
- - Improved block insertion processing speed
389
- - Added support to avoid insertion near images, headers and other elements
390
- - Added option to avoid insertion in feeds
391
- - Added option to display code blocks only to administrators
392
- - Added option for publishig date check for display positions Before/After Content
393
- - Added option for server-side device check for header and footer code
394
- - Added option for maximum page/post words
395
- - Added option for maximum paragraph words
396
- - Added option to black/white-list post IDs
397
- - Added option to black/white-list url query parameters
398
- - Added warning if the settings page is blocked by ad blocker
399
- - Added warning if old cached version of javascript is loaded on the settings page
400
- - Added support for multisite installations to disable settings, widgets and exceptions on network sites (Pro only)
401
- - Block names can be edited by clicking on the name
402
- - Filters now work also on posts and single pages
403
- - CSS code for client-side detection moved to inline CSS
404
- - Bug fix: Minimum user roles for exception editing was not calculated properly
405
- - Bug fix: Server-side detection checkbox was not saved properly
406
- - Many other minor bug fixes, code improvements and cosmetic changes
407
-
408
- Ad Inserter 1.7.0 - 16 August 2016
409
- - Bug fix: Shortcodes did not ignore post/static page exceptions
410
- - Slightly redesigned user interface
411
- - Excerpt/Post number(s) renamed to Filter as it now works on all display positions
412
- - Widget setting removed from Automatic display to Manual display section
413
- - Added support to disable widgets (standalone checkbox in Manual display)
414
- - Added call counter/filter for widgets
415
- - Added support to edit CSS for predefined styles
416
- - Few other minor bug fixes, code improvements and cosmetic changes
417
-
418
- Ad Inserter 1.6.7 - 9 August 2016
419
- - Bug fix: Block code textarea was not escaped
420
- - Added checks for page types for shortcodes
421
- - Added support for Before/After Post position call counter/filter
422
- - Few minor cosmetic changes
423
-
424
- Ad Inserter 1.6.6 - 5 August 2016
425
- - Bug fix: Display on Homepage and other blog pages might get disabled - important if you were using PHP function call or shortcode (import of settings from 1.6.4)
426
- - Few minor cosmetic changes
427
- - Requirements changed to WordPress 4.0 or newer
428
- - Added initial support for Pro version
429
-
430
- Ad Inserter 1.6.5 - 1 August 2016
431
- - Fixed bug: Wrong counting of max insertions
432
- - Change: display position Before Title was renamed to Before Post
433
- - Added support for display position After Post
434
- - Added support for posts with no <p> tags (paragraphs separated with \r\n\r\n characters)
435
- - Added support for paragraph processing on homepage, category, archive and search pages
436
- - Added support for custom viewports
437
- - Added support for PHP function call counter
438
- - Added support to disable code block on error 404 pages
439
- - Added support to debug paragraph tags
440
-
441
- Ad Inserter 1.6.4 - 15 May 2016
442
- - Fixed bug: For shortcodes in posts the url was not checked
443
- - Optimizations for device detection
444
-
445
- Ad Inserter 1.6.3 - 6 April 2016
446
- - Removed deprecated code (fixes PHP 7 deprecated warnings)
447
- - Added support for paragraphs with div and other HTML tags (h1, h2, h3,...)
448
-
449
- Ad Inserter 1.6.2 - 2 April 2016
450
- - Removed deprecated code (fixes PHP Fatal error Call to a member function get_display_type)
451
- - Added support to change plugin processing priority
452
-
453
- Ad Inserter 1.6.1 - 28 February 2016
454
- - Fixed bug: For shortcodes in posts the date was not checked
455
- - Fixed error with some templates "Call to undefined method is_main_query()"
456
- - Added support for minumum number of page/post words for Before/After content display option
457
- - Added support for {author} and {author_name} tags
458
-
459
- Ad Inserter 1.6.0 - 9 January 2016
460
- - Added support for client-side device detection
461
- - Many code improvements
462
- - Improved plugin processing speed
463
- - Removed support for deprecated tags for manual insertion {adinserter n}
464
- - Few minor bug fixes
465
-
466
- Ad Inserter 1.5.8 - 20 December 2015
467
- - Fixed notice "Undefined index: adinserter_selected_block_" when saving page or post
468
-
469
- Ad Inserter 1.5.7 - 20 December 2015
470
- - Fixed notice "has_cap was called with an argument that is deprecated since version 2.0!"
471
- - Few minor bug fixes and code improvements
472
- - Added support to blacklist or whitelist url patterns: /url-start*. *url-pattern*, *url-end
473
- - Added support to define minimum number of words in paragraphs
474
- - Added support to define minimum user role for page/post Ad Inserter exceptions editing
475
- - Added support to limit insertions of individual code blocks
476
- - Added support to filter direct visits (no referer)
477
-
478
- Ad Inserter 1.5.6 - 14 August 2015
479
- - Fixed Security Vulnerability: Plugin was vulnerable to Cross-Site Scripting (XSS)
480
- - Few bug fixes and code improvements
481
-
482
- Ad Inserter 1.5.5 - 6 June 2015
483
- - Few bug fixes and code improvements
484
- - Added support to export and import all Ad Inserter settings
485
-
486
- Ad Inserter 1.5.4 - 31 May 2015
487
- - Many code optimizations and cosmetic changes
488
- - Header and Footer code blocks moved to settings tab (#)
489
- - Added support to process shortcodes of other plugins used in Ad Inserter code blocks
490
- - Added support to white-list or black-list individual urls
491
- - Added support to export and import settings for code blocks
492
- - Added support to specify excerpts for block insertion
493
- - Added support to specify text that must be present when counting paragraphs
494
-
495
- Ad Inserter 1.5.3 - 2 May 2015
496
- - Fixed Security Vulnerability: Plugin was vulnerable to a combination of CSRF/XSS attacks (credits to Kaustubh Padwad)
497
- - Fixed bug: In some cases deprecated widgets warning reported errors
498
- - Added support to white-list or black-list tags
499
- - Added support for category slugs in category list
500
- - Added support for relative paragraph positions
501
- - Added support for individual code block exceptions on post/page editor page
502
- - Added support for minimum number of words
503
- - Added support to disable syntax highlighting editor (to allow using copy/paste on mobile devices)
504
-
505
- Ad Inserter 1.5.2 - 15 March 2015
506
- - Fixed bug: Widget titles might be displayed at wrong sidebar positions
507
- - Change: Default code block CSS class name was changed from ad-inserter to code-block to prevent Ad Blockers from blocking Ad Inserter divs
508
- - Added warning message if deprecated widgets are used
509
- - Added support to display blocks on desktop + tablet and desktop + phone devices
510
-
511
- Ad Inserter 1.5.1 - 3 March 2015
512
- - Few fixes to solve plugin incompatibility issues
513
- - Added support to disable all ads on specific page
514
-
515
- Ad Inserter 1.5.0 - 2 March 2015
516
- - Added support to display blocks on all, desktop or mobile devices
517
- - Added support for new widgets API - one widget for all code blocks with multiple instances
518
- - Added support to change wrapping code CSS class name
519
- - Fixed bug: Display block N days after post is published was not working properly
520
- - Fixed bug: Display block after paragraph in some cases was not working propery
521
-
522
- Ad Inserter 1.4.1 - 29 December 2014
523
- - Fixed bug: Code blocks configured as widgets were not displayed properly on widgets admin page
524
-
525
- Ad Inserter 1.4.0 - 21 December 2014
526
- - Added support to skip paragraphs with specified text
527
- - Added position After paragraph
528
- - Added support for header and footer scripts
529
- - Added support for custom CSS styles
530
- - Added support to display blocks to all, logged in or not logged in users
531
- - Added support for syntax highlighting
532
- - Added support for shortcodes
533
- - Added classes to block wrapping divs
534
- - Few bugs fixed
535
-
536
- Ad Inserter 1.3.5 - 18 March 2014
537
- - Fixed bug: missing echo for PHP function call example
538
-
539
- Ad Inserter 1.3.4 - 15 March 2014
540
- - Added option for no code wrapping with div
541
- - Added option to insert block codes from PHP code
542
- - Changed HTML codes to disable display on specific pages
543
- - Selected code block position is preserved after settings are saved
544
- - Manual insertion can be enabled or disabled regardless of primary display setting
545
- - Fixed bug: in some cases Before Title display setting inserted code into RSS feed
546
-
547
- Ad Inserter 1.3.3 - 8 January 2014
548
- - Added option to insert ads also before or after the excerpt
549
- - Fixed bug: in some cases many errors reported after activating the plugin
550
- - Few minor bugs fixed
551
- - Few minor cosmetic changes
552
-
553
- Ad Inserter 1.3.2 - 4 December 2013
554
- - Fixed blank settings page caused by incompatibility with some themes or plugins
555
-
556
- Ad Inserter 1.3.1 - 3 December 2013
557
- - Added option to insert ads also on pages
558
- - Added option to process PHP code
559
- - Few bugs fixed
560
-
561
- Ad Inserter 1.3.0 - 27 November 2013
562
- - Number of ad slots increased to 16
563
- - New tabbed admin interface
564
- - Ads can be manually inserted also with {adinserter AD_NUMBER} tag
565
- - Fixed bug: only the last ad block set to Before Title was displayed
566
- - Few other minor bugs fixed
567
- - Few cosmetic changes
568
-
569
- Ad Inserter 1.2.1 - 19 November 2013
570
- - Fixed problem: || in ad code (e.g. asynchronous code for AdSense) causes only part of the code to be inserted (|| to rotate ads is replaced with |rotate|)
571
-
572
- Ad Inserter 1.2.0 - 15/05/2012
573
- - Fixed bug: manual tags in posts lists were not removed
574
- - Added position Before title
575
- - Added support for minimum number of paragraphs
576
- - Added support for page display options for Widget and Before title positions
577
- - Alignment now works for all display positions
578
-
579
- Ad Inserter 1.1.3 - 07/04/2012
580
- - Fixed bug for {search_query}: When the tag is empty {smart_tag} is used in all cases
581
- - Few changes in the settings page
582
-
583
- Ad Inserter 1.1.2 - 16/07/2011
584
- - Fixed error with multisite/network installations
585
-
586
- Ad Inserter 1.1.1 - 16/07/2011
587
- - Fixed bug in Float Right setting display
588
-
589
- Ad Inserter 1.1.0 - 05/06/2011
590
- - Added option to manually display individual ads
591
- - Added new ad alignments: left, center, right
592
- - Added {search_query} tag
593
- - Added support for category black list and white list
594
-
595
- Ad Inserter 1.0.4 - 19/12/2010
596
- - HTML entities for {title} and {short_title} are now decoded
597
- - Added {tag} to display the first tag
598
-
599
- Ad Inserter 1.0.3 - 05/12/2010
600
- - Fixed bug for rotating ads
601
-
602
- Ad Inserter 1.0.2 - 04/12/2010
603
- - Added support for rotating ads
604
-
605
- Ad Inserter 1.0.1 - 17/11/2010
606
- - Added support for different sidebar implementations
607
-
608
- Ad Inserter 1.0.0 - 14/11/2010
609
- - Initial release
610
-
611
  */
612
 
613
 
614
- global $block_object, $ai_wp_data, $ad_inserter_globals, $ai_last_check, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_db_options, $block_insertion_log;
615
-
616
- if (!defined ('AD_INSERTER_PLUGIN_DIR'))
617
- define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
618
-
619
- define ('AI_WP_DEBUGGING_', 0);
620
- define ('AI_DEBUG_PROCESSING_', 0x01);
621
- define ('AI_URL_DEBUG_', 'ai-debug');
622
- define ('AI_URL_DEBUG_PROCESSING_', 'ai-debug-processing');
623
- define ('AI_URL_DEBUG_PHP_', 'ai-debug-php');
624
-
625
- if (isset ($_GET [AI_URL_DEBUG_PHP_]) && $_GET [AI_URL_DEBUG_PHP_] != '') {
626
- if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
627
- ini_set ('display_errors', 1);
628
- error_reporting (E_ALL);
629
- }
630
- }
631
-
632
- $ai_wp_data [AI_WP_DEBUGGING_] = 0;
633
-
634
- if (!is_admin()) {
635
- if (!isset ($_GET [AI_URL_DEBUG_]))
636
- if (isset ($_GET [AI_URL_DEBUG_PROCESSING_]) || (isset ($_COOKIE ['AI_WP_DEBUGGING']) && ($_COOKIE ['AI_WP_DEBUGGING'] & AI_DEBUG_PROCESSING_) != 0)) {
637
- if (!isset ($_GET [AI_URL_DEBUG_PROCESSING_]) || $_GET [AI_URL_DEBUG_PROCESSING_] == 1) {
638
- $ai_wp_data [AI_WP_DEBUGGING_] |= AI_DEBUG_PROCESSING_;
639
-
640
- $ai_total_plugin_time = 0;
641
- $start_time = microtime (true);
642
- $ai_total_php_time = 0;
643
- $ai_last_time = microtime (true);
644
- $ai_processing_log = array ();
645
- ai_log ("INITIALIZATION START");
646
- }
647
- }
648
- }
649
-
650
- // Version check
651
- global $wp_version, $version_string;
652
-
653
- if (version_compare ($wp_version, "4.0", "<")) {
654
- exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
655
- }
656
-
657
- //include required files
658
- require_once AD_INSERTER_PLUGIN_DIR.'class.php';
659
- require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
660
- require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
661
-
662
-
663
- $version_array = explode (".", AD_INSERTER_VERSION);
664
- $version_string = "";
665
- foreach ($version_array as $number) {
666
- $version_string .= sprintf ("%02d", $number);
667
- }
668
-
669
- $ai_wp_data [AI_WP_URL] = remove_debug_parameters_from_url ();
670
-
671
- $ad_inserter_globals = array ();
672
- $block_object = array ();
673
- $block_insertion_log = array ();
674
-
675
- $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
676
- $ai_wp_data [AI_WP_AMP_PAGE] = false;
677
- $ai_wp_data [AI_WP_USER_SET] = false;
678
- $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
679
- $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
680
-
681
- $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
682
- $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
683
- $ai_wp_data [AI_TRACKING] = false;
684
- $ai_wp_data [AI_STICKY_WIDGETS] = false;
685
- $ai_wp_data [AI_STICK_TO_THE_CONTENT] = false;
686
- $ai_wp_data [AI_ANIMATION] = false;
687
- $ai_wp_data [AI_CLOSE_BUTTONS] = false;
688
- $ai_wp_data [AI_DISABLE_CACHING] = false;
689
- $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
690
- $ai_wp_data [AI_LAZY_LOADING] = false;
691
- $ai_wp_data [AI_PAGE_BLOCKS] = 0;
692
- $ai_wp_data [AI_GEOLOCATION] = false;
693
-
694
- ai_load_settings ();
695
-
696
- $ai_wp_data [AI_BACKEND_JS_DEBUGGING] = get_backend_javascript_debugging ();
697
- $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] = get_frontend_javascript_debugging ();
698
-
699
- if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] == '1') {
700
- if (get_remote_debugging ()) {
701
- ini_set ('display_errors', 1);
702
- error_reporting (E_ALL);
703
- }
704
- }
705
-
706
- if (isset ($_GET [AI_URL_DEBUG_JAVASCRIPT]) && $_GET [AI_URL_DEBUG_JAVASCRIPT] == '1') {
707
- if (get_remote_debugging ()) {
708
- $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] = true;
709
- }
710
- }
711
-
712
- if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
713
- $ai_wp_data [AI_ADB_DETECTION] = $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ();
714
-
715
- if ($ai_wp_data [AI_ADB_DETECTION]) {
716
- $adb_2_name = AI_ADB_2_DEFAULT_NAME;
717
- define ('AI_ADB_COOKIE_VALUE', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY.md5 (NONCE_KEY)))), 0, 8));
718
-
719
- $script_path = AD_INSERTER_PLUGIN_DIR.'js';
720
- $script = $script_path.'/sponsors.js';
721
-
722
- if (is_writable ($script_path) && is_writable ($script)) {
723
- $adb_2_name = substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY).md5 (NONCE_KEY))), 0, 8);
724
-
725
- $js_ok = false;
726
- if (file_exists ($script)) {
727
- if (strpos (file_get_contents ($script), $adb_2_name) !== false) $js_ok = true;
728
- }
729
-
730
- if (!$js_ok) {
731
- file_put_contents ($script, 'window.' . $adb_2_name . '=true;');
732
- define ('AI_ADB_2_FILE_RECREATED', true);
733
- }
734
- }
735
-
736
- define ('AI_ADB_2_NAME', $adb_2_name);
737
-
738
- if (function_exists ('ai_check_files')) ai_check_files ();
739
- }
740
- }
741
-
742
- if (function_exists ('ai_load_globals')) ai_load_globals ();
743
-
744
- if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC) {
745
- if (!in_array ('w3-total-cache/w3-total-cache.php', get_option ('active_plugins'))) {
746
- define ('AI_NO_W3TC', true);
747
- if (!defined ('W3TC_DYNAMIC_SECURITY')) define ('W3TC_DYNAMIC_SECURITY', 'W3 Total Cache plugin not active');
748
- }
749
- if (!defined ('W3TC_DYNAMIC_SECURITY')) {
750
- $string = AD_INSERTER_PLUGIN_DIR;
751
- if (defined ('AUTH_KEY')) $string .= AUTH_KEY;
752
- if (defined ('LOGGED_IN_KEY')) $string .= LOGGED_IN_KEY;
753
-
754
- define ('W3TC_DYNAMIC_SECURITY', md5 ($string));
755
- }
756
- }
757
-
758
-
759
- //$adH = $block_object [AI_HEADER_OPTION_NAME];
760
- //$adF = $block_object [AI_FOOTER_OPTION_NAME];
761
- //if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
762
- //if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
763
-
764
- if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
765
- require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
766
-
767
- $detect = new ai_Mobile_Detect;
768
-
769
- define ('AI_MOBILE', $detect->isMobile ());
770
- define ('AI_TABLET', $detect->isTablet ());
771
- define ('AI_PHONE', AI_MOBILE && !AI_TABLET);
772
- define ('AI_DESKTOP', !AI_MOBILE);
773
- } else {
774
- define ('AI_MOBILE', true);
775
- define ('AI_TABLET', true);
776
- define ('AI_PHONE', true);
777
- define ('AI_DESKTOP', true);
778
- }
779
-
780
- if (isset ($_POST [AI_FORM_SAVE]))
781
- define ('AI_SYNTAX_HIGHLIGHTING', isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] != AI_OPTION_DISABLED); else
782
- define ('AI_SYNTAX_HIGHLIGHTING', get_syntax_highlighter_theme () != AI_OPTION_DISABLED);
783
-
784
-
785
- add_action ('wp_loaded', 'ai_wp_loaded_hook');
786
- add_action ('admin_menu', 'ai_admin_menu_hook');
787
- add_action ('init', 'ai_init_hook');
788
- add_action ('admin_notices', 'ai_admin_notice_hook');
789
- add_action ('wp', 'ai_wp_hook');
790
- add_action( 'wp_enqueue_scripts', 'ai_wp_enqueue_scripts_hook' );
791
-
792
- if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
793
-
794
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output)
795
- add_action ('shutdown', 'ai_shutdown_hook');
796
-
797
- add_action ('widgets_init', 'ai_widgets_init_hook');
798
- add_action ('add_meta_boxes', 'ai_add_meta_box_hook');
799
- add_action ('save_post', 'ai_save_meta_box_data_hook');
800
-
801
- if (function_exists ('ai_hooks')) ai_hooks ();
802
-
803
- add_filter ('plugin_action_links_'.plugin_basename (__FILE__), 'ai_plugin_action_links');
804
- add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 10, 2);
805
-
806
- if (is_admin () === true) {
807
- add_action ('wp_ajax_ai_ajax_backend', 'ai_ajax_backend');
808
- add_action ('wp_ajax_ai_ajax', 'ai_ajax');
809
- add_action ('wp_ajax_nopriv_ai_ajax', 'ai_ajax');
810
- }
811
-
812
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
813
- $ai_total_plugin_time += microtime (true) - $start_time;
814
- ai_log ("INITIALIZATION END\n");
815
- }
816
-
817
-
818
-
819
-
820
- //add_filter ('the_generator', 'ai_the_generator');
821
-
822
- //function ai_the_generator ($generator) {
823
- // return preg_replace ('/content="(.*?)"/', 'content="$1, '.AD_INSERTER_NAME.' '. AD_INSERTER_VERSION.'"', $generator);
824
- //}
825
-
826
 
 
827
 
828
 
829
  function ai_wp_default_editor () {
@@ -1084,7 +388,7 @@ function ai_log_message ($message) {
1084
  function ai_log_filter_content ($content_string) {
1085
 
1086
  $content_string = preg_replace ("/\[\[AI_[A|B]P([\d].?)\]\]/", "", $content_string);
1087
- return str_replace (array ("<!--", "-->", "\n", "\r"), array ("[!--", "--]", "*n", "*r"), $content_string);
1088
  }
1089
 
1090
  function ai_log_content (&$content) {
@@ -1092,6 +396,17 @@ function ai_log_content (&$content) {
1092
  ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).' words]');
1093
  }
1094
 
 
 
 
 
 
 
 
 
 
 
 
1095
  function ai_block_insertion_status ($block, $ai_last_check) {
1096
  global $block_object;
1097
 
@@ -2257,6 +1572,7 @@ function ai_admin_notice_hook () {
2257
  $used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
2258
 
2259
  $notice_option = get_option ('ai-notice-review');
 
2260
  if ($notice_option === false && $ai_wp_data [AI_DAYS_SINCE_INSTAL] >= 40) $notice_option = 'later';
2261
 
2262
  if (($notice_option === false && $used_blocks >= 2 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 20 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] < 40) ||
@@ -2280,13 +1596,16 @@ function ai_admin_notice_hook () {
2280
  <p><?php echo $message; ?>
2281
  I would really appreciate it if you could give the plugin a 5-star rating on WordPres.<br />
2282
  Positive reviews are a great incentive to fix bugs and to add new features for better monetization of your website.
2283
- Thank you! - Igor
2284
  </p>
2285
  </div>
2286
  <div class="ai-notice-element ai-notice-buttons last">
2287
- <button class="button-primary ai-notice-dismiss" data-notice="yes">
2288
- <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/" class="ai-notice-dismiss" target="_blank" data-notice="yes">Rate Ad Inserter</a>
2289
- </button>
 
 
 
2290
  <?php echo $option; ?>
2291
  <div class="ai-notice-text-button ai-notice-dismiss" data-notice="already">I already did.</div>
2292
  </div>
@@ -2582,14 +1901,13 @@ function ai_header_noindex () {
2582
  }
2583
  }
2584
 
2585
- function get_header_footer_debug_block ($name, $title, $code, $javascript = false) {
2586
- $message = '';
2587
  if (strpos ($code, 'enable_page_level_ads') !== false)
2588
  $message = 'Code for <a style="text-decoration: none; color: #fff; font-weight: bold; box-shadow: none;" href="https://adinserter.pro/adsense-ads#auto-ads" target="_blank">AdSense Auto Ads</a> detected - Code will automatically insert AdSense ads at optimal positions ';
2589
 
2590
  $debug_script = new ai_block_labels ('ai-debug-script');
2591
  $debug_block_start = $debug_script->block_start ();
2592
- $debug_block_start .= $debug_script->bar ($name, '', $message, $title);
2593
  if ($javascript) $debug_block_start = str_replace (array ('"', "\n", "\r"), array ("'", "\\n", ''), $debug_block_start);
2594
 
2595
  $debug_block_end = $debug_script->block_end ();
@@ -2598,7 +1916,10 @@ function get_header_footer_debug_block ($name, $title, $code, $javascript = fals
2598
  $html_code = htmlspecialchars ($code);
2599
  if ($javascript) $html_code = str_replace (array ("\n", "\r"), array ("\\n", ''), $html_code);
2600
 
2601
- return $debug_block_start . "<pre class='ai-debug-code'>". $html_code . "</pre>" . $debug_block_end;
 
 
 
2602
  }
2603
 
2604
  function ai_http_header () {
@@ -2643,33 +1964,43 @@ function ai_wp_head_hook () {
2643
 
2644
  add_head_inline_styles_and_scripts ();
2645
 
2646
- $header_code = null;
2647
 
2648
- $obj = $block_object [AI_HEADER_OPTION_NAME];
2649
- // $obj->clear_code_cache (); // cleared at ai_http_header
2650
 
2651
- if ($obj->get_enable_manual ()) {
2652
- if ($obj->check_server_side_detection ()) {
2653
- if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_404 || $obj->get_enable_404()) {
2654
- $header_code = '';
2655
 
2656
- $processed_code = do_shortcode ($obj->ai_getCode ());
2657
 
2658
- if (strpos ($processed_code, AD_HTTP_SEPARATOR) !== false) {
2659
- $codes = explode (AD_HTTP_SEPARATOR, $processed_code);
2660
- $processed_code = ltrim ($codes [1]);
2661
- }
2662
 
2663
- if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
2664
- $codes = explode (AD_AMP_SEPARATOR, $processed_code);
2665
- $processed_code = $codes [0];
2666
- } elseif ($ai_wp_data [AI_WP_AMP_PAGE]) $processed_code = '';
2667
 
2668
- $header_code = $processed_code;
2669
 
2670
- echo $processed_code;
 
 
 
 
 
 
 
 
 
 
 
2671
  }
2672
- }
2673
  }
2674
 
2675
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
@@ -2693,10 +2024,28 @@ function ai_wp_head_hook () {
2693
  </script>\n";
2694
  }
2695
 
2696
- if ($header_code !== null && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2697
  echo "<script>\n";
2698
  echo " jQuery(document).ready(function($) {
2699
- $('body').prepend (\"" . get_header_footer_debug_block (' Header code ', '&lt;head&gt;...&lt;/head&gt;', $header_code, true) . "\");
2700
  });
2701
  </script>\n";
2702
  }
@@ -2761,6 +2110,11 @@ function ai_amp_head_hook () {
2761
  $codes = explode (AD_AMP_SEPARATOR, $processed_code);
2762
  $processed_code = ltrim ($codes [1]);
2763
  echo $processed_code;
 
 
 
 
 
2764
  }
2765
  }
2766
  }
@@ -2817,27 +2171,38 @@ function ai_wp_footer_hook () {
2817
  if ($ai_wp_data [AI_DISABLE_CACHING]) ai_disable_caching ();
2818
 
2819
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
2820
- $footer_code = null;
2821
 
2822
  $footer = $block_object [AI_FOOTER_OPTION_NAME];
2823
  $footer->clear_code_cache ();
2824
 
2825
  if ($footer->get_enable_manual ()) {
2826
- if ($footer->check_server_side_detection ()) {
2827
- if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_404 || $footer->get_enable_404()) {
2828
- $footer_code = '';
2829
- $processed_code = do_shortcode ($footer->ai_getCode ());
2830
 
2831
- if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
2832
- $codes = explode (AD_AMP_SEPARATOR, $processed_code);
2833
- $processed_code = $codes [0];
2834
- } elseif ($ai_wp_data [AI_WP_AMP_PAGE]) $processed_code = '';
 
 
2835
 
2836
- $footer_code = $processed_code;
2837
 
2838
- echo $processed_code;
 
 
 
 
 
 
 
 
 
 
 
2839
  }
2840
- }
2841
  }
2842
 
2843
  if (!(defined ('DOING_AJAX') && DOING_AJAX)) {
@@ -2848,8 +2213,8 @@ function ai_wp_footer_hook () {
2848
  echo get_page_type_debug_info () , "\n";
2849
  }
2850
 
2851
- if ($footer_code !== null && ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0) {
2852
- echo get_header_footer_debug_block (' Footer code ', '...&lt;/body&gt;', $footer_code);
2853
  }
2854
 
2855
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
@@ -2976,6 +2341,7 @@ function ai_write_debug_info ($write_processing_log = false) {
2976
  switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
2977
  case AI_PT_STATIC:
2978
  case AI_PT_POST:
 
2979
  echo 'ID: ', get_the_ID(), "\n";
2980
  echo 'POST TYPE: ', get_post_type (), "\n";
2981
  $category_data = get_the_category();
@@ -3117,8 +2483,8 @@ function ai_write_debug_info ($write_processing_log = false) {
3117
  echo 'MAIN CONTENT: ', get_main_content_element (), "\n";
3118
  }
3119
  echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
3120
- echo 'HEADER CODE: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
3121
- echo 'FOOTER CODE: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
3122
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
3123
  echo 'AD BLOCKING DETECTION: ', $ai_wp_data [AI_ADB_DETECTION] ? 'ENABLED' : 'DISABLED', "\n";
3124
  if ($ai_wp_data [AI_ADB_DETECTION]) {
@@ -3150,6 +2516,17 @@ function ai_write_debug_info ($write_processing_log = false) {
3150
 
3151
  echo "\n";
3152
 
 
 
 
 
 
 
 
 
 
 
 
3153
  $default = new ai_Block (1);
3154
 
3155
  echo "BLOCK SETTINGS Po Pa Hp Cp Ap Sp AM Aj Fe 404 Wi Sh PHP\n";
@@ -3260,6 +2637,7 @@ function ai_write_debug_info ($write_processing_log = false) {
3260
  }
3261
  echo "\n";
3262
 
 
3263
  $args = array (
3264
  'public' => true,
3265
  '_builtin' => false
@@ -4888,6 +4266,7 @@ a.ai-debug-center {text-align: center; font-size: 10px; text-decoration: none; c
4888
  .ai-debug-h {background: #d4e;}
4889
  .ai-debug-img {background: #ee0; color: #000;}
4890
  .ai-debug-pre {background: #222;}
 
4891
  .ai-debug-special {background: #fb0; color: #000;}
4892
 
4893
  .ai-debug-ad-overlay {position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #8f8; opacity: 0.6; z-index': '999999990}
@@ -4902,6 +4281,9 @@ section.ai-debug-block {padding: 0; margin: 0;}
4902
 
4903
  .ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace, sans-serif; font-size: 12px; line-height: 13px; background: #fff; color: #000;}
4904
 
 
 
 
4905
  .ai-debug-block {border: 1px solid;}
4906
 
4907
  .ai-debug-block.ai-debug-default {border-color: #e00;}
@@ -4913,13 +4295,10 @@ section.ai-debug-block {padding: 0; margin: 0;}
4913
  .ai-debug-block.ai-debug-amp {border-color: #0c0;}
4914
  .ai-debug-bar.ai-debug-amp {background: #0c0;}
4915
 
4916
- .ai-debug-block.ai-debug-normal {border-color: #222;}
4917
- .ai-debug-bar.ai-debug-normal {background: #222;}
4918
-
4919
  .ai-debug-block.ai-debug-fallback {border-color: #a0f;}
4920
  .ai-debug-bar.ai-debug-fallback {background: #a0f;}
4921
 
4922
- .ai-debug-block.ai-debug-script {border-color: #00bae6;}
4923
  .ai-debug-bar.ai-debug-script {background: #00bae6;}
4924
 
4925
  .ai-debug-block.ai-debug-adb-status {border-color: #000;}
@@ -4928,8 +4307,8 @@ section.ai-debug-block {padding: 0; margin: 0;}
4928
  .ai-debug-block.ai-debug-adsense {border-color: #e0a;}
4929
  .ai-debug-bar.ai-debug-adsense {background: #e0a;}
4930
 
4931
- .ai-debug-adb-status.on {color: #f00;}
4932
- .ai-debug-adb-status.off {color: #0f0;}
4933
 
4934
  .ai-debug-block.ai-debug-lists {border-color: #00c5be;}
4935
  .ai-debug-bar.ai-debug-lists {background: #00c5be;}
@@ -4947,7 +4326,7 @@ section.ai-debug-block {padding: 0; margin: 0;}
4947
 
4948
  .ai-debug-bar kbd {margin: 0; padding: 0; color: #fff; font-size: inherit; font-family: arial; background-color: transparent; box-shadow: none;}
4949
 
4950
- .ai-debug-block pre {margin: 0;}
4951
 
4952
 
4953
  <?php
@@ -5402,7 +4781,8 @@ function ai_adinserter ($ad_number = '', $ignore = ''){
5402
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5403
 
5404
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5405
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) != 0) return "";
 
5406
 
5407
  $code = $obj->get_code_for_serverside_insertion ();
5408
  // Must be after get_code_for_serverside_insertion ()
@@ -5445,7 +4825,7 @@ function ai_content_hook ($content = '') {
5445
  } else $ad_inserter_globals [$globals_name] ++;
5446
 
5447
  if ($debug_processing) {
5448
- ai_log ("CONTENT HOOK START [" . $ad_inserter_globals [$globals_name] . ']');
5449
  $start_time = microtime (true);
5450
  }
5451
 
@@ -5538,7 +4918,9 @@ function ai_content_hook ($content = '') {
5538
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5539
 
5540
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5541
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
 
5542
  $content = $obj->get_code_for_serverside_insertion () . $content;
5543
  $ai_last_check = AI_CHECK_INSERTED;
5544
  }
@@ -5550,7 +4932,8 @@ function ai_content_hook ($content = '') {
5550
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5551
 
5552
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5553
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
5554
  $content = $content . $obj->get_code_for_serverside_insertion ();
5555
  $ai_last_check = AI_CHECK_INSERTED;
5556
  }
@@ -5568,21 +4951,23 @@ function ai_content_hook ($content = '') {
5568
 
5569
  $content = preg_replace ("/\r\n\r\n/", "\r\n\r\n<kbd class='$class ai-debug-rnrn'>\\r\\n\\r\\n</kbd>", $content);
5570
 
5571
- $content = preg_replace ("/<p>/i", "<p><kbd class='$class ai-debug-p'>&lt;p&gt;</kbd>", $content);
5572
  // $content = preg_replace ("/<p ([^>]*?)>/i", "<p$1><kbd class='$class ai-debug-p'>&lt;p$1&gt;</kbd>", $content); // Full p tags
5573
- $content = preg_replace ("/<p ([^>]*?)>/i", "<p$1><kbd class='$class ai-debug-p'>&lt;p&gt;</kbd>", $content);
5574
  // $content = preg_replace ("/<div([^>]*?)>/i", "<div$1><kbd class='$class ai-debug-div'>&lt;div$1&gt;</kbd>", $content); // Full div tags
5575
  $content = preg_replace ("/<div([^>]*?)>/i", "<div$1><kbd class='$class ai-debug-div'>&lt;div&gt;</kbd>", $content);
5576
  $content = preg_replace ("/<h([1-6])([^>]*?)>/i", "<h$1$2><kbd class='$class ai-debug-h'>&lt;h$1&gt;</kbd>", $content);
5577
  $content = preg_replace ("/<img([^>]*?)>/i", "<img$1><kbd class='$class ai-debug-img'>&lt;img$1&gt;</kbd>", $content);
5578
  $content = preg_replace ("/<pre([^>]*?)>/i", "<pre$1><kbd class='$class ai-debug-pre'>&lt;pre&gt;</kbd>", $content);
5579
- $content = preg_replace ("/<(?!section|ins|script|kbd|a|strong|pre|p|div|h[1-6]|img)([a-z0-9]+)([^>]*?)>/i", "<$1$2><kbd class='$class ai-debug-special'>&lt;$1$2&gt;</kbd>", $content);
 
5580
 
5581
  $content = preg_replace ("/<\/p>/i", "<kbd class='$class ai-debug-p'>&lt;/p&gt;</kbd></p>", $content);
5582
  $content = preg_replace ("/<\/div>/i", "<kbd class='$class ai-debug-div'>&lt;/div&gt;</kbd></div>", $content);
5583
  $content = preg_replace ("/<\/h([1-6])>/i", "<kbd class='$class ai-debug-h'>&lt;/h$1&gt;</kbd></h$1>", $content);
5584
  $content = preg_replace ("/<\/pre>/i", "<kbd class='$class ai-debug-pre'>&lt;/pre&gt;</kbd></pre>", $content);
5585
- $content = preg_replace ("/<\/(?!section|ins|script|kbd|a|strong|pre|p|div|h[1-6])([a-z0-9]+)>/i", "<kbd class='$class ai-debug-special'>&lt;/$1&gt;</kbd></$1>", $content);
 
5586
  }
5587
 
5588
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
@@ -5688,7 +5073,8 @@ function ai_excerpt_hook ($content = '') {
5688
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5689
 
5690
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5691
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
5692
 
5693
  $automatic_insertion = $obj->get_automatic_insertion ();
5694
  if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT)
@@ -5833,7 +5219,8 @@ function ai_comment_callback ($comment, $args, $depth) {
5833
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5834
 
5835
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5836
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
5837
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5838
  $ai_last_check = AI_CHECK_INSERTED;
5839
  }
@@ -5938,7 +5325,8 @@ function ai_comment_end_callback ($comment, $args, $depth) {
5938
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5939
 
5940
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5941
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
5942
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5943
  $ai_last_check = AI_CHECK_INSERTED;
5944
  }
@@ -6000,7 +5388,8 @@ function ai_comment_end_callback ($comment, $args, $depth) {
6000
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
6001
 
6002
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
6003
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
6004
  $ad_code .= $obj->get_code_for_serverside_insertion ();
6005
  $ai_last_check = AI_CHECK_INSERTED;
6006
  }
@@ -6102,7 +5491,8 @@ function ai_custom_hook ($action, $name, $hook_parameter = null, $hook_check = n
6102
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
6103
 
6104
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
6105
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
6106
  $ad_code .= $obj->get_code_for_serverside_insertion ();
6107
  $ai_last_check = AI_CHECK_INSERTED;
6108
  }
@@ -6330,9 +5720,10 @@ function ai_process_shortcode (&$block, $atts) {
6330
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
6331
 
6332
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
6333
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
6334
  $code = $obj->get_code_for_serverside_insertion (true, false, $code_only);
6335
- // Must be after et_code_for_serverside_insertion ()
6336
  $ai_last_check = AI_CHECK_INSERTED;
6337
  return $code;
6338
  }
@@ -6371,104 +5762,6 @@ function ai_process_shortcodes ($atts, $content, $tag) {
6371
  }
6372
 
6373
 
6374
- class ai_widget extends WP_Widget {
6375
-
6376
- function __construct () {
6377
- parent::__construct (
6378
- false, // Base ID
6379
- AD_INSERTER_NAME, // Name
6380
- array ( // Args
6381
- 'classname' => 'ai_widget',
6382
- 'description' => AD_INSERTER_NAME.' code block widget.')
6383
- );
6384
- }
6385
-
6386
- function form ($instance) {
6387
- global $block_object;
6388
-
6389
- // Output admin widget options form
6390
-
6391
- $widget_title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
6392
- $block = isset ($instance ['block']) ? $instance ['block'] : 1;
6393
- if ($block > AD_INSERTER_BLOCKS) $block = 1;
6394
- $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
6395
-
6396
- if ($block == 0) $title = 'Processing Log';
6397
- elseif ($block == - 1) $title = 'Dummy Widget';
6398
- elseif ($block == - 2) $title = 'Debugging Tools';
6399
- elseif ($block >= 1) {
6400
- $obj = $block_object [$block];
6401
-
6402
- $title = '[' . $block . '] ' . $obj->get_ad_name();
6403
- if (!empty ($widget_title)) $title .= ' - ' . $widget_title;
6404
- if (!$obj->get_enable_widget ()) $title .= ' - DISABLED';
6405
- } else $title = "Unknown block";
6406
-
6407
- $url_parameters = "";
6408
- if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block);
6409
-
6410
- ?>
6411
- <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); ?>">
6412
-
6413
- <p>
6414
- <label for="<?php echo $this->get_field_id ('widget-title'); ?>">Title: &nbsp;</label>
6415
- <input id="<?php echo $this->get_field_id ('widget-title'); ?>" name="<?php echo $this->get_field_name ('widget-title'); ?>" type="text" value="<?php echo esc_attr ($widget_title); ?>" style="width: 88%;">
6416
- </p>
6417
-
6418
- <p>
6419
- <label for="<?php echo $this->get_field_id ('block'); ?>"><a href='<?php echo admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, "&tab=", $block; ?>' title='Click for block settings' style='text-decoration: none;'>Block</a>:</label>
6420
- <select id="<?php echo $this->get_field_id ('block'); ?>" name="<?php echo $this->get_field_name('block'); ?>" style="width: 88%;">
6421
- <?php
6422
- for ($block_index = 1; $block_index <= AD_INSERTER_BLOCKS; $block_index ++) {
6423
- $obj = $block_object [$block_index];
6424
- ?>
6425
- <option value='<?php echo $block_index; ?>' <?php if ($block_index == $block) echo 'selected="selected"'; ?>><?php echo $block_index, ' - ', $obj->get_ad_name(), !$obj->get_enable_widget ()? ' - DISABLED' : ''; ?></option>
6426
- <?php } ?>
6427
- <option value='-2' <?php if ($block == - 2) echo 'selected="selected"'; ?>>Debugging Tools</option>
6428
- <option value='0' <?php if ($block == 0) echo 'selected="selected"'; ?>>Processing Log</option>
6429
- <option value='-1' <?php if ($block == - 1) echo 'selected="selected"'; ?>>Dummy Widget</option>
6430
- </select>
6431
- </p>
6432
-
6433
- <p>
6434
- <input type="hidden" name='<?php echo $this->get_field_name ('sticky'); ?>' value="0" />
6435
- <input type='checkbox' id='<?php echo $this->get_field_id ('sticky'); ?>' name='<?php echo $this->get_field_name ('sticky'); ?>' value='1' <?php if ($sticky) echo 'checked '; ?>>
6436
- <label for='<?php echo $this->get_field_id ('sticky'); ?>'>Sticky</label>
6437
- </p>
6438
- <?php
6439
- }
6440
-
6441
- function update ($new_instance, $old_instance) {
6442
- // Save widget options
6443
- $instance = $old_instance;
6444
-
6445
- $instance ['widget-title'] = (!empty ($new_instance ['widget-title'])) ? strip_tags ($new_instance ['widget-title']) : '';
6446
- $instance ['title'] = (!empty ($new_instance ['title'])) ? strip_tags ($new_instance ['title']) : '';
6447
- $instance ['block'] = (isset ($new_instance ['block'])) ? $new_instance ['block'] : 1;
6448
- $instance ['sticky'] = (isset ($new_instance ['sticky'])) ? $new_instance ['sticky'] : 0;
6449
-
6450
- return $instance;
6451
- }
6452
-
6453
- function widget ($args, $instance) {
6454
- global $ai_last_check, $ai_wp_data, $ai_total_plugin_time;
6455
-
6456
- $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
6457
- if ($debug_processing) $start_time = microtime (true);
6458
-
6459
- $ai_last_check = AI_CHECK_NONE;
6460
-
6461
- $block = 0;
6462
- ai_widget_draw ($args, $instance, $block);
6463
-
6464
- if ($debug_processing) {
6465
- $ai_total_plugin_time += microtime (true) - $start_time;
6466
- if ($ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($block, $ai_last_check));
6467
- ai_log ("WIDGET END\n");
6468
- }
6469
- }
6470
- }
6471
-
6472
  function ai_add_attr_data (&$tag, $attr, $new_data) {
6473
 
6474
  if (trim ($tag) != '' && strpos ($tag, '<!--') === false) {
@@ -6571,7 +5864,8 @@ function ai_widget_draw ($args, $instance, &$block) {
6571
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
6572
 
6573
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
6574
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
6575
 
6576
  $viewport_classes = $obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT ? '' : trim ($obj->get_viewport_classes ());
6577
  $sticky_class = $sticky ? ' ai-sticky-widget' : '';
@@ -6957,3 +6251,340 @@ function get_paragraph_end_positions ($content, $multibyte, $paragraph_start_pos
6957
  }
6958
  }
6959
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.18
6
+ Description: Ad management plugin with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
9
+ Plugin URI: https://adinserter.pro/documentation
10
  */
11
 
12
  /*
13
 
14
  Change Log
15
 
16
+ Ad Inserter 2.3.18 - 2018-08-21
17
+ - Added support to schedule insertion for N days after publishing
18
+ - Added support to schedule insertion only for posts published inside/outside time period (Pro only)
19
+ - Added support to prevent activation of free Ad Inserter while Pro is active
20
+ - Added url parameter to show block code
21
+ - Improved Header/Footer code debugging
22
+ - Few minor bug fixes, cosmetic changes and code improvements
23
+
24
  Ad Inserter 2.3.17 - 2018-08-03
25
  - Added shortcode for ad blocking detection action
26
  - Few minor bug fixes, cosmetic changes and code improvements
122
  - Fix for errors when importing code
123
  - Few minor bug fixes, cosmetic changes and code improvements
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  */
126
 
127
 
128
+ if (!defined ('ABSPATH')) exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ if (!defined ('AD_INSERTER_VERSION')) {
131
 
132
 
133
  function ai_wp_default_editor () {
388
  function ai_log_filter_content ($content_string) {
389
 
390
  $content_string = preg_replace ("/\[\[AI_[A|B]P([\d].?)\]\]/", "", $content_string);
391
+ return str_replace (array ("<!--", "-->", "\n", "\r"), array ("<!++", "++>", "*n", "*r"), $content_string);
392
  }
393
 
394
  function ai_log_content (&$content) {
396
  ai_log (ai_log_filter_content (html_entity_decode (substr ($content, 0, 60))) . ' ... ' . ai_log_filter_content (html_entity_decode (substr ($content, - 60))) . ' ['.number_of_words ($content).' words]');
397
  }
398
 
399
+ function ai_filter_code ($code) {
400
+ $code = preg_replace ("/\[\[AI_[A|B]P([\d].?)\]\]/", "", $code);
401
+ return str_replace (array ("<!--", "-->"), array ("<!++", "++>"), $code);
402
+ }
403
+
404
+ function ai_dump_code ($code, $max_size = 0) {
405
+ if ($max_size == 0) return ai_filter_code ($code); else
406
+ if ($max_size != 0 && strlen ($code) < $max_size) return ai_filter_code ($code); else
407
+ return ai_filter_code (html_entity_decode (substr ($code, 0, 120))) . ' ... ' . ai_filter_code (html_entity_decode (substr ($code, - 120)));
408
+ }
409
+
410
  function ai_block_insertion_status ($block, $ai_last_check) {
411
  global $block_object;
412
 
1572
  $used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
1573
 
1574
  $notice_option = get_option ('ai-notice-review');
1575
+
1576
  if ($notice_option === false && $ai_wp_data [AI_DAYS_SINCE_INSTAL] >= 40) $notice_option = 'later';
1577
 
1578
  if (($notice_option === false && $used_blocks >= 2 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] > 20 && $ai_wp_data [AI_DAYS_SINCE_INSTAL] < 40) ||
1596
  <p><?php echo $message; ?>
1597
  I would really appreciate it if you could give the plugin a 5-star rating on WordPres.<br />
1598
  Positive reviews are a great incentive to fix bugs and to add new features for better monetization of your website.
1599
+ Thank you, Igor
1600
  </p>
1601
  </div>
1602
  <div class="ai-notice-element ai-notice-buttons last">
1603
+ <div class="ai-notice-text-button ai-notice-dismiss" data-notice="yes">
1604
+ <button class="button-primary ai-notice-dismiss" data-notice="yes">
1605
+ <a href="https://wordpress.org/support/plugin/ad-inserter/reviews/" class="ai-notice-dismiss" target="_blank" data-notice="yes">Rate Ad Inserter</a>
1606
+ </button>
1607
+ </div>
1608
+
1609
  <?php echo $option; ?>
1610
  <div class="ai-notice-text-button ai-notice-dismiss" data-notice="already">I already did.</div>
1611
  </div>
1901
  }
1902
  }
1903
 
1904
+ function get_code_debug_block ($name, $message, $right_text, $code, $inserted_code, $javascript = false) {
 
1905
  if (strpos ($code, 'enable_page_level_ads') !== false)
1906
  $message = 'Code for <a style="text-decoration: none; color: #fff; font-weight: bold; box-shadow: none;" href="https://adinserter.pro/adsense-ads#auto-ads" target="_blank">AdSense Auto Ads</a> detected - Code will automatically insert AdSense ads at optimal positions ';
1907
 
1908
  $debug_script = new ai_block_labels ('ai-debug-script');
1909
  $debug_block_start = $debug_script->block_start ();
1910
+ $debug_block_start .= $debug_script->bar ($name, '', $message, $right_text);
1911
  if ($javascript) $debug_block_start = str_replace (array ('"', "\n", "\r"), array ("'", "\\n", ''), $debug_block_start);
1912
 
1913
  $debug_block_end = $debug_script->block_end ();
1916
  $html_code = htmlspecialchars ($code);
1917
  if ($javascript) $html_code = str_replace (array ("\n", "\r"), array ("\\n", ''), $html_code);
1918
 
1919
+ $html_inserted_code = htmlspecialchars ($inserted_code);
1920
+ if ($javascript) $html_inserted_code = str_replace (array ("\n", "\r"), array ("\\n", ''), $html_inserted_code);
1921
+
1922
+ return $debug_block_start . "<pre class='ai-debug-code ai-code-org'>" . $html_code . "</pre><pre class='ai-debug-code ai-code-inserted'>" . $html_inserted_code . "</pre><div style='clear: both;'></div>" . $debug_block_end;
1923
  }
1924
 
1925
  function ai_http_header () {
1964
 
1965
  add_head_inline_styles_and_scripts ();
1966
 
1967
+ $header_code = '';
1968
 
1969
+ $header = $block_object [AI_HEADER_OPTION_NAME];
1970
+ // $header->clear_code_cache (); // cleared at ai_http_header
1971
 
1972
+ if ($header->get_enable_manual ()) {
1973
+ if (!$header->get_debug_disable_insertion ()) {
1974
+ if ($header->check_server_side_detection ()) {
1975
+ if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_404 || $header->get_enable_404()) {
1976
 
1977
+ $processed_code = do_shortcode ($header->ai_getCode ());
1978
 
1979
+ if (strpos ($processed_code, AD_HTTP_SEPARATOR) !== false) {
1980
+ $codes = explode (AD_HTTP_SEPARATOR, $processed_code);
1981
+ $processed_code = ltrim ($codes [1]);
1982
+ }
1983
 
1984
+ if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
1985
+ $codes = explode (AD_AMP_SEPARATOR, $processed_code);
1986
+ $processed_code = $codes [0];
1987
+ } elseif ($ai_wp_data [AI_WP_AMP_PAGE]) $processed_code = '';
1988
 
1989
+ $header_code = $processed_code;
1990
 
1991
+ echo $processed_code;
1992
+
1993
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1994
+ if (strlen ($processed_code) != 0)
1995
+ ai_log ("HEAD CODE: " . strlen ($processed_code) . ' characters');
1996
+ }
1997
+ }
1998
+ }
1999
+ } else {
2000
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2001
+ ai_log ('HEAD CODE DEBUG NO INSERTION');
2002
+ }
2003
  }
 
2004
  }
2005
 
2006
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
2024
  </script>\n";
2025
  }
2026
 
2027
+ if ($ai_wp_data [AI_WP_DEBUGGING] != 0 && isset ($_GET ['ai-debug-code']) && !defined ('AI_DEBUGGING_DEMO')) {
2028
+ if (is_numeric ($_GET ['ai-debug-code']) && $_GET ['ai-debug-code'] >= 1 && $_GET ['ai-debug-code'] <= AD_INSERTER_BLOCKS) {
2029
+ $obj = $block_object [$_GET ['ai-debug-code']];
2030
+ $block_name = $obj->number . ' &nbsp; ' . $obj->get_ad_name ();
2031
+ if (!$header->get_debug_disable_insertion ()) {
2032
+ $ai_wp_debugging = $ai_wp_data [AI_WP_DEBUGGING];
2033
+ $ai_wp_data [AI_WP_DEBUGGING] = 0;
2034
+ $code_for_insertion = $obj->get_code_for_insertion ();
2035
+ $ai_wp_data [AI_WP_DEBUGGING] = $ai_wp_debugging;
2036
+ } else $code_for_insertion = '';
2037
+ echo "<script>\n";
2038
+ echo " jQuery(document).ready(function($) {
2039
+ $('body').prepend (\"" . get_code_debug_block (' ' . $block_name, '', 'Code for insertion ' . strlen ($code_for_insertion).' characters ', $obj->ai_getCode (), $code_for_insertion, true) . "\");
2040
+ });
2041
+ </script>\n";
2042
+ }
2043
+ }
2044
+
2045
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
2046
  echo "<script>\n";
2047
  echo " jQuery(document).ready(function($) {
2048
+ $('body').prepend (\"" . get_code_debug_block (' Header code ' . ($header->get_enable_manual () ? '' : ' DISABLED'), '&lt;head&gt;...&lt;/head&gt;', strlen ($header_code).' characters inserted ', $header->ai_getCode (), $header_code, true) . "\");
2049
  });
2050
  </script>\n";
2051
  }
2110
  $codes = explode (AD_AMP_SEPARATOR, $processed_code);
2111
  $processed_code = ltrim ($codes [1]);
2112
  echo $processed_code;
2113
+
2114
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2115
+ if (strlen ($processed_code) != 0)
2116
+ ai_log ("HEAD CODE: " . strlen ($processed_code) . ' bytes');
2117
+ }
2118
  }
2119
  }
2120
  }
2171
  if ($ai_wp_data [AI_DISABLE_CACHING]) ai_disable_caching ();
2172
 
2173
  $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_FOOTER;
2174
+ $footer_code = '';
2175
 
2176
  $footer = $block_object [AI_FOOTER_OPTION_NAME];
2177
  $footer->clear_code_cache ();
2178
 
2179
  if ($footer->get_enable_manual ()) {
2180
+ if (!$footer->get_debug_disable_insertion ()) {
2181
+ if ($footer->check_server_side_detection ()) {
2182
+ if ($ai_wp_data [AI_WP_PAGE_TYPE] != AI_PT_404 || $footer->get_enable_404()) {
 
2183
 
2184
+ $processed_code = do_shortcode ($footer->ai_getCode ());
2185
+
2186
+ if (strpos ($processed_code, AD_AMP_SEPARATOR) !== false) {
2187
+ $codes = explode (AD_AMP_SEPARATOR, $processed_code);
2188
+ $processed_code = $codes [0];
2189
+ } elseif ($ai_wp_data [AI_WP_AMP_PAGE]) $processed_code = '';
2190
 
2191
+ $footer_code = $processed_code;
2192
 
2193
+ echo $processed_code;
2194
+
2195
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2196
+ if (strlen ($processed_code) != 0)
2197
+ ai_log ("FOOTER CODE: " . strlen ($processed_code) . ' characters');
2198
+ }
2199
+ }
2200
+ }
2201
+ } else {
2202
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2203
+ ai_log ('FOOTER CODE DEBUG NO INSERTION');
2204
+ }
2205
  }
 
2206
  }
2207
 
2208
  if (!(defined ('DOING_AJAX') && DOING_AJAX)) {
2213
  echo get_page_type_debug_info () , "\n";
2214
  }
2215
 
2216
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 && !defined ('AI_DEBUGGING_DEMO')) {
2217
+ echo get_code_debug_block (' Footer code ' . ($footer->get_enable_manual () ? '' : ' DISABLED'), '...&lt;/body&gt;', strlen ($footer_code).' characters inserted', $footer->ai_getCode (), $footer_code);
2218
  }
2219
 
2220
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2341
  switch ($ai_wp_data [AI_WP_PAGE_TYPE]) {
2342
  case AI_PT_STATIC:
2343
  case AI_PT_POST:
2344
+ echo 'PUBLISHED: ', date ("Y-m-d H:i:s", get_the_date ('U')), "\n";
2345
  echo 'ID: ', get_the_ID(), "\n";
2346
  echo 'POST TYPE: ', get_post_type (), "\n";
2347
  $category_data = get_the_category();
2483
  echo 'MAIN CONTENT: ', get_main_content_element (), "\n";
2484
  }
2485
  echo 'PLUGIN PRIORITY: ', get_plugin_priority (), "\n";
2486
+ echo 'HEADER: ', $block_object [AI_HEADER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2487
+ echo 'FOOTER: ', $block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual () ? 'ENABLED' : 'DISABLED', "\n";
2488
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
2489
  echo 'AD BLOCKING DETECTION: ', $ai_wp_data [AI_ADB_DETECTION] ? 'ENABLED' : 'DISABLED', "\n";
2490
  if ($ai_wp_data [AI_ADB_DETECTION]) {
2516
 
2517
  echo "\n";
2518
 
2519
+ // if ($block_object [AI_HEADER_OPTION_NAME]->get_enable_manual ()) {
2520
+ // echo "HEADER CODE ========================================================\n";
2521
+ // echo ai_dump_code ($block_object [AI_HEADER_OPTION_NAME]->ai_getCode ());
2522
+ // echo "\n====================================================================\n\n";
2523
+ // }
2524
+ // if ($block_object [AI_FOOTER_OPTION_NAME]->get_enable_manual ()) {
2525
+ // echo "FOOTER CODE ========================================================\n";
2526
+ // echo ai_dump_code ($block_object [AI_FOOTER_OPTION_NAME]->ai_getCode ());
2527
+ // echo "\n====================================================================\n\n";
2528
+ // }
2529
+
2530
  $default = new ai_Block (1);
2531
 
2532
  echo "BLOCK SETTINGS Po Pa Hp Cp Ap Sp AM Aj Fe 404 Wi Sh PHP\n";
2637
  }
2638
  echo "\n";
2639
 
2640
+
2641
  $args = array (
2642
  'public' => true,
2643
  '_builtin' => false
4266
  .ai-debug-h {background: #d4e;}
4267
  .ai-debug-img {background: #ee0; color: #000;}
4268
  .ai-debug-pre {background: #222;}
4269
+ .ai-debug-span {background: #cff; color: #000;}
4270
  .ai-debug-special {background: #fb0; color: #000;}
4271
 
4272
  .ai-debug-ad-overlay {position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #8f8; opacity: 0.6; z-index': '999999990}
4281
 
4282
  .ai-debug-code {margin: 0; padding: 0; border: 0; font-family: monospace, sans-serif; font-size: 12px; line-height: 13px; background: #fff; color: #000;}
4283
 
4284
+ .ai-debug-code.ai-code-org {float: left; max-width: 48%;}
4285
+ .ai-debug-code.ai-code-inserted {float: right; max-width: 48%;}
4286
+
4287
  .ai-debug-block {border: 1px solid;}
4288
 
4289
  .ai-debug-block.ai-debug-default {border-color: #e00;}
4295
  .ai-debug-block.ai-debug-amp {border-color: #0c0;}
4296
  .ai-debug-bar.ai-debug-amp {background: #0c0;}
4297
 
 
 
 
4298
  .ai-debug-block.ai-debug-fallback {border-color: #a0f;}
4299
  .ai-debug-bar.ai-debug-fallback {background: #a0f;}
4300
 
4301
+ .ai-debug-block.ai-debug-script {border-color: #00bae6; background: #eee;}
4302
  .ai-debug-bar.ai-debug-script {background: #00bae6;}
4303
 
4304
  .ai-debug-block.ai-debug-adb-status {border-color: #000;}
4307
  .ai-debug-block.ai-debug-adsense {border-color: #e0a;}
4308
  .ai-debug-bar.ai-debug-adsense {background: #e0a;}
4309
 
4310
+ .ai-debug-adb-status.on kbd {color: #f00;}
4311
+ .ai-debug-adb-status.off kbd {color: #0f0;}
4312
 
4313
  .ai-debug-block.ai-debug-lists {border-color: #00c5be;}
4314
  .ai-debug-bar.ai-debug-lists {background: #00c5be;}
4326
 
4327
  .ai-debug-bar kbd {margin: 0; padding: 0; color: #fff; font-size: inherit; font-family: arial; background-color: transparent; box-shadow: none;}
4328
 
4329
+ .ai-debug-block pre {margin: 0; padding: 2px 5px 2px; line-height: 14px;}
4330
 
4331
 
4332
  <?php
4781
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
4782
 
4783
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4784
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) != 0) return "";
4785
+ if ($obj->get_debug_disable_insertion ()) return "";
4786
 
4787
  $code = $obj->get_code_for_serverside_insertion ();
4788
  // Must be after get_code_for_serverside_insertion ()
4825
  } else $ad_inserter_globals [$globals_name] ++;
4826
 
4827
  if ($debug_processing) {
4828
+ ai_log ("CONTENT HOOK START [" . $ad_inserter_globals [$globals_name] . (in_the_loop () ? '' : ', NOT IN THE LOOP') . ']');
4829
  $start_time = microtime (true);
4830
  }
4831
 
4918
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
4919
 
4920
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4921
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4922
+ if (!$obj->get_debug_disable_insertion ()) {
4923
+
4924
  $content = $obj->get_code_for_serverside_insertion () . $content;
4925
  $ai_last_check = AI_CHECK_INSERTED;
4926
  }
4932
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
4933
 
4934
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4935
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4936
+ if (!$obj->get_debug_disable_insertion ()) {
4937
  $content = $content . $obj->get_code_for_serverside_insertion ();
4938
  $ai_last_check = AI_CHECK_INSERTED;
4939
  }
4951
 
4952
  $content = preg_replace ("/\r\n\r\n/", "\r\n\r\n<kbd class='$class ai-debug-rnrn'>\\r\\n\\r\\n</kbd>", $content);
4953
 
4954
+ // $content = preg_replace ("/<p>/i", "<p><kbd class='$class ai-debug-p'>&lt;p&gt;</kbd>", $content);
4955
  // $content = preg_replace ("/<p ([^>]*?)>/i", "<p$1><kbd class='$class ai-debug-p'>&lt;p$1&gt;</kbd>", $content); // Full p tags
4956
+ $content = preg_replace ("/<p([^>]*?)>/i", "<p$1><kbd class='$class ai-debug-p'>&lt;p&gt;</kbd>", $content);
4957
  // $content = preg_replace ("/<div([^>]*?)>/i", "<div$1><kbd class='$class ai-debug-div'>&lt;div$1&gt;</kbd>", $content); // Full div tags
4958
  $content = preg_replace ("/<div([^>]*?)>/i", "<div$1><kbd class='$class ai-debug-div'>&lt;div&gt;</kbd>", $content);
4959
  $content = preg_replace ("/<h([1-6])([^>]*?)>/i", "<h$1$2><kbd class='$class ai-debug-h'>&lt;h$1&gt;</kbd>", $content);
4960
  $content = preg_replace ("/<img([^>]*?)>/i", "<img$1><kbd class='$class ai-debug-img'>&lt;img$1&gt;</kbd>", $content);
4961
  $content = preg_replace ("/<pre([^>]*?)>/i", "<pre$1><kbd class='$class ai-debug-pre'>&lt;pre&gt;</kbd>", $content);
4962
+ $content = preg_replace ("/<span([^>]*?)>/i", "<kbd class='$class ai-debug-span'>&lt;span&gt;</kbd><span$1>", $content);
4963
+ $content = preg_replace ("/<(?!section|ins|script|kbd|a|strong|pre|span|p|div|h[1-6]|img)([a-z0-9]+)([^>]*?)>/i", "<$1$2><kbd class='$class ai-debug-special'>&lt;$1$2&gt;</kbd>", $content);
4964
 
4965
  $content = preg_replace ("/<\/p>/i", "<kbd class='$class ai-debug-p'>&lt;/p&gt;</kbd></p>", $content);
4966
  $content = preg_replace ("/<\/div>/i", "<kbd class='$class ai-debug-div'>&lt;/div&gt;</kbd></div>", $content);
4967
  $content = preg_replace ("/<\/h([1-6])>/i", "<kbd class='$class ai-debug-h'>&lt;/h$1&gt;</kbd></h$1>", $content);
4968
  $content = preg_replace ("/<\/pre>/i", "<kbd class='$class ai-debug-pre'>&lt;/pre&gt;</kbd></pre>", $content);
4969
+ $content = preg_replace ("/<\/span>/i", "</span><kbd class='$class ai-debug-span'>&lt;/span&gt;</kbd>", $content);
4970
+ $content = preg_replace ("/<\/(?!section|ins|script|kbd|a|strong|pre|span|p|div|h[1-6])([a-z0-9]+)>/i", "<kbd class='$class ai-debug-special'>&lt;/$1&gt;</kbd></$1>", $content);
4971
  }
4972
 
4973
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
5073
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5074
 
5075
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5076
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5077
+ if (!$obj->get_debug_disable_insertion ()) {
5078
 
5079
  $automatic_insertion = $obj->get_automatic_insertion ();
5080
  if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT)
5219
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5220
 
5221
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5222
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5223
+ if (!$obj->get_debug_disable_insertion ()) {
5224
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5225
  $ai_last_check = AI_CHECK_INSERTED;
5226
  }
5325
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5326
 
5327
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5328
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5329
+ if (!$obj->get_debug_disable_insertion ()) {
5330
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5331
  $ai_last_check = AI_CHECK_INSERTED;
5332
  }
5388
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5389
 
5390
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5391
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5392
+ if (!$obj->get_debug_disable_insertion ()) {
5393
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5394
  $ai_last_check = AI_CHECK_INSERTED;
5395
  }
5491
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5492
 
5493
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5494
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5495
+ if (!$obj->get_debug_disable_insertion ()) {
5496
  $ad_code .= $obj->get_code_for_serverside_insertion ();
5497
  $ai_last_check = AI_CHECK_INSERTED;
5498
  }
5720
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5721
 
5722
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5723
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5724
+ if (!$obj->get_debug_disable_insertion ()) {
5725
  $code = $obj->get_code_for_serverside_insertion (true, false, $code_only);
5726
+ // Must be after get_code_for_serverside_insertion ()
5727
  $ai_last_check = AI_CHECK_INSERTED;
5728
  return $code;
5729
  }
5762
  }
5763
 
5764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5765
  function ai_add_attr_data (&$tag, $attr, $new_data) {
5766
 
5767
  if (trim ($tag) != '' && strpos ($tag, '<!--') === false) {
5864
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
5865
 
5866
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
5867
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
5868
+ if (!$obj->get_debug_disable_insertion ()) {
5869
 
5870
  $viewport_classes = $obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT ? '' : trim ($obj->get_viewport_classes ());
5871
  $sticky_class = $sticky ? ' ai-sticky-widget' : '';
6251
  }
6252
  }
6253
 
6254
+
6255
+ // ===========================================================================================
6256
+
6257
+
6258
+ global $block_object, $ai_wp_data, $ad_inserter_globals, $ai_last_check, $ai_last_time, $ai_total_plugin_time, $ai_total_php_time, $ai_processing_log, $ai_db_options_extract, $ai_db_options, $block_insertion_log;
6259
+
6260
+ if (!defined ('AD_INSERTER_PLUGIN_DIR'))
6261
+ define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
6262
+
6263
+ define ('AI_WP_DEBUGGING_', 0);
6264
+ define ('AI_DEBUG_PROCESSING_', 0x01);
6265
+ define ('AI_URL_DEBUG_', 'ai-debug');
6266
+ define ('AI_URL_DEBUG_PROCESSING_', 'ai-debug-processing');
6267
+ define ('AI_URL_DEBUG_PHP_', 'ai-debug-php');
6268
+
6269
+ if (isset ($_GET [AI_URL_DEBUG_PHP_]) && $_GET [AI_URL_DEBUG_PHP_] != '') {
6270
+ if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
6271
+ ini_set ('display_errors', 1);
6272
+ error_reporting (E_ALL);
6273
+ }
6274
+ }
6275
+
6276
+ $ai_wp_data [AI_WP_DEBUGGING_] = 0;
6277
+
6278
+ if (!is_admin()) {
6279
+ if (!isset ($_GET [AI_URL_DEBUG_]))
6280
+ if (isset ($_GET [AI_URL_DEBUG_PROCESSING_]) || (isset ($_COOKIE ['AI_WP_DEBUGGING']) && ($_COOKIE ['AI_WP_DEBUGGING'] & AI_DEBUG_PROCESSING_) != 0)) {
6281
+ if (!isset ($_GET [AI_URL_DEBUG_PROCESSING_]) || $_GET [AI_URL_DEBUG_PROCESSING_] == 1) {
6282
+ $ai_wp_data [AI_WP_DEBUGGING_] |= AI_DEBUG_PROCESSING_;
6283
+
6284
+ $ai_total_plugin_time = 0;
6285
+ $start_time = microtime (true);
6286
+ $ai_total_php_time = 0;
6287
+ $ai_last_time = microtime (true);
6288
+ $ai_processing_log = array ();
6289
+ ai_log ("INITIALIZATION START");
6290
+ }
6291
+ }
6292
+ }
6293
+
6294
+ // Version check
6295
+ global $wp_version, $version_string;
6296
+
6297
+ if (version_compare ($wp_version, "4.0", "<")) {
6298
+ exit ('Ad Inserter requires WordPress 4.0 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>');
6299
+ }
6300
+
6301
+ //include required files
6302
+ require_once AD_INSERTER_PLUGIN_DIR.'class.php';
6303
+ require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
6304
+ require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
6305
+
6306
+
6307
+ $version_array = explode (".", AD_INSERTER_VERSION);
6308
+ $version_string = "";
6309
+ foreach ($version_array as $number) {
6310
+ $version_string .= sprintf ("%02d", $number);
6311
+ }
6312
+
6313
+ $ai_wp_data [AI_WP_URL] = remove_debug_parameters_from_url ();
6314
+
6315
+ $ad_inserter_globals = array ();
6316
+ $block_object = array ();
6317
+ $block_insertion_log = array ();
6318
+
6319
+ $ai_wp_data [AI_WP_PAGE_TYPE] = AI_PT_NONE;
6320
+ $ai_wp_data [AI_WP_AMP_PAGE] = false;
6321
+ $ai_wp_data [AI_WP_USER_SET] = false;
6322
+ $ai_wp_data [AI_WP_USER] = AI_USER_NOT_LOGGED_IN;
6323
+ $ai_wp_data [AI_CONTEXT] = AI_CONTEXT_NONE;
6324
+
6325
+ $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
6326
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
6327
+ $ai_wp_data [AI_TRACKING] = false;
6328
+ $ai_wp_data [AI_STICKY_WIDGETS] = false;
6329
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] = false;
6330
+ $ai_wp_data [AI_ANIMATION] = false;
6331
+ $ai_wp_data [AI_CLOSE_BUTTONS] = false;
6332
+ $ai_wp_data [AI_DISABLE_CACHING] = false;
6333
+ $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
6334
+ $ai_wp_data [AI_LAZY_LOADING] = false;
6335
+ $ai_wp_data [AI_PAGE_BLOCKS] = 0;
6336
+ $ai_wp_data [AI_GEOLOCATION] = false;
6337
+
6338
+ ai_load_settings ();
6339
+
6340
+ $ai_wp_data [AI_BACKEND_JS_DEBUGGING] = get_backend_javascript_debugging ();
6341
+ $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] = get_frontend_javascript_debugging ();
6342
+
6343
+ if (isset ($_GET [AI_URL_DEBUG_PHP]) && $_GET [AI_URL_DEBUG_PHP] == '1') {
6344
+ if (get_remote_debugging ()) {
6345
+ ini_set ('display_errors', 1);
6346
+ error_reporting (E_ALL);
6347
+ }
6348
+ }
6349
+
6350
+ if (isset ($_GET [AI_URL_DEBUG_JAVASCRIPT]) && $_GET [AI_URL_DEBUG_JAVASCRIPT] == '1') {
6351
+ if (get_remote_debugging ()) {
6352
+ $ai_wp_data [AI_FRONTEND_JS_DEBUGGING] = true;
6353
+ }
6354
+ }
6355
+
6356
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
6357
+ $ai_wp_data [AI_ADB_DETECTION] = $block_object [AI_ADB_MESSAGE_OPTION_NAME]->get_enable_manual ();
6358
+
6359
+ if ($ai_wp_data [AI_ADB_DETECTION]) {
6360
+ $adb_2_name = AI_ADB_2_DEFAULT_NAME;
6361
+ define ('AI_ADB_COOKIE_VALUE', substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY.md5 (NONCE_KEY)))), 0, 8));
6362
+
6363
+ $script_path = AD_INSERTER_PLUGIN_DIR.'js';
6364
+ $script = $script_path.'/sponsors.js';
6365
+
6366
+ if (is_writable ($script_path) && is_writable ($script)) {
6367
+ $adb_2_name = substr (preg_replace ("/[^A-Za-z]+/", '', strtolower (md5 (LOGGED_IN_KEY).md5 (NONCE_KEY))), 0, 8);
6368
+
6369
+ $js_ok = false;
6370
+ if (file_exists ($script)) {
6371
+ if (strpos (file_get_contents ($script), $adb_2_name) !== false) $js_ok = true;
6372
+ }
6373
+
6374
+ if (!$js_ok) {
6375
+ file_put_contents ($script, 'window.' . $adb_2_name . '=true;');
6376
+ define ('AI_ADB_2_FILE_RECREATED', true);
6377
+ }
6378
+ }
6379
+
6380
+ define ('AI_ADB_2_NAME', $adb_2_name);
6381
+
6382
+ if (function_exists ('ai_check_files')) ai_check_files ();
6383
+ }
6384
+ }
6385
+
6386
+ if (function_exists ('ai_load_globals')) ai_load_globals ();
6387
+
6388
+ if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC) {
6389
+ if (!in_array ('w3-total-cache/w3-total-cache.php', get_option ('active_plugins'))) {
6390
+ define ('AI_NO_W3TC', true);
6391
+ if (!defined ('W3TC_DYNAMIC_SECURITY')) define ('W3TC_DYNAMIC_SECURITY', 'W3 Total Cache plugin not active');
6392
+ }
6393
+ if (!defined ('W3TC_DYNAMIC_SECURITY')) {
6394
+ $string = AD_INSERTER_PLUGIN_DIR;
6395
+ if (defined ('AUTH_KEY')) $string .= AUTH_KEY;
6396
+ if (defined ('LOGGED_IN_KEY')) $string .= LOGGED_IN_KEY;
6397
+
6398
+ define ('W3TC_DYNAMIC_SECURITY', md5 ($string));
6399
+ }
6400
+ }
6401
+
6402
+
6403
+ if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
6404
+ require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
6405
+
6406
+ $detect = new ai_Mobile_Detect;
6407
+
6408
+ define ('AI_MOBILE', $detect->isMobile ());
6409
+ define ('AI_TABLET', $detect->isTablet ());
6410
+ define ('AI_PHONE', AI_MOBILE && !AI_TABLET);
6411
+ define ('AI_DESKTOP', !AI_MOBILE);
6412
+ } else {
6413
+ define ('AI_MOBILE', true);
6414
+ define ('AI_TABLET', true);
6415
+ define ('AI_PHONE', true);
6416
+ define ('AI_DESKTOP', true);
6417
+ }
6418
+
6419
+ if (isset ($_POST [AI_FORM_SAVE]))
6420
+ define ('AI_SYNTAX_HIGHLIGHTING', isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] != AI_OPTION_DISABLED); else
6421
+ define ('AI_SYNTAX_HIGHLIGHTING', get_syntax_highlighter_theme () != AI_OPTION_DISABLED);
6422
+
6423
+
6424
+ add_action ('wp_loaded', 'ai_wp_loaded_hook');
6425
+ add_action ('admin_menu', 'ai_admin_menu_hook');
6426
+ add_action ('init', 'ai_init_hook');
6427
+ add_action ('admin_notices', 'ai_admin_notice_hook');
6428
+ add_action ('wp', 'ai_wp_hook');
6429
+ add_action( 'wp_enqueue_scripts', 'ai_wp_enqueue_scripts_hook' );
6430
+
6431
+ if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_output_check (); else $ai_system_output = false;
6432
+
6433
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output)
6434
+ add_action ('shutdown', 'ai_shutdown_hook');
6435
+
6436
+ add_action ('widgets_init', 'ai_widgets_init_hook');
6437
+ add_action ('add_meta_boxes', 'ai_add_meta_box_hook');
6438
+ add_action ('save_post', 'ai_save_meta_box_data_hook');
6439
+
6440
+ if (function_exists ('ai_hooks')) ai_hooks ();
6441
+
6442
+ add_filter ('plugin_action_links_'.plugin_basename (__FILE__), 'ai_plugin_action_links');
6443
+ add_filter ('plugin_row_meta', 'ai_set_plugin_meta', 10, 2);
6444
+
6445
+ if (is_admin () === true) {
6446
+ add_action ('wp_ajax_ai_ajax_backend', 'ai_ajax_backend');
6447
+ add_action ('wp_ajax_ai_ajax', 'ai_ajax');
6448
+ add_action ('wp_ajax_nopriv_ai_ajax', 'ai_ajax');
6449
+ }
6450
+
6451
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
6452
+ $ai_total_plugin_time += microtime (true) - $start_time;
6453
+ ai_log ("INITIALIZATION END\n");
6454
+ }
6455
+
6456
+ //add_filter ('the_generator', 'ai_the_generator');
6457
+
6458
+ //function ai_the_generator ($generator) {
6459
+ // return preg_replace ('/content="(.*?)"/', 'content="$1, '.AD_INSERTER_NAME.' '. AD_INSERTER_VERSION.'"', $generator);
6460
+ //}
6461
+
6462
+ // ===========================================================================================
6463
+
6464
+ if (!class_exists ('ai_widget')) {
6465
+ class ai_widget extends WP_Widget {
6466
+
6467
+ function __construct () {
6468
+ parent::__construct (
6469
+ false, // Base ID
6470
+ AD_INSERTER_NAME, // Name
6471
+ array ( // Args
6472
+ 'classname' => 'ai_widget',
6473
+ 'description' => AD_INSERTER_NAME.' code block widget.')
6474
+ );
6475
+ }
6476
+
6477
+ function form ($instance) {
6478
+ global $block_object;
6479
+
6480
+ // Output admin widget options form
6481
+
6482
+ $widget_title = !empty ($instance ['widget-title']) ? $instance ['widget-title'] : '';
6483
+ $block = isset ($instance ['block']) ? $instance ['block'] : 1;
6484
+ if ($block > AD_INSERTER_BLOCKS) $block = 1;
6485
+ $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
6486
+
6487
+ if ($block == 0) $title = 'Processing Log';
6488
+ elseif ($block == - 1) $title = 'Dummy Widget';
6489
+ elseif ($block == - 2) $title = 'Debugging Tools';
6490
+ elseif ($block >= 1) {
6491
+ $obj = $block_object [$block];
6492
+
6493
+ $title = '[' . $block . '] ' . $obj->get_ad_name();
6494
+ if (!empty ($widget_title)) $title .= ' - ' . $widget_title;
6495
+ if ($obj->get_disable_insertion ()) $title .= ' - PAUSED ';
6496
+ if (!$obj->get_enable_widget ()) $title .= ' - WIDGET DISABLED';
6497
+ } else $title = "Unknown block";
6498
+
6499
+ $url_parameters = "";
6500
+ if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block);
6501
+
6502
+ ?>
6503
+ <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); ?>">
6504
+
6505
+ <p>
6506
+ <label for="<?php echo $this->get_field_id ('widget-title'); ?>">Title: &nbsp;</label>
6507
+ <input id="<?php echo $this->get_field_id ('widget-title'); ?>" name="<?php echo $this->get_field_name ('widget-title'); ?>" type="text" value="<?php echo esc_attr ($widget_title); ?>" style="width: 88%;">
6508
+ </p>
6509
+
6510
+ <p>
6511
+ <label for="<?php echo $this->get_field_id ('block'); ?>"><a href='<?php echo admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, "&tab=", $block; ?>' title='Click for block settings' style='text-decoration: none;'>Block</a>:</label>
6512
+ <select id="<?php echo $this->get_field_id ('block'); ?>" name="<?php echo $this->get_field_name('block'); ?>" style="width: 88%;">
6513
+ <?php
6514
+ for ($block_index = 1; $block_index <= AD_INSERTER_BLOCKS; $block_index ++) {
6515
+ $obj = $block_object [$block_index];
6516
+ ?>
6517
+ <option value='<?php echo $block_index; ?>' <?php if ($block_index == $block) echo 'selected="selected"'; ?>><?php echo $block_index, ' - ', $obj->get_ad_name(), $obj->get_disable_insertion () ? ' - PAUSED' : ''; ?></option>
6518
+ <?php } ?>
6519
+ <option value='-2' <?php if ($block == - 2) echo 'selected="selected"'; ?>>Debugging Tools</option>
6520
+ <option value='0' <?php if ($block == 0) echo 'selected="selected"'; ?>>Processing Log</option>
6521
+ <option value='-1' <?php if ($block == - 1) echo 'selected="selected"'; ?>>Dummy Widget</option>
6522
+ </select>
6523
+ </p>
6524
+
6525
+ <p>
6526
+ <input type="hidden" name='<?php echo $this->get_field_name ('sticky'); ?>' value="0" />
6527
+ <input type='checkbox' id='<?php echo $this->get_field_id ('sticky'); ?>' name='<?php echo $this->get_field_name ('sticky'); ?>' value='1' <?php if ($sticky) echo 'checked '; ?>>
6528
+ <label for='<?php echo $this->get_field_id ('sticky'); ?>'>Sticky</label>
6529
+ </p>
6530
+ <?php
6531
+ }
6532
+
6533
+ function update ($new_instance, $old_instance) {
6534
+ // Save widget options
6535
+ $instance = $old_instance;
6536
+
6537
+ $instance ['widget-title'] = (!empty ($new_instance ['widget-title'])) ? strip_tags ($new_instance ['widget-title']) : '';
6538
+ // $instance ['title'] = (!empty ($new_instance ['title'])) ? strip_tags ($new_instance ['title']) : '';
6539
+ $instance ['title'] = (!empty ($new_instance ['title'])) ? ($new_instance ['title']) : '';
6540
+ $instance ['block'] = (isset ($new_instance ['block'])) ? $new_instance ['block'] : 1;
6541
+ $instance ['sticky'] = (isset ($new_instance ['sticky'])) ? $new_instance ['sticky'] : 0;
6542
+
6543
+ return $instance;
6544
+ }
6545
+
6546
+ function widget ($args, $instance) {
6547
+ global $ai_last_check, $ai_wp_data, $ai_total_plugin_time;
6548
+
6549
+ $debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
6550
+ if ($debug_processing) $start_time = microtime (true);
6551
+
6552
+ $ai_last_check = AI_CHECK_NONE;
6553
+
6554
+ $block = 0;
6555
+ ai_widget_draw ($args, $instance, $block);
6556
+
6557
+ if ($debug_processing) {
6558
+ $ai_total_plugin_time += microtime (true) - $start_time;
6559
+ if ($ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($block, $ai_last_check));
6560
+ ai_log ("WIDGET END\n");
6561
+ }
6562
+ }
6563
+ }
6564
+ }
6565
+
6566
+
6567
+ } else {
6568
+ if (!function_exists ('ai_activation_error')) {
6569
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
6570
+
6571
+ function ai_activation_error () {
6572
+ ?>
6573
+ <div class="notice notice-error is-dismissible">
6574
+ <div class="ai-notice-element">
6575
+ <img src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-50x50.jpg" style="width: 50px; margin: 5px 10px 0px 10px;" />
6576
+ </div>
6577
+ <div class="ai-notice-element" style="width: 100%; padding: 0 10px 0;">
6578
+ <p>Ad Inserter can't be used while Ad Inserter Pro is active! To activate Ad Inserter you need to first deactivate Ad Inserter Pro.</p>
6579
+ <p><strong>WARNING</strong>: Please note that saving settings in Ad Inserter will clear all settings that are available only in the Pro version (blocks 17 - 96, additional block and plugin settings)!</p>
6580
+ </div>
6581
+ </div>
6582
+ <?php
6583
+ }
6584
+
6585
+ unset ($_GET ['activate']);
6586
+ deactivate_plugins ('ad-inserter/ad-inserter.php');
6587
+ add_action ('admin_notices', 'ai_activation_error');
6588
+ }
6589
+ }
6590
+
class.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
4
 
5
  abstract class ai_BaseCodeBlock {
@@ -353,6 +355,16 @@ abstract class ai_BaseCodeBlock {
353
  return $display_for_devices;
354
  }
355
 
 
 
 
 
 
 
 
 
 
 
356
  public function clear_code_cache (){
357
  unset ($this->wp_options ['GENERATED_CODE']);
358
  }
@@ -1881,7 +1893,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1881
  if ($ai_wp_data [AI_WP_AMP_PAGE]) {
1882
  if (!$this->get_enable_amp ()) {
1883
  $processed_code = '';
1884
- $this->labels->class = 'ai-debug-normal';
 
1885
  }
1886
  }
1887
  }
@@ -2035,8 +2048,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2035
  }
2036
  }
2037
 
 
 
 
 
2038
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 /*&& !$hide_debug_label*/) {
2039
- $processed_code = "<div class='ai-code'>\n" . $processed_code ."</div>\n";
2040
  }
2041
 
2042
  if (function_exists ('ai_adb_block_actions')) ai_adb_block_actions ($this, $hide_debug_label);
@@ -2055,14 +2072,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2055
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
2056
  $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>' . $fallback_block_name;
2057
 
2058
- if (!defined ('AI_DEBUGGING_DEMO') || $this->demo_debugging) {
2059
- $this->additional_code_before =
2060
- $this->labels->block_start () .
2061
- $this->labels->bar ($block_name, '', '<kbd class="ai-debug-name ai-main"></kbd>', $counters, $title) .
2062
- $this->additional_code_before;
2063
 
2064
- $this->additional_code_after .= $this->labels->block_end ();
2065
- }
2066
  }
2067
 
2068
  return $this->additional_code_before . $processed_code . $this->additional_code_after;
@@ -2445,7 +2460,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2445
  $option = isset ($this->wp_options [AI_OPTION_SCHEDULING]) ? $this->wp_options [AI_OPTION_SCHEDULING] : "";
2446
 
2447
  // Convert old option
2448
- if ($option == '' && intval ($this->get_ad_after_day()) != 0) $option = AI_SCHEDULING_DELAY;
2449
 
2450
  if ($option == '') $option = AI_SCHEDULING_OFF;
2451
 
@@ -3366,10 +3381,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3366
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
3367
 
3368
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3369
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
3370
  $inserted_code = $this->get_code_for_serverside_insertion ();
3371
- $this->clear_code_cache ();
3372
  $ai_last_check = AI_CHECK_INSERTED;
 
3373
  $inserted = true;
3374
  }
3375
  }
@@ -3416,7 +3432,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
3416
  // $this->increment_block_counter ();
3417
 
3418
  // $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3419
- // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
3420
  // $content_position = $paragraph_positions [$position];
3421
 
3422
  // if ($multibyte) {
@@ -4083,10 +4100,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4083
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
4084
 
4085
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4086
- if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
4087
  $inserted_code = $this->get_code_for_serverside_insertion ();
4088
- $this->clear_code_cache ();
4089
  $ai_last_check = AI_CHECK_INSERTED;
 
4090
  $inserted = true;
4091
  }
4092
  }
@@ -4134,7 +4152,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4134
  // $this->increment_block_counter ();
4135
 
4136
  // $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4137
- // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
 
4138
  // $content_position = $paragraph_positions [$position];
4139
 
4140
  // if ($multibyte) {
@@ -4504,7 +4523,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4504
  return true;
4505
  break;
4506
 
4507
- case AI_SCHEDULING_DELAY:
4508
  $after_days = trim ($this->get_ad_after_day());
4509
  if ($after_days == '') return true;
4510
  $after_days = intval ($after_days);
@@ -4516,6 +4535,18 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4516
  return (date ('U', current_time ('timestamp')) >= $post_date + $after_days * 86400);
4517
  break;
4518
 
 
 
 
 
 
 
 
 
 
 
 
 
4519
  case AI_SCHEDULING_BETWEEN_DATES:
4520
  if (!function_exists ('ai_scheduling_options')) return true;
4521
 
@@ -4536,41 +4567,86 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
4536
  return ($insertion_enabled);
4537
  break;
4538
 
4539
- default:
4540
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4541
  break;
4542
- }
4543
- }
4544
 
4545
- function check_referer () {
 
4546
 
4547
- // if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE || ((get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW || get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT) && $ai_wp_data [AI_WP_AMP_PAGE])) {
4548
- // $domain_list_type = $this->get_ad_domain_list_type ();
4549
 
4550
- // if (isset ($_SERVER['HTTP_REFERER'])) {
4551
- // $referer_host = strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST));
4552
- // } else $referer_host = '';
4553
 
4554
- // if ($domain_list_type == AD_BLACK_LIST) $return = false; else $return = true;
4555
 
4556
- // $domains = strtolower (trim ($this->get_ad_domain_list ()));
4557
- // if ($domains == AD_EMPTY_DATA) return !$return;
4558
- // $domains = explode (",", $domains);
 
 
 
 
4559
 
4560
- // foreach ($domains as $domain) {
4561
- // $domain = trim ($domain);
4562
- // if ($domain == "") continue;
4563
 
4564
- // if ($domain == "#") {
4565
- // if ($referer_host == "") return $return;
4566
- // } elseif ($domain == $referer_host) return $return;
4567
- // }
4568
- // return !$return;
4569
- // }
 
 
 
4570
 
4571
- // return true;
 
 
 
 
 
4572
 
 
 
 
 
 
 
 
 
 
4573
 
 
 
 
 
 
 
 
 
 
 
4574
  return check_check_referer_list ($this->get_ad_domain_list(), $this->get_ad_domain_list_type() == AD_WHITE_LIST);
4575
  }
4576
 
1
  <?php
2
 
3
+ if (!defined ('ABSPATH')) exit;
4
+
5
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
6
 
7
  abstract class ai_BaseCodeBlock {
355
  return $display_for_devices;
356
  }
357
 
358
+ public function get_debug_disable_insertion (){
359
+ global $ai_wp_data;
360
+
361
+ if (defined ('AI_DEBUGGING_DEMO') && !$this->demo_debugging) {
362
+ return false;
363
+ }
364
+
365
+ return ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) != 0;
366
+ }
367
+
368
  public function clear_code_cache (){
369
  unset ($this->wp_options ['GENERATED_CODE']);
370
  }
1893
  if ($ai_wp_data [AI_WP_AMP_PAGE]) {
1894
  if (!$this->get_enable_amp ()) {
1895
  $processed_code = '';
1896
+ $hide_debug_label = true;
1897
+ ai_log ('BLOCK ' . $this->number . ' NOT ENABLED FOR AMP PAGES - EMPTY CODE');
1898
  }
1899
  }
1900
  }
2048
  }
2049
  }
2050
 
2051
+ if (defined ('AI_DEBUGGING_DEMO') && !$this->demo_debugging) {
2052
+ $hide_debug_label = true;
2053
+ }
2054
+
2055
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_BLOCKS) != 0 /*&& !$hide_debug_label*/) {
2056
+ $processed_code = "<div class='ai-code'>\n" . $processed_code ."\n</div>\n";
2057
  }
2058
 
2059
  if (function_exists ('ai_adb_block_actions')) ai_adb_block_actions ($this, $hide_debug_label);
2072
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
2073
  $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>' . $fallback_block_name;
2074
 
2075
+ $this->additional_code_before =
2076
+ $this->labels->block_start () .
2077
+ $this->labels->bar ($block_name, '', '<kbd class="ai-debug-name ai-main"></kbd>', $counters, $title) .
2078
+ $this->additional_code_before;
 
2079
 
2080
+ $this->additional_code_after .= $this->labels->block_end ();
 
2081
  }
2082
 
2083
  return $this->additional_code_before . $processed_code . $this->additional_code_after;
2460
  $option = isset ($this->wp_options [AI_OPTION_SCHEDULING]) ? $this->wp_options [AI_OPTION_SCHEDULING] : "";
2461
 
2462
  // Convert old option
2463
+ if ($option == '' && intval ($this->get_ad_after_day()) != 0) $option = AI_SCHEDULING_DELAY_FOR;
2464
 
2465
  if ($option == '') $option = AI_SCHEDULING_OFF;
2466
 
3381
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
3382
 
3383
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3384
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
3385
+ if (!$this->get_debug_disable_insertion ()) {
3386
  $inserted_code = $this->get_code_for_serverside_insertion ();
 
3387
  $ai_last_check = AI_CHECK_INSERTED;
3388
+ $this->clear_code_cache ();
3389
  $inserted = true;
3390
  }
3391
  }
3432
  // $this->increment_block_counter ();
3433
 
3434
  // $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
3435
+ // //if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
3436
+ // if (!$this->get_debug_disable_insertion ()) {
3437
  // $content_position = $paragraph_positions [$position];
3438
 
3439
  // if ($multibyte) {
4100
  if ($max_page_blocks_enabled) $ai_wp_data [AI_PAGE_BLOCKS] ++;
4101
 
4102
  $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4103
+ // if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4104
+ if (!$this->get_debug_disable_insertion ()) {
4105
  $inserted_code = $this->get_code_for_serverside_insertion ();
 
4106
  $ai_last_check = AI_CHECK_INSERTED;
4107
+ $this->clear_code_cache ();
4108
  $inserted = true;
4109
  }
4110
  }
4152
  // $this->increment_block_counter ();
4153
 
4154
  // $ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
4155
+ // //if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
4156
+ // if (!$this->get_debug_disable_insertion ()) {
4157
  // $content_position = $paragraph_positions [$position];
4158
 
4159
  // if ($multibyte) {
4523
  return true;
4524
  break;
4525
 
4526
+ case AI_SCHEDULING_DELAY_FOR:
4527
  $after_days = trim ($this->get_ad_after_day());
4528
  if ($after_days == '') return true;
4529
  $after_days = intval ($after_days);
4535
  return (date ('U', current_time ('timestamp')) >= $post_date + $after_days * 86400);
4536
  break;
4537
 
4538
+ case AI_SCHEDULING_INSERT_ONLY_FOR:
4539
+ $after_days = trim ($this->get_ad_after_day());
4540
+ if ($after_days == '') return false;
4541
+ $after_days = intval ($after_days);
4542
+ if ($after_days == AD_ZERO) return false;
4543
+
4544
+ $post_date = get_the_date ('U');
4545
+ if ($post_date === false) return false;
4546
+
4547
+ return (date ('U', current_time ('timestamp')) < $post_date + $after_days * 86400);
4548
+ break;
4549
+
4550
  case AI_SCHEDULING_BETWEEN_DATES:
4551
  if (!function_exists ('ai_scheduling_options')) return true;
4552
 
4567
  return ($insertion_enabled);
4568
  break;
4569
 
4570
+ case AI_SCHEDULING_OUTSIDE_DATES:
4571
+ if (!function_exists ('ai_scheduling_options')) return true;
4572
+
4573
+ $current_time = current_time ('timestamp');
4574
+ $start_date = strtotime ($this->get_schedule_start_date(), $current_time);
4575
+ $end_date = strtotime ($this->get_schedule_end_date(), $current_time);
4576
+
4577
+ $insertion_enabled = $current_time < $start_date || $current_time >= $end_date;
4578
+
4579
+ if (!$insertion_enabled) {
4580
+ $fallback = intval ($this->get_fallback());
4581
+ if ($fallback != 0 && $fallback <= AD_INSERTER_BLOCKS) {
4582
+ $this->fallback = $fallback;
4583
+ return true;
4584
+ }
4585
+ }
4586
+
4587
+ return ($insertion_enabled);
4588
  break;
 
 
4589
 
4590
+ case AI_SCHEDULING_PUBLISHED_BETWEEN_DATES:
4591
+ if (!function_exists ('ai_scheduling_options')) return true;
4592
 
4593
+ $post_date = get_the_date ('U');
4594
+ if ($post_date === false) return false;
4595
 
4596
+ $current_time = current_time ('timestamp');
4597
+ $start_date = strtotime ($this->get_schedule_start_date(), $current_time);
4598
+ $end_date = strtotime ($this->get_schedule_end_date(), $current_time);
4599
 
4600
+ $insertion_enabled = $post_date >= $start_date && $post_date < $end_date;
4601
 
4602
+ if (!$insertion_enabled) {
4603
+ $fallback = intval ($this->get_fallback());
4604
+ if ($fallback != 0 && $fallback <= AD_INSERTER_BLOCKS) {
4605
+ $this->fallback = $fallback;
4606
+ return true;
4607
+ }
4608
+ }
4609
 
4610
+ return ($insertion_enabled);
4611
+ break;
 
4612
 
4613
+ case AI_SCHEDULING_PUBLISHED_OUTSIDE_DATES:
4614
+ if (!function_exists ('ai_scheduling_options')) return true;
4615
+
4616
+ $post_date = get_the_date ('U');
4617
+ if ($post_date === false) return true;
4618
+
4619
+ $current_time = current_time ('timestamp');
4620
+ $start_date = strtotime ($this->get_schedule_start_date(), $current_time);
4621
+ $end_date = strtotime ($this->get_schedule_end_date(), $current_time);
4622
 
4623
+ // echo "<pre>";
4624
+ // echo "current_time ", $current_time, " ", date ("Y-m-d H:i:s", $current_time), "<br />";
4625
+ // echo "start_date ", $start_date, " ", date ("Y-m-d H:i:s", $start_date), "<br />";
4626
+ // echo "end_date ", $end_date, " ", date ("Y-m-d H:i:s", $end_date), "<br />";
4627
+ // echo "post_date ", $post_date, " ", date ("Y-m-d H:i:s", $post_date), "<br />";
4628
+ // echo "</pre>";
4629
 
4630
+ $insertion_enabled = $post_date < $start_date || $post_date >= $end_date;
4631
+
4632
+ if (!$insertion_enabled) {
4633
+ $fallback = intval ($this->get_fallback());
4634
+ if ($fallback != 0 && $fallback <= AD_INSERTER_BLOCKS) {
4635
+ $this->fallback = $fallback;
4636
+ return true;
4637
+ }
4638
+ }
4639
 
4640
+ return ($insertion_enabled);
4641
+ break;
4642
+
4643
+ default:
4644
+ return true;
4645
+ break;
4646
+ }
4647
+ }
4648
+
4649
+ function check_referer () {
4650
  return check_check_referer_list ($this->get_ad_domain_list(), $this->get_ad_domain_list_type() == AD_WHITE_LIST);
4651
  }
4652
 
constants.php CHANGED
@@ -26,7 +26,7 @@ if (!defined( 'AD_INSERTER_NAME'))
26
  define ('AD_INSERTER_NAME', 'Ad Inserter');
27
 
28
  if (!defined( 'AD_INSERTER_VERSION'))
29
- define ('AD_INSERTER_VERSION', '2.3.17');
30
 
31
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
32
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -472,13 +472,21 @@ define('AD_ABOVE_AND_THEN_BELOW','above and then below');
472
  define('AD_BELOW_AND_THEN_ABOVE','below and then above');
473
 
474
  // Scheduling
475
- define('AI_SCHEDULING_OFF', 0);
476
- define('AI_SCHEDULING_DELAY', 1);
477
- define('AI_SCHEDULING_BETWEEN_DATES', 2);
478
-
479
- define('AI_TEXT_OFF', 'Insert immediately');
480
- define('AI_TEXT_DELAY_INSERTION', 'Delay insertion');
481
- define('AI_TEXT_INSERT_BETWEEN_DATES', 'Insert between dates');
 
 
 
 
 
 
 
 
482
 
483
  // Dynamic blocks
484
  define('AI_DYNAMIC_BLOCKS_SERVER_SIDE', 0);
@@ -660,6 +668,7 @@ define ('AI_BUFFERING', true);
660
  define ('AI_ADSENSE_API', true);
661
  define ('AI_ADSENSE_OVERLAY', true);
662
  define ('AI_STICKY_SETTINGS', true);
 
663
  define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
664
  define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
665
  define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
26
  define ('AD_INSERTER_NAME', 'Ad Inserter');
27
 
28
  if (!defined( 'AD_INSERTER_VERSION'))
29
+ define ('AD_INSERTER_VERSION', '2.3.18');
30
 
31
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
32
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
472
  define('AD_BELOW_AND_THEN_ABOVE','below and then above');
473
 
474
  // Scheduling
475
+ define('AI_SCHEDULING_OFF', 0);
476
+ define('AI_SCHEDULING_DELAY_FOR', 1);
477
+ define('AI_SCHEDULING_BETWEEN_DATES', 2);
478
+ define('AI_SCHEDULING_INSERT_ONLY_FOR', 3);
479
+ define('AI_SCHEDULING_OUTSIDE_DATES', 4);
480
+ define('AI_SCHEDULING_PUBLISHED_BETWEEN_DATES', 5);
481
+ define('AI_SCHEDULING_PUBLISHED_OUTSIDE_DATES', 6);
482
+
483
+ define('AI_TEXT_OFF', 'Insert immediately');
484
+ define('AI_TEXT_DELAY_INSERTION', 'Delay insertion');
485
+ define('AI_TEXT_INSERT_BETWEEN_DATES', 'Insert between dates');
486
+ define('AI_TEXT_INSERT_OUTSIDE_DATES', 'Insert outside dates');
487
+ define('AI_TEXT_INSERT_ONLY', 'Insert only');
488
+ define('AI_TEXT_INSERT_PUBLISHED_BETWEEN_DATES', 'Insert for posts published between dates');
489
+ define('AI_TEXT_INSERT_PUBLISHED_OUTSIDE_DATES', 'Insert for posts published outside dates');
490
 
491
  // Dynamic blocks
492
  define('AI_DYNAMIC_BLOCKS_SERVER_SIDE', 0);
668
  define ('AI_ADSENSE_API', true);
669
  define ('AI_ADSENSE_OVERLAY', true);
670
  define ('AI_STICKY_SETTINGS', true);
671
+ //define ('AI_PLUGIN_TRACKING', true);
672
  define ('AI_ADB_1_NAME', 'dqwpediwqswqma');
673
  define ('AI_ADB_2_DEFAULT_NAME', 'lfoswyekaaslsd');
674
  define ('AI_ADB_CONTENT_CSS_BEGIN', 'ai-adb-content-begin');
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.17"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.3.18"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
css/ai-admin.css CHANGED
@@ -13,6 +13,7 @@
13
  color: #444;
14
  font-size: 13px;
15
  font-family: 'Open Sans', sans-serif;
 
16
  }
17
  .ai-notice-buttons {
18
  border-left: 1px solid #E5E5E5;
@@ -28,6 +29,7 @@
28
  }
29
  .ai-notice-buttons button.button-primary {
30
  margin: 10px;
 
31
  }
32
  .ai-notice-buttons a {
33
  text-decoration: none;
@@ -38,7 +40,8 @@
38
  display: inline-block;
39
  color: #bbb;
40
  cursor: pointer;
41
- margin: 2px 10px 10px;
 
42
  }
43
 
44
  @media (max-width: 1200px) {
13
  color: #444;
14
  font-size: 13px;
15
  font-family: 'Open Sans', sans-serif;
16
+ user-select: none;
17
  }
18
  .ai-notice-buttons {
19
  border-left: 1px solid #E5E5E5;
29
  }
30
  .ai-notice-buttons button.button-primary {
31
  margin: 10px;
32
+ line-height: 28px;
33
  }
34
  .ai-notice-buttons a {
35
  text-decoration: none;
40
  display: inline-block;
41
  color: #bbb;
42
  cursor: pointer;
43
+ margin: 0px 10px 0px;
44
+ vertical-align: middle;
45
  }
46
 
47
  @media (max-width: 1200px) {
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.17";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -948,6 +948,7 @@ jQuery(document).ready(function($) {
948
  function process_scheduling_dates (block) {
949
  var start_date_picker = $("#scheduling-on-"+block);
950
  var end_date_picker = $("#scheduling-off-"+block);
 
951
  var start_date = getDate (start_date_picker);
952
  var end_date = getDate (end_date_picker);
953
 
@@ -961,17 +962,18 @@ jQuery(document).ready(function($) {
961
  end_date_picker.attr ('title', '');
962
  } else
963
  if (end_date > start_date) {
964
- var now = new Date();
965
- var today_date = new Date (now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
966
- if (end_date <= today_date) {
967
- var expiration = Math.round ((today_date - end_date) / 1000 / 3600 / 24);
968
- // end_date_picker.attr ('title', 'Invalid end date - insertion already expired ');
969
- end_date_picker.attr ('title', 'Insertion expired');
970
- end_date_picker.css ("border-color", "#d00");
971
- } else {
972
- var duration = Math.round ((end_date - start_date) / 1000 / 3600 / 24);
973
- end_date_picker.attr ('title', ' Duration: ' + duration + ' day' + (duration == 1 ? '' : 's'));
974
- }
 
975
  } else {
976
  end_date_picker.attr ('title', 'Invalid end date - must be after start date');
977
  end_date_picker.css ("border-color", "#d00");
@@ -1136,14 +1138,14 @@ jQuery(document).ready(function($) {
1136
  $("#scheduling-between-dates-"+block).hide();
1137
  $("#scheduling-delay-warning-"+block).hide();
1138
  var scheduling = $("select#scheduling-"+block).val();
1139
- if (scheduling == "1") {
1140
  // if (content_settings) {
1141
  $("#scheduling-delay-"+block).show();
1142
  // } else {
1143
  // $("#scheduling-delay-warning-"+block).show();
1144
  // }
1145
  } else
1146
- if (scheduling == "2") {
1147
  $("#scheduling-between-dates-"+block).show();
1148
  process_scheduling_dates (block);
1149
  }
@@ -3920,7 +3922,7 @@ jQuery(document).ready(function($) {
3920
  update_block_code_demo ();
3921
  });
3922
 
3923
- setTimeout (update_rating, 1000);
3924
 
3925
  if (debug) console.log ("");
3926
  if (debug) console.log ("READY END");
1
+ var javascript_version = "2.3.18";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
948
  function process_scheduling_dates (block) {
949
  var start_date_picker = $("#scheduling-on-"+block);
950
  var end_date_picker = $("#scheduling-off-"+block);
951
+ var scheduling = $("select#scheduling-"+block).val();
952
  var start_date = getDate (start_date_picker);
953
  var end_date = getDate (end_date_picker);
954
 
962
  end_date_picker.attr ('title', '');
963
  } else
964
  if (end_date > start_date) {
965
+ if (scheduling == "2") {
966
+ var now = new Date();
967
+ var today_date = new Date (now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
968
+ if (end_date <= today_date) {
969
+ var expiration = Math.round ((today_date - end_date) / 1000 / 3600 / 24);
970
+ end_date_picker.attr ('title', 'Insertion expired');
971
+ end_date_picker.css ("border-color", "#d00");
972
+ } else {
973
+ var duration = Math.round ((end_date - start_date) / 1000 / 3600 / 24);
974
+ end_date_picker.attr ('title', ' Duration: ' + duration + ' day' + (duration == 1 ? '' : 's'));
975
+ }
976
+ }
977
  } else {
978
  end_date_picker.attr ('title', 'Invalid end date - must be after start date');
979
  end_date_picker.css ("border-color", "#d00");
1138
  $("#scheduling-between-dates-"+block).hide();
1139
  $("#scheduling-delay-warning-"+block).hide();
1140
  var scheduling = $("select#scheduling-"+block).val();
1141
+ if (scheduling == "1" || scheduling == "3") {
1142
  // if (content_settings) {
1143
  $("#scheduling-delay-"+block).show();
1144
  // } else {
1145
  // $("#scheduling-delay-warning-"+block).show();
1146
  // }
1147
  } else
1148
+ if (scheduling == "2" || scheduling == "4" || scheduling == "5" || scheduling == "6") {
1149
  $("#scheduling-between-dates-"+block).show();
1150
  process_scheduling_dates (block);
1151
  }
3922
  update_block_code_demo ();
3923
  });
3924
 
3925
+ setTimeout (function() {update_rating ('');}, 1000);
3926
 
3927
  if (debug) console.log ("");
3928
  if (debug) console.log ("READY END");
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Ad Inserter - WordPress Ads with AdSense Header Integration ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
@@ -6,7 +6,7 @@ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, adv
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
- Stable tag: 2.3.16
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
@@ -17,7 +17,7 @@ Ad management plugin with many advanced advertising features to insert ads at op
17
 
18
  Supports all kinds of ads including **Google AdSense ads**, contextual **Amazon Native Shopping Ads**, **Media.net ads** and **rotating banner ads.**
19
 
20
- Ad Inserter is more than just ad manager or plugin for ads. It provides many advanced options to insert opt-in forms, header scripts, AMP ads, Javascript, CSS, HTML, PHP, analytics, tracking or advert code anywhere on the page.
21
 
22
  **Ad Inserter can insert ads where other plugins fail**.
23
  It's all about the settings.
@@ -45,9 +45,11 @@ Average Rating: 5 out of 5 stars - check <a href="https://wordpress.org/support/
45
  > God bless these guys! [...](https://wordpress.org/support/topic/god-bless-these-guys-2/)
46
  > PRO for Free [...](https://wordpress.org/support/topic/pro-for-free/)
47
 
 
 
48
  **Features**
49
 
50
- * [AdSense integration](https://adinserter.pro/documentation/adsense-ads) - get ads form your AdSense account
51
  * Syntax highlighting [editor](https://adinserter.pro/documentation/code-editing)
52
  * Code preview with visual CSS editor
53
  * Automatically inserts ads on posts and pages
@@ -677,6 +679,14 @@ AD CODE RIGHT
677
 
678
  == Changelog ==
679
 
 
 
 
 
 
 
 
 
680
  = 2.3.17 =
681
  - Added shortcode for ad blocking detection action
682
  - Few minor bug fixes, cosmetic changes and code improvements
@@ -785,6 +795,14 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
785
 
786
  == Upgrade Notice ==
787
 
 
 
 
 
 
 
 
 
788
  = 2.3.17 =
789
  Added shortcode for ad blocking detection action;
790
  Few minor bug fixes, cosmetic changes and code improvements
1
+ === Ad Inserter - AdSense plugin, WP Ads, Header Code ===
2
 
3
  Contributors: spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
+ Stable tag: 2.3.17
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
17
 
18
  Supports all kinds of ads including **Google AdSense ads**, contextual **Amazon Native Shopping Ads**, **Media.net ads** and **rotating banner ads.**
19
 
20
+ This plugin is more than AdSense plugin or plugin for ads. It provides many advanced options to insert opt-in forms, header scripts, AMP ads, Javascript, CSS, HTML, PHP, analytics, tracking or advert code anywhere on the page.
21
 
22
  **Ad Inserter can insert ads where other plugins fail**.
23
  It's all about the settings.
45
  > God bless these guys! [...](https://wordpress.org/support/topic/god-bless-these-guys-2/)
46
  > PRO for Free [...](https://wordpress.org/support/topic/pro-for-free/)
47
 
48
+ Looking for AdSense plugin with simple setup for ads at best positions? A plugin for Amazon ads and Google Analytics code in the header?
49
+
50
  **Features**
51
 
52
+ * Enable [AdSense integration](https://adinserter.pro/documentation/adsense-ads) and get powerful AdSense plugin
53
  * Syntax highlighting [editor](https://adinserter.pro/documentation/code-editing)
54
  * Code preview with visual CSS editor
55
  * Automatically inserts ads on posts and pages
679
 
680
  == Changelog ==
681
 
682
+ = 2.3.18 =
683
+ - Added support to schedule insertion for N days after publishing
684
+ - Added support to schedule insertion only for posts published inside/outside time period (Pro only)
685
+ - Added support to prevent activation of free Ad Inserter while Pro is active
686
+ - Added url parameter to show block code
687
+ - Improved Header/Footer code debugging
688
+ - Few minor bug fixes, cosmetic changes and code improvements
689
+
690
  = 2.3.17 =
691
  - Added shortcode for ad blocking detection action
692
  - Few minor bug fixes, cosmetic changes and code improvements
795
 
796
  == Upgrade Notice ==
797
 
798
+ = 2.3.18 =
799
+ Added support to schedule insertion for N days after publishing;
800
+ Added support to schedule insertion only for posts published inside/outside time period (Pro only);
801
+ Added support to prevent activation of free Ad Inserter while Pro is active;
802
+ Added url parameter to show block code;
803
+ Improved Header/Footer code debugging;
804
+ Few minor bug fixes, cosmetic changes and code improvements
805
+
806
  = 2.3.17 =
807
  Added shortcode for ad blocking detection action;
808
  Few minor bug fixes, cosmetic changes and code improvements
settings.php CHANGED
@@ -146,11 +146,11 @@ function generate_settings_form (){
146
  </div>
147
  <div id="header-buttons">
148
  <img id="ai-loading" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>loading.gif" style="width: 24px; height: 24px; vertical-align: middle; margin-right: 20px; display: none;" />
149
- <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('http://adinserter.pro/documentation')" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button>
150
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter')" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button>
151
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4')" title="Support Free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!">Donate</button>
152
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/')" title="If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres">Review</button>
153
- <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('http://adinserter.pro/')" title="Need more code blocks, sticky ads, GEO targeting, impression and click tracking? Upgrade to Ad Inserter Pro">Go&nbsp;Pro</button>
154
  <button id="ai-list" type="button" class="ai-top-button" style="width: 62px; display: none; margin-right: 0px; outline-color: transparent;" title="Show list of all code blocks"><span>Blocks</span></button>
155
  </div>
156
 
@@ -163,7 +163,7 @@ function generate_settings_form (){
163
  <div id="javascript-warning" class="ai-form rounded" style="display: none;">
164
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
165
  <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
166
- <span id="javascript-version-parameter" style="display: none;">Wrong or <a href="https://adinserter.pro/documentation#missing-version-parameter" class="simple-link" target="_blank">missing version parameter</a> for the javscript file, probably due to inappropriate caching.<br /></span>
167
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
168
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
169
  Please delete browser's cache and all other caches used and then reload this page.
@@ -185,7 +185,7 @@ function generate_settings_form (){
185
  <div id="blocked-warning" class="ai-form warning-enabled rounded">
186
  <h2 class="blocked-warning-text" style="float: left; color: red; margin: 7px 0;" title="Error loading page">WARNING</h2>
187
  <div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
188
- Page may <a href="https://adinserter.pro/documentation#page-blocked" class="simple-link" target="_blank">not be loaded properly</a>.
189
  Check ad blocking software that may block CSS, Javascript or image files.
190
  </div>
191
  <div style="clear: both;"></div>
@@ -438,7 +438,7 @@ function generate_settings_form (){
438
  $lists;
439
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
440
 
441
- $show_manual = $manual [$block];
442
  if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$block] || empty ($sidebars_with_widget [$block]) ? "#66f;" : "#e44;"); else $manual_style = "";
443
 
444
  $insertion_options =
@@ -1782,7 +1782,8 @@ function generate_settings_form (){
1782
  <div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
1783
  <select id="scheduling-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
1784
  <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
1785
- <option value="<?php echo AI_SCHEDULING_DELAY; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
 
1786
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
1787
  </select>
1788
 
@@ -2520,7 +2521,7 @@ function generate_settings_form (){
2520
  if ($number_of_used_blocks >= 3) $sidebar = 4;
2521
  }
2522
 
2523
- // $sidebar = 4;
2524
 
2525
  if (!function_exists ('ai_settings_side')) {
2526
 
@@ -3369,34 +3370,40 @@ function generate_list_options ($options) {
3369
 
3370
  function sidebar_addense_alternative () { ?>
3371
 
 
 
 
 
3372
  <div class="ai-form header rounded">
3373
  <div style="float: left;">
3374
  <h2 style="display: inline-block; margin: 5px 0;">Blank Ad Blocks? Looking for AdSense alternative?</h2>
3375
  </div>
3376
  <div style="clear: both;"></div>
3377
  </div>
3378
- <?php
3379
- switch (rand (1, 2)) {
3380
- case 1:
3381
- ?>
3382
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3383
  <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3384
  </div>
3385
 
3386
- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3387
- <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
3388
- </div>
3389
  <?php
3390
  break;
3391
  case 2:
3392
  ?>
 
 
 
 
 
 
3393
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3394
  <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
3395
  </div>
3396
 
3397
- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3398
- <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3399
- </div>
3400
  <?php
3401
  break;
3402
  }
@@ -3460,25 +3467,26 @@ function sidebar_help () { ?>
3460
  <div style="float: left;">
3461
  <h2 style="display: inline-block; margin: 5px 0;">
3462
  Need help with <a href="https://adinserter.pro/documentation" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">settings</a>?
3463
- For <a href="https://adinserter.pro/documentation#quick-start" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">quick start</a> check <a href="https://adinserter.pro/code-editing" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Code Editing</a> and
3464
- <a href="https://adinserter.pro/settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Common Settings</a>
 
3465
  </h2>
3466
  <div>
3467
- <strong>New to <a href="https://adinserter.pro/adsense-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense</a>?</strong>
3468
- <a href="https://adinserter.pro/adsense-ads#connect-your-site" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Connect your site</a> - Advanced
3469
- <a href="https://adinserter.pro/adsense-ads#ad-code" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense code</a>:
3470
- <a href="https://adinserter.pro/adsense-ads#in-feed-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">In-feed ads</a>,
3471
- <a href="https://adinserter.pro/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Auto ads</a>,
3472
- <a href="https://adinserter.pro/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AMP ads</a>
3473
  </div>
3474
  <hr />
3475
- <div>Ads are not showing? Check <a href="https://adinserter.pro/adsense-ads#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">troubleshooting guide</a> to find out how to diagnose and fix the problem.</div>
3476
  <div>If you need any kind of help or support, please do not hesitate to open a thread on the <a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">support forum</a>.</div>
3477
  </div>
3478
- <div style="float: right; margin: -5px -5px 0 0;">
3479
- <a href="https://adinserter.pro/Ad_Inserter_User_Manual.pdf" class="clear-link" target="_blank"><img id="ai-pdf" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>manual.png" title="Download user manual"/></a>
3480
- <div style="text-align: center; font-size: 12px;">User Manual</div>
3481
- </div>
3482
  <div style="clear: both;"></div>
3483
  </div>
3484
 
@@ -3494,7 +3502,7 @@ function sidebar_pro () {
3494
  <div>
3495
  <?php switch ($version) {
3496
  case 0: ?>
3497
- <!-- <a href="http://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>-->
3498
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" style="margin-top: 10px;" /></a>
3499
  <?php break; case 1: ?>
3500
  <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
@@ -3504,9 +3512,9 @@ function sidebar_pro () {
3504
  <div>
3505
  <?php switch ($version) {
3506
  case 0: ?>
3507
- <a href="https://adinserter.pro/tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3508
  <?php break; case 1: ?>
3509
- <a href='https://adinserter.pro/documentation#code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3510
  <?php break;
3511
  } ?>
3512
  </div>
@@ -3515,7 +3523,7 @@ function sidebar_pro () {
3515
  case 0: ?>
3516
  <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3517
  <?php break; case 1: ?>
3518
- <!-- <a href="https://adinserter.pro/lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>-->
3519
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" style="margin-top: 10px;" /></a>
3520
  <?php break;
3521
  } ?>
@@ -3523,9 +3531,9 @@ function sidebar_pro () {
3523
  <div>
3524
  <?php switch ($version) {
3525
  case 0: ?>
3526
- <a href='https://adinserter.pro/documentation#code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3527
  <?php break; case 1: ?>
3528
- <a href="https://adinserter.pro/tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3529
  <?php break;
3530
  } ?>
3531
  </div>
@@ -3536,52 +3544,52 @@ function sidebar_pro () {
3536
 
3537
  <ul>
3538
  <li>64 code (ad) blocks</li>
3539
- <li><a href="https://adinserter.pro/adsense-ads#integration" class="simple-link" target="_blank">AdSense Integration</a></li>
3540
- <li>Syntax highlighting <a href="https://adinserter.pro/code-editing" class="simple-link" target="_blank">editor</a></li>
3541
- <li><a href="http://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
3542
  <li>Simple user interface - all settings on a single page</li>
3543
- <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
3544
- <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
3545
- <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
3546
- <li><a href="http://adinserter.pro/documentation#automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> below <code>&lt;body&gt;</code> or above <code>&lt;/body&gt;</code> tags</li>
3547
- <li>Automatic insertion at <a href="https://adinserter.pro/documentation#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
3548
- <li>Insertion <a href="https://adinserter.pro/documentation#insertion-before-after-html-element" class="simple-link" target="_blank">before or after any HTML element on the page</a> (using CSS selectors)</li>
3549
- <li><a href="https://adinserter.pro/exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
3550
- <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
3551
- <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ads</a> with optional close button (ads stay fixed when the page scrolls)</li>
3552
- <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky sidebar ads</a> (stick to the screen or to the content)</li>
3553
- <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad animations</a> (fade, slide, turn, flip, zoom)</li>
3554
- <li><a href="https://adinserter.pro/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad trigger</a> (page scroll in % or px, HTML element becomes visible)</li>
3555
- <li><a href="http://adinserter.pro/documentation#manual-insertion" class="simple-link" target="_blank">Sticky (fixed) widgets</a> (sidebar does not move when the page scrolls)</li>
3556
- <li>Block <a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">alignment and style</a> customizations</li>
3557
- <li><a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers (AdSense TOS)</li>
3558
- <li>Options to <a href="http://adinserter.pro/documentation#misc" class="simple-link" target="_blank">disable insertion</a> on Ajax calls, 404 error pages or in RSS feeds</li>
3559
- <li><a href="https://adinserter.pro/code-editing#ad-rotation" class="simple-link" target="_blank">Ad rotation</a> (works also with caching)</li>
3560
- <li>Ad impression and click <a href="https://adinserter.pro/tracking" class="simple-link" target="_blank">tracking</a> (works also with Javascript ads like AdSense)</li>
3561
- <li>Support for <a href="https://adinserter.pro/tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
3562
- <li>Support for <a href="https://adinserter.pro/documentation#lazy-loading" class="simple-link" target="_blank">lazy loading</a></li>
3563
- <li>Support for ads on <a href="http://adinserter.pro/settings#amp" class="simple-link" target="_blank">AMP pages</a></li>
3564
- <li>Support for contextual <a href="https://adinserter.pro/settings#amazon" class="simple-link" target="_blank">Amazon Native Shopping Ads</a> (responsive)</li>
3565
  <li>Custom CSS class name for wrapping divs to avoid ad blockers</li>
3566
  <li>PHP code processing</li>
3567
- <li><a href="https://adinserter.pro/code-editing#banners" class="simple-link" target="_blank">Banner</a> code generator</li>
3568
- <li>Support for <a href="http://adinserter.pro/documentation#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
3569
  <li>Support for Google Analytics, Piwik or any other web analytics code</li>
3570
- <li>Desktop, tablet and phone server-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">device detection</a></li>
3571
- <li>Client-side <a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">mobile device detection</a> (works with caching, 6 custom viewports)</li>
3572
- <li><a href="https://adinserter.pro/ad-blocking-detection" class="simple-link" target="_blank">Ad blocking detection</a> - popup message, ad replacement, content protection</li>
3573
- <li><a href="https://adinserter.pro/tracking#ad-blocking-statistics" class="simple-link" target="_blank">Ad blocking statistics</a></li>
3574
- <li><a href="http://adinserter.pro/lists" class="simple-link" target="_blank">Black/White-list </a>categories, tags, taxonomies, users, post IDs, urls, referers</li>
3575
- <li><a href="http://adinserter.pro/lists#geo-targeting" class="simple-link" target="_blank">Black/White-list </a>IP addresses or countries (works also with caching)</li>
3576
- <li><a href="http://adinserter.pro/documentation#multisite" class="simple-link" target="_blank">Multisite options</a> to limit settings on the sites</li>
3577
- <li><a href="https://adinserter.pro/code-editing#export-import" class="simple-link" target="_blank">Import/Export</a> block or plugin settings</li>
3578
- <li><a href="http://adinserter.pro/documentation#scheduling" class="simple-link" target="_blank">Scheduling</a> with fallback option</li>
3579
- <li>Country-level <a href="http://adinserter.pro/lists#geo-targeting" class="simple-link" target="_blank">GEO targeting</a> (works also with caching)</li>
3580
- <li>Simple troubleshooting with many <a href="http://adinserter.pro/documentation#debugging" class="simple-link" target="_blank">debugging functions</a></li>
3581
- <li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
3582
- <li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
3583
- <li><a href="http://adinserter.pro/documentation#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
3584
- <li><a href="https://adinserter.pro/code-editing#clipboard" class="simple-link" target="_blank">Clipboard support</a> to easily copy code blocks or settings</li>
3585
  <li>No ads on the settings page</li>
3586
  <li>Support via email</li>
3587
  </ul>
@@ -3590,7 +3598,7 @@ function sidebar_pro () {
3590
  With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, ad statistics for impressions and clicks,
3591
  A/B testing, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, to protect content from users using ad blockers, to serve different ads for users using ad blockers,
3592
  multisite options to limit settings for ads, to block some IP addresses, to schedule ads, then you can simply upgrade to
3593
- <a href="http://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
3594
  </div>
3595
 
3596
  <?php
@@ -3616,25 +3624,25 @@ function sidebar_pro_small () { ?>
3616
 
3617
  <div style="float: right; margin-left: 15px;">
3618
  <ul>
3619
- <li><a href="https://adinserter.pro/alignments-and-styles" class="simple-link" target="_blank">Sticky positions</a></li>
3620
- <li><a href="http://adinserter.pro/lists" class="simple-link" target="_blank">Limit insertions</a></li>
3621
- <li><a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options</li>
3622
  </ul>
3623
  </div>
3624
 
3625
  <div style="float: right; margin-left: 15px;">
3626
  <ul>
3627
  <li>Ad rotation</li>
3628
- <li><a href="https://adinserter.pro/tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
3629
- <li><a href="https://adinserter.pro/tracking" class="simple-link" target="_blank">Ad tracking</a></li>
3630
  </ul>
3631
  </div>
3632
 
3633
  <div style="float: right; margin-left: 15px;">
3634
  <ul>
3635
- <li>Support for <a href="http://adinserter.pro/settings#amp" class="simple-link" target="_blank">AMP pages</a></li>
3636
- <li><a href="https://adinserter.pro/ad-blocking-detection" class="simple-link" target="_blank">Ad blocking detection</a></li>
3637
- <li><a href="http://adinserter.pro/documentation#devices" class="simple-link" target="_blank">Mobile device detection</a></li>
3638
 
3639
  </ul>
3640
  </div>
@@ -3642,8 +3650,8 @@ function sidebar_pro_small () { ?>
3642
  <div style="float: right; margin-left: 15px;">
3643
  <ul>
3644
  <li>64 code blocks</li>
3645
- <li><a href="http://adinserter.pro/lists#geo-targeting" class="simple-link" target="_blank">GEO targeting</a></li>
3646
- <li><a href="http://adinserter.pro/documentation#scheduling" class="simple-link" target="_blank">Scheduling</a></li>
3647
  </ul>
3648
  </div>
3649
 
146
  </div>
147
  <div id="header-buttons">
148
  <img id="ai-loading" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>loading.gif" style="width: 24px; height: 24px; vertical-align: middle; margin-right: 20px; display: none;" />
149
+ <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://adinserter.pro/documentation')" title="<?php echo AD_INSERTER_NAME; ?> Documentation">Doc</button>
150
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter')" title="<?php echo AD_INSERTER_NAME; ?> support forum">Support</button>
151
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4')" title="Support Free Ad Inserter development. If you are making money with Ad Inserter consider donating some small amount. Even 1 dollar counts. Thank you!">Donate</button>
152
  <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://wordpress.org/support/plugin/ad-inserter/reviews/')" title="If you like Ad Inserter and have a moment, please help me spread the word by reviewing the plugin on WordPres">Review</button>
153
+ <button type="button" class="ai-top-button" style="display: none; margin: 0 10px 0 0; width: 62px; outline-color: transparent;" onclick="window.open('https://adinserter.pro/')" title="Need more code blocks, sticky ads, GEO targeting, impression and click tracking? Upgrade to Ad Inserter Pro">Go&nbsp;Pro</button>
154
  <button id="ai-list" type="button" class="ai-top-button" style="width: 62px; display: none; margin-right: 0px; outline-color: transparent;" title="Show list of all code blocks"><span>Blocks</span></button>
155
  </div>
156
 
163
  <div id="javascript-warning" class="ai-form rounded" style="display: none;">
164
  <h2 id="javascript-version" style="float: left; color: red;" title="Loaded plugin javascript version">&nbsp;</h2>
165
  <div style="float: right; text-align: right; margin: 8px 5px 0px 0;">
166
+ <span id="javascript-version-parameter" style="display: none;">Wrong or <a href="https://adinserter.pro/documentation/troubleshooting#missing-version-parameter" class="simple-link" target="_blank">missing version parameter</a> for the javscript file, probably due to inappropriate caching.<br /></span>
167
  <span id="javascript-version-parameter-missing" style="display: none;">Missing version parameter for the javscript file, probably due to inappropriate caching.<br /></span>
168
  Incompatible (old) javscript file loaded, probably due to inappropriate caching.<br />
169
  Please delete browser's cache and all other caches used and then reload this page.
185
  <div id="blocked-warning" class="ai-form warning-enabled rounded">
186
  <h2 class="blocked-warning-text" style="float: left; color: red; margin: 7px 0;" title="Error loading page">WARNING</h2>
187
  <div style="float: right; text-align: right; width: 630px; margin: 8px 5px 0px 0;">
188
+ Page may <a href="https://adinserter.pro/documentation/troubleshooting#page-blocked" class="simple-link" target="_blank">not be loaded properly</a>.
189
  Check ad blocking software that may block CSS, Javascript or image files.
190
  </div>
191
  <div style="clear: both;"></div>
438
  $lists;
439
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
440
 
441
+ $show_manual = $manual [$block] ||!empty ($sidebars_with_widget [$block]);
442
  if ($show_manual) $manual_style = "font-weight: bold; color: " . ($manual_widget [$block] || empty ($sidebars_with_widget [$block]) ? "#66f;" : "#e44;"); else $manual_style = "";
443
 
444
  $insertion_options =
1782
  <div id="tab-scheduling-<?php echo $block; ?>" class="rounded" style="min-height: 24px;">
1783
  <select id="scheduling-<?php echo $block; ?>" style="margin: 0 1px;" name="<?php echo AI_OPTION_SCHEDULING, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_scheduling(); ?>">
1784
  <option value="<?php echo AI_SCHEDULING_OFF; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_OFF) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_OFF; ?></option>
1785
+ <option value="<?php echo AI_SCHEDULING_DELAY_FOR; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_DELAY_FOR) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DELAY_INSERTION; ?></option>
1786
+ <option value="<?php echo AI_SCHEDULING_INSERT_ONLY_FOR; ?>" <?php echo ($obj->get_scheduling() == AI_SCHEDULING_INSERT_ONLY_FOR) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_INSERT_ONLY; ?></option>
1787
  <?php if (function_exists ('ai_scheduling_options')) ai_scheduling_options ($obj); ?>
1788
  </select>
1789
 
2521
  if ($number_of_used_blocks >= 3) $sidebar = 4;
2522
  }
2523
 
2524
+ // $sidebar = 0;
2525
 
2526
  if (!function_exists ('ai_settings_side')) {
2527
 
3370
 
3371
  function sidebar_addense_alternative () { ?>
3372
 
3373
+ <?php
3374
+ switch (rand (1, 2)) {
3375
+ case 1:
3376
+ ?>
3377
  <div class="ai-form header rounded">
3378
  <div style="float: left;">
3379
  <h2 style="display: inline-block; margin: 5px 0;">Blank Ad Blocks? Looking for AdSense alternative?</h2>
3380
  </div>
3381
  <div style="clear: both;"></div>
3382
  </div>
 
 
 
 
3383
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3384
  <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3385
  </div>
3386
 
3387
+ <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
3388
+ <!-- <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>-->
3389
+ <!-- </div>-->
3390
  <?php
3391
  break;
3392
  case 2:
3393
  ?>
3394
+ <div class="ai-form header rounded">
3395
+ <div style="float: left;">
3396
+ <h2 style="display: inline-block; margin: 5px 0;">Try Infolinks Ads with Adsense or Media.net</h2>
3397
+ </div>
3398
+ <div style="clear: both;"></div>
3399
+ </div>
3400
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3401
  <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
3402
  </div>
3403
 
3404
+ <!-- <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">-->
3405
+ <!-- <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>-->
3406
+ <!-- </div>-->
3407
  <?php
3408
  break;
3409
  }
3467
  <div style="float: left;">
3468
  <h2 style="display: inline-block; margin: 5px 0;">
3469
  Need help with <a href="https://adinserter.pro/documentation" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">settings</a>?
3470
+ Check <a href="https://adinserter.pro/documentation/quick-start" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Quick Start</a>,
3471
+ <a href="https://adinserter.pro/documentation/code-editing" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Code Editing</a> and
3472
+ <a href="https://adinserter.pro/documentation/common-settings" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Common Settings</a> pages
3473
  </h2>
3474
  <div>
3475
+ <strong>New to <a href="https://adinserter.pro/documentation/adsense-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense</a>?</strong>
3476
+ <a href="https://adinserter.pro/documentation/adsense-ads#connect-your-site" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Connect your site</a> - Advanced
3477
+ <a href="https://adinserter.pro/documentation/adsense-ads#ad-code" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AdSense code</a>:
3478
+ <a href="https://adinserter.pro/documentation/adsense-ads#in-feed-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">In-feed ads</a>,
3479
+ <a href="https://adinserter.pro/documentation/adsense-ads#auto-ads" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">Auto ads</a>,
3480
+ <a href="https://adinserter.pro/documentation/adsense-ads#amp" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">AMP ads</a>
3481
  </div>
3482
  <hr />
3483
+ <div>Ads are not showing? Check <a href="https://adinserter.pro/documentation/adsense-ads#ads-not-displayed" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">troubleshooting guide</a> to find out how to diagnose and fix the problem.</div>
3484
  <div>If you need any kind of help or support, please do not hesitate to open a thread on the <a href="https://wordpress.org/support/plugin/ad-inserter/" style="text-decoration: none; box-shadow: 0 0 0;" target="_blank">support forum</a>.</div>
3485
  </div>
3486
+ <!-- <div style="float: right; margin: -5px -5px 0 0;">-->
3487
+ <!-- <a href="https://adinserter.pro/Ad_Inserter_User_Manual.pdf" class="clear-link" target="_blank"><img id="ai-pdf" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>manual.png" title="Download user manual"/></a>-->
3488
+ <!-- <div style="text-align: center; font-size: 12px;">User Manual</div>-->
3489
+ <!-- </div>-->
3490
  <div style="clear: both;"></div>
3491
  </div>
3492
 
3502
  <div>
3503
  <?php switch ($version) {
3504
  case 0: ?>
3505
+ <!-- <a href="https://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>-->
3506
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" style="margin-top: 10px;" /></a>
3507
  <?php break; case 1: ?>
3508
  <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3512
  <div>
3513
  <?php switch ($version) {
3514
  case 0: ?>
3515
+ <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3516
  <?php break; case 1: ?>
3517
+ <a href='https://adinserter.pro/documentation/code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3518
  <?php break;
3519
  } ?>
3520
  </div>
3523
  case 0: ?>
3524
  <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3525
  <?php break; case 1: ?>
3526
+ <!-- <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>-->
3527
  <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" style="margin-top: 10px;" /></a>
3528
  <?php break;
3529
  } ?>
3531
  <div>
3532
  <?php switch ($version) {
3533
  case 0: ?>
3534
+ <a href='https://adinserter.pro/documentation/code-preview' class="clear-link" title="Code preview with visual CSS editor" target="_blank"><img id="ai-preview" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-preview-250.png" style="margin-top: 10px;" /></a>
3535
  <?php break; case 1: ?>
3536
+ <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="clear-link" title="A/B testing - Track ad impressions and clicks" target="_blank"><img id="ai-pro-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-charts-250.png" style="margin-top: 10px;" /></a>
3537
  <?php break;
3538
  } ?>
3539
  </div>
3544
 
3545
  <ul>
3546
  <li>64 code (ad) blocks</li>
3547
+ <li><a href="https://adinserter.pro/documentation/adsense-ads#integration" class="simple-link" target="_blank">AdSense Integration</a></li>
3548
+ <li>Syntax highlighting <a href="https://adinserter.pro/documentation/code-editing" class="simple-link" target="_blank">editor</a></li>
3549
+ <li><a href="https://adinserter.pro/documentation#code-preview" class="simple-link" target="_blank">Code preview</a> with visual CSS editor</li>
3550
  <li>Simple user interface - all settings on a single page</li>
3551
+ <li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before or after post / content / <a href="http://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">paragraph</a> / excerpt</li>
3552
+ <li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> between posts on blog pages</li>
3553
+ <li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> before, between and after comments</li>
3554
+ <li><a href="https://adinserter.pro/documentation/automatic-insertion" class="simple-link" target="_blank">Automatic insertion</a> below <code>&lt;body&gt;</code> or above <code>&lt;/body&gt;</code> tags</li>
3555
+ <li>Automatic insertion at <a href="https://adinserter.pro/documentation/automatic-insertion#custom-hooks" class="simple-link" target="_blank">custom hook positions</a></li>
3556
+ <li>Insertion <a href="https://adinserter.pro/documentation/automatic-insertion#before-after-html-element" class="simple-link" target="_blank">before or after any HTML element on the page</a> (using CSS selectors)</li>
3557
+ <li><a href="https://adinserter.pro/documentation/individual-post-and-page-exceptions" class="simple-link" target="_blank">Insertion exceptions</a> for individual posts and pages</li>
3558
+ <li><a href="https://adinserter.pro/documentation/manual-insertion" class="simple-link" target="_blank">Manual insertion</a>: widgets, shortcodes, PHP function call</li>
3559
+ <li><a href="https://adinserter.pro/documentation/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ads</a> with optional close button (ads stay fixed when the page scrolls)</li>
3560
+ <li><a href="https://adinserter.pro/documentation/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky sidebar ads</a> (stick to the screen or to the content)</li>
3561
+ <li><a href="https://adinserter.pro/documentation/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad animations</a> (fade, slide, turn, flip, zoom)</li>
3562
+ <li><a href="https://adinserter.pro/documentation/alignments-and-styles#sticky-ads" class="simple-link" target="_blank">Sticky ad trigger</a> (page scroll in % or px, HTML element becomes visible)</li>
3563
+ <li><a href="https://adinserter.pro/documentation/manual-insertion" class="simple-link" target="_blank">Sticky (fixed) widgets</a> (sidebar does not move when the page scrolls)</li>
3564
+ <li>Block <a href="https://adinserter.pro/documentation/alignments-and-styles" class="simple-link" target="_blank">alignment and style</a> customizations</li>
3565
+ <li><a href="https://adinserter.pro/documentation/paragraph-settings" class="simple-link" target="_blank">Clearance</a> options to avoid insertion near images or headers (AdSense TOS)</li>
3566
+ <li>Options to <a href="https://adinserter.pro/documentation/additional-block-settings" class="simple-link" target="_blank">disable insertion</a> on Ajax calls, 404 error pages or in RSS feeds</li>
3567
+ <li><a href="https://adinserter.pro/documentation/ad-rotation" class="simple-link" target="_blank">Ad rotation</a> (works also with caching)</li>
3568
+ <li>Ad impression and click <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="simple-link" target="_blank">tracking</a> (works also with Javascript ads like AdSense)</li>
3569
+ <li>Support for <a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
3570
+ <li>Support for <a href="https://adinserter.pro/documentation/additional-block-settings#lazy-loading" class="simple-link" target="_blank">lazy loading</a></li>
3571
+ <li>Support for ads on <a href="https://adinserter.pro/documentation/amp-pages" class="simple-link" target="_blank">AMP pages</a></li>
3572
+ <li>Support for contextual <a href="https://adinserter.pro/documentation/common-settings#amazon" class="simple-link" target="_blank">Amazon Native Shopping Ads</a> (responsive)</li>
3573
  <li>Custom CSS class name for wrapping divs to avoid ad blockers</li>
3574
  <li>PHP code processing</li>
3575
+ <li><a href="https://adinserter.pro/documentation/code-editing#banners" class="simple-link" target="_blank">Banner</a> code generator</li>
3576
+ <li>Support for <a href="https://adinserter.pro/documentation/plugin-settings#header-footer" class="simple-link" target="_blank">header and footer</a> code</li>
3577
  <li>Support for Google Analytics, Piwik or any other web analytics code</li>
3578
+ <li>Desktop, tablet and phone server-side <a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">device detection</a></li>
3579
+ <li>Client-side <a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">mobile device detection</a> (works with caching, 6 custom viewports)</li>
3580
+ <li><a href="https://adinserter.pro/documentation/ad-blocking-detection" class="simple-link" target="_blank">Ad blocking detection</a> - popup message, ad replacement, content protection</li>
3581
+ <li><a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ad-blocking-statistics" class="simple-link" target="_blank">Ad blocking statistics</a></li>
3582
+ <li><a href="https://adinserter.pro/documentation/black-and-white-lists" class="simple-link" target="_blank">Black/White-list </a>categories, tags, taxonomies, users, post IDs, urls, referers</li>
3583
+ <li><a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">Black/White-list </a>IP addresses or countries (works also with caching)</li>
3584
+ <li><a href="https://adinserter.pro/documentation/plugin-settings#multisite" class="simple-link" target="_blank">Multisite options</a> to limit settings on the sites</li>
3585
+ <li><a href="https://adinserter.pro/documentation/code-editing#export-import" class="simple-link" target="_blank">Import/Export</a> block or plugin settings</li>
3586
+ <li><a href="https://adinserter.pro/documentation/additional-block-settings#scheduling" class="simple-link" target="_blank">Scheduling</a> with fallback option</li>
3587
+ <li>Country-level <a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">GEO targeting</a> (works also with caching)</li>
3588
+ <li>Simple troubleshooting with many <a href="https://adinserter.pro/documentation/debugging" class="simple-link" target="_blank">debugging functions</a></li>
3589
+ <li><a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">Visualization</a> of inserted code blocks or ads for easier placement</li>
3590
+ <li><a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">Visualization</a> of available positions for automatic ad insertion</li>
3591
+ <li><a href="https://adinserter.pro/documentation/debugging#visualization" class="simple-link" target="_blank">Visualization</a> of HTML tags for easier ad placement between paragraphs</li>
3592
+ <li><a href="https://adinserter.pro/documentation/code-editing#clipboard" class="simple-link" target="_blank">Clipboard support</a> to easily copy code blocks or settings</li>
3593
  <li>No ads on the settings page</li>
3594
  <li>Support via email</li>
3595
  </ul>
3598
  With Ad Inserter Pro you also get <strong>one year of free updates and support via email</strong>. If you find Ad Inserter useful and need more code blocks, ad statistics for impressions and clicks,
3599
  A/B testing, sticky ads, slider ads, pop-up ads, geotargeting or geolocation to serve country-specific ads, to protect content from users using ad blockers, to serve different ads for users using ad blockers,
3600
  multisite options to limit settings for ads, to block some IP addresses, to schedule ads, then you can simply upgrade to
3601
+ <a href="https://adinserter.pro/" style="text-decoration: none;" target="_blank">Ad Inserter Pro</a> (existing settings will be preserved).</p>
3602
  </div>
3603
 
3604
  <?php
3624
 
3625
  <div style="float: right; margin-left: 15px;">
3626
  <ul>
3627
+ <li><a href="https://adinserter.pro/documentation/alignments-and-styles" class="simple-link" target="_blank">Sticky positions</a></li>
3628
+ <li><a href="https://adinserter.pro/documentation/black-and-white-lists" class="simple-link" target="_blank">Limit insertions</a></li>
3629
+ <li><a href="https://adinserter.pro/documentation#paragraphs" class="simple-link" target="_blank">Clearance</a> options</li>
3630
  </ul>
3631
  </div>
3632
 
3633
  <div style="float: right; margin-left: 15px;">
3634
  <ul>
3635
  <li>Ad rotation</li>
3636
+ <li><a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking#ab-testing" class="simple-link" target="_blank">A/B testing</a></li>
3637
+ <li><a href="https://adinserter.pro/documentation/ad-impression-and-click-tracking" class="simple-link" target="_blank">Ad tracking</a></li>
3638
  </ul>
3639
  </div>
3640
 
3641
  <div style="float: right; margin-left: 15px;">
3642
  <ul>
3643
+ <li>Support for <a href="https://adinserter.pro/documentation/amp-pages" class="simple-link" target="_blank">AMP pages</a></li>
3644
+ <li><a href="https://adinserter.pro/documentation/ad-blocking-detection" class="simple-link" target="_blank">Ad blocking detection</a></li>
3645
+ <li><a href="https://adinserter.pro/documentation/device-detection" class="simple-link" target="_blank">Mobile device detection</a></li>
3646
 
3647
  </ul>
3648
  </div>
3650
  <div style="float: right; margin-left: 15px;">
3651
  <ul>
3652
  <li>64 code blocks</li>
3653
+ <li><a href="https://adinserter.pro/documentation/black-and-white-lists#geo-targeting" class="simple-link" target="_blank">GEO targeting</a></li>
3654
+ <li><a href="https://adinserter.pro/documentation/additional-block-settings#scheduling" class="simple-link" target="_blank">Scheduling</a></li>
3655
  </ul>
3656
  </div>
3657