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

Version Description

  • Added support for alt text and lazy loading for banner code generator
  • 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.6.20
Comparing to
See all releases

Code changes from version 2.6.19 to 2.6.20

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.6.19
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -17,6 +17,10 @@ Requires PHP: 5.6
17
 
18
  Change Log
19
 
 
 
 
 
20
  Ad Inserter 2.6.19 - 2020-12-16
21
  - Improved code to reduce layout shift when using client-side device detection
22
  - Added translation for es_ES
@@ -865,6 +869,7 @@ function remove_debug_parameters_from_url ($url = false) {
865
  AI_URL_DEBUG_PROCESSING_FE,
866
  AI_URL_DEBUG_PHP,
867
  AI_URL_DEBUG_BLOCKS,
 
868
  AI_URL_DEBUG_USER,
869
  AI_URL_DEBUG_TAGS,
870
  AI_URL_DEBUG_POSITIONS,
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.6.20
6
  Description: Ad management with many advanced advertising features to insert ads at optimal positions
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
17
 
18
  Change Log
19
 
20
+ Ad Inserter 2.6.20 - 2021-01-06
21
+ - Added support for alt text and lazy loading for banner code generator
22
+ - Few minor bug fixes, cosmetic changes and code improvements
23
+
24
  Ad Inserter 2.6.19 - 2020-12-16
25
  - Improved code to reduce layout shift when using client-side device detection
26
  - Added translation for es_ES
869
  AI_URL_DEBUG_PROCESSING_FE,
870
  AI_URL_DEBUG_PHP,
871
  AI_URL_DEBUG_BLOCKS,
872
+ AI_URL_DEBUG_CODE,
873
  AI_URL_DEBUG_USER,
874
  AI_URL_DEBUG_TAGS,
875
  AI_URL_DEBUG_POSITIONS,
class.php CHANGED
@@ -8483,7 +8483,14 @@ class ai_code_generator {
8483
  case AI_CODE_BANNER:
8484
  $code = '';
8485
  if (isset ($data ['image']) && $data ['image'] != '') {
8486
- $code = '<img src="' . $data ['image'] . '">';
 
 
 
 
 
 
 
8487
  }
8488
  if (isset ($data ['link']) && $data ['link'] != '') {
8489
  $code = '<a href="' . $data ['link'] . '"' .(isset ($data ['target']) ? ' target="' . $data ['target'] . '"' : '') . '>' . $code . '</a>';
@@ -9142,6 +9149,8 @@ class ai_code_generator {
9142
  if ($images->length != 0) {
9143
  // $data ['image'] = $images [0]->getAttribute ('src');
9144
  $data ['image'] = $images->item (0)->getAttribute ('src');
 
 
9145
  }
9146
 
9147
  if ($links->length != 0) {
8483
  case AI_CODE_BANNER:
8484
  $code = '';
8485
  if (isset ($data ['image']) && $data ['image'] != '') {
8486
+ $attributes = '';
8487
+ if (isset ($data ['loading']) && $data ['loading'] != '') {
8488
+ $attributes .= ' loading="'.$data ['loading'].'"';
8489
+ }
8490
+ if (isset ($data ['alt']) && $data ['alt'] != '') {
8491
+ $attributes .= ' alt="'.$data ['alt'].'"';
8492
+ }
8493
+ $code = '<img src="' . $data ['image'] . '"'.$attributes.'>';
8494
  }
8495
  if (isset ($data ['link']) && $data ['link'] != '') {
8496
  $code = '<a href="' . $data ['link'] . '"' .(isset ($data ['target']) ? ' target="' . $data ['target'] . '"' : '') . '>' . $code . '</a>';
9149
  if ($images->length != 0) {
9150
  // $data ['image'] = $images [0]->getAttribute ('src');
9151
  $data ['image'] = $images->item (0)->getAttribute ('src');
9152
+ $data ['alt'] = $images->item (0)->getAttribute ('alt');
9153
+ $data ['loading'] = $images->item (0)->getAttribute ('loading');
9154
  }
9155
 
9156
  if ($links->length != 0) {
constants.php CHANGED
@@ -31,7 +31,7 @@ if (!defined( 'AD_INSERTER_NAME'))
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
- define ('AD_INSERTER_VERSION', '2.6.19');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -1177,6 +1177,7 @@ define ('AI_URL_DEBUG_PROCESSING', 'ai-debug-processing'); // AI_UR
1177
  define ('AI_URL_DEBUG_PROCESSING_FE', 'ai-debug-processing-fe'); // AI_URL_DEBUG_PROCESSING_FE_
1178
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php'); // AI_URL_DEBUG_PHP
1179
  define ('AI_URL_DEBUG_BLOCKS', 'ai-debug-blocks');
 
1180
  define ('AI_URL_DEBUG_USER', 'ai-debug-user');
1181
  define ('AI_URL_DEBUG_TAGS', 'ai-debug-tags');
1182
  define ('AI_URL_DEBUG_POSITIONS', 'ai-debug-positions');
31
  define ('AD_INSERTER_NAME', 'Ad Inserter');
32
 
33
  if (!defined( 'AD_INSERTER_VERSION'))
34
+ define ('AD_INSERTER_VERSION', '2.6.20');
35
 
36
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
37
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
1177
  define ('AI_URL_DEBUG_PROCESSING_FE', 'ai-debug-processing-fe'); // AI_URL_DEBUG_PROCESSING_FE_
1178
  define ('AI_URL_DEBUG_PHP', 'ai-debug-php'); // AI_URL_DEBUG_PHP
1179
  define ('AI_URL_DEBUG_BLOCKS', 'ai-debug-blocks');
1180
+ define ('AI_URL_DEBUG_CODE', 'ai-debug-code');
1181
  define ('AI_URL_DEBUG_USER', 'ai-debug-user');
1182
  define ('AI_URL_DEBUG_TAGS', 'ai-debug-tags');
1183
  define ('AI_URL_DEBUG_POSITIONS', 'ai-debug-positions');
css/ai-settings.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.6.19"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1
  #ai-data {
2
+ font-family: "2.6.20"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
includes/js/ai-lists.js CHANGED
@@ -794,8 +794,12 @@ jQuery (function ($) {
794
  }, 50);
795
 
796
  if (typeof ai_load_blocks == 'function') {
 
797
  jQuery(document).on ("cmplzEnableScripts", ai_cmplzEnableScripts);
798
 
 
 
 
799
  function ai_cmplzEnableScripts (consentData) {
800
  if (consentData.consentLevel === 'all'){
801
  ai_load_blocks ();
794
  }, 50);
795
 
796
  if (typeof ai_load_blocks == 'function') {
797
+ // https://adinserter.pro/faq/gdpr-compliance-cookies-consent#manual-loading
798
  jQuery(document).on ("cmplzEnableScripts", ai_cmplzEnableScripts);
799
 
800
+ // Complianz Privacy Suite
801
+ jQuery(document).on ("cmplz_event_marketing", ai_cmplzEnableScripts);
802
+
803
  function ai_cmplzEnableScripts (consentData) {
804
  if (consentData.consentLevel === 'all'){
805
  ai_load_blocks ();
includes/js/ai-lists.min.js CHANGED
@@ -1,21 +1,22 @@
1
  var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,k){a.raw=k;return a};$jscomp.arrayIteratorImpl=function(a){var k=0;return function(){return k<a.length?{done:!1,value:a[k++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var k="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return k?k.call(a):$jscomp.arrayIterator(a)};
2
- jQuery(function(a){function k(e){e=e.match(E);return null!=e&&1<e.length&&"string"===typeof e[1]&&0<e[1].length?e[1].toLowerCase():null}function z(e){try{var h=Date.parse(e);isNaN(h)&&(h=null)}catch(J){h=null}if(null==h&&e.includes(" ")){e=e.split(" ");try{h=Date.parse(e[0]);if(e[1].includes(":")){var F=e[1].split(":");h+=1E3*(3600*parseInt(F[0])+60*parseInt(F[1])+parseInt(F[2]))}isNaN(h)&&(h=null)}catch(J){h=null}}return h}function n(){(jQuery("#ai-iab-tcf-bar").length||jQuery(".ai-list-manual").length)&&
3
- "function"==typeof __tcfapi&&"function"==typeof ai_load_blocks&&"undefined"==typeof ai_iab_tcf_callback_installed&&(__tcfapi("addEventListener",2,function(e,h){h&&"useractioncomplete"===e.eventStatus&&(ai_tcData=e,ai_load_blocks(),jQuery("#ai-iab-tcf-status").text("DATA LOADED"),jQuery("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"))}),ai_iab_tcf_callback_installed=!0)}Array.prototype.includes||(Array.prototype.includes=function(e){return!!~this.indexOf(e)});var E=/:\/\/(.[^/:]+)/i;
4
- ai_process_lists=function(e){function h(d,b,g){if(0==d.length){if("!@!"==g)return!0;b!=g&&("true"==g.toLowerCase()?g=!0:"false"==g.toLowerCase()&&(g=!1));return b==g}if("object"!=typeof b&&"array"!=typeof b)return!1;var f=d[0];d=d.slice(1);if("*"==f)for(b=$jscomp.makeIterator(Object.entries(b)),f=b.next();!f.done;f=b.next()){if(f=$jscomp.makeIterator(f.value),f.next(),f=f.next().value,h(d,f,g))return!0}else if(f in b)return h(d,b[f],g);return!1}function F(d,b,g){if("object"!=typeof d||-1==b.indexOf("["))return!1;
5
  b=b.replace(/]| /gi,"").split("[");return h(b,d,g)}function J(){"function"==typeof __tcfapi&&(a("#ai-iab-tcf-status").text("DETECTED"),__tcfapi("getTCData",2,function(d,b){b?(a("#ai-iab-tcf-bar").addClass("status-ok"),"tcloaded"==d.eventStatus||"useractioncomplete"==d.eventStatus?(ai_tcData=d,d.gdprApplies?a("#ai-iab-tcf-status").text("DATA LOADED"):jQuery("#ai-iab-tcf-status").text("GDPR DOES NOT APPLY"),a("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"),setTimeout(function(){ai_process_lists()},
6
  10)):"cmpuishown"==d.eventStatus&&(ai_cmpuishown=!0,a("#ai-iab-tcf-status").text("CMP UI SHOWN"),a("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"))):(a("#ai-iab-tcf-status").text("__tcfapi getTCData failed"),a("#ai-iab-tcf-bar").removeClass("status-ok").addClass("status-error"))}))}function P(d){"function"==typeof __tcfapi?("undefined"==typeof ai_iab_tcf_callback_installed&&n(),"undefined"==typeof ai_tcData_requested&&(ai_tcData_requested=!0,J(),url_parameters_need_tcData=!0)):
7
  d&&(a("#ai-iab-tcf-bar").addClass("status-error").removeClass("status-ok"),a("#ai-iab-tcf-status").text("MISSING: __tcfapi function not found"))}e=null==e?a("div.ai-list-data, meta.ai-list-data"):e.filter(".ai-list-data");if(e.length){e.removeClass("ai-list-data");var G=document.cookie.split(";");G.forEach(function(d,b){G[b]=d.trim()});var Q=getAllUrlParams(window.location.search);if(null!=Q.referrer)var r=Q.referrer;else r=document.referrer,""!=r&&(r=k(r));var K=window.navigator.userAgent,L=K.toLowerCase();
8
  if("undefined"!==typeof MobileDetect)var R=new MobileDetect(K);e.each(function(){var d=a(this).closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME"),b=!0,g=a(this).attr("referer-list");if("undefined"!=typeof g){g=b64d(g).split(",");var f=a(this).attr("referer-list-type"),l=!1;a.each(g,function(t,c){if(""==c)return!0;if("*"==c.charAt(0))if("*"==c.charAt(c.length-1)){if(c=c.substr(1,c.length-2),-1!=r.indexOf(c))return l=!0,!1}else{if(c=c.substr(1),r.substr(-c.length)==c)return l=!0,!1}else if("*"==c.charAt(c.length-
9
  1)){if(c=c.substr(0,c.length-1),0==r.indexOf(c))return l=!0,!1}else if("#"==c){if(""==r)return l=!0,!1}else if(c==r)return l=!0,!1});switch(f){case "B":l&&(b=!1);break;case "W":l||(b=!1)}}if(b&&(g=a(this).attr("client-list"),"undefined"!=typeof g&&"undefined"!==typeof R))switch(g=b64d(g).split(","),f=a(this).attr("client-list-type"),l=!1,a.each(g,function(t,c){if(""==c)return!0;if("*"==c.charAt(0))if("*"==c.charAt(c.length-1)){if(c=c.substr(1,c.length-2).toLowerCase(),-1!=L.indexOf(c))return l=!0,
10
  !1}else{if(c=c.substr(1).toLowerCase(),L.substr(-c.length)==c)return l=!0,!1}else if("*"==c.charAt(c.length-1)){if(c=c.substr(0,c.length-1).toLowerCase(),0==L.indexOf(c))return l=!0,!1}else if(R.is(c))return l=!0,!1}),f){case "B":l&&(b=!1);break;case "W":l||(b=!1)}var M=g=!1;if(b&&(f=a(this).attr("parameter-list"),"undefined"!=typeof f)){f=b64d(f).split(",");var u=a(this).attr("parameter-list-type"),S=[];G.forEach(function(t){t=t.split("=");try{var c=JSON.parse(decodeURIComponent(t[1]))}catch(T){c=
11
- decodeURIComponent(t[1])}S[t[0]]=c});var w=!1,H=a(this);a.each(f,function(t,c){var T=c.split("&&");a.each(T,function(X,m){var x=!0;m=m.trim();"!!"==m.substring(0,2)&&(x=!1,m=m.substring(2));var p=m,y="!@!",U=-1!=m.indexOf("["),V=(0==m.indexOf("tcf-v2")||0==m.indexOf("euconsent-v2"))&&-1!=m.indexOf("[");-1!=m.indexOf("=")&&(y=m.split("="),p=y[0],y=y[1],U=-1!=p.indexOf("["),V=(0==p.indexOf("tcf-v2")||0==p.indexOf("euconsent-v2"))&&-1!=p.indexOf("["));if(V)a("#ai-iab-tcf-bar").show(),"object"==typeof ai_tcData?
12
- (a("#ai-iab-tcf-bar").addClass("status-ok"),p=p.replace(/]| /gi,"").split("["),p.shift(),w=(p=h(p,ai_tcData,y))?x:!x):(H.addClass("ai-list-data"),M=!0,"function"==typeof __tcfapi?P(!1):"undefined"==typeof ai_tcData_retrying&&(ai_tcData_retrying=!0,setTimeout(function(){P(!0)},200)));else if(U)w=(p=F(S,p,y))?x:!x;else{var N=!1;"!@!"==y?G.every(function(W){return W.split("=")[0]==m?(N=!0,!1):!0}):N=-1!=G.indexOf(m);w=N?x:!x}if(!w)return!1});if(w)return!1});switch(u){case "B":w&&(b=!1);break;case "W":w||
13
  (b=!1)}a(this).hasClass("ai-list-manual")&&(b?(H.removeClass("ai-list-data"),H.removeClass("ai-list-manual")):(g=!0,H.addClass("ai-list-data")));if(!g&&!M&&(f=a(this).data("debug-info"),"undefined"!=typeof f&&(f=a("."+f),0!=f.length))){var q=f.parent();q.hasClass("ai-debug-info")&&q.remove()}}q=a(this).prevAll(".ai-debug-bar.ai-debug-lists");f=""==r?"#":r;q.find(".ai-debug-name.ai-list-info").text(f).attr("title",K);q.find(".ai-debug-name.ai-list-status").text(b?ai_front.visible:ai_front.hidden);
14
- f=!1;if(b){u=a(this).attr("scheduling-start");var A=a(this).attr("scheduling-end"),B=a(this).attr("scheduling-days");if("undefined"!=typeof u&&"undefined"!=typeof A&&"undefined"!=typeof B){f=!0;var O=parseInt(a(this).attr("scheduling-fallback")),v=parseInt(a(this).attr("gmt"));u=z(b64d(u))+v;A=z(b64d(A))+v;B=b64d(B).split(",");q=a(this).attr("scheduling-type");var C=(new Date).getTime()+v,I=new Date(C),D=I.getDay();0==D?D=6:D--;v=C>=u&&C<A&&B.includes(D.toString());switch(q){case "B":v=!v}v||(b=!1);
15
- I=I.toISOString().split(".")[0].replace("T"," ");q=a(this).prevAll(".ai-debug-bar.ai-debug-scheduling");q.find(".ai-debug-name.ai-scheduling-info").text(I+" "+D+" current_time:"+C.toString()+" start_date:"+u.toString()+" ="+(C>=u).toString()+" end_date:"+A.toString()+" =:"+(C<A).toString()+" days:"+B.toString()+" =:"+B.includes(D.toString()).toString());q.find(".ai-debug-name.ai-scheduling-status").text(b?ai_front.visible:ai_front.hidden);b||0==O||(q.removeClass("ai-debug-scheduling").addClass("ai-debug-fallback"),
16
  q.find(".ai-debug-name.ai-scheduling-status").text(ai_front.fallback+"="+O))}}if(g||M)return!0;a(this).css({visibility:"",position:"",width:"",height:"","z-index":""});b?(d.css({visibility:""}),d.hasClass("ai-remove-position")&&d.css({position:""}),"undefined"!=typeof a(this).data("code")&&(b=b64d(a(this).data("code")),0!=a(this).closest("head").length?(a(this).after(b),a(this).remove()):a(this).append(b),ai_process_element(this))):f&&!v&&0!=O?(d.css({visibility:""}),d.hasClass("ai-remove-position")&&
17
  d.css({position:""}),a(this).next(".ai-fallback").removeClass("ai-fallback"),"undefined"!=typeof a(this).data("fallback-code")?(b=b64d(a(this).data("fallback-code")),a(this).append(b),ai_process_element(this)):(a(this).hide(),d.find(".ai-debug-block").length||d.hide()),b=d.attr("data-ai"),"undefined"!==typeof b&&!1!==b&&(b=a(this).attr("fallback-tracking"),"undefined"!==typeof b&&!1!==b&&d.attr("data-ai",b))):(a(this).hide(),d.find(".ai-debug-block").length||d.hide(),d.removeAttr("data-ai").removeClass("ai-track"),
18
- d.find(".ai-debug-block").length?(d.css({visibility:""}).removeClass("ai-close"),d.hasClass("ai-remove-position")&&d.css({position:""})):d.hide());a(this).attr("data-code","");a(this).attr("data-fallback-code","");d.removeClass("ai-list-block")})}};a(document).ready(function(e){setTimeout(function(){ai_process_lists();setTimeout(function(){n()},50);if("function"==typeof ai_load_blocks)jQuery(document).on("cmplzEnableScripts",function(h){"all"===h.consentLevel&&ai_load_blocks()});jQuery("#ai-iab-tcf-bar").click(function(){AiCookies.remove("euconsent-v2",
19
- {path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2_daisybit",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2_gdaisybit",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("cmplz_marketing",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("cmplz_stats",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("complianz_consent_status",
20
- {path:"/",domain:"."+window.location.hostname});jQuery("#ai-iab-tcf-status").text("COOKIE DELETED")})},5)})});function ai_process_element(a){setTimeout(function(){"function"==typeof ai_process_rotations_in_element&&ai_process_rotations_in_element(a);"function"==typeof ai_process_lists&&ai_process_lists(jQuery(".ai-list-data",a));"function"==typeof ai_process_ip_addresses&&ai_process_ip_addresses(jQuery(".ai-ip-data",a));"function"==typeof ai_adb_process_blocks&&ai_adb_process_blocks(a)},5)}
21
- function getAllUrlParams(a){var k=a?a.split("?")[1]:window.location.search.slice(1);a={};if(k){k=k.split("#")[0];k=k.split("&");for(var z=0;z<k.length;z++){var n=k[z].split("="),E=void 0,e=n[0].replace(/\[\d*\]/,function(h){E=h.slice(1,-1);return""});n="undefined"===typeof n[1]?"":n[1];e=e.toLowerCase();n=n.toLowerCase();a[e]?("string"===typeof a[e]&&(a[e]=[a[e]]),"undefined"===typeof E?a[e].push(n):a[e][E]=n):a[e]=n}}return a};
 
1
  var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,k){a.raw=k;return a};$jscomp.arrayIteratorImpl=function(a){var k=0;return function(){return k<a.length?{done:!1,value:a[k++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var k="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return k?k.call(a):$jscomp.arrayIterator(a)};
2
+ jQuery(function(a){function k(e){e=e.match(F);return null!=e&&1<e.length&&"string"===typeof e[1]&&0<e[1].length?e[1].toLowerCase():null}function A(e){try{var h=Date.parse(e);isNaN(h)&&(h=null)}catch(J){h=null}if(null==h&&e.includes(" ")){e=e.split(" ");try{h=Date.parse(e[0]);if(e[1].includes(":")){var w=e[1].split(":");h+=1E3*(3600*parseInt(w[0])+60*parseInt(w[1])+parseInt(w[2]))}isNaN(h)&&(h=null)}catch(J){h=null}}return h}function n(){(jQuery("#ai-iab-tcf-bar").length||jQuery(".ai-list-manual").length)&&
3
+ "function"==typeof __tcfapi&&"function"==typeof ai_load_blocks&&"undefined"==typeof ai_iab_tcf_callback_installed&&(__tcfapi("addEventListener",2,function(e,h){h&&"useractioncomplete"===e.eventStatus&&(ai_tcData=e,ai_load_blocks(),jQuery("#ai-iab-tcf-status").text("DATA LOADED"),jQuery("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"))}),ai_iab_tcf_callback_installed=!0)}Array.prototype.includes||(Array.prototype.includes=function(e){return!!~this.indexOf(e)});var F=/:\/\/(.[^/:]+)/i;
4
+ ai_process_lists=function(e){function h(d,b,g){if(0==d.length){if("!@!"==g)return!0;b!=g&&("true"==g.toLowerCase()?g=!0:"false"==g.toLowerCase()&&(g=!1));return b==g}if("object"!=typeof b&&"array"!=typeof b)return!1;var f=d[0];d=d.slice(1);if("*"==f)for(b=$jscomp.makeIterator(Object.entries(b)),f=b.next();!f.done;f=b.next()){if(f=$jscomp.makeIterator(f.value),f.next(),f=f.next().value,h(d,f,g))return!0}else if(f in b)return h(d,b[f],g);return!1}function w(d,b,g){if("object"!=typeof d||-1==b.indexOf("["))return!1;
5
  b=b.replace(/]| /gi,"").split("[");return h(b,d,g)}function J(){"function"==typeof __tcfapi&&(a("#ai-iab-tcf-status").text("DETECTED"),__tcfapi("getTCData",2,function(d,b){b?(a("#ai-iab-tcf-bar").addClass("status-ok"),"tcloaded"==d.eventStatus||"useractioncomplete"==d.eventStatus?(ai_tcData=d,d.gdprApplies?a("#ai-iab-tcf-status").text("DATA LOADED"):jQuery("#ai-iab-tcf-status").text("GDPR DOES NOT APPLY"),a("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"),setTimeout(function(){ai_process_lists()},
6
  10)):"cmpuishown"==d.eventStatus&&(ai_cmpuishown=!0,a("#ai-iab-tcf-status").text("CMP UI SHOWN"),a("#ai-iab-tcf-bar").addClass("status-ok").removeClass("status-error"))):(a("#ai-iab-tcf-status").text("__tcfapi getTCData failed"),a("#ai-iab-tcf-bar").removeClass("status-ok").addClass("status-error"))}))}function P(d){"function"==typeof __tcfapi?("undefined"==typeof ai_iab_tcf_callback_installed&&n(),"undefined"==typeof ai_tcData_requested&&(ai_tcData_requested=!0,J(),url_parameters_need_tcData=!0)):
7
  d&&(a("#ai-iab-tcf-bar").addClass("status-error").removeClass("status-ok"),a("#ai-iab-tcf-status").text("MISSING: __tcfapi function not found"))}e=null==e?a("div.ai-list-data, meta.ai-list-data"):e.filter(".ai-list-data");if(e.length){e.removeClass("ai-list-data");var G=document.cookie.split(";");G.forEach(function(d,b){G[b]=d.trim()});var Q=getAllUrlParams(window.location.search);if(null!=Q.referrer)var r=Q.referrer;else r=document.referrer,""!=r&&(r=k(r));var K=window.navigator.userAgent,L=K.toLowerCase();
8
  if("undefined"!==typeof MobileDetect)var R=new MobileDetect(K);e.each(function(){var d=a(this).closest("div.AI_FUNCT_GET_BLOCK_CLASS_NAME"),b=!0,g=a(this).attr("referer-list");if("undefined"!=typeof g){g=b64d(g).split(",");var f=a(this).attr("referer-list-type"),l=!1;a.each(g,function(t,c){if(""==c)return!0;if("*"==c.charAt(0))if("*"==c.charAt(c.length-1)){if(c=c.substr(1,c.length-2),-1!=r.indexOf(c))return l=!0,!1}else{if(c=c.substr(1),r.substr(-c.length)==c)return l=!0,!1}else if("*"==c.charAt(c.length-
9
  1)){if(c=c.substr(0,c.length-1),0==r.indexOf(c))return l=!0,!1}else if("#"==c){if(""==r)return l=!0,!1}else if(c==r)return l=!0,!1});switch(f){case "B":l&&(b=!1);break;case "W":l||(b=!1)}}if(b&&(g=a(this).attr("client-list"),"undefined"!=typeof g&&"undefined"!==typeof R))switch(g=b64d(g).split(","),f=a(this).attr("client-list-type"),l=!1,a.each(g,function(t,c){if(""==c)return!0;if("*"==c.charAt(0))if("*"==c.charAt(c.length-1)){if(c=c.substr(1,c.length-2).toLowerCase(),-1!=L.indexOf(c))return l=!0,
10
  !1}else{if(c=c.substr(1).toLowerCase(),L.substr(-c.length)==c)return l=!0,!1}else if("*"==c.charAt(c.length-1)){if(c=c.substr(0,c.length-1).toLowerCase(),0==L.indexOf(c))return l=!0,!1}else if(R.is(c))return l=!0,!1}),f){case "B":l&&(b=!1);break;case "W":l||(b=!1)}var M=g=!1;if(b&&(f=a(this).attr("parameter-list"),"undefined"!=typeof f)){f=b64d(f).split(",");var u=a(this).attr("parameter-list-type"),S=[];G.forEach(function(t){t=t.split("=");try{var c=JSON.parse(decodeURIComponent(t[1]))}catch(T){c=
11
+ decodeURIComponent(t[1])}S[t[0]]=c});var x=!1,H=a(this);a.each(f,function(t,c){var T=c.split("&&");a.each(T,function(X,m){var y=!0;m=m.trim();"!!"==m.substring(0,2)&&(y=!1,m=m.substring(2));var p=m,z="!@!",U=-1!=m.indexOf("["),V=(0==m.indexOf("tcf-v2")||0==m.indexOf("euconsent-v2"))&&-1!=m.indexOf("[");-1!=m.indexOf("=")&&(z=m.split("="),p=z[0],z=z[1],U=-1!=p.indexOf("["),V=(0==p.indexOf("tcf-v2")||0==p.indexOf("euconsent-v2"))&&-1!=p.indexOf("["));if(V)a("#ai-iab-tcf-bar").show(),"object"==typeof ai_tcData?
12
+ (a("#ai-iab-tcf-bar").addClass("status-ok"),p=p.replace(/]| /gi,"").split("["),p.shift(),x=(p=h(p,ai_tcData,z))?y:!y):(H.addClass("ai-list-data"),M=!0,"function"==typeof __tcfapi?P(!1):"undefined"==typeof ai_tcData_retrying&&(ai_tcData_retrying=!0,setTimeout(function(){P(!0)},200)));else if(U)x=(p=w(S,p,z))?y:!y;else{var N=!1;"!@!"==z?G.every(function(W){return W.split("=")[0]==m?(N=!0,!1):!0}):N=-1!=G.indexOf(m);x=N?y:!y}if(!x)return!1});if(x)return!1});switch(u){case "B":x&&(b=!1);break;case "W":x||
13
  (b=!1)}a(this).hasClass("ai-list-manual")&&(b?(H.removeClass("ai-list-data"),H.removeClass("ai-list-manual")):(g=!0,H.addClass("ai-list-data")));if(!g&&!M&&(f=a(this).data("debug-info"),"undefined"!=typeof f&&(f=a("."+f),0!=f.length))){var q=f.parent();q.hasClass("ai-debug-info")&&q.remove()}}q=a(this).prevAll(".ai-debug-bar.ai-debug-lists");f=""==r?"#":r;q.find(".ai-debug-name.ai-list-info").text(f).attr("title",K);q.find(".ai-debug-name.ai-list-status").text(b?ai_front.visible:ai_front.hidden);
14
+ f=!1;if(b){u=a(this).attr("scheduling-start");var B=a(this).attr("scheduling-end"),C=a(this).attr("scheduling-days");if("undefined"!=typeof u&&"undefined"!=typeof B&&"undefined"!=typeof C){f=!0;var O=parseInt(a(this).attr("scheduling-fallback")),v=parseInt(a(this).attr("gmt"));u=A(b64d(u))+v;B=A(b64d(B))+v;C=b64d(C).split(",");q=a(this).attr("scheduling-type");var D=(new Date).getTime()+v,I=new Date(D),E=I.getDay();0==E?E=6:E--;v=D>=u&&D<B&&C.includes(E.toString());switch(q){case "B":v=!v}v||(b=!1);
15
+ I=I.toISOString().split(".")[0].replace("T"," ");q=a(this).prevAll(".ai-debug-bar.ai-debug-scheduling");q.find(".ai-debug-name.ai-scheduling-info").text(I+" "+E+" current_time:"+D.toString()+" start_date:"+u.toString()+" ="+(D>=u).toString()+" end_date:"+B.toString()+" =:"+(D<B).toString()+" days:"+C.toString()+" =:"+C.includes(E.toString()).toString());q.find(".ai-debug-name.ai-scheduling-status").text(b?ai_front.visible:ai_front.hidden);b||0==O||(q.removeClass("ai-debug-scheduling").addClass("ai-debug-fallback"),
16
  q.find(".ai-debug-name.ai-scheduling-status").text(ai_front.fallback+"="+O))}}if(g||M)return!0;a(this).css({visibility:"",position:"",width:"",height:"","z-index":""});b?(d.css({visibility:""}),d.hasClass("ai-remove-position")&&d.css({position:""}),"undefined"!=typeof a(this).data("code")&&(b=b64d(a(this).data("code")),0!=a(this).closest("head").length?(a(this).after(b),a(this).remove()):a(this).append(b),ai_process_element(this))):f&&!v&&0!=O?(d.css({visibility:""}),d.hasClass("ai-remove-position")&&
17
  d.css({position:""}),a(this).next(".ai-fallback").removeClass("ai-fallback"),"undefined"!=typeof a(this).data("fallback-code")?(b=b64d(a(this).data("fallback-code")),a(this).append(b),ai_process_element(this)):(a(this).hide(),d.find(".ai-debug-block").length||d.hide()),b=d.attr("data-ai"),"undefined"!==typeof b&&!1!==b&&(b=a(this).attr("fallback-tracking"),"undefined"!==typeof b&&!1!==b&&d.attr("data-ai",b))):(a(this).hide(),d.find(".ai-debug-block").length||d.hide(),d.removeAttr("data-ai").removeClass("ai-track"),
18
+ d.find(".ai-debug-block").length?(d.css({visibility:""}).removeClass("ai-close"),d.hasClass("ai-remove-position")&&d.css({position:""})):d.hide());a(this).attr("data-code","");a(this).attr("data-fallback-code","");d.removeClass("ai-list-block")})}};a(document).ready(function(e){setTimeout(function(){ai_process_lists();setTimeout(function(){n()},50);if("function"==typeof ai_load_blocks){var h=function(w){"all"===w.consentLevel&&ai_load_blocks()};jQuery(document).on("cmplzEnableScripts",h);jQuery(document).on("cmplz_event_marketing",
19
+ h)}jQuery("#ai-iab-tcf-bar").click(function(){AiCookies.remove("euconsent-v2",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2_daisybit",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("__lxG__consent__v2_gdaisybit",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("cmplz_marketing",{path:"/",domain:"."+window.location.hostname});AiCookies.remove("cmplz_stats",
20
+ {path:"/",domain:"."+window.location.hostname});AiCookies.remove("complianz_consent_status",{path:"/",domain:"."+window.location.hostname});jQuery("#ai-iab-tcf-status").text("COOKIE DELETED")})},5)})});
21
+ function ai_process_element(a){setTimeout(function(){"function"==typeof ai_process_rotations_in_element&&ai_process_rotations_in_element(a);"function"==typeof ai_process_lists&&ai_process_lists(jQuery(".ai-list-data",a));"function"==typeof ai_process_ip_addresses&&ai_process_ip_addresses(jQuery(".ai-ip-data",a));"function"==typeof ai_adb_process_blocks&&ai_adb_process_blocks(a)},5)}
22
+ function getAllUrlParams(a){var k=a?a.split("?")[1]:window.location.search.slice(1);a={};if(k){k=k.split("#")[0];k=k.split("&");for(var A=0;A<k.length;A++){var n=k[A].split("="),F=void 0,e=n[0].replace(/\[\d*\]/,function(h){F=h.slice(1,-1);return""});n="undefined"===typeof n[1]?"":n[1];e=e.toLowerCase();n=n.toLowerCase();a[e]?("string"===typeof a[e]&&(a[e]=[a[e]]),"undefined"===typeof F?a[e].push(n):a[e][F]=n):a[e]=n}}return a};
includes/js/ai-wait-jquery.js CHANGED
@@ -36,7 +36,8 @@ function ai_wait_for_jquery () {
36
  head.appendChild (script);
37
  };
38
 
39
- if (window.jQuery) {
 
40
  if (ai_debug) console.log ('AI jQuery READY');
41
 
42
  ai_run_scripts ();
36
  head.appendChild (script);
37
  };
38
 
39
+ // if (window.jQuery) {
40
+ if (window.jQuery && window.jQuery.fn) {
41
  if (ai_debug) console.log ('AI jQuery READY');
42
 
43
  ai_run_scripts ();
includes/js/ai-wait-jquery.min.js CHANGED
@@ -1,3 +1,3 @@
1
  function ai_run_scripts(){AI_JS_CODE=1}
2
- function ai_wait_for_jquery(){function b(b,c){var a=document.createElement("script");a.src=b;var d=document.getElementsByTagName("head")[0],e=!1;a.onload=a.onreadystatechange=function(){e||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(e=!0,c&&c(),a.onload=a.onreadystatechange=null,d.removeChild(a))};d.appendChild(a)}window.jQuery?ai_run_scripts():(ai_jquery_waiting_counter++,4==ai_jquery_waiting_counter&&b("AI_JS_JQUERY0",function(){b("AI_JS_JQUERY1",null)}),30>ai_jquery_waiting_counter&&
3
- setTimeout(function(){ai_wait_for_jquery()},50))}ai_jquery_waiting_counter=0;ai_wait_for_jquery();
1
  function ai_run_scripts(){AI_JS_CODE=1}
2
+ function ai_wait_for_jquery(){function b(f,c){var a=document.createElement("script");a.src=f;var d=document.getElementsByTagName("head")[0],e=!1;a.onload=a.onreadystatechange=function(){e||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(e=!0,c&&c(),a.onload=a.onreadystatechange=null,d.removeChild(a))};d.appendChild(a)}window.jQuery&&window.jQuery.fn?ai_run_scripts():(ai_jquery_waiting_counter++,4==ai_jquery_waiting_counter&&b("AI_JS_JQUERY0",function(){b("AI_JS_JQUERY1",
3
+ null)}),30>ai_jquery_waiting_counter&&setTimeout(function(){ai_wait_for_jquery()},50))}ai_jquery_waiting_counter=0;ai_wait_for_jquery();
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.6.19";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -3308,8 +3308,11 @@ jQuery(document).ready (function($) {
3308
  switch (code_type) {
3309
  case AI_CODE_BANNER:
3310
  $("#banner-image-url-" + block).val (code_data ['image']).trigger ('input');
 
 
 
3311
  $("#banner-url-" + block).val (code_data ['link']).trigger ('input');
3312
- $("#open-new-tab-" + block).attr('checked', code_data ['target'] == '_blank');
3313
  break;
3314
  case AI_CODE_ADSENSE:
3315
  $("#adsense-comment-" + block).val (code_data ['adsense-comment']);
@@ -3386,10 +3389,13 @@ jQuery(document).ready (function($) {
3386
  switch (code_type) {
3387
  case AI_CODE_BANNER:
3388
  code_data ['image'] = $("#banner-image-url-" + block).val ();
3389
- code_data ['link'] = $("#banner-url-" + block).val ();
 
 
3390
 
 
3391
  if ($("#open-new-tab-" + block).is(":checked"))
3392
- code_data ['target'] = '_blank';
3393
  break;
3394
  case AI_CODE_ADSENSE:
3395
  code_data ['block'] = block;
1
+ var javascript_version = "2.6.20";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
3308
  switch (code_type) {
3309
  case AI_CODE_BANNER:
3310
  $("#banner-image-url-" + block).val (code_data ['image']).trigger ('input');
3311
+ $("#image-alt-text-" + block).val (code_data ['alt']);
3312
+ $("#lazy-load-image-" + block).prop ('checked', code_data ['loading'] == 'lazy');
3313
+
3314
  $("#banner-url-" + block).val (code_data ['link']).trigger ('input');
3315
+ $("#open-new-tab-" + block).prop ('checked', code_data ['target'] == '_blank');
3316
  break;
3317
  case AI_CODE_ADSENSE:
3318
  $("#adsense-comment-" + block).val (code_data ['adsense-comment']);
3389
  switch (code_type) {
3390
  case AI_CODE_BANNER:
3391
  code_data ['image'] = $("#banner-image-url-" + block).val ();
3392
+ code_data ['alt'] = $("#image-alt-text-" + block).val ();
3393
+ if ($("#lazy-load-image-" + block).is(":checked"))
3394
+ code_data ['loading'] = 'lazy';
3395
 
3396
+ code_data ['link'] = $("#banner-url-" + block).val ();
3397
  if ($("#open-new-tab-" + block).is(":checked"))
3398
+ code_data ['target'] = '_blank';
3399
  break;
3400
  case AI_CODE_ADSENSE:
3401
  code_data ['block'] = block;
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: adinserter, spacetime
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
  Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection, header code, banners, adverts, sticky fixed widgets, dfp
6
  Requires at least: 4.6
7
- Tested up to: 5.5
8
  Requires PHP: 5.6
9
- Stable tag: 2.6.19
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
@@ -335,6 +335,10 @@ If you are not happy to reveal this information and you have opted in, simply di
335
 
336
  == Changelog ==
337
 
 
 
 
 
338
  = 2.6.19 =
339
  - Improved code to reduce layout shift when using client-side device detection
340
  - Added translation for es_ES
@@ -486,6 +490,10 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
486
 
487
  == Upgrade Notice ==
488
 
 
 
 
 
489
  = 2.6.19 =
490
  Improved code to reduce layout shift when using client-side device detection;
491
  Added translation for es_ES;
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LHGZEMRTR7WB4
5
  Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection, header code, banners, adverts, sticky fixed widgets, dfp
6
  Requires at least: 4.6
7
+ Tested up to: 5.6
8
  Requires PHP: 5.6
9
+ Stable tag: 2.6.20
10
  License: GPLv3
11
 
12
  Manage Google AdSense, Media.net, Amazon banners, ads.txt, ad rotation, sticky widgets, AMP ads, DFP, tracking, AdSense header and footer code
335
 
336
  == Changelog ==
337
 
338
+ = 2.6.20 =
339
+ - Added support for alt text and lazy loading for banner code generator
340
+ - Few minor bug fixes, cosmetic changes and code improvements
341
+
342
  = 2.6.19 =
343
  - Improved code to reduce layout shift when using client-side device detection
344
  - Added translation for es_ES
490
 
491
  == Upgrade Notice ==
492
 
493
+ = 2.6.20 =
494
+ Added support for alt text and lazy loading for banner code generator;
495
+ Few minor bug fixes, cosmetic changes and code improvements
496
+
497
  = 2.6.19 =
498
  Improved code to reduce layout shift when using client-side device detection;
499
  Added translation for es_ES;
settings.php CHANGED
@@ -909,15 +909,29 @@ function generate_settings_form (){
909
  <td style="padding-right: 7px;">
910
  <?php _e ('Image', 'ad-inserter'); ?>
911
  </td>
912
- <td style="width: 98%;">
913
  <input id="banner-image-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
914
  </td>
915
  </tr>
916
  <tr>
917
  <td>
918
- <?php _e ('Link', 'ad-inserter'); ?>
 
 
 
919
  </td>
 
 
 
 
 
 
 
 
920
  <td>
 
 
 
921
  <input id="banner-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
922
  </td>
923
  </tr>
@@ -926,7 +940,9 @@ function generate_settings_form (){
926
  <input type="checkbox" id="open-new-tab-<?php echo $block; ?>" />
927
  </td>
928
  <td>
929
- <label for="open-new-tab-<?php echo $block; ?>" style="display: inline-block; margin-top: 8px;"><?php _e ('Open link in a new tab', 'ad-inserter'); ?></label>
 
 
930
  <button id="select-image-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 0 0 0;"><?php _e ('Select Image', 'ad-inserter'); ?></button>
931
  <button id="select-placeholder-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 10px 0 0;"><?php _e ('Select Placeholder', 'ad-inserter'); ?></button>
932
  </td>
909
  <td style="padding-right: 7px;">
910
  <?php _e ('Image', 'ad-inserter'); ?>
911
  </td>
912
+ <td style="width: 98%;" colspan="2">
913
  <input id="banner-image-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
914
  </td>
915
  </tr>
916
  <tr>
917
  <td>
918
+ <?php _e ('Alt text', 'ad-inserter'); ?>
919
+ </td>
920
+ <td style="width: 50%;">
921
+ <input id="image-alt-text-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
922
  </td>
923
+ <td style="text-align: right;">
924
+ <span style="margin-left: 20px;">
925
+ <input type="checkbox" id="lazy-load-image-<?php echo $block; ?>" />
926
+ <label for="lazy-load-image-<?php echo $block; ?>" style="display: inline-block; margin-top: -1px;"><?php _e ('Lazy loading', 'ad-inserter'); ?></label>
927
+ </span>
928
+ </td>
929
+ </tr>
930
+ <tr>
931
  <td>
932
+ <?php _e ('Link', 'ad-inserter'); ?>
933
+ </td>
934
+ <td colspan="2">
935
  <input id="banner-url-<?php echo $block; ?>" style="width: 100%;" type="text" size="50" maxlength="200" />
936
  </td>
937
  </tr>
940
  <input type="checkbox" id="open-new-tab-<?php echo $block; ?>" />
941
  </td>
942
  <td>
943
+ <label for="open-new-tab-<?php echo $block; ?>" style="display: inline-block; margin-top: 6px;"><?php _e ('Open link in a new tab', 'ad-inserter'); ?></label>
944
+ </td>
945
+ <td>
946
  <button id="select-image-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 0 0 0;"><?php _e ('Select Image', 'ad-inserter'); ?></button>
947
  <button id="select-placeholder-button-<?php echo $block; ?>" type="button" class='ai-button select-image' style="display: none; min-width: 120px; float: right; margin: 7px 10px 0 0;"><?php _e ('Select Placeholder', 'ad-inserter'); ?></button>
948
  </td>