Plugin Directory

Changeset 3145275


Ignore:
Timestamp:
09/02/2024 11:06:56 AM (19 months ago)
Author:
advancedads
Message:

Update to version 1.54.0 from GitHub

Location:
advanced-ads
Files:
14 added
4 deleted
70 edited
1 copied

Legend:

Unmodified
Added
Removed
  • advanced-ads/tags/1.54.0/admin/assets/css/admin.css

    r3063392 r3145275  
    14351435    text-decoration: underline;
    14361436}
     1437
     1438.rollback-block header {
     1439    background-color: #f9f9f9;
     1440    border: solid #c3c4c7;
     1441    padding: 10px;
     1442    margin: 30px -12px 15px;
     1443    border-width: 1px 0;
     1444}
  • advanced-ads/tags/1.54.0/admin/class-advanced-ads-admin.php

    r3134243 r3145275  
    22// phpcs:ignoreFile
    33
     4use AdvancedAds\Importers\Api_Ads;
     5use AdvancedAds\Utilities\WordPress;
    46use AdvancedAds\Utilities\Conditional;
    5 use AdvancedAds\Utilities\WordPress;
     7use AdvancedAds\Framework\Utilities\Params;
    68
    79/**
     
    106108        // update placements.
    107109        add_action( 'admin_init', [ 'Advanced_Ads_Placements', 'update_placements' ] );
     110        add_action( 'admin_init', [ $this, 'api_import_rollback' ] );
    108111
    109112        // add Advanced Ads admin notices
     
    483486        echo '</span>';
    484487    }
     488
     489    public function api_import_rollback() {
     490        if ( 'advads_import_delete' !== Params::get( 'action' ) ) {
     491            return;
     492        }
     493
     494        check_admin_referer( 'advads_import_delete' );
     495
     496        $session_key = Params::get( 'session_key' );
     497        $db_session  = get_option( 'advanced-ads-importer-history' );
     498
     499        if ( $session_key !== $db_session ) {
     500            add_action( 'all_admin_notices', [ $this, 'import_error' ] );
     501            return;
     502        }
     503
     504        ( new Api_Ads() )->rollback( $session_key);
     505        delete_option( 'advanced-ads-importer-history' );
     506        add_action( 'all_admin_notices', [ $this, 'import_success' ] );
     507    }
     508
     509    public function import_error() {
     510        ?>
     511        <div class="notice notice-error">
     512            <p><strong>Error:</strong> Session key not matched.</p>
     513        </div>
     514        <?php
     515    }
     516
     517    public function import_success() {
     518        ?>
     519        <div class="notice notice-success">
     520            <p><strong>Success:</strong> the rollback is completed.</p>
     521        </div>
     522        <?php
     523    }
    485524}
  • advanced-ads/tags/1.54.0/admin/includes/class-meta-box.php

    r3134243 r3145275  
    22// phpcs:ignoreFile
    33
    4 use AdvancedAds\Assets_Registry;
    54use AdvancedAds\Entities;
    65use AdvancedAds\Utilities\WordPress;
     
    7069
    7170        if ( 'index.php' === $pagenow ) {
    72             Assets_Registry::enqueue_script( 'wp-widget-adsense' );
     71            wp_advads()->registry->enqueue_script( 'wp-widget-adsense' );
    7372        }
    7473    }
  • advanced-ads/tags/1.54.0/advanced-ads.php

    r3134930 r3145275  
    44 *
    55 * @package   Advanced_Ads
    6  * @author    Advanced Ads GmbH <[email protected]>
     6 * @author    Advanced Ads <[email protected]>
    77 * @license   GPL-2.0+
    88 * @link      https://wpadvancedads.com
     
    1313 * Plugin URI:        https://wpadvancedads.com
    1414 * Description:       Manage and optimize your ads in WordPress
    15  * Version:           1.53.2
    16  * Author:            Advanced Ads GmbH
     15 * Version:           1.54.0
     16 * Author:            Advanced Ads
    1717 * Author URI:        https://wpadvancedads.com
    1818 * Text Domain:       advanced-ads
     
    3434
    3535define( 'ADVADS_FILE', __FILE__ );
    36 define( 'ADVADS_VERSION', '1.53.2' );
     36define( 'ADVADS_VERSION', '1.54.0' );
    3737
    3838// Load the autoloader.
  • advanced-ads/tags/1.54.0/assets/css/app.css

    r3050336 r3145275  
    1 .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.\!mr-2{margin-right:.5rem!important}.\!mt-1{margin-top:.25rem!important}.mb-6{margin-bottom:1.5rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.items-center{align-items:center}.gap-x-4{column-gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.text-base{font-size:1rem;line-height:1.5rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.lds-ripple{display:none;height:40px;position:relative;width:40px}.lds-ripple.show{display:inline-block}.lds-ripple div{animation:lds-ripple 1s cubic-bezier(0,.2,.8,1) infinite;border:4px solid #ccc;border-radius:50%;opacity:1;position:absolute}.lds-ripple div:nth-child(2){animation-delay:-.5s}@keyframes lds-ripple{0%{height:0;left:20px;opacity:0;top:20px;width:0}4.9%{height:0;left:20px;opacity:0;top:20px;width:0}5%{height:0;left:20px;opacity:1;top:20px;width:0}to{height:40px;left:0;opacity:0;top:0;width:40px}}.advads-ui-switch{align-items:center;cursor:pointer;display:inline-flex;position:relative}.advads-ui-switch-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.25rem*var(--tw-space-y-reverse));margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)))}.advads-ui-switch input{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.advads-ui-switch input:checked~div{--tw-bg-opacity:1;background-color:rgb(4 116 162/var(--tw-bg-opacity))}.advads-ui-switch input:checked~div:after{--tw-translate-x:100%;--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.advads-ui-switch input:disabled~div:after{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));content:var(--tw-content)}.advads-ui-switch div{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));border-radius:9999px;height:1.5rem;width:2.75rem}.advads-ui-switch div:after{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-content:"";background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:9999px;border-width:1px;content:var(--tw-content);height:1.25rem;left:2px;position:absolute;top:.125rem;transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1.25rem}.advads-ui-switch span{font-size:.875rem;font-weight:500;line-height:1.25rem;margin-left:.75rem}#advads-m2-connect{display:none}#advads-m2-connect a{--tw-text-opacity:1;color:rgb(4 116 162/var(--tw-text-opacity))}
     1.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.\!mr-2{margin-right:.5rem!important}.\!mt-1{margin-top:.25rem!important}.mb-6{margin-bottom:1.5rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.items-center{align-items:center}.gap-x-4{column-gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.text-base{font-size:1rem;line-height:1.5rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.lds-ripple{display:none;height:40px;position:relative;width:40px}.lds-ripple.show{display:inline-block}.lds-ripple div{animation:lds-ripple 1s cubic-bezier(0,.2,.8,1) infinite;border:4px solid #ccc;border-radius:50%;opacity:1;position:absolute}.lds-ripple div:nth-child(2){animation-delay:-.5s}@keyframes lds-ripple{0%{height:0;left:20px;opacity:0;top:20px;width:0}4.9%{height:0;left:20px;opacity:0;top:20px;width:0}5%{height:0;left:20px;opacity:1;top:20px;width:0}to{height:40px;left:0;opacity:0;top:0;width:40px}}.advads-ui-switch{align-items:center;cursor:pointer;display:inline-flex;position:relative}.advads-ui-switch-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.25rem*var(--tw-space-y-reverse));margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)))}.advads-ui-switch input{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.advads-ui-switch input:checked~div{--tw-bg-opacity:1;background-color:rgb(4 116 162/var(--tw-bg-opacity))}.advads-ui-switch input:checked~div:after{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content);left:auto;right:2px}.advads-ui-switch input:disabled~div:after{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));content:var(--tw-content)}.advads-ui-switch div{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));border-radius:9999px;border-width:1px;height:1.5rem;position:relative;width:2.75rem}.advads-ui-switch div:after{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-content:"";background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:9999px;border-width:1px;content:var(--tw-content);height:1.25rem;left:2px;position:absolute;top:.125rem;transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1.25rem}.advads-ui-switch span{font-size:.875rem;font-weight:500;line-height:1.25rem;margin-left:.75rem}#advads-m2-connect{display:none}#advads-m2-connect a{--tw-text-opacity:1;color:rgb(4 116 162/var(--tw-text-opacity))}
  • advanced-ads/tags/1.54.0/assets/js/app.js

    r3134243 r3145275  
    1 (()=>{"use strict";var t,e={570:(t,e,n)=>{const a=jQuery;var o=n.n(a);function s(){var t,e,n,a,s;t=o()(".js-pubguru-connect"),e=t.next(".aa-spinner"),n=o()("#advads-m2-connect"),o()(".js-m2-show-consent").on("click",".button",(function(t){t.preventDefault();var e=o()(this).closest("tr");n.show(),e.addClass("hidden"),e.next().removeClass("hidden")})),o()(".js-pubguru-disconnect").on("click",".button",(function(t){t.preventDefault();var e=o()(this).closest("tr");n.hide(),e.addClass("hidden"),e.prev().removeClass("hidden"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_disconnect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(t){if(t.success){var n=o()('<div class="notice notice-success" />');n.html("<p>"+t.data.message+"</p>"),e.closest(".postbox").after(n),setTimeout((function(){n.fadeOut(500,(function(){n.remove()}))}),3e3)}}))})),o()("#m2-connect-consent").on("change",(function(){var e=o()(this);t.prop("disabled",!e.is(":checked"))})),o()("#advads-overview").on("click",".notice-dismiss",(function(t){t.preventDefault();var e=o()(this).parent();e.fadeOut(500,(function(){e.remove()}))})),t.on("click",(function(n){n.preventDefault(),e.addClass("show"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_connect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(t){t.success&&(o()(".pubguru-not-connected").hide(),o()(".pubguru-connected").removeClass("hidden"),o()(".pg-tc-trail").toggle(!t.data.hasTrafficCop),o()(".pg-tc-install").toggle(t.data.hasTrafficCop))})).fail((function(e){var n=e.responseJSON,a=o()('<div class="notice notice-error is-dismissible" />');a.html("<p>"+n.data+'</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'),t.closest(".postbox").after(a)})).complete((function(){return e.removeClass("show")}))})),a=o()("#pubguru-modules"),s=o()("#pubguru-notices"),a.on("input","input:checkbox",(function(){var t=o()(this),e=t.attr("name"),n=t.is(":checked");o().ajax({url:a.attr("action"),method:"POST",data:{action:"pubguru_module_change",security:a.data("security"),module:e,status:n}}).done((function(t){var e=t.data.notice,n=void 0===e?"":e;s.html(""),""!==n&&s.html(n)}))})),s.on("click",".js-btn-backup-adstxt",(function(){var t=o()(this);t.prop("disabled",!0),t.html(t.data("loading")),o().ajax({url:a.attr("action"),method:"POST",data:{action:"pubguru_backup_ads_txt",security:t.data("security")}}).done((function(e){e.success?(t.html(t.data("done")),setTimeout((function(){s.fadeOut("slow",(function(){s.html("")}))}),4e3)):t.html(t.data("text"))})).fail((function(){t.html(t.data("text"))}))}))}o()((function(){s()}))},576:()=>{}},n={};function a(t){var o=n[t];if(void 0!==o)return o.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,a),s.exports}a.m=e,t=[],a.O=(e,n,o,s)=>{if(!n){var c=1/0;for(d=0;d<t.length;d++){for(var[n,o,s]=t[d],i=!0,r=0;r<n.length;r++)(!1&s||c>=s)&&Object.keys(a.O).every((t=>a.O[t](n[r])))?n.splice(r--,1):(i=!1,s<c&&(c=s));if(i){t.splice(d--,1);var u=o();void 0!==u&&(e=u)}}return e}s=s||0;for(var d=t.length;d>0&&t[d-1][2]>s;d--)t[d]=t[d-1];t[d]=[n,o,s]},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={845:0,196:0};a.O.j=e=>0===t[e];var e=(e,n)=>{var o,s,[c,i,r]=n,u=0;if(c.some((e=>0!==t[e]))){for(o in i)a.o(i,o)&&(a.m[o]=i[o]);if(r)var d=r(a)}for(e&&e(n);u<c.length;u++)s=c[u],a.o(t,s)&&t[s]&&t[s][0](),t[s]=0;return a.O(d)},n=globalThis.webpackChunkadvanced_ads=globalThis.webpackChunkadvanced_ads||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})(),a.O(void 0,[196],(()=>a(570)));var o=a.O(void 0,[196],(()=>a(576)));o=a.O(o)})();
     1(()=>{"use strict";var e,t={612:(e,t,a)=>{const n=jQuery;var o=a.n(n);function s(e,t){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=o()('<div class="notice notice-'.concat(t,' is-dismissible" />'));n.html("<p>"+e+'</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'),o()("#pubguru-notices").append(n),a&&setTimeout((function(){n.fadeOut(500,(function(){n.remove()}))}),3e3)}function c(){var e,t,a,n,c,i,u,d,r,l;e=o()(".js-pubguru-connect"),t=o()(".js-pubguru-disconnect"),a=o()("#advads-m2-connect"),n=o()(".js-pubguru-connecting"),c=n.next(".aa-spinner"),i=o()(".pubguru-connected"),u=o()(".pubguru-not-connected"),e.on("click",".button",(function(e){e.preventDefault(),a.show()})),o()("#m2-connect-consent").on("change",(function(){var e=o()(this);n.prop("disabled",!e.is(":checked"))})),n.on("click",(function(a){a.preventDefault(),c.addClass("show"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_connect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(a){a.success&&(u.addClass("hidden"),e.addClass("hidden"),i.removeClass("hidden"),t.removeClass("hidden"),o()(".pg-tc-trail").toggle(!a.data.hasTrafficCop),o()(".pg-tc-install").toggle(a.data.hasTrafficCop),s(a.data.message,"success",!0))})).fail((function(e){s(e.responseJSON.data,"error")})).complete((function(){return c.removeClass("show")}))})),t.on("click",".button",(function(n){n.preventDefault(),a.hide(),u.removeClass("hidden"),e.removeClass("hidden"),i.addClass("hidden"),t.addClass("hidden"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_disconnect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(e){e.success&&s(e.data.message,"success",!0)}))})),d=o()("#pubguru-modules"),r=o()("#pubguru-notices"),l=o()("#pubguru-header-bidding-at-body").closest("div"),d.on("input","input:checkbox",(function(){var e=o()(this),t=e.attr("name"),a=e.is(":checked");"header_bidding"===t&&l.toggle(a),o().ajax({url:d.attr("action"),method:"POST",data:{action:"pubguru_module_change",security:d.data("security"),module:t,status:a}}).done((function(e){var t=e.data.notice,a=void 0===t?"":t;r.html(""),""!==a&&r.html(a)}))})),o()(document).on("click",".js-btn-backup-adstxt",(function(){var e=o()(this),t=e.closest(".notice");e.prop("disabled",!0),e.html(e.data("loading")),o().ajax({url:d.attr("action"),method:"POST",data:{action:"pubguru_backup_ads_txt",security:e.data("security")}}).always((function(){e.prop("disabled",!1),e.html(e.data("text"))})).done((function(e){if(e.success){var a=o()(e.data);r.html(a),t.after(a),t.remove(),setTimeout((function(){a.fadeOut("slow",(function(){a.html("")}))}),4e3)}else r.html(e.data),t.after(e.data)}))})),o()("#advads-overview").on("click",".notice-dismiss",(function(e){e.preventDefault();var t=o()(this).parent();t.fadeOut(500,(function(){t.remove()}))}))}o()((function(){c()}))},576:()=>{}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var s=a[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.m=t,e=[],n.O=(t,a,o,s)=>{if(!a){var c=1/0;for(r=0;r<e.length;r++){for(var[a,o,s]=e[r],i=!0,u=0;u<a.length;u++)(!1&s||c>=s)&&Object.keys(n.O).every((e=>n.O[e](a[u])))?a.splice(u--,1):(i=!1,s<c&&(c=s));if(i){e.splice(r--,1);var d=o();void 0!==d&&(t=d)}}return t}s=s||0;for(var r=e.length;r>0&&e[r-1][2]>s;r--)e[r]=e[r-1];e[r]=[a,o,s]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={845:0,196:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,s,[c,i,u]=a,d=0;if(c.some((t=>0!==e[t]))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(u)var r=u(n)}for(t&&t(a);d<c.length;d++)s=c[d],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(r)},a=globalThis.webpackChunkadvanced_ads=globalThis.webpackChunkadvanced_ads||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),n.O(void 0,[196],(()=>n(612)));var o=n.O(void 0,[196],(()=>n(576)));o=n.O(o)})();
  • advanced-ads/tags/1.54.0/assets/scss/ui/_switch.scss

    r3041809 r3145275  
    1010
    1111        &:checked ~ div {
    12             @apply after:translate-x-full after:border-white bg-primary;
     12            @apply bg-primary after:left-auto after:right-[2px] after:border-white;
    1313        }
    1414
     
    1919
    2020    div {
    21         @apply w-11 h-6 bg-gray-200 rounded-full;
     21        @apply relative w-11 h-6 bg-gray-200 rounded-full border;
    2222
    2323        &::after {
  • advanced-ads/tags/1.54.0/assets/src/modules/oneclick/connect-button.js

    r3041809 r3145275  
    11import jQuery from 'jquery';
    22
     3function createNotice(message, type, fadeAway = false) {
     4    const notice = jQuery(
     5        `<div class="notice notice-${type} is-dismissible" />`
     6    );
     7    notice.html(
     8        '<p>' +
     9            message +
     10            '</p>' +
     11            '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'
     12    );
     13
     14    jQuery('#pubguru-notices').append(notice);
     15
     16    if (fadeAway) {
     17        setTimeout(() => {
     18            notice.fadeOut(500, () => {
     19                notice.remove();
     20            });
     21        }, 3000);
     22    }
     23}
     24
    325export default function () {
    4     const pubguruConnectButton = jQuery('.js-pubguru-connect');
    5     const spinner = pubguruConnectButton.next('.aa-spinner');
     26    const connectWrap = jQuery('.js-pubguru-connect');
     27    const disconnectWrap = jQuery('.js-pubguru-disconnect');
    628    const metabox = jQuery('#advads-m2-connect');
     29    const connectButton = jQuery('.js-pubguru-connecting');
     30    const spinner = connectButton.next('.aa-spinner');
     31    const contentConnected = jQuery('.pubguru-connected');
     32    const contentNotConnected = jQuery('.pubguru-not-connected');
    733
    8     jQuery('.js-m2-show-consent').on('click', '.button', function (event) {
     34    // Show consent box.
     35    connectWrap.on('click', '.button', function (event) {
    936        event.preventDefault();
    10 
    11         const tr = jQuery(this).closest('tr');
    12 
    1337        metabox.show();
    14         tr.addClass('hidden');
    15         tr.next().removeClass('hidden');
    16     });
    17 
    18     jQuery('.js-pubguru-disconnect').on('click', '.button', function (event) {
    19         event.preventDefault();
    20 
    21         const tr = jQuery(this).closest('tr');
    22 
    23         metabox.hide();
    24         tr.addClass('hidden');
    25         tr.prev().removeClass('hidden');
    26 
    27         jQuery
    28             .ajax({
    29                 type: 'POST',
    30                 url: ajaxurl,
    31                 data: {
    32                     action: 'pubguru_disconnect',
    33                     nonce: advadsglobal.ajax_nonce,
    34                 },
    35                 dataType: 'json',
    36             })
    37             .done(function (response) {
    38                 if (!response.success) {
    39                     return;
    40                 }
    41 
    42                 const notice = jQuery('<div class="notice notice-success" />');
    43                 notice.html('<p>' + response.data.message + '</p>');
    44 
    45                 tr.closest('.postbox').after(notice);
    46                 setTimeout(function () {
    47                     notice.fadeOut(500, function () {
    48                         notice.remove();
    49                     });
    50                 }, 3000);
    51             });
    5238    });
    5339
    5440    jQuery('#m2-connect-consent').on('change', function () {
    5541        const checkbox = jQuery(this);
    56         pubguruConnectButton.prop('disabled', !checkbox.is(':checked'));
     42        connectButton.prop('disabled', !checkbox.is(':checked'));
    5743    });
    5844
    59     jQuery('#advads-overview').on('click', '.notice-dismiss', function (event) {
    60         event.preventDefault();
    61         const button = jQuery(this);
    62         const notice = button.parent();
    63         notice.fadeOut(500, function () {
    64             notice.remove();
    65         });
    66     });
    67 
    68     pubguruConnectButton.on('click', function (event) {
     45    connectButton.on('click', function (event) {
    6946        event.preventDefault();
    7047
     
    8562                }
    8663
    87                 jQuery('.pubguru-not-connected').hide();
    88                 jQuery('.pubguru-connected').removeClass('hidden');
     64                contentNotConnected.addClass('hidden');
     65                connectWrap.addClass('hidden');
     66                contentConnected.removeClass('hidden');
     67                disconnectWrap.removeClass('hidden');
    8968
    9069                jQuery('.pg-tc-trail').toggle(!response.data.hasTrafficCop);
    9170                jQuery('.pg-tc-install').toggle(response.data.hasTrafficCop);
     71                createNotice(response.data.message, 'success');
    9272            })
    9373            .fail(function (jqXHR) {
    9474                const response = jqXHR.responseJSON;
    95                 const notice = jQuery(
    96                     '<div class="notice notice-error is-dismissible" />'
    97                 );
    98                 notice.html(
    99                     '<p>' +
    100                         response.data +
    101                         '</p>' +
    102                         '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'
    103                 );
    104 
    105                 pubguruConnectButton.closest('.postbox').after(notice);
     75                createNotice(response.data, 'error');
    10676            })
    10777            .complete(() => spinner.removeClass('show'));
    10878    });
     79
     80    disconnectWrap.on('click', '.button', function (event) {
     81        event.preventDefault();
     82
     83        metabox.hide();
     84        contentNotConnected.removeClass('hidden');
     85        connectWrap.removeClass('hidden');
     86        contentConnected.addClass('hidden');
     87        disconnectWrap.addClass('hidden');
     88
     89        jQuery
     90            .ajax({
     91                type: 'POST',
     92                url: ajaxurl,
     93                data: {
     94                    action: 'pubguru_disconnect',
     95                    nonce: advadsglobal.ajax_nonce,
     96                },
     97                dataType: 'json',
     98            })
     99            .done(function (response) {
     100                if (!response.success) {
     101                    return;
     102                }
     103
     104                createNotice(response.data.message, 'success', true);
     105            });
     106    });
    109107}
  • advanced-ads/tags/1.54.0/assets/src/modules/oneclick/index.js

    r3041809 r3145275  
     1import jQuery from 'jquery';
     2
    13import connectButton from './connect-button';
    2 import settingsUi from './settings';
     4import connectSettings from './connect-settings';
    35
    46export default function () {
    57    connectButton();
    6     settingsUi();
     8    connectSettings();
     9
     10    jQuery('#advads-overview').on('click', '.notice-dismiss', function (event) {
     11        event.preventDefault();
     12        const button = jQuery(this);
     13        const notice = button.parent();
     14        notice.fadeOut(500, function () {
     15            notice.remove();
     16        });
     17    });
    718}
  • advanced-ads/tags/1.54.0/classes/ad-debug.php

    r2983598 r3145275  
    247247            $content = '';
    248248            foreach ( $_condition as $_k => $_v ) {
    249                 $content .= esc_html( $_k ) . ': ' . esc_html( $_v ) . '<br>';
     249                $content .= esc_html( $_k ) . ': ';
     250                if ( is_array( $_v ) ) {
     251                    $content .= esc_html( implode( ', ', $_v ) );
     252                } else {
     253                    $content .= esc_html( $_v );
     254                }
     255                $content .= '<br />';
    250256            }
    251257
  • advanced-ads/tags/1.54.0/classes/ad_group.php

    r3134930 r3145275  
    376376            'orderby'        => 'id', // Might want to avoid sorting as not needed for most calls and fast in PHP; slight I/O blocking concern.
    377377        ];
     378
     379        if ( ! empty( $this->ad_args['post_status'] ) ) {
     380            $args['post_status'] = array_unique( array_merge( (array) $args['post_status'], (array) $this->ad_args['post_status'] ) );
     381        }
    378382
    379383        $ads = new WP_Query( $args );
  • advanced-ads/tags/1.54.0/classes/frontend_checks.php

    r3108573 r3145275  
    22// phpcs:ignoreFile
    33
    4 use AdvancedAds\Assets_Registry;
    54use AdvancedAds\Utilities\WordPress;
    65
     
    5352
    5453        if( $this->has_adblocker_placements() ) {
    55             if ( ! Assets_Registry::script_is('find-adblocker', 'enqueued') ) {
    56                 Assets_Registry::enqueue_script('find-adblocker');
     54            if ( ! wp_advads()->registry->is_script('find-adblocker', 'enqueued') ) {
     55                wp_advads()->registry->enqueue_script('find-adblocker');
    5756            }
    5857        }
  • advanced-ads/tags/1.54.0/classes/in-content-injector.php

    r2983598 r3145275  
    1 <?php
     1<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
    22
    33use AdvancedAds\Utilities\WordPress;
     
    8080        }
    8181
    82         // handle tags that are empty by definition or could be empty ("custom" option)
     82        // Handle tags that are empty by definition or could be empty ("custom" option).
    8383        if ( in_array( $tag_option, [ 'img', 'iframe', 'custom' ], true ) ) {
    8484            $defaults['allowEmpty'] = true;
     
    116116        switch ( $tag_option ) {
    117117            case 'p':
    118                 // exclude paragraphs within blockquote tags
     118                // Exclude paragraphs within blockquote tags.
    119119                $tag = 'p[not(parent::blockquote)]';
    120120                break;
    121121            case 'pwithoutimg':
    122                 // convert option name into correct path, exclude paragraphs within blockquote tags
     122                // Convert option name into correct path, exclude paragraphs within blockquote tags.
    123123                $tag = 'p[not(descendant::img) and not(parent::blockquote)]';
    124124                break;
     
    133133                        contains(concat(' ', normalize-space(@class), ' '), ' gallery-size') or
    134134                        contains(concat(' ', normalize-space(@class), ' '), ' wp-caption ') )";
    135                 $tag = "*[self::img or self::figure or self::div[$shortcodes]]
     135                $tag        = "*[self::img or self::figure or self::div[$shortcodes]]
    136136                    [not(ancestor::table or ancestor::figure or ancestor::div[$shortcodes])]";
    137137                break;
    138             // any headline. By default h2, h3, and h4
     138            // Any headline. By default h2, h3, and h4.
    139139            case 'headlines':
    140140                $headlines = apply_filters( 'advanced-ads-headlines-for-ad-injection', [ 'h2', 'h3', 'h4' ] );
     
    145145                $tag = '*[' . implode( ' or ', $headlines ) . ']'; // /html/body/*[self::h2 or self::h3 or self::h4]
    146146                break;
    147             // any HTML element that makes sense in the content
     147            // Any HTML element that makes sense in the content.
    148148            case 'anyelement':
    149149                $exclude = [
     
    186186                break;
    187187            case 'custom':
    188                 // get the path for the "custom" tag choice, use p as a fallback to prevent it from showing any ads if users left it empty
     188                // Get the path for the "custom" tag choice, use p as a fallback to prevent it from showing any ads if users left it empty.
    189189                $tag = ! empty( $placement_opts['xpath'] ) ? stripslashes( $placement_opts['xpath'] ) : 'p';
    190190                break;
     
    194194        $xpath = new DOMXPath( $dom );
    195195
    196 
    197         if ( $options['itemLimit'] !== -1 ) {
     196        if ( -1 !== $options['itemLimit'] ) {
    198197            $items = $xpath->query( '/html/body/' . $tag );
    199198
     
    254253                    }
    255254
    256                     // make sure that the ad is injected outside the link
     255                    // Make sure that the ad is injected outside the link.
    257256                    if ( 'img' === $tag_option && 'a' === $node->parentNode->tagName ) {
    258257                        if ( $options['before'] ) {
    259258                            $node->parentNode;
    260259                        } else {
    261                             // go one level deeper if inserted after to not insert the ad into the link; probably after the paragraph
     260                            // Go one level deeper if inserted after to not insert the ad into the link; probably after the paragraph.
    262261                            $node->parentNode->parentNode;
    263262                        }
     
    274273                $ad_content = self::filter_ad_content( $ad_content, $node->tagName, $options );
    275274
    276                 // convert HTML to XML!
    277                 $ad_dom = new DOMDocument( '1.0', $wp_charset );
     275                // Convert HTML to XML!.
     276                $ad_dom                     = new DOMDocument( '1.0', $wp_charset );
    278277                $libxml_use_internal_errors = libxml_use_internal_errors( true );
    279278                $ad_dom->loadHtml( '<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wp_charset . '" /><body>' . $ad_content );
     
    314313                            }
    315314                        } else {
    316                             // append to body; -TODO using here that we only select direct children of the body tag.
     315                            // Append to body; -TODO using here that we only select direct children of the body tag.
    317316                            foreach ( $ad_dom->getElementsByTagName( 'body' )->item( 0 )->childNodes as $importedNode ) {
    318317                                $importedNode = $dom->importNode( $importedNode, true );
     
    341340             * * but there are enough elements on the site, but just in sub-containers
    342341             */
    343         } elseif ( WordPress::user_can( 'advanced_ads_manage_options' )
    344                 && $options['itemLimit'] !== -1
    345                 && empty( $plugin_options['content-injection-level-disabled'] ) ) {
     342        } elseif (
     343            WordPress::user_can( 'advanced_ads_manage_options' ) &&
     344            -1 !== $options['itemLimit'] &&
     345            empty( $plugin_options['content-injection-level-disabled'] )
     346        ) {
    346347
    347348            // Check if there are more elements without limitation.
     
    363364
    364365        // phpcs:enable
    365 
    366366        return $content;
    367367    }
     
    473473        // Add tags before/after which ad placehoders were injected.
    474474        foreach ( $ads_for_placeholders as $ad_content ) {
    475             $tag = $ad_content['tag'];
     475            $alts = [];
     476            $tag  = $ad_content['tag'];
    476477
    477478            switch ( $ad_content['position'] ) {
     
    492493            }
    493494        }
     495
    494496        $alts       = array_unique( $alts );
    495497        $tag_regexp = implode( '|', $alts );
     
    527529                }
    528530            } else {
    529                 $count ++;
     531                ++$count;
    530532            }
    531533        }
     
    749751        return '//*[' . implode( ' or ', $query ) . ']';
    750752    }
    751 
    752753}
  • advanced-ads/tags/1.54.0/classes/plugin.php

    r3134733 r3145275  
    9090     */
    9191    public function wp_plugins_loaded() {
    92         // Load plugin text domain.
    93         $this->load_plugin_textdomain();
    94 
    9592        // Load public-facing style sheet and JavaScript.
    9693        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
     
    267264
    268265    /**
    269      * Load the plugin text domain for translation.
    270      */
    271     public function load_plugin_textdomain() {
    272         load_plugin_textdomain( 'advanced-ads', false, ADVADS_BASE_DIR . '/languages' );
    273     }
    274 
    275     /**
    276266     * Shortcode to include ad in frontend
    277267     *
  • advanced-ads/tags/1.54.0/includes/admin/class-assets.php

    r3134243 r3145275  
    1010namespace AdvancedAds\Admin;
    1111
     12use AdvancedAds\Entities;
    1213use Advanced_Ads_AdSense_Admin;
    1314use Advanced_Ads_Display_Conditions;
    14 use AdvancedAds\Assets_Registry;
    15 use AdvancedAds\Entities;
    16 use AdvancedAds\Utilities\Data;
    1715use AdvancedAds\Utilities\Conditional;
    1816use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    4341        $screen = get_current_screen();
    4442
    45         Assets_Registry::enqueue_style( 'ui' );
    46         Assets_Registry::enqueue_style( 'admin' );
     43        wp_advads()->registry->enqueue_style( 'ui' );
     44        wp_advads()->registry->enqueue_style( 'admin' );
    4745
    4846        if ( 'post' === $screen->base && Entities::POST_TYPE_AD === $screen->post_type ) {
    49             Assets_Registry::enqueue_style( 'ad-positioning' );
     47            wp_advads()->registry->enqueue_style( 'ad-positioning' );
    5048        }
    5149    }
     
    6361
    6462        // TODO: add conditional loading.
    65         Assets_Registry::enqueue_script( 'admin-global' );
    66         Assets_Registry::enqueue_script( 'find-adblocker' );
     63        wp_advads()->registry->enqueue_script( 'admin-global' );
     64        wp_advads()->registry->enqueue_script( 'find-adblocker' );
    6765
    6866        $params = [
     
    7775
    7876        if ( Conditional::is_screen_advanced_ads() ) {
    79             Assets_Registry::enqueue_script( 'admin' );
    80             Assets_Registry::enqueue_script( 'conditions' );
    81             Assets_Registry::enqueue_script( 'wizard' );
     77            wp_advads()->registry->enqueue_script( 'admin' );
     78            wp_advads()->registry->enqueue_script( 'conditions' );
     79            wp_advads()->registry->enqueue_script( 'wizard' );
    8280
    8381            $translation_array = [
     
    118116        // Ad edit screen.
    119117        if ( 'post' === $screen->base && Entities::POST_TYPE_AD === $screen->post_type ) {
    120             Assets_Registry::enqueue_script( 'ad-positioning' );
     118            wp_advads()->registry->enqueue_script( 'ad-positioning' );
    121119        }
    122120
    123121        if ( in_array( $screen->id, [ 'edit-post', 'edit-page' ], true ) && current_user_can( 'edit_posts' ) ) {
    124             Assets_Registry::enqueue_script( 'page-quick-edit' );
     122            wp_advads()->registry->enqueue_script( 'page-quick-edit' );
    125123            wp_advads()->json->add( 'page_quick_edit', [ 'nonce' => wp_create_nonce( 'advads-post-quick-edit' ) ] );
    126124        }
  • advanced-ads/tags/1.54.0/includes/class-assets-registry.php

    r3134243 r3145275  
    1010namespace AdvancedAds;
    1111
    12 use AdvancedAds\Framework\Interfaces\Integration_Interface;
    13 
    1412defined( 'ABSPATH' ) || exit;
    1513
     
    1715 * Assets Registry.
    1816 */
    19 class Assets_Registry implements Integration_Interface {
     17class Assets_Registry extends \AdvancedAds\Framework\Assets_Registry {
    2018
    2119    /**
    22      * Enqueue stylesheet
     20     * Version for plugin local assets.
    2321     *
    24      * @param string $handle Name of the stylesheet.
    25      *
    26      * @return void
     22     * @return string
    2723     */
    28     public static function enqueue_style( $handle ): void {
    29         wp_enqueue_style( self::prefix_it( $handle ) );
     24    public function get_version(): string {
     25        return ADVADS_VERSION;
    3026    }
    3127
    3228    /**
    33      * Enqueue script
     29     * Prefix to use in handle to make it unique.
    3430     *
    35      * @param string $handle Name of the script.
    36      *
    37      * @return void
     31     * @return string
    3832     */
    39     public static function enqueue_script( $handle ): void {
    40         wp_enqueue_script( self::prefix_it( $handle ) );
     33    public function get_prefix(): string {
     34        return ADVADS_SLUG;
    4135    }
    4236
    4337    /**
    44      * Prefix the handle
    45      *
    46      * @param string $handle Name of the asset.
     38     * Base URL for plugin local assets.
    4739     *
    4840     * @return string
    4941     */
    50     public static function prefix_it( $handle ): string {
    51         return ADVADS_SLUG . '-' . $handle;
    52     }
    53 
    54     /**
    55      * Determines whether a script has been added to the queue.
    56      *
    57      * @param string $handle Name of the script.
    58      * @param string $status Optional. Status of the script to check. Default 'enqueued'.
    59      *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
    60      *
    61      * @return bool
    62      */
    63     public static function script_is( $handle, $status = 'enqueued' ): bool {
    64         return wp_script_is( self::prefix_it( $handle ), $status );
    65     }
    66 
    67     /**
    68      * Hook into WordPress.
    69      *
    70      * @return void
    71      */
    72     public function hooks(): void {
    73         add_action( 'admin_enqueue_scripts', [ $this, 'register_assets' ], 0 );
    74         add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ], 0 );
    75     }
    76 
    77     /**
    78      * Register assets
    79      *
    80      * @return void
    81      */
    82     public function register_assets(): void {
    83         $this->register_styles();
    84         $this->register_scripts();
     42    public function get_base_url(): string {
     43        return ADVADS_BASE_URL;
    8544    }
    8645
     
    9453            return;
    9554        }
     55
    9656        $this->register_style( 'ui', 'admin/assets/css/ui.css' );
    9757        $this->register_style( 'admin', 'admin/assets/css/admin.css' );
     
    9959            $this->register_style( 'app', 'assets/css/app.css' );
    10060        }
    101         $this->register_style( 'ad-positioning', 'modules/ad-positioning/assets/css/ad-positioning.css', [ self::prefix_it( 'admin' ) ] );
     61        $this->register_style( 'ad-positioning', 'modules/ad-positioning/assets/css/ad-positioning.css', [ $this->prefix_it( 'admin' ) ] );
    10262    }
    10363
     
    11171        $this->register_script( 'wp-widget-adsense', 'modules/gadsense/admin/assets/js/wp-widget.js', [ 'jquery' ], false, true );
    11272        $this->register_script( 'app', 'assets/js/app.js', [ 'jquery' ], false, true );
     73        $this->register_script( 'find-adblocker', 'admin/assets/js/advertisement.js' );
    11374
    11475        if ( ! is_admin() ) {
     
    11778
    11879        // Backend JS files go here.
    119         $this->register_script( 'find-adblocker', 'admin/assets/js/advertisement.js' );
    120         $this->register_script( 'conditions', 'admin/assets/js/conditions.js', [ 'jquery', self::prefix_it( 'ui' ) ] );
     80        $this->register_script( 'conditions', 'admin/assets/js/conditions.js', [ 'jquery', $this->prefix_it( 'ui' ) ] );
    12181        $this->register_script( 'wizard', 'admin/assets/js/wizard.js', [ 'jquery' ] );
    12282        $this->register_script( 'inline-edit-group-ads', 'admin/assets/js/inline-edit-group-ads.js', [ 'jquery' ] );
    123         $this->register_script( 'admin', 'admin/assets/js/admin.min.js', [ 'jquery', self::prefix_it( 'ui' ), 'jquery-ui-autocomplete', 'wp-util' ] );
     83        $this->register_script( 'admin', 'admin/assets/js/admin.min.js', [ 'jquery', $this->prefix_it( 'ui' ), 'jquery-ui-autocomplete', 'wp-util' ] );
    12484        $this->register_script( 'ui', 'admin/assets/js/ui.js', [ 'jquery' ] );
    12585        $this->register_script( 'admin-global', 'admin/assets/js/admin-global.js', [ 'jquery' ], false, true );
    12686        $this->register_script( 'page-quick-edit', 'assets/js/admin/page-quick-edit.js', [], false, true );
    12787    }
    128 
    129     /**
    130      * Register stylesheet
    131      *
    132      * @param string           $handle Name of the stylesheet. Should be unique.
    133      * @param string|bool      $src    URL of the stylesheet.
    134      * @param string[]         $deps   Optional. An array of registered stylesheet handles this stylesheet depends on.
    135      * @param string|bool|null $ver    Optional. String specifying stylesheet version number.
    136      * @param string           $media  Optional. The media for which this stylesheet has been defined.
    137      *
    138      * @return void
    139      */
    140     private function register_style( $handle, $src, $deps = [], $ver = false, $media = 'all' ) {
    141         if ( false === $ver ) {
    142             $ver = ADVADS_VERSION;
    143         }
    144 
    145         wp_register_style( self::prefix_it( $handle ), ADVADS_BASE_URL . $src, $deps, $ver, $media );
    146     }
    147 
    148     /**
    149      * Register script
    150      *
    151      * @param string           $handle    Name of the stylesheet. Should be unique.
    152      * @param string|bool      $src       URL of the stylesheet.
    153      * @param string[]         $deps      Optional. An array of registered stylesheet handles this stylesheet depends on.
    154      * @param string|bool|null $ver       Optional. String specifying stylesheet version number.
    155      * @param bool             $in_footer Optional. The media for which this stylesheet has been defined.
    156      *
    157      * @return void
    158      */
    159     private function register_script( $handle, $src, $deps = [], $ver = false, $in_footer = false ) {
    160         if ( false === $ver ) {
    161             $ver = ADVADS_VERSION;
    162         }
    163 
    164         $new_src = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? $src : str_replace( '.js', '.min.js', $src );
    165         wp_register_script( self::prefix_it( $handle ), ADVADS_BASE_URL . $src, $deps, $ver, $in_footer );
    166     }
    16788}
  • advanced-ads/tags/1.54.0/includes/class-autoloader.php

    r2991956 r3145275  
    5151
    5252    /**
     53     * Get plugin directory.
     54     *
     55     * @return string
     56     */
     57    public function get_directory(): string {
     58        return dirname( ADVADS_FILE );
     59    }
     60
     61    /**
    5362     * Runs this initializer.
    5463     *
     
    6372        }
    6473
    65         $this->autoloader = require_once $locate;
     74        $this->autoloader = require $locate;
    6675        $this->register_wordpress();
    6776    }
     
    7584     */
    7685    private function locate() {
    77         $directory   = dirname( ADVADS_FILE );
    78         $packages    = $directory . '/packages/autoload.php';
    79         $vendors     = $directory . '/vendor/autoload.php';
    80         $is_debug    = 'local' === ( function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : $this->get_environment_type() );
    81         $is_packages = is_readable( $packages );
    82         $is_vendors  = is_readable( $vendors );
    83 
    84         if ( $is_packages && ( ! $is_debug || ! $is_vendors ) ) {
     86        $directory = $this->get_directory();
     87        $packages  = $directory . '/packages/autoload.php';
     88        $vendors   = $directory . '/vendor/autoload.php';
     89        $is_debug  = $this->is_debug() || 'local' === $this->get_environment_type();
     90
     91        if ( is_readable( $packages ) && ( ! $is_debug || ! is_readable( $vendors ) ) ) {
    8592            return $packages;
    8693        }
    8794
    88         if ( $is_vendors ) {
     95        if ( is_readable( $vendors ) ) {
    8996            return $vendors;
    9097        }
     
    135142     */
    136143    public function get_environment_type(): string {
     144        return function_exists( 'wp_get_environment_type' )
     145            ? wp_get_environment_type()
     146            : $this->get_environment_type_fallback();
     147    }
     148
     149    /**
     150     * Retrieves the current environment type.
     151     *
     152     * @return string
     153     */
     154    private function get_environment_type_fallback(): string {
    137155        static $current_env = '';
    138156
     
    184202        return $current_env;
    185203    }
     204
     205    /**
     206     * Is WordPress debug mode enabled
     207     *
     208     * @return bool
     209     */
     210    private function is_debug(): bool {
     211        return defined( 'WP_DEBUG' ) && WP_DEBUG;
     212    }
    186213}
  • advanced-ads/tags/1.54.0/includes/class-plugin.php

    r3134243 r3145275  
    1111
    1212use AdvancedAds\Admin;
    13 use AdvancedAds\Groups;
    1413use AdvancedAds\Framework;
    1514use AdvancedAds\Framework\Loader;
     
    2019/**
    2120 * Plugin.
     21 *
     22 * Containers:
     23 *
     24 * @property Shortcodes           $shortcodes Shortcodes handler.
     25 * @property Assets_Registry      $registry   Assets registry.
     26 * @property Framework\JSON       $json       JSON handler.
     27 * @property Admin\Admin_Menu     $screens    Admin screens.
     28 * @property Frontend\Ad_Renderer $renderer   Ads renderer.
     29 * @property Frontend\Manager     $frontend   Frontend manager.
    2230 */
    2331class Plugin extends Loader {
     
    5765    private function setup(): void {
    5866        $this->define_constants();
     67        $this->includes_functions();
    5968        $this->includes();
     69        $this->includes_admin();
    6070
    6171        /**
     
    6474         * TODO: need to remove it in future.
    6575         */
    66 
    67         // Load public functions (might be used by modules, other plugins or theme).
    68         require_once ADVADS_ABSPATH . 'includes/functions.php';
    69         require_once ADVADS_ABSPATH . 'includes/cap_map.php';
    70 
    7176        // Public-Facing and Core Functionality.
    7277        \Advanced_Ads::get_instance();
     
    7883        }
    7984
     85        add_action( 'init', [ $this, 'load_textdomain' ] );
    8086        add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ], -1 );
     87
     88        // Load it all.
    8189        $this->load();
    8290    }
     
    96104         */
    97105        do_action( 'advanced-ads-loaded' );
     106    }
     107
     108    /**
     109     * Load the plugin text domain for translation.
     110     *
     111     * @return void
     112     */
     113    public function load_textdomain(): void {
     114        $locale = get_user_locale();
     115        $locale = apply_filters( 'plugin_locale', $locale, 'advanced-ads' );
     116
     117        unload_textdomain( 'advanced-ads' );
     118        if ( false === load_textdomain( 'advanced-ads', WP_LANG_DIR . '/plugins/advanced-ads-' . $locale . '.mo' ) ) {
     119            load_textdomain( 'advanced-ads', WP_LANG_DIR . '/advanced-ads/advanced-ads-' . $locale . '.mo' );
     120        }
     121
     122        load_plugin_textdomain( 'advanced-ads', false, dirname( ADVADS_PLUGIN_BASENAME ) . '/languages' );
    98123    }
    99124
     
    145170     */
    146171    private function includes(): void {
     172        // Common.
    147173        $this->register_initializer( Install::class );
    148174        $this->register_integration( Entities::class );
    149         $this->register_integration( Assets_Registry::class );
     175        $this->register_integration( Assets_Registry::class, 'registry' );
    150176        $this->register_integration( Framework\JSON::class, 'json', [ 'advancedAds' ] );
    151177        $this->register_integration( Groups\Manager::class, 'group_manager' );
    152 
    153         // Only in admin area.
    154         if ( is_admin() ) {
    155             $this->register_integration( Admin\Action_Links::class );
    156             $this->register_integration( Admin\Assets::class );
    157             $this->register_integration( Admin\Header::class );
    158             $this->register_integration( Admin\TinyMCE::class );
    159             $this->register_integration( Admin\Admin_Menu::class );
    160             $this->register_integration( Admin\Page_Quick_Edit::class );
    161         }
     178    }
     179
     180    /**
     181     * Includes files used in admin.
     182     *
     183     * @return void
     184     */
     185    private function includes_admin(): void {
     186        // Early bail!!
     187        if ( ! is_admin() ) {
     188            return;
     189        }
     190
     191        $this->register_integration( Admin\Action_Links::class );
     192        $this->register_integration( Admin\Assets::class );
     193        $this->register_integration( Admin\Header::class );
     194        $this->register_integration( Admin\TinyMCE::class );
     195        $this->register_integration( Admin\Admin_Menu::class );
     196        $this->register_integration( Admin\Page_Quick_Edit::class );
     197    }
     198
     199    /**
     200     * Includes the necessary functions files.
     201     *
     202     * @return void
     203     */
     204    private function includes_functions(): void {
     205        require_once ADVADS_ABSPATH . 'includes/functions.php';
     206        require_once ADVADS_ABSPATH . 'includes/cap_map.php';
    162207    }
    163208}
  • advanced-ads/tags/1.54.0/languages/advanced-ads.pot

    r3134930 r3145275  
    1 # Copyright (C) 2024 Advanced Ads GmbH
     1# Copyright (C) 2024 Advanced Ads
    22# This file is distributed under the GPL-2.0+.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 1.53.1\n"
     5"Project-Id-Version: Advanced Ads 1.53.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
    77"Last-Translator: Thomas Maier <[email protected]>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-08-13T12:34:04+00:00\n"
     12"POT-Creation-Date: 2024-09-02T11:05:48+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
     
    1616
    1717#. Plugin Name of the plugin
    18 #: admin/includes/class-meta-box.php:565
     18#. Author of the plugin
     19#: admin/includes/class-meta-box.php:564
    1920#: modules/gutenberg/includes/class-gutenberg.php:136
    2021msgid "Advanced Ads"
     
    2829#. Description of the plugin
    2930msgid "Manage and optimize your ads in WordPress"
    30 msgstr ""
    31 
    32 #. Author of the plugin
    33 msgid "Advanced Ads GmbH"
    3431msgstr ""
    3532
     
    8683#. translators: %s is empty here, but the string will be followed by a name of an ad unit.
    8784#: admin/includes/ad-health-notices.php:112
    88 #: classes/frontend_checks.php:280
     85#: classes/frontend_checks.php:279
    8986msgid "Visible ads should not use the Header placement: %s"
    9087msgstr ""
    9188
    9289#: admin/includes/ad-health-notices.php:123
    93 #: classes/ad-debug.php:272
    94 #: classes/frontend_checks.php:267
     90#: classes/ad-debug.php:278
     91#: classes/frontend_checks.php:266
    9592msgid "Your website is using HTTPS, but the ad code contains HTTP and might not work."
    9693msgstr ""
     
    295292
    296293#: admin/includes/class-ad-type.php:953
    297 #: classes/frontend_checks.php:547
     294#: classes/frontend_checks.php:546
    298295msgid "Get help"
    299296msgstr ""
     
    439436msgstr ""
    440437
    441 #: admin/includes/class-meta-box.php:50
     438#: admin/includes/class-meta-box.php:49
    442439#: admin/includes/class-overview-widgets.php:68
    443440msgid "AdSense Earnings"
    444441msgstr ""
    445442
    446 #: admin/includes/class-meta-box.php:101
     443#: admin/includes/class-meta-box.php:100
    447444msgid "Ad Type"
    448445msgstr ""
    449446
    450447#. translators: 1: Name of ad unit
    451 #: admin/includes/class-meta-box.php:119
     448#: admin/includes/class-meta-box.php:118
    452449msgid "Earnings of  %1$s"
    453450msgstr ""
    454451
    455 #: admin/includes/class-meta-box.php:137
     452#: admin/includes/class-meta-box.php:136
    456453#: includes/admin/class-groups-list-table.php:451
    457454#: views/admin/screens/placements.php:351
     
    459456msgstr ""
    460457
    461 #: admin/includes/class-meta-box.php:146
     458#: admin/includes/class-meta-box.php:145
    462459msgid "Ad Parameters"
    463460msgstr ""
    464461
    465 #: admin/includes/class-meta-box.php:154
     462#: admin/includes/class-meta-box.php:153
    466463#: admin/includes/class-settings.php:73
    467464msgid "Layout / Output"
    468465msgstr ""
    469466
    470 #: admin/includes/class-meta-box.php:162
     467#: admin/includes/class-meta-box.php:161
    471468msgid "Targeting"
    472469msgstr ""
    473470
    474 #: admin/includes/class-meta-box.php:171
     471#: admin/includes/class-meta-box.php:170
    475472msgid "Increase your ad revenue"
    476473msgstr ""
    477474
    478 #: admin/includes/class-meta-box.php:181
     475#: admin/includes/class-meta-box.php:180
    479476msgid "Statistics"
    480477msgstr ""
    481478
    482 #: admin/includes/class-meta-box.php:252
    483 #: admin/includes/class-meta-box.php:266
     479#: admin/includes/class-meta-box.php:251
     480#: admin/includes/class-meta-box.php:265
    484481#: admin/includes/class-overview-widgets.php:181
    485482#: admin/views/ad-main-metabox.php:29
     
    502499msgstr ""
    503500
     501#: admin/includes/class-meta-box.php:269
     502msgid "Video"
     503msgstr ""
     504
    504505#: admin/includes/class-meta-box.php:270
    505 msgid "Video"
    506 msgstr ""
    507 
    508 #: admin/includes/class-meta-box.php:271
    509506#: admin/views/conditions/ad-targeting-metabox.php:18
    510507#: classes/ad-debug.php:152
     
    514511msgstr ""
    515512
    516 #: admin/includes/class-meta-box.php:272
     513#: admin/includes/class-meta-box.php:271
    517514#: admin/views/conditions/ad-targeting-metabox.php:37
    518515#: classes/ad-debug.php:239
     
    522519msgstr ""
    523520
    524 #: admin/includes/class-meta-box.php:304
     521#: admin/includes/class-meta-box.php:303
    525522#: admin/includes/class-overview-widgets.php:64
    526523#: views/admin/page-bulk-edit.php:20
     
    529526msgstr ""
    530527
    531 #: admin/includes/class-meta-box.php:466
     528#: admin/includes/class-meta-box.php:465
    532529msgid "Ad Settings"
    533530msgstr ""
    534531
    535532#. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
    536 #: admin/includes/class-meta-box.php:581
     533#: admin/includes/class-meta-box.php:580
    537534msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
    538535msgstr ""
    539536
    540 #: admin/includes/class-meta-box.php:594
     537#: admin/includes/class-meta-box.php:593
    541538msgid "Get the tutorial via email"
    542539msgstr ""
    543540
    544 #: admin/includes/class-meta-box.php:603
     541#: admin/includes/class-meta-box.php:602
    545542msgid "Get AdSense tips via email"
    546543msgstr ""
    547544
    548 #: admin/includes/class-meta-box.php:612
     545#: admin/includes/class-meta-box.php:611
    549546msgid "Visit our blog for more articles about ad optimization"
    550547msgstr ""
    551548
    552549#. translators: %s is our URL.
    553 #: admin/includes/class-meta-box.php:667
     550#: admin/includes/class-meta-box.php:666
    554551msgid "Latest posts on wpadvancedads.com"
    555552msgstr ""
     
    585582#: admin/views/notices/welcome-panel.php:15
    586583#: admin/views/placements-item.php:68
    587 #: includes/admin/class-assets.php:71
     584#: includes/admin/class-assets.php:69
    588585#: views/admin/tables/groups/list-row-loop-none.php:17
    589586#: views/admin/tables/groups/list-row-option-ads.php:61
     
    744741#: admin/includes/class-overview-widgets.php:627
    745742#: admin/includes/class-overview-widgets.php:645
    746 #: classes/ad_group.php:650
     743#: classes/ad_group.php:654
    747744msgid "Activate now"
    748745msgstr ""
     
    778775
    779776#: admin/includes/class-overview-widgets.php:733
    780 #: classes/ad_group.php:653
     777#: classes/ad_group.php:657
    781778msgid "Get this add-on"
    782779msgstr ""
     
    823820
    824821#: admin/includes/class-settings.php:178
    825 #: classes/in-content-injector.php:609
     822#: classes/in-content-injector.php:611
    826823msgid "Disable level limitation"
    827824msgstr ""
     
    17031700
    17041701#: admin/views/settings/general/block-bots.php:11
    1705 #: classes/frontend_checks.php:138
     1702#: classes/frontend_checks.php:137
    17061703msgid "You look like a bot"
    17071704msgstr ""
     
    20782075
    20792076#. translators: %1$s is an URL, %2$s is a URL text
    2080 #: classes/ad_group.php:659
     2077#: classes/ad_group.php:663
    20812078msgid "It seems that a caching plugin is activated. Your ads might not rotate properly. The cache busting in Advanced Ads Pro will solve that. <a href=\"%1$s\" target=\"_blank\">%2$s.</a>"
    20822079msgstr ""
     
    23842381#: classes/display-conditions.php:318
    23852382#: classes/visitor-conditions.php:317
    2386 #: includes/admin/class-assets.php:84
     2383#: includes/admin/class-assets.php:82
    23872384#: modules/gadsense/admin/views/external-ads-links.php:17
    23882385#: modules/gadsense/admin/views/external-ads-links.php:22
     
    23932390#: classes/display-conditions.php:318
    23942391#: classes/visitor-conditions.php:317
    2395 #: includes/admin/class-assets.php:85
     2392#: includes/admin/class-assets.php:83
    23962393msgid "and"
    23972394msgstr ""
     
    25642561msgstr ""
    25652562
    2566 #: classes/frontend_checks.php:123
     2563#: classes/frontend_checks.php:122
    25672564msgid "Random AdSense ads"
    25682565msgstr ""
    25692566
    2570 #: classes/frontend_checks.php:152
     2567#: classes/frontend_checks.php:151
    25712568msgid "Ad blocker enabled"
    25722569msgstr ""
    25732570
    2574 #: classes/frontend_checks.php:164
     2571#: classes/frontend_checks.php:163
    25752572msgid "<em>%s</em> filter does not exist"
    25762573msgstr ""
    25772574
    2578 #: classes/frontend_checks.php:180
     2575#: classes/frontend_checks.php:179
    25792576msgid "Ads are disabled in the content of this page"
    25802577msgstr ""
    25812578
    2582 #: classes/frontend_checks.php:192
     2579#: classes/frontend_checks.php:191
    25832580msgid "the current post ID is 0 "
    25842581msgstr ""
    25852582
    2586 #: classes/frontend_checks.php:211
     2583#: classes/frontend_checks.php:210
    25872584msgid "Ads are disabled on this page"
    25882585msgstr ""
    25892586
    2590 #: classes/frontend_checks.php:225
     2587#: classes/frontend_checks.php:224
    25912588msgid "Ads are disabled on all pages"
    25922589msgstr ""
    25932590
    2594 #: classes/frontend_checks.php:240
     2591#: classes/frontend_checks.php:239
    25952592msgid "Ads are disabled on 404 pages"
    25962593msgstr ""
    25972594
    2598 #: classes/frontend_checks.php:254
     2595#: classes/frontend_checks.php:253
    25992596msgid "Ads are disabled on non singular pages"
    26002597msgstr ""
    26012598
    2602 #: classes/frontend_checks.php:268
     2599#: classes/frontend_checks.php:267
    26032600msgid "Ad IDs: %s"
    26042601msgstr ""
    26052602
     2603#: classes/frontend_checks.php:295
     2604msgid "AdSense violation"
     2605msgstr ""
     2606
    26062607#: classes/frontend_checks.php:296
    2607 msgid "AdSense violation"
     2608msgid "Ad is hidden"
    26082609msgstr ""
    26092610
    26102611#: classes/frontend_checks.php:297
    2611 msgid "Ad is hidden"
    2612 msgstr ""
    2613 
    2614 #: classes/frontend_checks.php:298
    26152612msgid "IDs: %s"
    26162613msgstr ""
    26172614
    2618 #: classes/frontend_checks.php:314
     2615#: classes/frontend_checks.php:313
    26192616msgid "The following responsive AdSense ads are not showing up: %s"
    26202617msgstr ""
    26212618
    2622 #: classes/frontend_checks.php:331
     2619#: classes/frontend_checks.php:330
    26232620msgid "Consent not given"
    26242621msgstr ""
    26252622
    2626 #: classes/frontend_checks.php:348
     2623#: classes/frontend_checks.php:347
    26272624msgid "Enable TCF integration"
    26282625msgstr ""
    26292626
    2630 #: classes/frontend_checks.php:363
     2627#: classes/frontend_checks.php:362
    26312628msgid "Debug Google Ad Manager"
    26322629msgstr ""
    26332630
    2634 #: classes/frontend_checks.php:380
     2631#: classes/frontend_checks.php:379
    26352632msgid "highlight ads"
    26362633msgstr ""
    26372634
    2638 #: classes/frontend_checks.php:500
     2635#: classes/frontend_checks.php:499
    26392636msgid "Ad Health"
    26402637msgstr ""
    26412638
    2642 #: classes/frontend_checks.php:515
     2639#: classes/frontend_checks.php:514
    26432640msgid "Show %d more notifications"
    26442641msgstr ""
    26452642
    2646 #: classes/frontend_checks.php:534
     2643#: classes/frontend_checks.php:533
    26472644msgid "Everything is fine"
    26482645msgstr ""
    26492646
    2650 #: classes/frontend_checks.php:605
     2647#: classes/frontend_checks.php:604
    26512648msgid "the following code is used for automatic error detection and only visible to admins"
    26522649msgstr ""
    26532650
    26542651#. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
    2655 #: classes/in-content-injector.php:608
     2652#: classes/in-content-injector.php:610
    26562653msgid "Set <em>%s</em> to show more ads"
    26572654msgstr ""
     
    27612758msgstr ""
    27622759
     2760#: includes/admin/class-assets.php:84
     2761msgid "After which paragraph?"
     2762msgstr ""
     2763
    27632764#: includes/admin/class-assets.php:86
    2764 msgid "After which paragraph?"
    2765 msgstr ""
    2766 
    2767 #: includes/admin/class-assets.php:88
    27682765#: modules/gadsense/includes/class-adsense-report.php:159
    27692766msgid "Today"
    27702767msgstr ""
    27712768
    2772 #: includes/admin/class-assets.php:89
     2769#: includes/admin/class-assets.php:87
    27732770#: modules/gadsense/includes/class-adsense-report.php:160
    27742771msgid "Yesterday"
    27752772msgstr ""
    27762773
    2777 #: includes/admin/class-assets.php:90
     2774#: includes/admin/class-assets.php:88
    27782775#: modules/gadsense/includes/class-adsense-report.php:163
    27792776msgid "This Month"
     
    27812778
    27822779#. translators: 1: The number of days.
    2783 #: includes/admin/class-assets.php:92
     2780#: includes/admin/class-assets.php:90
    27842781#: modules/gadsense/includes/class-adsense-report.php:162
    27852782#: modules/gadsense/includes/class-adsense-report.php:165
     
    27882785
    27892786#. translators: 1: An error message.
    2790 #: includes/admin/class-assets.php:94
     2787#: includes/admin/class-assets.php:92
    27912788msgid "An error occurred: %1$s"
    27922789msgstr ""
    27932790
    2794 #: includes/admin/class-assets.php:95
     2791#: includes/admin/class-assets.php:93
    27952792#: modules/gadsense/admin/views/adsense-report.php:24
    27962793msgid "All"
    27972794msgstr ""
    27982795
     2796#: includes/admin/class-assets.php:94
     2797msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
     2798msgstr ""
     2799
     2800#: includes/admin/class-assets.php:95
     2801msgid "Show inactive ads"
     2802msgstr ""
     2803
    27992804#: includes/admin/class-assets.php:96
    2800 msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
    2801 msgstr ""
    2802 
    2803 #: includes/admin/class-assets.php:97
    2804 msgid "Show inactive ads"
     2805msgid "Hide inactive ads"
    28052806msgstr ""
    28062807
    28072808#: includes/admin/class-assets.php:98
    2808 msgid "Hide inactive ads"
     2809msgid "Permanently delete this placement?"
     2810msgstr ""
     2811
     2812#: includes/admin/class-assets.php:99
     2813msgid "Close"
    28092814msgstr ""
    28102815
    28112816#: includes/admin/class-assets.php:100
    2812 msgid "Permanently delete this placement?"
    2813 msgstr ""
    2814 
    2815 #: includes/admin/class-assets.php:101
    2816 msgid "Close"
    2817 msgstr ""
    2818 
    2819 #: includes/admin/class-assets.php:102
    28202817msgid "Data you have entered has not been saved. Are you sure you want to discard your changes?"
    28212818msgstr ""
     
    30113008
    30123009#. translators: 1: is a link to a support document. 2: closing link
    3013 #: includes/class-autoloader.php:121
     3010#: includes/class-autoloader.php:128
    30143011msgid "Your installation of Advanced Ads is incomplete. If you installed Advanced Ads from GitHub, %1$s please refer to this document%2$s to set up your development environment."
    30153012msgstr ""
    30163013
    30173014#. translators: %s: WP_ENVIRONMENT_TYPES
    3018 #: includes/class-autoloader.php:154
     3015#: includes/class-autoloader.php:172
    30193016msgid "The %s constant is no longer supported."
    30203017msgstr ""
     
    31283125#: includes/groups/types/type-unknown.php:60
    31293126msgid "No description"
     3127msgstr ""
     3128
     3129#: includes/importers/class-api-ads.php:56
     3130msgid "Ads from API"
     3131msgstr ""
     3132
     3133#: includes/importers/class-api-ads.php:65
     3134msgid "For MonetizeMore clients using PubGuru, you will be able to create all of your new ads from api."
     3135msgstr ""
     3136
     3137#. translators: 1: counts 2: Importer title
     3138#: includes/importers/class-api-ads.php:192
     3139msgid "%1$d ads migrated from %2$s"
     3140msgstr ""
     3141
     3142#: includes/importers/class-manager.php:104
     3143msgid "History deleted successfully."
    31303144msgstr ""
    31313145
     
    41384152msgstr ""
    41394153
     4154#: modules/one-click/admin/class-admin.php:60
     4155msgid "MonetizeMore & PubGuru Integration"
     4156msgstr ""
     4157
    41404158#: modules/one-click/admin/class-admin.php:61
    4141 msgid "MonetizeMore & PubGuru Integration"
    4142 msgstr ""
    4143 
    4144 #: modules/one-click/admin/class-admin.php:62
    41454159msgid "Enables MonetizeMore users to link their settings with the PubGuru insights & analytics dashboard."
    41464160msgstr ""
     
    41504164msgstr ""
    41514165
    4152 #: modules/one-click/admin/class-admin.php:74
     4166#: modules/one-click/admin/class-admin.php:76
    41534167msgid "Disconnect now"
    41544168msgstr ""
    41554169
    4156 #: modules/one-click/admin/class-admin.php:100
     4170#: modules/one-click/admin/class-admin.php:101
    41574171msgid "PubGuru OneClick Consent & Privacy Policy"
    41584172msgstr ""
    41594173
    4160 #: modules/one-click/admin/class-admin.php:102
     4174#: modules/one-click/admin/class-admin.php:103
    41614175msgid "Connecting Your With Your PubGuru Account Settings"
    41624176msgstr ""
     
    41674181
    41684182#: modules/one-click/admin/class-ajax.php:78
    4169 msgid "Pubguru successfully connected."
     4183msgid "We have successfully migrated your MonetizeMore Pubguru Ad Units to your WordPress site. The existing placements and ads have been paused."
    41704184msgstr ""
    41714185
     
    41744188msgstr ""
    41754189
     4190#: modules/one-click/admin/class-ajax.php:132
    41764191#: modules/one-click/admin/class-ajax.php:167
    41774192msgid "An error has occurred please try again."
    41784193msgstr ""
    41794194
    4180 #: modules/one-click/modules/adstxt/class-detector.php:88
     4195#: modules/one-click/admin/class-ajax.php:139
     4196msgid "File successfully backed up."
     4197msgstr ""
     4198
     4199#: modules/one-click/modules/adstxt/class-detector.php:93
    41814200msgid "File alert!"
    41824201msgstr ""
    41834202
    4184 #: modules/one-click/modules/adstxt/class-detector.php:88
    4185 msgid "Physical ads.txt found. In order to use PubGuru service you need to delete it."
    4186 msgstr ""
    4187 
    4188 #: modules/one-click/modules/adstxt/class-detector.php:90
    4189 #: modules/one-click/modules/adstxt/class-detector.php:91
     4203#: modules/one-click/modules/adstxt/class-detector.php:93
     4204msgid "Physical ads.txt found. In order to use PubGuru service you need to delete it or back it up."
     4205msgstr ""
     4206
     4207#: modules/one-click/modules/adstxt/class-detector.php:96
     4208#: modules/one-click/modules/adstxt/class-detector.php:97
    41904209msgid "Backup the File"
    41914210msgstr ""
    41924211
    4193 #: modules/one-click/modules/adstxt/class-detector.php:90
     4212#: modules/one-click/modules/adstxt/class-detector.php:96
    41944213msgid "Backing Up"
    41954214msgstr ""
    41964215
    4197 #: modules/one-click/modules/adstxt/class-detector.php:90
     4216#: modules/one-click/modules/adstxt/class-detector.php:96
    41984217msgid "Backed Up"
    41994218msgstr ""
     
    43694388
    43704389#. translators: %s link to privacy policy
    4371 #: views/admin/metabox-pubguru-connect.php:21
     4390#: views/admin/metabox-pubguru-connect.php:23
    43724391msgid "This form is designed exclusively for MonetizeMore customers who wish to integrate Advanced Ads with the PubGuru Dashboard. By selecting \"Connect PGHB,\" you agree to share your domain name to facilitate the connection with your PubGuru account, in alignment with our <a href=\"%s\">Privacy Policy</a>. Rest assured, no additional information is exchanged, and Advanced Ads does not engage in any tracking activities."
    43734392msgstr ""
    43744393
    4375 #: views/admin/metabox-pubguru-connect.php:30
     4394#: views/admin/metabox-pubguru-connect.php:32
    43764395msgid "Connect PGHB"
    43774396msgstr ""
    43784397
    4379 #: views/admin/metabox-pubguru-connect.php:42
     4398#: views/admin/metabox-pubguru-connect.php:43
    43804399msgid "To activate any of the settings with your PubGuru account, please select from the options below. Should you have any inquiries, feel free to <a href=\"https://www.monetizemore.com/contact/\">click here<a/> to reach out to us or send an email to <a href=\"mailto:[email protected]\">[email protected]</a>"
    43814400msgstr ""
    43824401
    4383 #: views/admin/metabox-pubguru-connect.php:52
     4402#: views/admin/metabox-pubguru-connect.php:53
    43844403msgid "Install PubGuru Header Bidding"
    43854404msgstr ""
    43864405
    4387 #: views/admin/metabox-pubguru-connect.php:62
     4406#: views/admin/metabox-pubguru-connect.php:63
     4407msgid "Move the PubGuru Header Bidding script to the footer. Keep this option disabled to maximize revenue. Only enable it if PageSpeed is your priority."
     4408msgstr ""
     4409
     4410#: views/admin/metabox-pubguru-connect.php:75
     4411msgid "Enable ads.txt settings from the <a href=\"https://app.pubguru.com/ads-txt\" target=\"_blank\">PubGuru platform</a>"
     4412msgstr ""
     4413
     4414#: views/admin/metabox-pubguru-connect.php:94
     4415msgid "Install Traffic Cop. 7 days free trial"
     4416msgstr ""
     4417
     4418#: views/admin/metabox-pubguru-connect.php:97
     4419msgid "Install Traffic Cop."
     4420msgstr ""
     4421
     4422#: views/admin/metabox-pubguru-connect.php:107
    43884423msgid "Activate Tag Conversion"
    43894424msgstr ""
    43904425
    4391 #: views/admin/metabox-pubguru-connect.php:74
    4392 msgid "Enable ads.txt settings from the <a href=\"https://app.pubguru.com/ads-txt\" target=\"_blank\">PubGuru platform</a>"
    4393 msgstr ""
    4394 
    4395 #: views/admin/metabox-pubguru-connect.php:93
    4396 msgid "Install Traffic Cop. 7 days free trial"
    4397 msgstr ""
    4398 
    4399 #: views/admin/metabox-pubguru-connect.php:96
    4400 msgid "Install Traffic Cop."
     4426#: views/admin/metabox-pubguru-connect.php:132
     4427msgid "Rollback"
     4428msgstr ""
     4429
     4430#: views/admin/metabox-pubguru-connect.php:133
     4431msgid "Rollback the api changes back to previous state."
    44014432msgstr ""
    44024433
  • advanced-ads/tags/1.54.0/lib/composer/autoload_classmap.php

    r3134243 r3145275  
    5555    'AdvancedAds\\BuildTools\\Values\\SemanticVersion' => $vendorDir . '/advanced-ads/build-tools/src/Values/SemanticVersion.php',
    5656    'AdvancedAds\\BuildTools\\Values\\Translation' => $vendorDir . '/advanced-ads/build-tools/src/Values/Translation.php',
     57    'AdvancedAds\\Constants' => $baseDir . '/includes/class-constants.php',
    5758    'AdvancedAds\\Entities' => $baseDir . '/includes/class-entities.php',
    5859    'AdvancedAds\\Groups\\Manager' => $baseDir . '/includes/groups/class-manager.php',
     
    6263    'AdvancedAds\\Groups\\Types\\Standard' => $baseDir . '/includes/groups/types/type-standard.php',
    6364    'AdvancedAds\\Groups\\Types\\Unknown' => $baseDir . '/includes/groups/types/type-unknown.php',
     65    'AdvancedAds\\Importers\\Api_Ads' => $baseDir . '/includes/importers/class-api-ads.php',
     66    'AdvancedAds\\Importers\\Importer' => $baseDir . '/includes/importers/abstract-importer.php',
     67    'AdvancedAds\\Importers\\Manager' => $baseDir . '/includes/importers/class-manager.php',
    6468    'AdvancedAds\\Installation\\Capabilities' => $baseDir . '/includes/installation/class-capabilities.php',
    6569    'AdvancedAds\\Installation\\Install' => $baseDir . '/includes/installation/class-install.php',
    6670    'AdvancedAds\\Installation\\Uninstall' => $baseDir . '/includes/installation/class-uninstall.php',
    6771    'AdvancedAds\\Interfaces\\Group_Type' => $baseDir . '/includes/interfaces/interface-group-type.php',
     72    'AdvancedAds\\Interfaces\\Importer' => $baseDir . '/includes/interfaces/interface-importer.php',
    6873    'AdvancedAds\\Interfaces\\Screen_Interface' => $baseDir . '/includes/interfaces/interface-screen.php',
    6974    'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => $baseDir . '/modules/one-click/admin/class-admin.php',
     
    7176    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => $baseDir . '/modules/one-click/modules/adstxt/class-adstxt.php',
    7277    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => $baseDir . '/modules/one-click/modules/adstxt/class-detector.php',
    73     'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => $baseDir . '/modules/one-click/modules/class-auto-ads.php',
    7478    'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => $baseDir . '/modules/one-click/modules/class-header-bidding.php',
    7579    'AdvancedAds\\Modules\\OneClick\\Helpers' => $baseDir . '/modules/one-click/class-helpers.php',
  • advanced-ads/tags/1.54.0/lib/composer/autoload_static.php

    r3134243 r3145275  
    8585        'AdvancedAds\\BuildTools\\Values\\SemanticVersion' => __DIR__ . '/..' . '/advanced-ads/build-tools/src/Values/SemanticVersion.php',
    8686        'AdvancedAds\\BuildTools\\Values\\Translation' => __DIR__ . '/..' . '/advanced-ads/build-tools/src/Values/Translation.php',
     87        'AdvancedAds\\Constants' => __DIR__ . '/../..' . '/includes/class-constants.php',
    8788        'AdvancedAds\\Entities' => __DIR__ . '/../..' . '/includes/class-entities.php',
    8889        'AdvancedAds\\Groups\\Manager' => __DIR__ . '/../..' . '/includes/groups/class-manager.php',
     
    9293        'AdvancedAds\\Groups\\Types\\Standard' => __DIR__ . '/../..' . '/includes/groups/types/type-standard.php',
    9394        'AdvancedAds\\Groups\\Types\\Unknown' => __DIR__ . '/../..' . '/includes/groups/types/type-unknown.php',
     95        'AdvancedAds\\Importers\\Api_Ads' => __DIR__ . '/../..' . '/includes/importers/class-api-ads.php',
     96        'AdvancedAds\\Importers\\Importer' => __DIR__ . '/../..' . '/includes/importers/abstract-importer.php',
     97        'AdvancedAds\\Importers\\Manager' => __DIR__ . '/../..' . '/includes/importers/class-manager.php',
    9498        'AdvancedAds\\Installation\\Capabilities' => __DIR__ . '/../..' . '/includes/installation/class-capabilities.php',
    9599        'AdvancedAds\\Installation\\Install' => __DIR__ . '/../..' . '/includes/installation/class-install.php',
    96100        'AdvancedAds\\Installation\\Uninstall' => __DIR__ . '/../..' . '/includes/installation/class-uninstall.php',
    97101        'AdvancedAds\\Interfaces\\Group_Type' => __DIR__ . '/../..' . '/includes/interfaces/interface-group-type.php',
     102        'AdvancedAds\\Interfaces\\Importer' => __DIR__ . '/../..' . '/includes/interfaces/interface-importer.php',
    98103        'AdvancedAds\\Interfaces\\Screen_Interface' => __DIR__ . '/../..' . '/includes/interfaces/interface-screen.php',
    99104        'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => __DIR__ . '/../..' . '/modules/one-click/admin/class-admin.php',
     
    101106        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-adstxt.php',
    102107        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-detector.php',
    103         'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => __DIR__ . '/../..' . '/modules/one-click/modules/class-auto-ads.php',
    104108        'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => __DIR__ . '/../..' . '/modules/one-click/modules/class-header-bidding.php',
    105109        'AdvancedAds\\Modules\\OneClick\\Helpers' => __DIR__ . '/../..' . '/modules/one-click/class-helpers.php',
  • advanced-ads/tags/1.54.0/modules/one-click/admin/class-admin.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick\Admin;
    1111
    12 use AdvancedAds\Assets_Registry;
    1312use AdvancedAds\Utilities\Conditional;
    1413use AdvancedAds\Modules\OneClick\Helpers;
     
    4443        }
    4544
    46         Assets_Registry::enqueue_style( 'app' );
    47         Assets_Registry::enqueue_script( 'app' );
     45        wp_advads()->registry->enqueue_style( 'app' );
     46        wp_advads()->registry->enqueue_script( 'app' );
    4847    }
    4948
     
    6362            'order' => 1000,
    6463            'link'  => '#',
     64            'icon'  => ADVADS_BASE_URL . 'assets/img/add-ons/aa-addons-icons-m2pg.svg',
    6565        ];
    6666
    6767        $addons['monetizemore-connect'] = $defaults + [
    68             'class'      => 'js-m2-show-consent',
    69             'link_title' => __( 'Connect now', 'advanced-ads' ),
     68            'class'        => 'js-pubguru-connect',
     69            'link_title'   => __( 'Connect now', 'advanced-ads' ),
     70            'link_icon'    => 'dashicons-plus',
     71            'link_primary' => true,
    7072        ];
    7173
     
    7375            'class'      => 'js-pubguru-disconnect',
    7476            'link_title' => __( 'Disconnect now', 'advanced-ads' ),
     77            'link_icon'  => 'dashicons-dismiss',
    7578        ];
    7679
    77         if ( $is_connected ) {
    78             $addons['monetizemore-connect']['class'] .= ' hidden';
    79         } else {
    80             $addons['monetizemore-disconnect']['class'] .= ' hidden';
    81         }
     80        $key = $is_connected ? 'monetizemore-connect' : 'monetizemore-disconnect';
     81
     82        $addons[ $key ]['class'] .= ' hidden';
    8283
    8384        return $addons;
     
    111112            </div>
    112113        </div>
     114        <div id="pubguru-notices"></div>
    113115
    114116        <?php
  • advanced-ads/tags/1.54.0/modules/one-click/admin/class-ajax.php

    r3041809 r3145275  
    1414use AdvancedAds\Modules\OneClick\Helpers;
    1515use AdvancedAds\Modules\OneClick\Options;
     16use AdvancedAds\Framework\Utilities\Params;
    1617use AdvancedAds\Modules\OneClick\AdsTxt\Detector;
    17 use AdvancedAds\Framework\Utilities\Params;
    1818use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1919
     
    7676        wp_send_json_success(
    7777            [
    78                 'message'       => esc_html__( 'Pubguru successfully connected.', 'advanced-ads' ),
     78                'message'       => esc_html__( 'We have successfully migrated your MonetizeMore Pubguru Ad Units to your WordPress site. The existing placements and ads have been paused.', 'advanced-ads' ),
    7979                'hasTrafficCop' => Helpers::has_traffic_cop( $config ),
    8080            ]
     
    107107        check_ajax_referer( 'pubguru_module_changed', 'security' );
    108108
    109         $module     = Params::post( 'module', [] );
    110         $status     = Params::post( 'status', false, FILTER_VALIDATE_BOOLEAN );
    111         $option_key = 'pubguru_module_' . $module;
     109        $module = Params::post( 'module', [] );
     110        $status = Params::post( 'status', false, FILTER_VALIDATE_BOOLEAN );
    112111
    113         update_option( $option_key, $status );
     112        Options::module( $module, $status );
    114113
    115         do_action( 'pubguru_module_status_changed', $module, $status );
     114        $data = apply_filters( 'pubguru_module_status_changed', [], $module, $status );
    116115
    117         $notice = '';
    118 
    119         if ( 'ads_txt' === $module && $status ) {
    120             $detector = new Detector();
    121             if ( $detector->detect_files() ) {
    122                 ob_start();
    123                 $detector->show_notice();
    124                 $notice = ob_get_clean();
    125             }
    126         }
    127 
    128         wp_send_json_success( [ 'notice' => $notice ] );
     116        wp_send_json_success( $data );
    129117    }
    130118
     
    137125        check_ajax_referer( 'pubguru_backup_adstxt', 'security' );
    138126
    139         ( new Detector() )->backup_file();
     127        $notice = '';
     128        $result = ( new Detector() )->backup_file();
     129        if ( false === $result ) {
     130            $notice = sprintf(
     131                '<div class="notice notice-error flex items-center p-4">%s</div>',
     132                esc_html__( 'An error has occurred please try again.', 'advanced-ads' )
     133            );
     134            wp_send_json_error( $notice );
     135        }
    140136
    141         wp_send_json_success();
     137        $notice = sprintf(
     138            '<div class="notice notice-success flex items-center p-4">%s</div>',
     139            esc_html__( 'File successfully backed up.', 'advanced-ads' )
     140        );
     141        wp_send_json_success( $notice );
    142142    }
    143143
  • advanced-ads/tags/1.54.0/modules/one-click/class-helpers.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Constants;
    1313use AdvancedAds\Utilities\WordPress;
     14use AdvancedAds\Framework\Utilities\Str;
    1415
    1516defined( 'ABSPATH' ) || exit;
     
    1920 */
    2021class Helpers {
    21 
    22     /**
    23      * Is module enabled.
    24      *
    25      * @param string $name name of module.
    26      *
    27      * @return bool
    28      */
    29     public static function is_module_enabled( $name ): bool {
    30         return boolval( get_option( "pubguru_module_{$name}" ) );
    31     }
    3222
    3323    /**
     
    9686
    9787        foreach ( $configs['configs'] as $config ) {
    98             if ( Str::str_contains( $needle, $config['name'] ) ) {
     88            if ( Str::contains( $needle, $config['name'] ) ) {
    9989                return $config['name'];
    10090            }
     
    112102        $ads = self::get_ads_from_config();
    113103
    114         if ( $ads && ! wp_next_scheduled( 'advanced-ads-pghb-auto-ad-creation' ) ) {
    115             wp_schedule_single_event( current_datetime()->getTimestamp() + MINUTE_IN_SECONDS, 'advanced-ads-pghb-auto-ad-creation' );
     104        if ( $ads && ! wp_next_scheduled( Constants::CRON_API_ADS_CREATION ) ) {
     105            wp_schedule_single_event( current_datetime()->getTimestamp() + 5, Constants::CRON_API_ADS_CREATION );
    116106        }
    117107    }
     
    140130                }
    141131            }
     132        } else {
     133            $domain             = WordPress::get_site_domain();
     134            $pubguru_config_ads = [
     135                $domain . '_leaderboard'  => [
     136                    'ad_unit'              => $domain . '_leaderboard',
     137                    'slot'                 => $domain . '_leaderboard',
     138                    'device'               => 'All',
     139                    'placement'            => 'Before Content',
     140                    'placement_conditions' => 'All',
     141                    'in_content_position'  => 'Before',
     142                    'in_content_count'     => 1,
     143                    'in_content_element'   => 'p',
     144                    'in_content_repeat'    => false,
     145                ],
     146                $domain . '_in_content_1' => [
     147                    'ad_unit'              => $domain . '_in_content_1',
     148                    'slot'                 => $domain . '_in_content_1',
     149                    'device'               => 'All',
     150                    'placement'            => 'Before Content',
     151                    'placement_conditions' => 'All',
     152                    'in_content_position'  => 'Before',
     153                    'in_content_count'     => 1,
     154                    'in_content_element'   => 'p',
     155                    'in_content_repeat'    => false,
     156                ],
     157                $domain . '_in_content_2' => [
     158                    'ad_unit'              => $domain . '_in_content_2',
     159                    'slot'                 => $domain . '_in_content_2',
     160                    'device'               => 'All',
     161                    'placement'            => 'After Content',
     162                    'placement_conditions' => 'All',
     163                    'in_content_position'  => 'Aefore',
     164                    'in_content_count'     => 3,
     165                    'in_content_element'   => 'p',
     166                    'in_content_repeat'    => true,
     167                ],
     168            ];
    142169        }
    143170
     
    155182        global $post;
    156183
     184        if ( ! $post ) {
     185            return false;
     186        }
     187
    157188        if ( ! $post_id ) {
    158189            $post_id = $post->ID;
  • advanced-ads/tags/1.54.0/modules/one-click/class-options.php

    r3041809 r3145275  
    3737        return update_option( self::CONFIG_KEY, $data );
    3838    }
     39
     40    /**
     41     * Read and Write pubguru module status
     42     *
     43     * @param string $module Module name.
     44     * @param bool   $status Module status.
     45     *
     46     * @return bool
     47     */
     48    public static function module( $module, $status = null ): bool {
     49        $option_key = 'pubguru_module_' . $module;
     50
     51        if ( null === $status ) {
     52            return boolval( get_option( $option_key, false ) );
     53        }
     54
     55        update_option( $option_key, $status );
     56
     57        return $status;
     58    }
    3959}
  • advanced-ads/tags/1.54.0/modules/one-click/modules/adstxt/class-adstxt.php

    r3041809 r3145275  
    1212use AdvancedAds\Utilities\WordPress;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
     14use AdvancedAds\Framework\Utilities\Params;
     15use AdvancedAds\Framework\Utilities\Str;
    1416
    1517defined( 'ABSPATH' ) || exit;
     
    2830        remove_action( 'advanced-ads-plugin-loaded', 'advanced_ads_ads_txt_init' );
    2931
    30         add_action( 'init', [ $this, 'add_rewrite_rules' ] );
    31         add_filter( 'query_vars', [ $this, 'add_query_vars' ] );
    3232        add_action( 'template_redirect', [ $this, 'handle_redirect' ] );
    3333        add_filter( 'allowed_redirect_hosts', [ $this, 'allowed_redirect_hosts' ] );
    34 
    35         if ( is_admin() ) {
    36             ( new Detector() )->hooks();
    37         }
    38     }
    39 
    40     /**
    41      * Add rewrite rules
    42      *
    43      * @return void
    44      */
    45     public function add_rewrite_rules(): void {
    46         global $wp_rewrite;
    47 
    48         if ( ! $wp_rewrite->using_permalinks() ) {
    49             return;
    50         }
    51 
    52         add_rewrite_rule( 'ads\.txt$', $wp_rewrite->index . '?adstxt=1', 'top' );
    53     }
    54 
    55     /**
    56      * Add query var
    57      *
    58      * @param array $vars Array to hold query variables.
    59      *
    60      * @return array
    61      */
    62     public function add_query_vars( $vars ): array {
    63         $vars[] = 'adstxt';
    64         return $vars;
    6534    }
    6635
     
    7140     */
    7241    public function handle_redirect(): void {
    73         if ( empty( get_query_var( 'adstxt' ) ) ) {
     42        if (
     43            'ads-txt' !== get_query_var( 'name' ) ||
     44            Str::contains( Params::server( 'REQUEST_URI' ), 'ads.txt' )
     45        ) {
    7446            return;
    7547        }
    7648
    77         $redirect = sprintf( 'https://adstxt.pubguru.net/%s/ads.txt', WordPress::get_site_domain() );
     49        $redirect = sprintf( 'https://adstxt.pubguru.net/pg/%s/ads.txt', WordPress::get_site_domain() );
    7850        wp_safe_redirect( $redirect, 301 );
    7951        exit;
  • advanced-ads/tags/1.54.0/modules/one-click/modules/adstxt/class-detector.php

    r3041809 r3145275  
    4040
    4141        if ( $this->detect_files() ) {
    42             add_action( 'pubguru_notices', [ $this, 'show_notice' ] );
     42            add_action( 'all_admin_notices', [ $this, 'show_notice' ] );
    4343        }
    4444    }
     
    4747     * Detect file exists
    4848     *
     49     * @param string $file file name.
     50     *
    4951     * @return bool
    5052     */
    51     public function detect_files(): bool {
     53    public function detect_files( $file = 'ads.txt' ): bool {
    5254        $wp_filesystem = $this->get_filesystem();
    5355        if ( null === $wp_filesystem ) {
     
    5557        }
    5658
    57         return $wp_filesystem->exists( ABSPATH . '/ads.txt' );
     59        return $wp_filesystem->exists( ABSPATH . '/' . $file );
    5860    }
    5961
     
    6466     */
    6567    public function backup_file(): bool {
    66         $wp_filesystem = $this->get_filesystem();
    67         if ( null === $wp_filesystem ) {
    68             return false;
    69         }
     68        $source      = ABSPATH . '/ads.txt';
     69        $destination = $source . '.bak';
     70        return $this->move_file( $source, $destination );
     71    }
    7072
    71         return $wp_filesystem->move( ABSPATH . '/ads.txt', ABSPATH . '/ads.txt.bak' );
     73    /**
     74     * Revert file
     75     *
     76     * @return bool
     77     */
     78    public function revert_file(): bool {
     79        $source      = ABSPATH . '/ads.txt.bak';
     80        $destination = ABSPATH . 'ads.txt';
     81        return $this->move_file( $source, $destination );
    7282    }
    7383
     
    7989    public function show_notice(): void {
    8090        ?>
    81         <div class="flex shadow-lg rounded">
    82             <div class="bg-red-600 p-3 rounded-l flex items-center">
    83                 <svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" class="fill-current text-white w-5" viewBox="0 0 32 32" aria-hidden="true"><path d="M2,16H2A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm23.15,7.75L8.25,6.85a12,12,0,0,1,16.9,16.9ZM8.24,25.16A12,12,0,0,1,6.84,8.27L23.73,25.16a12,12,0,0,1-15.49,0Z"></path><title>Error</title></svg>
     91        <div class="notice notice-error flex items-center p-4">
     92            <div>
     93                <strong><?php esc_html_e( 'File alert!', 'advanced-ads' ); ?></strong> <?php esc_html_e( 'Physical ads.txt found. In order to use PubGuru service you need to delete it or back it up.', 'advanced-ads' ); ?>
    8494            </div>
    8595
    86             <div class="p-3 bg-white rounded-r w-full flex justify-between items-center">
    87                 <div>
    88                     <span class="font-medium"><?php esc_html_e( 'File alert!', 'advanced-ads' ); ?></span> <?php esc_html_e( 'Physical ads.txt found. In order to use PubGuru service you need to delete it.', 'advanced-ads' ); ?>
    89                 </div>
    90                 <button class="js-btn-backup-adstxt px-3 py-2 rounded text-xs bg-blue-600 text-white hover:bg-blue-700" data-text="<?php esc_attr_e( 'Backup the File', 'advanced-ads' ); ?>" data-loading="<?php esc_attr_e( 'Backing Up', 'advanced-ads' ); ?>" data-done="<?php esc_attr_e( 'Backed Up', 'advanced-ads' ); ?>" data-security="<?php echo wp_create_nonce( 'pubguru_backup_adstxt' ); // phpcs:ignore ?>">
    91                     <?php esc_html_e( 'Backup the File', 'advanced-ads' ); ?>
    92                 </button>
    93             </div>
     96            <button class="!ml-auto button button-primary js-btn-backup-adstxt" data-text="<?php esc_attr_e( 'Backup the File', 'advanced-ads' ); ?>" data-loading="<?php esc_attr_e( 'Backing Up', 'advanced-ads' ); ?>" data-done="<?php esc_attr_e( 'Backed Up', 'advanced-ads' ); ?>" data-security="<?php echo wp_create_nonce( 'pubguru_backup_adstxt' ); // phpcs:ignore ?>">
     97                <?php esc_html_e( 'Backup the File', 'advanced-ads' ); ?>
     98            </button>
    9499        </div>
    95100        <?php
     
    101106     * @return object
    102107     */
    103     public function get_filesystem() {
     108    private function get_filesystem() {
    104109        global $wp_filesystem;
    105110
     
    111116        return $wp_filesystem;
    112117    }
     118
     119    /**
     120     * Handle file operations (backup or revert)
     121     *
     122     * @param string $source      Source file path.
     123     * @param string $destination Destination file path.
     124     *
     125     * @return bool
     126     */
     127    private function move_file( string $source, string $destination ): bool {
     128        $wp_filesystem = $this->get_filesystem();
     129
     130        if ( null === $wp_filesystem || ! $wp_filesystem->is_writable( $source ) ) {
     131            return false;
     132        }
     133
     134        return $wp_filesystem->move( $source, $destination );
     135    }
    113136}
  • advanced-ads/tags/1.54.0/modules/one-click/modules/class-header-bidding.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Framework\Utilities\Str;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1414
     
    1919 */
    2020class Header_Bidding implements Integration_Interface {
    21 
    22     /**
    23      * Check if has gpt
    24      *
    25      * @var bool
    26      */
    27     private $has_gpt = false;
    28 
    29     /**
    30      * Check if has pubguru tag
    31      *
    32      * @var bool
    33      */
    34     private $has_pubguru = false;
    35 
    36     /**
    37      * Check if has traffic cop atq
    38      *
    39      * @var bool
    40      */
    41     private $has_traffic_cop = false;
    4221
    4322    /**
     
    7251    public function remove_tags( $script ): string {
    7352
    74         if ( Str::str_contains( '/gpt.js', $script ) ) {
    75             $script        = '';
    76             $this->has_gpt = true;
     53        if ( Str::contains( '/gpt.js', $script ) ) {
     54            $script = '';
    7755        }
    7856
    79         if ( Str::str_contains( '//m2d.m2.ai/', $script ) || Str::str_contains( '//c.pubguru.net/', $script ) ) {
    80             $script            = '';
    81             $this->has_gpt     = true;
    82             $this->has_pubguru = true;
     57        if ( Str::contains( '//m2d.m2.ai/', $script ) || Str::contains( '//c.pubguru.net/', $script ) ) {
     58            $script = '';
    8359        }
    8460
    85         if ( Str::str_contains( 'window.pg.atq = window.pg.atq || [];', $script ) ) {
    86             $script                = '';
    87             $this->has_traffic_cop = true;
     61        if ( Str::contains( 'window.pg.atq = window.pg.atq || [];', $script ) ) {
     62            $script = '';
    8863        }
    8964
     
    9974     */
    10075    private function add_script_tag( $page ): string {
    101         $name = Helpers::get_config_file();
     76        $name    = Helpers::get_config_file();
     77        $at_body = Options::module( 'header_bidding_at_body' );
    10278
    10379        if ( $name ) {
    104             $script = [ '<head>' ];
    105 
    106             if ( $this->has_gpt ) {
    107                 $script[] = '<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" async></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
    108                 $script[] = '<script type="text/javascript">window.googletag=window.googletag||{};window.googletag.cmd=window.googletag.cmd||[];';
    109                 $script[] = 'window.googletag.cmd.push(function(){window.__onpageGptEmbed=(new Date()).getTime()})</script>';
     80            $script = [];
     81            if ( ! $at_body ) {
     82                $script[] = '<head>';
    11083            }
    11184
    112             if ( $this->has_pubguru ) {
    113                 $script[] = sprintf( '<script src="//c.pubguru.net/%s" async> </script>', $name ); // phpcs:ignore
    114             }
     85            $script[] = '<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" async></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
     86            $script[] = '<script type="text/javascript">window.googletag=window.googletag||{};window.googletag.cmd=window.googletag.cmd||[];';
     87            $script[] = 'window.googletag.cmd.push(function(){window.__onpageGptEmbed=(new Date()).getTime()})</script>';
     88            $script[] = sprintf( '<script src="//c.pubguru.net/%s" async> </script>', $name ); // phpcs:ignore
    11589
    116             if ( Helpers::is_module_enabled( 'traffic_cop' ) && Helpers::has_traffic_cop() && $this->has_traffic_cop ) {
     90            if ( Options::module( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
    11791                $script[] = '<script>window.pg = window.pg || {};window.pg.atq = window.pg.atq || [];</script>';
    11892            }
    11993
    120             $page = str_replace( '<head>', join( "\n", $script ), $page );
     94            if ( $at_body ) {
     95                $page = $page . join( "\n", $script );
     96            } else {
     97                $page = str_replace(
     98                    '<head>',
     99                    join( "\n", $script ),
     100                    $page
     101                );
     102            }
    121103        }
    122104
  • advanced-ads/tags/1.54.0/modules/one-click/modules/class-traffic-cop.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Framework\Utilities\Str;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1414
     
    3838    public function modify_script_tag( $content ) {
    3939        // Early bail!!
    40         if ( ! Str::str_contains( 'googletag.display', $content ) ) {
     40        if ( ! Str::contains( 'googletag.display', $content ) ) {
    4141            return false;
    4242        }
  • advanced-ads/tags/1.54.0/modules/one-click/modules/class-workflow.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
     12use AdvancedAds\Constants;
     13use AdvancedAds\Importers\Api_Ads;
    1214use AdvancedAds\Modules\OneClick\Helpers;
    1315use AdvancedAds\Modules\OneClick\Options;
     16use AdvancedAds\Framework\Utilities\Params;
     17use AdvancedAds\Modules\OneClick\Traffic_Cop;
     18use AdvancedAds\Modules\OneClick\AdsTxt\AdsTxt;
     19use AdvancedAds\Modules\OneClick\AdsTxt\Detector;
    1420use AdvancedAds\Framework\Interfaces\Integration_Interface;
    15 use AdvancedAds\Framework\Utilities\Params;
    16 use AdvancedAds\Modules\OneClick\AdsTxt\AdsTxt;
    17 use AdvancedAds\Modules\OneClick\Traffic_Cop;
    1821
    1922defined( 'ABSPATH' ) || exit;
     
    3841    public function hooks(): void {
    3942        add_action( 'init', [ $this, 'flush_rewrite_rules' ], 999 );
    40         add_action( 'pubguru_module_status_changed', [ $this, 'module_status_changed' ], 10, 1 );
    41         add_action( 'advanced-ads-pghb-auto-ad-creation', [ $this, 'auto_ad_creation' ], 10, 0 );
     43        add_filter( 'pubguru_module_status_changed', [ $this, 'module_status_changed' ], 10, 3 );
     44        add_action( Constants::CRON_API_ADS_CREATION, [ $this, 'auto_ad_creation' ], 10, 0 );
    4245
    4346        if ( false !== Options::pubguru_config() && ! is_admin() ) {
    4447            add_action( 'wp', [ $this, 'init' ] );
    4548
    46             if ( Helpers::is_module_enabled( 'ads_txt' ) ) {
     49            if ( Options::module( 'ads_txt' ) ) {
    4750                ( new AdsTxt() )->hooks();
    4851            }
     52        }
     53
     54        if ( Options::module( 'ads_txt' ) ) {
     55            if ( is_admin() ) {
     56                ( new Detector() )->hooks();
     57            }
     58            remove_action( 'advanced-ads-plugin-loaded', 'advanced_ads_ads_txt_init' );
    4959        }
    5060    }
     
    6474        Page_Parser::get_instance();
    6575
    66         if ( $is_debugging || Helpers::is_module_enabled( 'header_bidding' ) ) {
     76        if ( $is_debugging || Options::module( 'header_bidding' ) ) {
    6777            ( new Header_Bidding() )->hooks();
    6878        }
    6979
    70         if ( $is_debugging || Helpers::is_module_enabled( 'tag_conversion' ) ) {
     80        if ( $is_debugging || Options::module( 'tag_conversion' ) ) {
    7181            ( new Tags_Conversion() )->hooks();
    7282        }
    7383
    74         if ( Helpers::is_module_enabled( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
    75             if ( ! Helpers::is_module_enabled( 'header_bidding' ) ) {
     84        if ( Options::module( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
     85            if ( ! Options::module( 'header_bidding' ) ) {
    7686                ( new Header_Bidding() )->hooks();
    7787            }
     
    8494     * Handle module status change
    8595     *
     96     * @param array  $data   Data to send back to ajax request.
    8697     * @param string $module Module name.
     98     * @param bool   $status Module status.
    8799     *
    88      * @return void
     100     * @return array
    89101     */
    90     public function module_status_changed( $module ): void {
     102    public function module_status_changed( $data, $module, $status ): array {
    91103        if ( 'ads_txt' === $module ) {
     104            $detector = new Detector();
     105            if ( $status && $detector->detect_files() ) {
     106                ob_start();
     107                $detector->show_notice();
     108                $notice = ob_get_clean();
     109                if ( $notice ) {
     110                    $data['notice'] = $notice;
     111                }
     112            }
     113
     114            if ( ! $status && $detector->detect_files( 'ads.txt.bak' ) ) {
     115                $detector->revert_file();
     116            }
     117
    92118            update_option( self::FLUSH_KEY, 1 );
    93119        }
     120
     121        return $data;
    94122    }
    95123
     
    112140     */
    113141    public function auto_ad_creation(): void {
    114         $ads = Helpers::get_ads_from_config();
    115         // ( new Auto_Ads() )->run( $ads );
     142        ( new Api_Ads() )->import();
    116143    }
    117144}
  • advanced-ads/tags/1.54.0/packages/composer/LICENSE

    r3134733 r3145275  
     1
    12Copyright (c) Nils Adermann, Jordi Boggiano
    23
     
    1819OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    1920THE SOFTWARE.
     21
  • advanced-ads/tags/1.54.0/packages/composer/autoload_classmap.php

    r3134733 r3145275  
    2424    'AdvancedAds\\Assets_Registry' => $baseDir . '/includes/class-assets-registry.php',
    2525    'AdvancedAds\\Autoloader' => $baseDir . '/includes/class-autoloader.php',
     26    'AdvancedAds\\Constants' => $baseDir . '/includes/class-constants.php',
    2627    'AdvancedAds\\Entities' => $baseDir . '/includes/class-entities.php',
    2728    'AdvancedAds\\Framework\\Assets_Registry' => $vendorDir . '/advanced-ads/framework/src/class-assets-registry.php',
     
    5859    'AdvancedAds\\Groups\\Types\\Standard' => $baseDir . '/includes/groups/types/type-standard.php',
    5960    'AdvancedAds\\Groups\\Types\\Unknown' => $baseDir . '/includes/groups/types/type-unknown.php',
     61    'AdvancedAds\\Importers\\Api_Ads' => $baseDir . '/includes/importers/class-api-ads.php',
     62    'AdvancedAds\\Importers\\Importer' => $baseDir . '/includes/importers/abstract-importer.php',
     63    'AdvancedAds\\Importers\\Manager' => $baseDir . '/includes/importers/class-manager.php',
    6064    'AdvancedAds\\Installation\\Capabilities' => $baseDir . '/includes/installation/class-capabilities.php',
    6165    'AdvancedAds\\Installation\\Install' => $baseDir . '/includes/installation/class-install.php',
    6266    'AdvancedAds\\Installation\\Uninstall' => $baseDir . '/includes/installation/class-uninstall.php',
    6367    'AdvancedAds\\Interfaces\\Group_Type' => $baseDir . '/includes/interfaces/interface-group-type.php',
     68    'AdvancedAds\\Interfaces\\Importer' => $baseDir . '/includes/interfaces/interface-importer.php',
    6469    'AdvancedAds\\Interfaces\\Screen_Interface' => $baseDir . '/includes/interfaces/interface-screen.php',
    6570    'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => $baseDir . '/modules/one-click/admin/class-admin.php',
     
    6772    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => $baseDir . '/modules/one-click/modules/adstxt/class-adstxt.php',
    6873    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => $baseDir . '/modules/one-click/modules/adstxt/class-detector.php',
    69     'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => $baseDir . '/modules/one-click/modules/class-auto-ads.php',
    7074    'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => $baseDir . '/modules/one-click/modules/class-header-bidding.php',
    7175    'AdvancedAds\\Modules\\OneClick\\Helpers' => $baseDir . '/modules/one-click/class-helpers.php',
  • advanced-ads/tags/1.54.0/packages/composer/autoload_static.php

    r3134733 r3145275  
    5353        'AdvancedAds\\Assets_Registry' => __DIR__ . '/../..' . '/includes/class-assets-registry.php',
    5454        'AdvancedAds\\Autoloader' => __DIR__ . '/../..' . '/includes/class-autoloader.php',
     55        'AdvancedAds\\Constants' => __DIR__ . '/../..' . '/includes/class-constants.php',
    5556        'AdvancedAds\\Entities' => __DIR__ . '/../..' . '/includes/class-entities.php',
    5657        'AdvancedAds\\Framework\\Assets_Registry' => __DIR__ . '/..' . '/advanced-ads/framework/src/class-assets-registry.php',
     
    8788        'AdvancedAds\\Groups\\Types\\Standard' => __DIR__ . '/../..' . '/includes/groups/types/type-standard.php',
    8889        'AdvancedAds\\Groups\\Types\\Unknown' => __DIR__ . '/../..' . '/includes/groups/types/type-unknown.php',
     90        'AdvancedAds\\Importers\\Api_Ads' => __DIR__ . '/../..' . '/includes/importers/class-api-ads.php',
     91        'AdvancedAds\\Importers\\Importer' => __DIR__ . '/../..' . '/includes/importers/abstract-importer.php',
     92        'AdvancedAds\\Importers\\Manager' => __DIR__ . '/../..' . '/includes/importers/class-manager.php',
    8993        'AdvancedAds\\Installation\\Capabilities' => __DIR__ . '/../..' . '/includes/installation/class-capabilities.php',
    9094        'AdvancedAds\\Installation\\Install' => __DIR__ . '/../..' . '/includes/installation/class-install.php',
    9195        'AdvancedAds\\Installation\\Uninstall' => __DIR__ . '/../..' . '/includes/installation/class-uninstall.php',
    9296        'AdvancedAds\\Interfaces\\Group_Type' => __DIR__ . '/../..' . '/includes/interfaces/interface-group-type.php',
     97        'AdvancedAds\\Interfaces\\Importer' => __DIR__ . '/../..' . '/includes/interfaces/interface-importer.php',
    9398        'AdvancedAds\\Interfaces\\Screen_Interface' => __DIR__ . '/../..' . '/includes/interfaces/interface-screen.php',
    9499        'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => __DIR__ . '/../..' . '/modules/one-click/admin/class-admin.php',
     
    96101        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-adstxt.php',
    97102        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-detector.php',
    98         'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => __DIR__ . '/../..' . '/modules/one-click/modules/class-auto-ads.php',
    99103        'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => __DIR__ . '/../..' . '/modules/one-click/modules/class-header-bidding.php',
    100104        'AdvancedAds\\Modules\\OneClick\\Helpers' => __DIR__ . '/../..' . '/modules/one-click/class-helpers.php',
  • advanced-ads/tags/1.54.0/readme.txt

    r3134930 r3145275  
    11=== Advanced Ads – Ad Manager & AdSense ===
    22Contributors: webzunft, advancedads
    3 Tags: ads, adsense, amp, ads.txt, ad rotations, ad blocker, amazon, banner, click fraud protection, google ad manager, header code, lazy loading,
     3Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.0
    55Tested up to: 6.5
    66Requires PHP: 7.2
    7 Stable tag: 1.53.2
     7Stable tag: 1.54.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Manage and optimize all ad types. Support for Google AdSense Auto ads, Amazon, image banners, HTML, page builder, ad widget, ad rotations, ads.txt
     11The only complete toolkit for all ad types. Grow your revenue with AdSense, Amazon—or any affiliate network. Get pinpoint targeting and best support!
    1212
    1313== Description ==
     
    3131This is what our users are saying about Advanced Ads:
    3232
    33 > We use this plugin to deliver rotating ads on a community news site, and it’s great. We’ve delivered over a million ad impressions since we launched less than a year ago, using a combination of sidebar, top, sticky and in-content placements — both HTML5 and images. Advanced Ads makes it easy for our small team to deliver a good experience to our users and our advertisers.
     33> We use this plugin to deliver rotating ads on a community news site, and it’s great. We’ve delivered over a million ad impressions since we launched less than a year ago, using a combination of sidebar, top, sticky and in-content placements — both HTML5 ads and images. Advanced Ads makes it easy for our small team to deliver a good experience to our users and our advertisers.
    3434> <i>mytown304 on wp.org</i>
    3535
     
    3737
    3838= Premium Features =
    39 This plugin is the lite version of the Advanced Ads plugin that comes with all the features you will ever need to optimize your ads and increase your revenues, including performance tracking, advanced ad targeting, split tests, click fraud protection, lazy loading, background ads, popups and sticky ads, full AMP support, adblocker detection, the most comfortable Google Ad Manager integration, and tons more. [Click here to purchase the best premium WordPress ad management plugin now!](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-all-access)
     39This plugin is the lite version of the Advanced Ads plugin that comes with all the features you will ever need to optimize your ads and increase your revenues, including performance tracking, advanced ad targeting, split tests, click fraud protection, lazy loading, background ads, floating ads, popups and sticky ads, full AMP support, adblocker detection, the most comfortable Google Ad Manager integration, and tons more. [Click here to purchase the best premium WordPress ad management plugin now!](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-all-access)
    4040
    4141[Full Feature List](https://wpadvancedads.com/features/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
    4242
    43 = ad management =
     43= Ad Management =
    4444
    4545* create and display **unlimited** ad units
     
    4949* inject ads into posts and pages automatically without coding
    5050
    51 = ad types =
     51= Ad Types =
    5252
    5353Choose between different ad types that enable you to:
    5454
    55 * insert ads and banners from all ad and affiliate networks (e.g., [Google AdSense](https://wpadvancedads.com/adsense-ads/), [Amazon Affiliate Program](https://wpadvancedads.com/amazon-affiliate-program-wordpress/), BuySellAds, Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), Ezoic, media.net, [Booking.com](https://wpadvancedads.com/booking-com-ads-wordpress/), Tradedoubler, Awin, Getyourguide, The Moneytizer, Infolinks...)
     55* insert ads and banners from all ad and affiliate networks (e.g., [Google AdSense](https://wpadvancedads.com/adsense-ads/), [Amazon Affiliate Program Amazon Associates](https://wpadvancedads.com/amazon-affiliate-program-wordpress/), BuySellAds, Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), Ezoic, media.net, [Booking.com](https://wpadvancedads.com/booking-com-ads-wordpress/), Tradedoubler, Awin, GetYourGuide, The Moneytizer, Infolinks...)
    5656* dedicated support for all types of Google AdSense ads, including text and display ads, native ads (In-article, In-feed, Multiplex ads), Auto ads, and Auto ads for AMP
    5757* display images and image banners
    5858* create content-rich ads with the WordPress TinyMCE editor
    5959* insert contextual Amazon Native Shopping Ads
    60 * inject HTML, CSS, Javascript or PHP code
    61 * use shortcodes within ads (to also deliver advertisements from another ad plugin like Ad Inserter, AdRotate, Quick AdSense, Ads for WP, or the Google AdSense Plugin WP QUADS)
    62 
    63 = display ads for WordPress =
     60* inject HTML, CSS, Javascript, or PHP code
     61* use shortcodes within ads (to also deliver advertisements from another ad plugin like Ad Inserter, AdRotate, Quick AdSense, AdSanity, Ads for WP, or the Google AdSense plugin WP QUADS)
     62
     63= Display Ads for WordPress =
    6464
    6565* auto-inject ads via placements
    6666* use functions to display ads in template files
    67 * use shortcodes to place ads manually in post content
     67* use shortcodes to place ads manually
    6868* show ads in the sidebar and in widgets
    6969* disable all ads on specific pages
    70 * display multiple ads (ad grids)
    7170* display a customizable ad label, e.g., “Advertisements” above each banner ad
    72 
    73 = display conditions =
     71* display multiple ads in ad grids ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-5))
     72
     73= Display Conditions =
    7474
    7575Show ads based on content. [List of all display conditions](https://wpadvancedads.com/manual/display-conditions/)
     
    7979* archive pages by category, tags, taxonomies
    8080* special page types like 404, attachment and front page
    81 * posts and pages by contained keywords [(keyword targeting)](https://wpadvancedads.com/manual/ads-based-on-keywords/?utm_source=wporg&utm_medium=link&utm_campaign=features) or URL parameters, included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-1)
    8281* hide ads on secondary queries (e.g., posts in sidebars)
    8382* display or hide banners within the post feed
    8483* hide all ads from specific page types, e.g., 404 pages, feed
    8584* hide ads from bots and web crawlers
    86 
    87 = visitor conditions =
     85* posts and pages by contained keywords [(keyword targeting)](https://wpadvancedads.com/manual/ads-based-on-keywords/?utm_source=wporg&utm_medium=link&utm_campaign=features) or URL parameters, included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-1)
     86
     87= Visitor Conditions =
    8888
    8989Serve ads by conditions based on the visitor. [List of all visitor conditions](https://wpadvancedads.com/manual/visitor-conditions/)
     
    9292* display or hide a banner by role and for logged-in visitors
    9393* advanced visitor conditions: geolocation, previously visited URL (referrer), user capability, browser language, browser, and browser width included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-2)
     94* frequency capping ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-6))
    9495
    9596> **Fantastic plugin and outstanding support**
     
    9798> djsawyer on wp.org
    9899
    99 = ad injection | placements =
     100= Ad Injection | Placements =
    100101
    101102Placements to insert ads in pre-defined positions in your theme and content. [List of all placements](https://wpadvancedads.com/manual/placements/)
     
    107108* [Page peel banners](https://wpadvancedads.com/page-peel-ads/)
    108109* create [split tests and A/B testing](https://wpadvancedads.com/ab-testing-wordpress/)
    109 * many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
    110110* automatic insertion of any kind of footer and header code, not only advertising
    111111* use the [ad server](https://wpadvancedads.com/ad-server-wordpress/) placement to display ads on other sites
    112 
    113 = mobile devices =
     112* many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
     113
     114= Mobile Devices =
    114115
    115116* target ads to mobile devices, or tablets, or desktops
    116117* display responsive image ads
    117 * ads only for specific browser sizes using [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3)
    118 * insert ads on AMP pages with [AMP Ads](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-1)
     118* ads only for specific browser sizes [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3)
     119* insert ads on AMP pages [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-1)
    119120
    120121= Google AdSense =
     
    133134* easy Ad Health integration and Google AdSense violation checks
    134135* option to remove the Google AdSense background color
    135 * place Google AdSense In-feed ads using the also free [In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
    136 * assistant for exact sizes of responsive Google AdSense ads with the [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-2)
    137 * convert Google AdSense ads into AMP ads automatically with the [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-3)
    138136* ads.txt generated with the correct AdSense information automatically
    139137* works along with Google Site Kit or can replace it if you want to [control your ad placements](https://wpadvancedads.com/place-adsense-ad-unit-manually/)
     138* place Google AdSense In-feed ads [free In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
     139* assistant for exact sizes of responsive Google AdSense ads [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-2)
     140* convert Google AdSense ads into AMP ads automatically [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-3)
    140141
    141142https://vimeo.com/577120971
     
    145146> Your app is awesome, congratulations! Google Adsense suggests using your app on its official website, it’s incredible!
    146147
    147 = ads.txt =
     148= Affiliate Marketing =
     149
     150Easily integrate affiliate marketing with a comprehensive toolkit.
     151
     152* unlimited affiliate ads and banners
     153* text link support
     154* affiliate disclosure
     155* automatic affiliate ad insertion
     156* advanced targeting
     157* dedicated AAWP ad type (Amazon Affiliate WordPress Plugin)
     158* integrates with other affiliate plugins like Pretty Links, Thirsty Affiliates, Lasso, and many more
     159* support for all Amazon ad formats
     160* compatible with all affiliate networks
     161* link masking and link cloaking ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-7))
     162* affiliate ad tracking ([Tracking add-on](https://wpadvancedads.com/add-ons/tracking/?utm_source=wporg&utm_medium=link&utm_campaign=affiliate-tracking))
     163
     164
     165= Ads.txt =
    148166
    149167* generates an ads.txt with custom content
     
    156174* all add-ons include priority email support
    157175* [All Access](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – includes all available add-ons
    158 * [Advanced Ads Pro](https://wpadvancedads.com/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – powerful tools for ad optimizations: cache-busting, more placements, [lazy loading](https://wpadvancedads.com/lazy-load-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features), ad blocker module, [click fraud protection](https://wpadvancedads.com/manual/click-fraud-protection/?utm_source=wporg&utm_medium=link&utm_campaign=features), [geo targeting](https://wpadvancedads.com/add-ons/geo-targeting/?utm_source=wporg&utm_medium=link&utm_campaign=features), [parallax ads](https://wpadvancedads.com/parallax-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features) and many more
     176* [Advanced Ads Pro](https://wpadvancedads.com/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – powerful tools for ad optimizations: cache-busting, more placements, [lazy loading](https://wpadvancedads.com/lazy-load-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features), ad blocker module, ad refresh, [click fraud protection](https://wpadvancedads.com/manual/click-fraud-protection/?utm_source=wporg&utm_medium=link&utm_campaign=features), [geo targeting](https://wpadvancedads.com/add-ons/geo-targeting/?utm_source=wporg&utm_medium=link&utm_campaign=features), [parallax ads](https://wpadvancedads.com/parallax-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features) and many more
    159177* [Tracking](https://wpadvancedads.com/add-ons/tracking/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – track ad impressions and ad clicks with local methods or Google Analytics
    160178* [AMP Ads](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – make your ads compatible with AMP and convert Google AdSense ads automatically
     
    167185* [Full Feature List](https://wpadvancedads.com/features/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons)
    168186
    169 = ad blocker =
     187= Ad Blocker =
    170188
    171189* basic features to prevent ads from being removed by AdBlock and other ad blockers
    172190* prevent ad blockers from breaking sites where plugin scripts are running
    173 * ad blocking detection: show alternative content to ad block users with [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3) and improve the monetization of your website
     191* ad blocker detection: show alternative content to ad block users and improve the monetization of your website [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-4)
    174192
    175193Learn more on the [plugin homepage](https://wpadvancedads.com).
     
    188206- BuddyPress – [How to add ads on BuddyPress pages](https://wpadvancedads.com/ads-on-buddypress-pages/)
    189207- bbPress – [How to show ads on bbPress pages?](https://wpadvancedads.com/ads-in-bbpress/)
    190 - Cookie Consent, Borlabs Cookies, Complianz, GDPR Cookie Consent, and other content manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
     208- Cookie Consent, Borlabs Cookies, Complianz, GDPR Cookie Consent, and other privacy and consent manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
    191209- Elementor - [How to create and implement ads in Elementor](https://wpadvancedads.com/elementor-ads/)
    192210- GamiPress – [How to target ads on GamiPress websites](https://wpadvancedads.com/manual/gamipress-ads/)
    193211- Genesis – [Genesis Ads add-on](https://wpadvancedads.com/add-ons/genesis-ads/)
    194 - [IAB TCF 2.0 consent](https://wpadvancedads.com/manual/tcf-consent-wordpress/) – hide ads until users give their consent. Integrating with any CMP, Quantcast Choices, iubenda, Google Funding Choices, cookiebot, etc.
     212- [IAB TCF 2.0 consent](https://wpadvancedads.com/manual/tcf-consent-wordpress/) – hide ads until users give their consent. Integrating with any CMP, InMobi, iubenda, Google Funding Choices, cookiebot, etc.
    195213- LearnDash - [How to integrate ads into LearnDash](https://wpadvancedads.com/learndash-ads/)
    196214- MailPoet - [How to integrate Advanced Ads in MailPoet Newsletters](https://wpadvancedads.com/mailpoet-newsletters/)
     
    201219- WPBakery Page Builder – [Displaying Ads with WPBakery Page Builder](https://wpadvancedads.com/visual-composer-ads/)
    202220- WPML – [Showing different ads per language with WPML](https://wpadvancedads.com/translating-ads-wpml/)
     221- Youzify – [How to integrate ads in Youzify](https://wpadvancedads.com/how-to-integrate-ads-in-youzify/)
    203222
    204223== Installation ==
     
    241260* Ads not showing up? Take a look [here](https://wpadvancedads.com/manual/ads-not-showing-up).
    242261
    243 = What about my users’ privacy and GDPR? =
     262= What about my users’ privacy and GDPR compliance? =
    244263
    245264The plugin comes with Privacy settings that help you gather consent from users before showing ads to them. The feature works for any ads managed with the plugin, including AdSense Auto ads.
     
    257276= Which ad networks are supported? =
    258277
    259 Advanced Ads is compatible with all ad networks and banners from affiliate programs like AWin, Google AdSense, Chitika, Clickbank, Amazon, and also Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), media.net.
    260 
    261 You can also use it to insert additional ad network tags into header or footer of your site without coding.
    262 
    263 AdSense has even a dedicated ad type leveling the specific options this ad network provides.
     278Advanced Ads is compatible with all ad networks and banners from affiliate programs like Awin, Google AdSense, Chitika, Clickbank, CJ Affiliate, Amazon, ShareASale, Impact, Rakuten, Booking.com, GetYourGuide, media.net, and also Google Ad Manager (formerly Google DoubleClick for Publishers, DFP).
     279
     280You can also use it to insert additional ad network tags into your site's header or footer without coding to integrate header bidding.
     281Advanced Ads even provides a dedicated AdSense ad type to leverage this ad network's specific options.
    264282
    265283= PHP functions and shortcodes =
     
    284302`<?php the_ad_placement('header-left'); ?>`
    285303
    286 = Is there a revenue share? =
    287 
    288 There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way that you earn less than you would directly including the ad code in your template.
     304= Is there an ad revenue share? =
     305
     306There is no revenue sharing. Advanced Ads doesn’t alter your ad codes in a way that you earn less than you would directly including the ad code in your template. To implement revenue sharing between multiple authors, follow the instructions of [this tutorial](https://wpadvancedads.com/publisher-revenue-share/).
    289307
    290308= Can I place ads directly in my theme files? =
     
    339357== Changelog ==
    340358
    341 = 1.53.2 (August 13, 2024) =
    342 
    343 - Fix: ensure content from a group shows in all content placements
    344 
    345 = 1.53.1 (August 13, 2024) =
    346 
    347 - Fix: resolve issue with deleting data on uninstall
    348 - Fix: resolve JavaScript error when uninstall
    349 
    350 = 1.53.0 (August 6, 2024) =
    351 
    352 - Improvement: add quick & bulk edit for "disable" ads on post/pages
    353 - Fix: correct handling of conditions array when no conditions are set for an ad
    354 - Fix: add drafted ads to group statistics on the statistic page
     359= 1.54.0 (September 2, 2024) =
     360
     361- Improvement: enhance PubGuru one click integration
     362- Fix: prevent PHP warning when using ad debug
     363- Fix: readd drafted ads to group statistics on the statistic page
     364- Fix: resolve issue with ad blocker detection
  • advanced-ads/tags/1.54.0/views/admin/metabox-pubguru-connect.php

    r3041809 r3145275  
    77 */
    88
    9 if ( false === $pubguru_config ) : ?>
     9use AdvancedAds\Modules\OneClick\Options;
    1010
    11 <div class="pubguru-not-connected space-y-4">
     11$header_bidding = Options::module( 'header_bidding' );
     12?>
     13<div class="pubguru-not-connected space-y-4<?php echo false === $pubguru_config ? '' : ' hidden'; ?>">
    1214    <label for="m2-connect-consent" class="flex items-center w-full">
    1315        <span class="self-start">
     
    2830
    2931    <div class="flex items-center gap-x-4">
    30         <button class="button button-primary js-pubguru-connect" disabled type="button"><?php esc_html_e( 'Connect PGHB', 'advanced-ads' ); ?></button>
     32        <button class="button button-primary js-pubguru-connecting" disabled type="button"><?php esc_html_e( 'Connect PGHB', 'advanced-ads' ); ?></button>
    3133        <div class="lds-ripple aa-spinner"><div></div><div></div></div>
    3234    </div>
    3335</div>
    34 <?php endif; ?>
    3536
    3637<div class="pubguru-connected<?php echo false === $pubguru_config ? ' hidden' : ''; ?>">
     
    4748            <div>
    4849                <label for="pubguru-header-bidding" class="advads-ui-switch">
    49                     <input type="checkbox" name="header_bidding" id="pubguru-header-bidding" class="sr-only peer" <?php checked( boolval( get_option( 'pubguru_module_header_bidding', false ) ) ); ?>>
     50                    <input type="checkbox" name="header_bidding" id="pubguru-header-bidding" class="sr-only peer" <?php checked( $header_bidding ); ?>>
    5051                    <div></div>
    5152                    <span>
     
    5556            </div>
    5657
    57             <div>
    58                 <label for="pubguru-tag-conversion" class="advads-ui-switch">
    59                     <input type="checkbox" name="tag_conversion" id="pubguru-tag-conversion" <?php checked( boolval( get_option( 'pubguru_module_tag_conversion', false ) ) ); ?> />
     58            <div<?php echo $header_bidding ? ' style="margin-left: 20px;"' : ' style="display: none;"'; ?>>
     59                <label for="pubguru-header-bidding-at-body" class="advads-ui-switch">
     60                    <input type="checkbox" name="header_bidding_at_body" id="pubguru-header-bidding-at-body" class="sr-only peer" <?php checked( Options::module( 'header_bidding_at_body' ) ); ?>>
    6061                    <div></div>
    6162                    <span>
    62                         <?php esc_html_e( 'Activate Tag Conversion', 'advanced-ads' ); ?>
     63                        <?php esc_html_e( 'Move the PubGuru Header Bidding script to the footer. Keep this option disabled to maximize revenue. Only enable it if PageSpeed is your priority.', 'advanced-ads' ); ?>
    6364                    </span>
    6465                </label>
     
    6768            <div>
    6869                <label for="pubguru-adstxt" class="advads-ui-switch">
    69                     <input type="checkbox" name="ads_txt" id="pubguru-adstxt" <?php checked( boolval( get_option( 'pubguru_module_ads_txt', false ) ) ); ?> />
     70                    <input type="checkbox" name="ads_txt" id="pubguru-adstxt" <?php checked( Options::module( 'ads_txt' ) ); ?> />
    7071                    <div></div>
    7172                    <span>
     
    8687            </div>
    8788
    88             <div>
     89            <div class="hidden">
    8990                <label for="pubguru-traffic-cop" class="advads-ui-switch">
    90                     <input type="checkbox" name="traffic_cop" id="pubguru-traffic-cop" <?php checked( boolval( get_option( 'pubguru_module_traffic_cop', false ) ) ); ?> />
     91                    <input type="checkbox" name="traffic_cop" id="pubguru-traffic-cop" <?php checked( Options::module( 'traffic_cop' ) ); ?> />
    9192                    <div></div>
    9293                    <span class="pg-tc-trail <?php echo $has_traffic_cop ? 'hidden' : ''; ?>">
     
    99100            </div>
    100101
     102            <div class="hidden">
     103                <label for="pubguru-tag-conversion" class="advads-ui-switch">
     104                    <input type="checkbox" name="tag_conversion" id="pubguru-tag-conversion" <?php checked( Options::module( 'tag_conversion' ) ); ?> />
     105                    <div></div>
     106                    <span>
     107                        <?php esc_html_e( 'Activate Tag Conversion', 'advanced-ads' ); ?>
     108                    </span>
     109                </label>
     110            </div>
     111
    101112        </div>
    102113
     
    104115
    105116</div>
     117
     118<?php
     119$session_key = get_option( 'advanced-ads-importer-history' );
     120if ( $session_key ) :
     121    $delete_link = wp_nonce_url(
     122        add_query_arg(
     123            [
     124                'action'      => 'advads_import_delete',
     125                'session_key' => $session_key,
     126            ]
     127        ),
     128        'advads_import_delete'
     129    );
     130    ?>
     131<div class="rollback-block">
     132    <header><?php esc_html_e( 'Rollback', 'advanced-ads' ); ?></header>
     133    <a href="<?php echo esc_url( $delete_link ); ?>" class="button-link !text-red-500"><?php esc_html_e( 'Rollback the api changes back to previous state.', 'advanced-ads' ); ?></a>
     134</div>
     135<?php endif; ?>
  • advanced-ads/trunk/admin/assets/css/admin.css

    r3063392 r3145275  
    14351435    text-decoration: underline;
    14361436}
     1437
     1438.rollback-block header {
     1439    background-color: #f9f9f9;
     1440    border: solid #c3c4c7;
     1441    padding: 10px;
     1442    margin: 30px -12px 15px;
     1443    border-width: 1px 0;
     1444}
  • advanced-ads/trunk/admin/class-advanced-ads-admin.php

    r3134243 r3145275  
    22// phpcs:ignoreFile
    33
     4use AdvancedAds\Importers\Api_Ads;
     5use AdvancedAds\Utilities\WordPress;
    46use AdvancedAds\Utilities\Conditional;
    5 use AdvancedAds\Utilities\WordPress;
     7use AdvancedAds\Framework\Utilities\Params;
    68
    79/**
     
    106108        // update placements.
    107109        add_action( 'admin_init', [ 'Advanced_Ads_Placements', 'update_placements' ] );
     110        add_action( 'admin_init', [ $this, 'api_import_rollback' ] );
    108111
    109112        // add Advanced Ads admin notices
     
    483486        echo '</span>';
    484487    }
     488
     489    public function api_import_rollback() {
     490        if ( 'advads_import_delete' !== Params::get( 'action' ) ) {
     491            return;
     492        }
     493
     494        check_admin_referer( 'advads_import_delete' );
     495
     496        $session_key = Params::get( 'session_key' );
     497        $db_session  = get_option( 'advanced-ads-importer-history' );
     498
     499        if ( $session_key !== $db_session ) {
     500            add_action( 'all_admin_notices', [ $this, 'import_error' ] );
     501            return;
     502        }
     503
     504        ( new Api_Ads() )->rollback( $session_key);
     505        delete_option( 'advanced-ads-importer-history' );
     506        add_action( 'all_admin_notices', [ $this, 'import_success' ] );
     507    }
     508
     509    public function import_error() {
     510        ?>
     511        <div class="notice notice-error">
     512            <p><strong>Error:</strong> Session key not matched.</p>
     513        </div>
     514        <?php
     515    }
     516
     517    public function import_success() {
     518        ?>
     519        <div class="notice notice-success">
     520            <p><strong>Success:</strong> the rollback is completed.</p>
     521        </div>
     522        <?php
     523    }
    485524}
  • advanced-ads/trunk/admin/includes/class-meta-box.php

    r3134243 r3145275  
    22// phpcs:ignoreFile
    33
    4 use AdvancedAds\Assets_Registry;
    54use AdvancedAds\Entities;
    65use AdvancedAds\Utilities\WordPress;
     
    7069
    7170        if ( 'index.php' === $pagenow ) {
    72             Assets_Registry::enqueue_script( 'wp-widget-adsense' );
     71            wp_advads()->registry->enqueue_script( 'wp-widget-adsense' );
    7372        }
    7473    }
  • advanced-ads/trunk/advanced-ads.php

    r3134930 r3145275  
    44 *
    55 * @package   Advanced_Ads
    6  * @author    Advanced Ads GmbH <[email protected]>
     6 * @author    Advanced Ads <[email protected]>
    77 * @license   GPL-2.0+
    88 * @link      https://wpadvancedads.com
     
    1313 * Plugin URI:        https://wpadvancedads.com
    1414 * Description:       Manage and optimize your ads in WordPress
    15  * Version:           1.53.2
    16  * Author:            Advanced Ads GmbH
     15 * Version:           1.54.0
     16 * Author:            Advanced Ads
    1717 * Author URI:        https://wpadvancedads.com
    1818 * Text Domain:       advanced-ads
     
    3434
    3535define( 'ADVADS_FILE', __FILE__ );
    36 define( 'ADVADS_VERSION', '1.53.2' );
     36define( 'ADVADS_VERSION', '1.54.0' );
    3737
    3838// Load the autoloader.
  • advanced-ads/trunk/assets/css/app.css

    r3050336 r3145275  
    1 .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.\!mr-2{margin-right:.5rem!important}.\!mt-1{margin-top:.25rem!important}.mb-6{margin-bottom:1.5rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.items-center{align-items:center}.gap-x-4{column-gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.text-base{font-size:1rem;line-height:1.5rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.lds-ripple{display:none;height:40px;position:relative;width:40px}.lds-ripple.show{display:inline-block}.lds-ripple div{animation:lds-ripple 1s cubic-bezier(0,.2,.8,1) infinite;border:4px solid #ccc;border-radius:50%;opacity:1;position:absolute}.lds-ripple div:nth-child(2){animation-delay:-.5s}@keyframes lds-ripple{0%{height:0;left:20px;opacity:0;top:20px;width:0}4.9%{height:0;left:20px;opacity:0;top:20px;width:0}5%{height:0;left:20px;opacity:1;top:20px;width:0}to{height:40px;left:0;opacity:0;top:0;width:40px}}.advads-ui-switch{align-items:center;cursor:pointer;display:inline-flex;position:relative}.advads-ui-switch-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.25rem*var(--tw-space-y-reverse));margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)))}.advads-ui-switch input{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.advads-ui-switch input:checked~div{--tw-bg-opacity:1;background-color:rgb(4 116 162/var(--tw-bg-opacity))}.advads-ui-switch input:checked~div:after{--tw-translate-x:100%;--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.advads-ui-switch input:disabled~div:after{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));content:var(--tw-content)}.advads-ui-switch div{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));border-radius:9999px;height:1.5rem;width:2.75rem}.advads-ui-switch div:after{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-content:"";background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:9999px;border-width:1px;content:var(--tw-content);height:1.25rem;left:2px;position:absolute;top:.125rem;transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1.25rem}.advads-ui-switch span{font-size:.875rem;font-weight:500;line-height:1.25rem;margin-left:.75rem}#advads-m2-connect{display:none}#advads-m2-connect a{--tw-text-opacity:1;color:rgb(4 116 162/var(--tw-text-opacity))}
     1.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.\!mr-2{margin-right:.5rem!important}.\!mt-1{margin-top:.25rem!important}.mb-6{margin-bottom:1.5rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.items-center{align-items:center}.gap-x-4{column-gap:1rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.text-base{font-size:1rem;line-height:1.5rem}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.lds-ripple{display:none;height:40px;position:relative;width:40px}.lds-ripple.show{display:inline-block}.lds-ripple div{animation:lds-ripple 1s cubic-bezier(0,.2,.8,1) infinite;border:4px solid #ccc;border-radius:50%;opacity:1;position:absolute}.lds-ripple div:nth-child(2){animation-delay:-.5s}@keyframes lds-ripple{0%{height:0;left:20px;opacity:0;top:20px;width:0}4.9%{height:0;left:20px;opacity:0;top:20px;width:0}5%{height:0;left:20px;opacity:1;top:20px;width:0}to{height:40px;left:0;opacity:0;top:0;width:40px}}.advads-ui-switch{align-items:center;cursor:pointer;display:inline-flex;position:relative}.advads-ui-switch-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.25rem*var(--tw-space-y-reverse));margin-top:calc(1.25rem*(1 - var(--tw-space-y-reverse)))}.advads-ui-switch input{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.advads-ui-switch input:checked~div{--tw-bg-opacity:1;background-color:rgb(4 116 162/var(--tw-bg-opacity))}.advads-ui-switch input:checked~div:after{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content);left:auto;right:2px}.advads-ui-switch input:disabled~div:after{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));content:var(--tw-content)}.advads-ui-switch div{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity));border-radius:9999px;border-width:1px;height:1.5rem;position:relative;width:2.75rem}.advads-ui-switch div:after{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-content:"";background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:9999px;border-width:1px;content:var(--tw-content);height:1.25rem;left:2px;position:absolute;top:.125rem;transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1.25rem}.advads-ui-switch span{font-size:.875rem;font-weight:500;line-height:1.25rem;margin-left:.75rem}#advads-m2-connect{display:none}#advads-m2-connect a{--tw-text-opacity:1;color:rgb(4 116 162/var(--tw-text-opacity))}
  • advanced-ads/trunk/assets/js/app.js

    r3134243 r3145275  
    1 (()=>{"use strict";var t,e={570:(t,e,n)=>{const a=jQuery;var o=n.n(a);function s(){var t,e,n,a,s;t=o()(".js-pubguru-connect"),e=t.next(".aa-spinner"),n=o()("#advads-m2-connect"),o()(".js-m2-show-consent").on("click",".button",(function(t){t.preventDefault();var e=o()(this).closest("tr");n.show(),e.addClass("hidden"),e.next().removeClass("hidden")})),o()(".js-pubguru-disconnect").on("click",".button",(function(t){t.preventDefault();var e=o()(this).closest("tr");n.hide(),e.addClass("hidden"),e.prev().removeClass("hidden"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_disconnect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(t){if(t.success){var n=o()('<div class="notice notice-success" />');n.html("<p>"+t.data.message+"</p>"),e.closest(".postbox").after(n),setTimeout((function(){n.fadeOut(500,(function(){n.remove()}))}),3e3)}}))})),o()("#m2-connect-consent").on("change",(function(){var e=o()(this);t.prop("disabled",!e.is(":checked"))})),o()("#advads-overview").on("click",".notice-dismiss",(function(t){t.preventDefault();var e=o()(this).parent();e.fadeOut(500,(function(){e.remove()}))})),t.on("click",(function(n){n.preventDefault(),e.addClass("show"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_connect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(t){t.success&&(o()(".pubguru-not-connected").hide(),o()(".pubguru-connected").removeClass("hidden"),o()(".pg-tc-trail").toggle(!t.data.hasTrafficCop),o()(".pg-tc-install").toggle(t.data.hasTrafficCop))})).fail((function(e){var n=e.responseJSON,a=o()('<div class="notice notice-error is-dismissible" />');a.html("<p>"+n.data+'</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'),t.closest(".postbox").after(a)})).complete((function(){return e.removeClass("show")}))})),a=o()("#pubguru-modules"),s=o()("#pubguru-notices"),a.on("input","input:checkbox",(function(){var t=o()(this),e=t.attr("name"),n=t.is(":checked");o().ajax({url:a.attr("action"),method:"POST",data:{action:"pubguru_module_change",security:a.data("security"),module:e,status:n}}).done((function(t){var e=t.data.notice,n=void 0===e?"":e;s.html(""),""!==n&&s.html(n)}))})),s.on("click",".js-btn-backup-adstxt",(function(){var t=o()(this);t.prop("disabled",!0),t.html(t.data("loading")),o().ajax({url:a.attr("action"),method:"POST",data:{action:"pubguru_backup_ads_txt",security:t.data("security")}}).done((function(e){e.success?(t.html(t.data("done")),setTimeout((function(){s.fadeOut("slow",(function(){s.html("")}))}),4e3)):t.html(t.data("text"))})).fail((function(){t.html(t.data("text"))}))}))}o()((function(){s()}))},576:()=>{}},n={};function a(t){var o=n[t];if(void 0!==o)return o.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,a),s.exports}a.m=e,t=[],a.O=(e,n,o,s)=>{if(!n){var c=1/0;for(d=0;d<t.length;d++){for(var[n,o,s]=t[d],i=!0,r=0;r<n.length;r++)(!1&s||c>=s)&&Object.keys(a.O).every((t=>a.O[t](n[r])))?n.splice(r--,1):(i=!1,s<c&&(c=s));if(i){t.splice(d--,1);var u=o();void 0!==u&&(e=u)}}return e}s=s||0;for(var d=t.length;d>0&&t[d-1][2]>s;d--)t[d]=t[d-1];t[d]=[n,o,s]},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={845:0,196:0};a.O.j=e=>0===t[e];var e=(e,n)=>{var o,s,[c,i,r]=n,u=0;if(c.some((e=>0!==t[e]))){for(o in i)a.o(i,o)&&(a.m[o]=i[o]);if(r)var d=r(a)}for(e&&e(n);u<c.length;u++)s=c[u],a.o(t,s)&&t[s]&&t[s][0](),t[s]=0;return a.O(d)},n=globalThis.webpackChunkadvanced_ads=globalThis.webpackChunkadvanced_ads||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})(),a.O(void 0,[196],(()=>a(570)));var o=a.O(void 0,[196],(()=>a(576)));o=a.O(o)})();
     1(()=>{"use strict";var e,t={612:(e,t,a)=>{const n=jQuery;var o=a.n(n);function s(e,t){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=o()('<div class="notice notice-'.concat(t,' is-dismissible" />'));n.html("<p>"+e+'</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'),o()("#pubguru-notices").append(n),a&&setTimeout((function(){n.fadeOut(500,(function(){n.remove()}))}),3e3)}function c(){var e,t,a,n,c,i,u,d,r,l;e=o()(".js-pubguru-connect"),t=o()(".js-pubguru-disconnect"),a=o()("#advads-m2-connect"),n=o()(".js-pubguru-connecting"),c=n.next(".aa-spinner"),i=o()(".pubguru-connected"),u=o()(".pubguru-not-connected"),e.on("click",".button",(function(e){e.preventDefault(),a.show()})),o()("#m2-connect-consent").on("change",(function(){var e=o()(this);n.prop("disabled",!e.is(":checked"))})),n.on("click",(function(a){a.preventDefault(),c.addClass("show"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_connect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(a){a.success&&(u.addClass("hidden"),e.addClass("hidden"),i.removeClass("hidden"),t.removeClass("hidden"),o()(".pg-tc-trail").toggle(!a.data.hasTrafficCop),o()(".pg-tc-install").toggle(a.data.hasTrafficCop),s(a.data.message,"success",!0))})).fail((function(e){s(e.responseJSON.data,"error")})).complete((function(){return c.removeClass("show")}))})),t.on("click",".button",(function(n){n.preventDefault(),a.hide(),u.removeClass("hidden"),e.removeClass("hidden"),i.addClass("hidden"),t.addClass("hidden"),o().ajax({type:"POST",url:ajaxurl,data:{action:"pubguru_disconnect",nonce:advadsglobal.ajax_nonce},dataType:"json"}).done((function(e){e.success&&s(e.data.message,"success",!0)}))})),d=o()("#pubguru-modules"),r=o()("#pubguru-notices"),l=o()("#pubguru-header-bidding-at-body").closest("div"),d.on("input","input:checkbox",(function(){var e=o()(this),t=e.attr("name"),a=e.is(":checked");"header_bidding"===t&&l.toggle(a),o().ajax({url:d.attr("action"),method:"POST",data:{action:"pubguru_module_change",security:d.data("security"),module:t,status:a}}).done((function(e){var t=e.data.notice,a=void 0===t?"":t;r.html(""),""!==a&&r.html(a)}))})),o()(document).on("click",".js-btn-backup-adstxt",(function(){var e=o()(this),t=e.closest(".notice");e.prop("disabled",!0),e.html(e.data("loading")),o().ajax({url:d.attr("action"),method:"POST",data:{action:"pubguru_backup_ads_txt",security:e.data("security")}}).always((function(){e.prop("disabled",!1),e.html(e.data("text"))})).done((function(e){if(e.success){var a=o()(e.data);r.html(a),t.after(a),t.remove(),setTimeout((function(){a.fadeOut("slow",(function(){a.html("")}))}),4e3)}else r.html(e.data),t.after(e.data)}))})),o()("#advads-overview").on("click",".notice-dismiss",(function(e){e.preventDefault();var t=o()(this).parent();t.fadeOut(500,(function(){t.remove()}))}))}o()((function(){c()}))},576:()=>{}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var s=a[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.m=t,e=[],n.O=(t,a,o,s)=>{if(!a){var c=1/0;for(r=0;r<e.length;r++){for(var[a,o,s]=e[r],i=!0,u=0;u<a.length;u++)(!1&s||c>=s)&&Object.keys(n.O).every((e=>n.O[e](a[u])))?a.splice(u--,1):(i=!1,s<c&&(c=s));if(i){e.splice(r--,1);var d=o();void 0!==d&&(t=d)}}return t}s=s||0;for(var r=e.length;r>0&&e[r-1][2]>s;r--)e[r]=e[r-1];e[r]=[a,o,s]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={845:0,196:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,s,[c,i,u]=a,d=0;if(c.some((t=>0!==e[t]))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(u)var r=u(n)}for(t&&t(a);d<c.length;d++)s=c[d],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(r)},a=globalThis.webpackChunkadvanced_ads=globalThis.webpackChunkadvanced_ads||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),n.O(void 0,[196],(()=>n(612)));var o=n.O(void 0,[196],(()=>n(576)));o=n.O(o)})();
  • advanced-ads/trunk/assets/scss/ui/_switch.scss

    r3041809 r3145275  
    1010
    1111        &:checked ~ div {
    12             @apply after:translate-x-full after:border-white bg-primary;
     12            @apply bg-primary after:left-auto after:right-[2px] after:border-white;
    1313        }
    1414
     
    1919
    2020    div {
    21         @apply w-11 h-6 bg-gray-200 rounded-full;
     21        @apply relative w-11 h-6 bg-gray-200 rounded-full border;
    2222
    2323        &::after {
  • advanced-ads/trunk/assets/src/modules/oneclick/connect-button.js

    r3041809 r3145275  
    11import jQuery from 'jquery';
    22
     3function createNotice(message, type, fadeAway = false) {
     4    const notice = jQuery(
     5        `<div class="notice notice-${type} is-dismissible" />`
     6    );
     7    notice.html(
     8        '<p>' +
     9            message +
     10            '</p>' +
     11            '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'
     12    );
     13
     14    jQuery('#pubguru-notices').append(notice);
     15
     16    if (fadeAway) {
     17        setTimeout(() => {
     18            notice.fadeOut(500, () => {
     19                notice.remove();
     20            });
     21        }, 3000);
     22    }
     23}
     24
    325export default function () {
    4     const pubguruConnectButton = jQuery('.js-pubguru-connect');
    5     const spinner = pubguruConnectButton.next('.aa-spinner');
     26    const connectWrap = jQuery('.js-pubguru-connect');
     27    const disconnectWrap = jQuery('.js-pubguru-disconnect');
    628    const metabox = jQuery('#advads-m2-connect');
     29    const connectButton = jQuery('.js-pubguru-connecting');
     30    const spinner = connectButton.next('.aa-spinner');
     31    const contentConnected = jQuery('.pubguru-connected');
     32    const contentNotConnected = jQuery('.pubguru-not-connected');
    733
    8     jQuery('.js-m2-show-consent').on('click', '.button', function (event) {
     34    // Show consent box.
     35    connectWrap.on('click', '.button', function (event) {
    936        event.preventDefault();
    10 
    11         const tr = jQuery(this).closest('tr');
    12 
    1337        metabox.show();
    14         tr.addClass('hidden');
    15         tr.next().removeClass('hidden');
    16     });
    17 
    18     jQuery('.js-pubguru-disconnect').on('click', '.button', function (event) {
    19         event.preventDefault();
    20 
    21         const tr = jQuery(this).closest('tr');
    22 
    23         metabox.hide();
    24         tr.addClass('hidden');
    25         tr.prev().removeClass('hidden');
    26 
    27         jQuery
    28             .ajax({
    29                 type: 'POST',
    30                 url: ajaxurl,
    31                 data: {
    32                     action: 'pubguru_disconnect',
    33                     nonce: advadsglobal.ajax_nonce,
    34                 },
    35                 dataType: 'json',
    36             })
    37             .done(function (response) {
    38                 if (!response.success) {
    39                     return;
    40                 }
    41 
    42                 const notice = jQuery('<div class="notice notice-success" />');
    43                 notice.html('<p>' + response.data.message + '</p>');
    44 
    45                 tr.closest('.postbox').after(notice);
    46                 setTimeout(function () {
    47                     notice.fadeOut(500, function () {
    48                         notice.remove();
    49                     });
    50                 }, 3000);
    51             });
    5238    });
    5339
    5440    jQuery('#m2-connect-consent').on('change', function () {
    5541        const checkbox = jQuery(this);
    56         pubguruConnectButton.prop('disabled', !checkbox.is(':checked'));
     42        connectButton.prop('disabled', !checkbox.is(':checked'));
    5743    });
    5844
    59     jQuery('#advads-overview').on('click', '.notice-dismiss', function (event) {
    60         event.preventDefault();
    61         const button = jQuery(this);
    62         const notice = button.parent();
    63         notice.fadeOut(500, function () {
    64             notice.remove();
    65         });
    66     });
    67 
    68     pubguruConnectButton.on('click', function (event) {
     45    connectButton.on('click', function (event) {
    6946        event.preventDefault();
    7047
     
    8562                }
    8663
    87                 jQuery('.pubguru-not-connected').hide();
    88                 jQuery('.pubguru-connected').removeClass('hidden');
     64                contentNotConnected.addClass('hidden');
     65                connectWrap.addClass('hidden');
     66                contentConnected.removeClass('hidden');
     67                disconnectWrap.removeClass('hidden');
    8968
    9069                jQuery('.pg-tc-trail').toggle(!response.data.hasTrafficCop);
    9170                jQuery('.pg-tc-install').toggle(response.data.hasTrafficCop);
     71                createNotice(response.data.message, 'success');
    9272            })
    9373            .fail(function (jqXHR) {
    9474                const response = jqXHR.responseJSON;
    95                 const notice = jQuery(
    96                     '<div class="notice notice-error is-dismissible" />'
    97                 );
    98                 notice.html(
    99                     '<p>' +
    100                         response.data +
    101                         '</p>' +
    102                         '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>'
    103                 );
    104 
    105                 pubguruConnectButton.closest('.postbox').after(notice);
     75                createNotice(response.data, 'error');
    10676            })
    10777            .complete(() => spinner.removeClass('show'));
    10878    });
     79
     80    disconnectWrap.on('click', '.button', function (event) {
     81        event.preventDefault();
     82
     83        metabox.hide();
     84        contentNotConnected.removeClass('hidden');
     85        connectWrap.removeClass('hidden');
     86        contentConnected.addClass('hidden');
     87        disconnectWrap.addClass('hidden');
     88
     89        jQuery
     90            .ajax({
     91                type: 'POST',
     92                url: ajaxurl,
     93                data: {
     94                    action: 'pubguru_disconnect',
     95                    nonce: advadsglobal.ajax_nonce,
     96                },
     97                dataType: 'json',
     98            })
     99            .done(function (response) {
     100                if (!response.success) {
     101                    return;
     102                }
     103
     104                createNotice(response.data.message, 'success', true);
     105            });
     106    });
    109107}
  • advanced-ads/trunk/assets/src/modules/oneclick/index.js

    r3041809 r3145275  
     1import jQuery from 'jquery';
     2
    13import connectButton from './connect-button';
    2 import settingsUi from './settings';
     4import connectSettings from './connect-settings';
    35
    46export default function () {
    57    connectButton();
    6     settingsUi();
     8    connectSettings();
     9
     10    jQuery('#advads-overview').on('click', '.notice-dismiss', function (event) {
     11        event.preventDefault();
     12        const button = jQuery(this);
     13        const notice = button.parent();
     14        notice.fadeOut(500, function () {
     15            notice.remove();
     16        });
     17    });
    718}
  • advanced-ads/trunk/classes/ad-debug.php

    r2983598 r3145275  
    247247            $content = '';
    248248            foreach ( $_condition as $_k => $_v ) {
    249                 $content .= esc_html( $_k ) . ': ' . esc_html( $_v ) . '<br>';
     249                $content .= esc_html( $_k ) . ': ';
     250                if ( is_array( $_v ) ) {
     251                    $content .= esc_html( implode( ', ', $_v ) );
     252                } else {
     253                    $content .= esc_html( $_v );
     254                }
     255                $content .= '<br />';
    250256            }
    251257
  • advanced-ads/trunk/classes/ad_group.php

    r3134930 r3145275  
    376376            'orderby'        => 'id', // Might want to avoid sorting as not needed for most calls and fast in PHP; slight I/O blocking concern.
    377377        ];
     378
     379        if ( ! empty( $this->ad_args['post_status'] ) ) {
     380            $args['post_status'] = array_unique( array_merge( (array) $args['post_status'], (array) $this->ad_args['post_status'] ) );
     381        }
    378382
    379383        $ads = new WP_Query( $args );
  • advanced-ads/trunk/classes/frontend_checks.php

    r3108573 r3145275  
    22// phpcs:ignoreFile
    33
    4 use AdvancedAds\Assets_Registry;
    54use AdvancedAds\Utilities\WordPress;
    65
     
    5352
    5453        if( $this->has_adblocker_placements() ) {
    55             if ( ! Assets_Registry::script_is('find-adblocker', 'enqueued') ) {
    56                 Assets_Registry::enqueue_script('find-adblocker');
     54            if ( ! wp_advads()->registry->is_script('find-adblocker', 'enqueued') ) {
     55                wp_advads()->registry->enqueue_script('find-adblocker');
    5756            }
    5857        }
  • advanced-ads/trunk/classes/in-content-injector.php

    r2983598 r3145275  
    1 <?php
     1<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
    22
    33use AdvancedAds\Utilities\WordPress;
     
    8080        }
    8181
    82         // handle tags that are empty by definition or could be empty ("custom" option)
     82        // Handle tags that are empty by definition or could be empty ("custom" option).
    8383        if ( in_array( $tag_option, [ 'img', 'iframe', 'custom' ], true ) ) {
    8484            $defaults['allowEmpty'] = true;
     
    116116        switch ( $tag_option ) {
    117117            case 'p':
    118                 // exclude paragraphs within blockquote tags
     118                // Exclude paragraphs within blockquote tags.
    119119                $tag = 'p[not(parent::blockquote)]';
    120120                break;
    121121            case 'pwithoutimg':
    122                 // convert option name into correct path, exclude paragraphs within blockquote tags
     122                // Convert option name into correct path, exclude paragraphs within blockquote tags.
    123123                $tag = 'p[not(descendant::img) and not(parent::blockquote)]';
    124124                break;
     
    133133                        contains(concat(' ', normalize-space(@class), ' '), ' gallery-size') or
    134134                        contains(concat(' ', normalize-space(@class), ' '), ' wp-caption ') )";
    135                 $tag = "*[self::img or self::figure or self::div[$shortcodes]]
     135                $tag        = "*[self::img or self::figure or self::div[$shortcodes]]
    136136                    [not(ancestor::table or ancestor::figure or ancestor::div[$shortcodes])]";
    137137                break;
    138             // any headline. By default h2, h3, and h4
     138            // Any headline. By default h2, h3, and h4.
    139139            case 'headlines':
    140140                $headlines = apply_filters( 'advanced-ads-headlines-for-ad-injection', [ 'h2', 'h3', 'h4' ] );
     
    145145                $tag = '*[' . implode( ' or ', $headlines ) . ']'; // /html/body/*[self::h2 or self::h3 or self::h4]
    146146                break;
    147             // any HTML element that makes sense in the content
     147            // Any HTML element that makes sense in the content.
    148148            case 'anyelement':
    149149                $exclude = [
     
    186186                break;
    187187            case 'custom':
    188                 // get the path for the "custom" tag choice, use p as a fallback to prevent it from showing any ads if users left it empty
     188                // Get the path for the "custom" tag choice, use p as a fallback to prevent it from showing any ads if users left it empty.
    189189                $tag = ! empty( $placement_opts['xpath'] ) ? stripslashes( $placement_opts['xpath'] ) : 'p';
    190190                break;
     
    194194        $xpath = new DOMXPath( $dom );
    195195
    196 
    197         if ( $options['itemLimit'] !== -1 ) {
     196        if ( -1 !== $options['itemLimit'] ) {
    198197            $items = $xpath->query( '/html/body/' . $tag );
    199198
     
    254253                    }
    255254
    256                     // make sure that the ad is injected outside the link
     255                    // Make sure that the ad is injected outside the link.
    257256                    if ( 'img' === $tag_option && 'a' === $node->parentNode->tagName ) {
    258257                        if ( $options['before'] ) {
    259258                            $node->parentNode;
    260259                        } else {
    261                             // go one level deeper if inserted after to not insert the ad into the link; probably after the paragraph
     260                            // Go one level deeper if inserted after to not insert the ad into the link; probably after the paragraph.
    262261                            $node->parentNode->parentNode;
    263262                        }
     
    274273                $ad_content = self::filter_ad_content( $ad_content, $node->tagName, $options );
    275274
    276                 // convert HTML to XML!
    277                 $ad_dom = new DOMDocument( '1.0', $wp_charset );
     275                // Convert HTML to XML!.
     276                $ad_dom                     = new DOMDocument( '1.0', $wp_charset );
    278277                $libxml_use_internal_errors = libxml_use_internal_errors( true );
    279278                $ad_dom->loadHtml( '<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wp_charset . '" /><body>' . $ad_content );
     
    314313                            }
    315314                        } else {
    316                             // append to body; -TODO using here that we only select direct children of the body tag.
     315                            // Append to body; -TODO using here that we only select direct children of the body tag.
    317316                            foreach ( $ad_dom->getElementsByTagName( 'body' )->item( 0 )->childNodes as $importedNode ) {
    318317                                $importedNode = $dom->importNode( $importedNode, true );
     
    341340             * * but there are enough elements on the site, but just in sub-containers
    342341             */
    343         } elseif ( WordPress::user_can( 'advanced_ads_manage_options' )
    344                 && $options['itemLimit'] !== -1
    345                 && empty( $plugin_options['content-injection-level-disabled'] ) ) {
     342        } elseif (
     343            WordPress::user_can( 'advanced_ads_manage_options' ) &&
     344            -1 !== $options['itemLimit'] &&
     345            empty( $plugin_options['content-injection-level-disabled'] )
     346        ) {
    346347
    347348            // Check if there are more elements without limitation.
     
    363364
    364365        // phpcs:enable
    365 
    366366        return $content;
    367367    }
     
    473473        // Add tags before/after which ad placehoders were injected.
    474474        foreach ( $ads_for_placeholders as $ad_content ) {
    475             $tag = $ad_content['tag'];
     475            $alts = [];
     476            $tag  = $ad_content['tag'];
    476477
    477478            switch ( $ad_content['position'] ) {
     
    492493            }
    493494        }
     495
    494496        $alts       = array_unique( $alts );
    495497        $tag_regexp = implode( '|', $alts );
     
    527529                }
    528530            } else {
    529                 $count ++;
     531                ++$count;
    530532            }
    531533        }
     
    749751        return '//*[' . implode( ' or ', $query ) . ']';
    750752    }
    751 
    752753}
  • advanced-ads/trunk/classes/plugin.php

    r3134733 r3145275  
    9090     */
    9191    public function wp_plugins_loaded() {
    92         // Load plugin text domain.
    93         $this->load_plugin_textdomain();
    94 
    9592        // Load public-facing style sheet and JavaScript.
    9693        add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
     
    267264
    268265    /**
    269      * Load the plugin text domain for translation.
    270      */
    271     public function load_plugin_textdomain() {
    272         load_plugin_textdomain( 'advanced-ads', false, ADVADS_BASE_DIR . '/languages' );
    273     }
    274 
    275     /**
    276266     * Shortcode to include ad in frontend
    277267     *
  • advanced-ads/trunk/includes/admin/class-assets.php

    r3134243 r3145275  
    1010namespace AdvancedAds\Admin;
    1111
     12use AdvancedAds\Entities;
    1213use Advanced_Ads_AdSense_Admin;
    1314use Advanced_Ads_Display_Conditions;
    14 use AdvancedAds\Assets_Registry;
    15 use AdvancedAds\Entities;
    16 use AdvancedAds\Utilities\Data;
    1715use AdvancedAds\Utilities\Conditional;
    1816use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    4341        $screen = get_current_screen();
    4442
    45         Assets_Registry::enqueue_style( 'ui' );
    46         Assets_Registry::enqueue_style( 'admin' );
     43        wp_advads()->registry->enqueue_style( 'ui' );
     44        wp_advads()->registry->enqueue_style( 'admin' );
    4745
    4846        if ( 'post' === $screen->base && Entities::POST_TYPE_AD === $screen->post_type ) {
    49             Assets_Registry::enqueue_style( 'ad-positioning' );
     47            wp_advads()->registry->enqueue_style( 'ad-positioning' );
    5048        }
    5149    }
     
    6361
    6462        // TODO: add conditional loading.
    65         Assets_Registry::enqueue_script( 'admin-global' );
    66         Assets_Registry::enqueue_script( 'find-adblocker' );
     63        wp_advads()->registry->enqueue_script( 'admin-global' );
     64        wp_advads()->registry->enqueue_script( 'find-adblocker' );
    6765
    6866        $params = [
     
    7775
    7876        if ( Conditional::is_screen_advanced_ads() ) {
    79             Assets_Registry::enqueue_script( 'admin' );
    80             Assets_Registry::enqueue_script( 'conditions' );
    81             Assets_Registry::enqueue_script( 'wizard' );
     77            wp_advads()->registry->enqueue_script( 'admin' );
     78            wp_advads()->registry->enqueue_script( 'conditions' );
     79            wp_advads()->registry->enqueue_script( 'wizard' );
    8280
    8381            $translation_array = [
     
    118116        // Ad edit screen.
    119117        if ( 'post' === $screen->base && Entities::POST_TYPE_AD === $screen->post_type ) {
    120             Assets_Registry::enqueue_script( 'ad-positioning' );
     118            wp_advads()->registry->enqueue_script( 'ad-positioning' );
    121119        }
    122120
    123121        if ( in_array( $screen->id, [ 'edit-post', 'edit-page' ], true ) && current_user_can( 'edit_posts' ) ) {
    124             Assets_Registry::enqueue_script( 'page-quick-edit' );
     122            wp_advads()->registry->enqueue_script( 'page-quick-edit' );
    125123            wp_advads()->json->add( 'page_quick_edit', [ 'nonce' => wp_create_nonce( 'advads-post-quick-edit' ) ] );
    126124        }
  • advanced-ads/trunk/includes/class-assets-registry.php

    r3134243 r3145275  
    1010namespace AdvancedAds;
    1111
    12 use AdvancedAds\Framework\Interfaces\Integration_Interface;
    13 
    1412defined( 'ABSPATH' ) || exit;
    1513
     
    1715 * Assets Registry.
    1816 */
    19 class Assets_Registry implements Integration_Interface {
     17class Assets_Registry extends \AdvancedAds\Framework\Assets_Registry {
    2018
    2119    /**
    22      * Enqueue stylesheet
     20     * Version for plugin local assets.
    2321     *
    24      * @param string $handle Name of the stylesheet.
    25      *
    26      * @return void
     22     * @return string
    2723     */
    28     public static function enqueue_style( $handle ): void {
    29         wp_enqueue_style( self::prefix_it( $handle ) );
     24    public function get_version(): string {
     25        return ADVADS_VERSION;
    3026    }
    3127
    3228    /**
    33      * Enqueue script
     29     * Prefix to use in handle to make it unique.
    3430     *
    35      * @param string $handle Name of the script.
    36      *
    37      * @return void
     31     * @return string
    3832     */
    39     public static function enqueue_script( $handle ): void {
    40         wp_enqueue_script( self::prefix_it( $handle ) );
     33    public function get_prefix(): string {
     34        return ADVADS_SLUG;
    4135    }
    4236
    4337    /**
    44      * Prefix the handle
    45      *
    46      * @param string $handle Name of the asset.
     38     * Base URL for plugin local assets.
    4739     *
    4840     * @return string
    4941     */
    50     public static function prefix_it( $handle ): string {
    51         return ADVADS_SLUG . '-' . $handle;
    52     }
    53 
    54     /**
    55      * Determines whether a script has been added to the queue.
    56      *
    57      * @param string $handle Name of the script.
    58      * @param string $status Optional. Status of the script to check. Default 'enqueued'.
    59      *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
    60      *
    61      * @return bool
    62      */
    63     public static function script_is( $handle, $status = 'enqueued' ): bool {
    64         return wp_script_is( self::prefix_it( $handle ), $status );
    65     }
    66 
    67     /**
    68      * Hook into WordPress.
    69      *
    70      * @return void
    71      */
    72     public function hooks(): void {
    73         add_action( 'admin_enqueue_scripts', [ $this, 'register_assets' ], 0 );
    74         add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ], 0 );
    75     }
    76 
    77     /**
    78      * Register assets
    79      *
    80      * @return void
    81      */
    82     public function register_assets(): void {
    83         $this->register_styles();
    84         $this->register_scripts();
     42    public function get_base_url(): string {
     43        return ADVADS_BASE_URL;
    8544    }
    8645
     
    9453            return;
    9554        }
     55
    9656        $this->register_style( 'ui', 'admin/assets/css/ui.css' );
    9757        $this->register_style( 'admin', 'admin/assets/css/admin.css' );
     
    9959            $this->register_style( 'app', 'assets/css/app.css' );
    10060        }
    101         $this->register_style( 'ad-positioning', 'modules/ad-positioning/assets/css/ad-positioning.css', [ self::prefix_it( 'admin' ) ] );
     61        $this->register_style( 'ad-positioning', 'modules/ad-positioning/assets/css/ad-positioning.css', [ $this->prefix_it( 'admin' ) ] );
    10262    }
    10363
     
    11171        $this->register_script( 'wp-widget-adsense', 'modules/gadsense/admin/assets/js/wp-widget.js', [ 'jquery' ], false, true );
    11272        $this->register_script( 'app', 'assets/js/app.js', [ 'jquery' ], false, true );
     73        $this->register_script( 'find-adblocker', 'admin/assets/js/advertisement.js' );
    11374
    11475        if ( ! is_admin() ) {
     
    11778
    11879        // Backend JS files go here.
    119         $this->register_script( 'find-adblocker', 'admin/assets/js/advertisement.js' );
    120         $this->register_script( 'conditions', 'admin/assets/js/conditions.js', [ 'jquery', self::prefix_it( 'ui' ) ] );
     80        $this->register_script( 'conditions', 'admin/assets/js/conditions.js', [ 'jquery', $this->prefix_it( 'ui' ) ] );
    12181        $this->register_script( 'wizard', 'admin/assets/js/wizard.js', [ 'jquery' ] );
    12282        $this->register_script( 'inline-edit-group-ads', 'admin/assets/js/inline-edit-group-ads.js', [ 'jquery' ] );
    123         $this->register_script( 'admin', 'admin/assets/js/admin.min.js', [ 'jquery', self::prefix_it( 'ui' ), 'jquery-ui-autocomplete', 'wp-util' ] );
     83        $this->register_script( 'admin', 'admin/assets/js/admin.min.js', [ 'jquery', $this->prefix_it( 'ui' ), 'jquery-ui-autocomplete', 'wp-util' ] );
    12484        $this->register_script( 'ui', 'admin/assets/js/ui.js', [ 'jquery' ] );
    12585        $this->register_script( 'admin-global', 'admin/assets/js/admin-global.js', [ 'jquery' ], false, true );
    12686        $this->register_script( 'page-quick-edit', 'assets/js/admin/page-quick-edit.js', [], false, true );
    12787    }
    128 
    129     /**
    130      * Register stylesheet
    131      *
    132      * @param string           $handle Name of the stylesheet. Should be unique.
    133      * @param string|bool      $src    URL of the stylesheet.
    134      * @param string[]         $deps   Optional. An array of registered stylesheet handles this stylesheet depends on.
    135      * @param string|bool|null $ver    Optional. String specifying stylesheet version number.
    136      * @param string           $media  Optional. The media for which this stylesheet has been defined.
    137      *
    138      * @return void
    139      */
    140     private function register_style( $handle, $src, $deps = [], $ver = false, $media = 'all' ) {
    141         if ( false === $ver ) {
    142             $ver = ADVADS_VERSION;
    143         }
    144 
    145         wp_register_style( self::prefix_it( $handle ), ADVADS_BASE_URL . $src, $deps, $ver, $media );
    146     }
    147 
    148     /**
    149      * Register script
    150      *
    151      * @param string           $handle    Name of the stylesheet. Should be unique.
    152      * @param string|bool      $src       URL of the stylesheet.
    153      * @param string[]         $deps      Optional. An array of registered stylesheet handles this stylesheet depends on.
    154      * @param string|bool|null $ver       Optional. String specifying stylesheet version number.
    155      * @param bool             $in_footer Optional. The media for which this stylesheet has been defined.
    156      *
    157      * @return void
    158      */
    159     private function register_script( $handle, $src, $deps = [], $ver = false, $in_footer = false ) {
    160         if ( false === $ver ) {
    161             $ver = ADVADS_VERSION;
    162         }
    163 
    164         $new_src = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? $src : str_replace( '.js', '.min.js', $src );
    165         wp_register_script( self::prefix_it( $handle ), ADVADS_BASE_URL . $src, $deps, $ver, $in_footer );
    166     }
    16788}
  • advanced-ads/trunk/includes/class-autoloader.php

    r2991956 r3145275  
    5151
    5252    /**
     53     * Get plugin directory.
     54     *
     55     * @return string
     56     */
     57    public function get_directory(): string {
     58        return dirname( ADVADS_FILE );
     59    }
     60
     61    /**
    5362     * Runs this initializer.
    5463     *
     
    6372        }
    6473
    65         $this->autoloader = require_once $locate;
     74        $this->autoloader = require $locate;
    6675        $this->register_wordpress();
    6776    }
     
    7584     */
    7685    private function locate() {
    77         $directory   = dirname( ADVADS_FILE );
    78         $packages    = $directory . '/packages/autoload.php';
    79         $vendors     = $directory . '/vendor/autoload.php';
    80         $is_debug    = 'local' === ( function_exists( 'wp_get_environment_type' ) ? wp_get_environment_type() : $this->get_environment_type() );
    81         $is_packages = is_readable( $packages );
    82         $is_vendors  = is_readable( $vendors );
    83 
    84         if ( $is_packages && ( ! $is_debug || ! $is_vendors ) ) {
     86        $directory = $this->get_directory();
     87        $packages  = $directory . '/packages/autoload.php';
     88        $vendors   = $directory . '/vendor/autoload.php';
     89        $is_debug  = $this->is_debug() || 'local' === $this->get_environment_type();
     90
     91        if ( is_readable( $packages ) && ( ! $is_debug || ! is_readable( $vendors ) ) ) {
    8592            return $packages;
    8693        }
    8794
    88         if ( $is_vendors ) {
     95        if ( is_readable( $vendors ) ) {
    8996            return $vendors;
    9097        }
     
    135142     */
    136143    public function get_environment_type(): string {
     144        return function_exists( 'wp_get_environment_type' )
     145            ? wp_get_environment_type()
     146            : $this->get_environment_type_fallback();
     147    }
     148
     149    /**
     150     * Retrieves the current environment type.
     151     *
     152     * @return string
     153     */
     154    private function get_environment_type_fallback(): string {
    137155        static $current_env = '';
    138156
     
    184202        return $current_env;
    185203    }
     204
     205    /**
     206     * Is WordPress debug mode enabled
     207     *
     208     * @return bool
     209     */
     210    private function is_debug(): bool {
     211        return defined( 'WP_DEBUG' ) && WP_DEBUG;
     212    }
    186213}
  • advanced-ads/trunk/includes/class-plugin.php

    r3134243 r3145275  
    1111
    1212use AdvancedAds\Admin;
    13 use AdvancedAds\Groups;
    1413use AdvancedAds\Framework;
    1514use AdvancedAds\Framework\Loader;
     
    2019/**
    2120 * Plugin.
     21 *
     22 * Containers:
     23 *
     24 * @property Shortcodes           $shortcodes Shortcodes handler.
     25 * @property Assets_Registry      $registry   Assets registry.
     26 * @property Framework\JSON       $json       JSON handler.
     27 * @property Admin\Admin_Menu     $screens    Admin screens.
     28 * @property Frontend\Ad_Renderer $renderer   Ads renderer.
     29 * @property Frontend\Manager     $frontend   Frontend manager.
    2230 */
    2331class Plugin extends Loader {
     
    5765    private function setup(): void {
    5866        $this->define_constants();
     67        $this->includes_functions();
    5968        $this->includes();
     69        $this->includes_admin();
    6070
    6171        /**
     
    6474         * TODO: need to remove it in future.
    6575         */
    66 
    67         // Load public functions (might be used by modules, other plugins or theme).
    68         require_once ADVADS_ABSPATH . 'includes/functions.php';
    69         require_once ADVADS_ABSPATH . 'includes/cap_map.php';
    70 
    7176        // Public-Facing and Core Functionality.
    7277        \Advanced_Ads::get_instance();
     
    7883        }
    7984
     85        add_action( 'init', [ $this, 'load_textdomain' ] );
    8086        add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ], -1 );
     87
     88        // Load it all.
    8189        $this->load();
    8290    }
     
    96104         */
    97105        do_action( 'advanced-ads-loaded' );
     106    }
     107
     108    /**
     109     * Load the plugin text domain for translation.
     110     *
     111     * @return void
     112     */
     113    public function load_textdomain(): void {
     114        $locale = get_user_locale();
     115        $locale = apply_filters( 'plugin_locale', $locale, 'advanced-ads' );
     116
     117        unload_textdomain( 'advanced-ads' );
     118        if ( false === load_textdomain( 'advanced-ads', WP_LANG_DIR . '/plugins/advanced-ads-' . $locale . '.mo' ) ) {
     119            load_textdomain( 'advanced-ads', WP_LANG_DIR . '/advanced-ads/advanced-ads-' . $locale . '.mo' );
     120        }
     121
     122        load_plugin_textdomain( 'advanced-ads', false, dirname( ADVADS_PLUGIN_BASENAME ) . '/languages' );
    98123    }
    99124
     
    145170     */
    146171    private function includes(): void {
     172        // Common.
    147173        $this->register_initializer( Install::class );
    148174        $this->register_integration( Entities::class );
    149         $this->register_integration( Assets_Registry::class );
     175        $this->register_integration( Assets_Registry::class, 'registry' );
    150176        $this->register_integration( Framework\JSON::class, 'json', [ 'advancedAds' ] );
    151177        $this->register_integration( Groups\Manager::class, 'group_manager' );
    152 
    153         // Only in admin area.
    154         if ( is_admin() ) {
    155             $this->register_integration( Admin\Action_Links::class );
    156             $this->register_integration( Admin\Assets::class );
    157             $this->register_integration( Admin\Header::class );
    158             $this->register_integration( Admin\TinyMCE::class );
    159             $this->register_integration( Admin\Admin_Menu::class );
    160             $this->register_integration( Admin\Page_Quick_Edit::class );
    161         }
     178    }
     179
     180    /**
     181     * Includes files used in admin.
     182     *
     183     * @return void
     184     */
     185    private function includes_admin(): void {
     186        // Early bail!!
     187        if ( ! is_admin() ) {
     188            return;
     189        }
     190
     191        $this->register_integration( Admin\Action_Links::class );
     192        $this->register_integration( Admin\Assets::class );
     193        $this->register_integration( Admin\Header::class );
     194        $this->register_integration( Admin\TinyMCE::class );
     195        $this->register_integration( Admin\Admin_Menu::class );
     196        $this->register_integration( Admin\Page_Quick_Edit::class );
     197    }
     198
     199    /**
     200     * Includes the necessary functions files.
     201     *
     202     * @return void
     203     */
     204    private function includes_functions(): void {
     205        require_once ADVADS_ABSPATH . 'includes/functions.php';
     206        require_once ADVADS_ABSPATH . 'includes/cap_map.php';
    162207    }
    163208}
  • advanced-ads/trunk/languages/advanced-ads.pot

    r3134930 r3145275  
    1 # Copyright (C) 2024 Advanced Ads GmbH
     1# Copyright (C) 2024 Advanced Ads
    22# This file is distributed under the GPL-2.0+.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 1.53.1\n"
     5"Project-Id-Version: Advanced Ads 1.53.2\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
    77"Last-Translator: Thomas Maier <[email protected]>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-08-13T12:34:04+00:00\n"
     12"POT-Creation-Date: 2024-09-02T11:05:48+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
     
    1616
    1717#. Plugin Name of the plugin
    18 #: admin/includes/class-meta-box.php:565
     18#. Author of the plugin
     19#: admin/includes/class-meta-box.php:564
    1920#: modules/gutenberg/includes/class-gutenberg.php:136
    2021msgid "Advanced Ads"
     
    2829#. Description of the plugin
    2930msgid "Manage and optimize your ads in WordPress"
    30 msgstr ""
    31 
    32 #. Author of the plugin
    33 msgid "Advanced Ads GmbH"
    3431msgstr ""
    3532
     
    8683#. translators: %s is empty here, but the string will be followed by a name of an ad unit.
    8784#: admin/includes/ad-health-notices.php:112
    88 #: classes/frontend_checks.php:280
     85#: classes/frontend_checks.php:279
    8986msgid "Visible ads should not use the Header placement: %s"
    9087msgstr ""
    9188
    9289#: admin/includes/ad-health-notices.php:123
    93 #: classes/ad-debug.php:272
    94 #: classes/frontend_checks.php:267
     90#: classes/ad-debug.php:278
     91#: classes/frontend_checks.php:266
    9592msgid "Your website is using HTTPS, but the ad code contains HTTP and might not work."
    9693msgstr ""
     
    295292
    296293#: admin/includes/class-ad-type.php:953
    297 #: classes/frontend_checks.php:547
     294#: classes/frontend_checks.php:546
    298295msgid "Get help"
    299296msgstr ""
     
    439436msgstr ""
    440437
    441 #: admin/includes/class-meta-box.php:50
     438#: admin/includes/class-meta-box.php:49
    442439#: admin/includes/class-overview-widgets.php:68
    443440msgid "AdSense Earnings"
    444441msgstr ""
    445442
    446 #: admin/includes/class-meta-box.php:101
     443#: admin/includes/class-meta-box.php:100
    447444msgid "Ad Type"
    448445msgstr ""
    449446
    450447#. translators: 1: Name of ad unit
    451 #: admin/includes/class-meta-box.php:119
     448#: admin/includes/class-meta-box.php:118
    452449msgid "Earnings of  %1$s"
    453450msgstr ""
    454451
    455 #: admin/includes/class-meta-box.php:137
     452#: admin/includes/class-meta-box.php:136
    456453#: includes/admin/class-groups-list-table.php:451
    457454#: views/admin/screens/placements.php:351
     
    459456msgstr ""
    460457
    461 #: admin/includes/class-meta-box.php:146
     458#: admin/includes/class-meta-box.php:145
    462459msgid "Ad Parameters"
    463460msgstr ""
    464461
    465 #: admin/includes/class-meta-box.php:154
     462#: admin/includes/class-meta-box.php:153
    466463#: admin/includes/class-settings.php:73
    467464msgid "Layout / Output"
    468465msgstr ""
    469466
    470 #: admin/includes/class-meta-box.php:162
     467#: admin/includes/class-meta-box.php:161
    471468msgid "Targeting"
    472469msgstr ""
    473470
    474 #: admin/includes/class-meta-box.php:171
     471#: admin/includes/class-meta-box.php:170
    475472msgid "Increase your ad revenue"
    476473msgstr ""
    477474
    478 #: admin/includes/class-meta-box.php:181
     475#: admin/includes/class-meta-box.php:180
    479476msgid "Statistics"
    480477msgstr ""
    481478
    482 #: admin/includes/class-meta-box.php:252
    483 #: admin/includes/class-meta-box.php:266
     479#: admin/includes/class-meta-box.php:251
     480#: admin/includes/class-meta-box.php:265
    484481#: admin/includes/class-overview-widgets.php:181
    485482#: admin/views/ad-main-metabox.php:29
     
    502499msgstr ""
    503500
     501#: admin/includes/class-meta-box.php:269
     502msgid "Video"
     503msgstr ""
     504
    504505#: admin/includes/class-meta-box.php:270
    505 msgid "Video"
    506 msgstr ""
    507 
    508 #: admin/includes/class-meta-box.php:271
    509506#: admin/views/conditions/ad-targeting-metabox.php:18
    510507#: classes/ad-debug.php:152
     
    514511msgstr ""
    515512
    516 #: admin/includes/class-meta-box.php:272
     513#: admin/includes/class-meta-box.php:271
    517514#: admin/views/conditions/ad-targeting-metabox.php:37
    518515#: classes/ad-debug.php:239
     
    522519msgstr ""
    523520
    524 #: admin/includes/class-meta-box.php:304
     521#: admin/includes/class-meta-box.php:303
    525522#: admin/includes/class-overview-widgets.php:64
    526523#: views/admin/page-bulk-edit.php:20
     
    529526msgstr ""
    530527
    531 #: admin/includes/class-meta-box.php:466
     528#: admin/includes/class-meta-box.php:465
    532529msgid "Ad Settings"
    533530msgstr ""
    534531
    535532#. translators: %1$d is the number of ads, %2$s and %3$s are URLs.
    536 #: admin/includes/class-meta-box.php:581
     533#: admin/includes/class-meta-box.php:580
    537534msgid "%1$d ads – <a href=\"%2$s\">manage</a> - <a href=\"%3$s\">new</a>"
    538535msgstr ""
    539536
    540 #: admin/includes/class-meta-box.php:594
     537#: admin/includes/class-meta-box.php:593
    541538msgid "Get the tutorial via email"
    542539msgstr ""
    543540
    544 #: admin/includes/class-meta-box.php:603
     541#: admin/includes/class-meta-box.php:602
    545542msgid "Get AdSense tips via email"
    546543msgstr ""
    547544
    548 #: admin/includes/class-meta-box.php:612
     545#: admin/includes/class-meta-box.php:611
    549546msgid "Visit our blog for more articles about ad optimization"
    550547msgstr ""
    551548
    552549#. translators: %s is our URL.
    553 #: admin/includes/class-meta-box.php:667
     550#: admin/includes/class-meta-box.php:666
    554551msgid "Latest posts on wpadvancedads.com"
    555552msgstr ""
     
    585582#: admin/views/notices/welcome-panel.php:15
    586583#: admin/views/placements-item.php:68
    587 #: includes/admin/class-assets.php:71
     584#: includes/admin/class-assets.php:69
    588585#: views/admin/tables/groups/list-row-loop-none.php:17
    589586#: views/admin/tables/groups/list-row-option-ads.php:61
     
    744741#: admin/includes/class-overview-widgets.php:627
    745742#: admin/includes/class-overview-widgets.php:645
    746 #: classes/ad_group.php:650
     743#: classes/ad_group.php:654
    747744msgid "Activate now"
    748745msgstr ""
     
    778775
    779776#: admin/includes/class-overview-widgets.php:733
    780 #: classes/ad_group.php:653
     777#: classes/ad_group.php:657
    781778msgid "Get this add-on"
    782779msgstr ""
     
    823820
    824821#: admin/includes/class-settings.php:178
    825 #: classes/in-content-injector.php:609
     822#: classes/in-content-injector.php:611
    826823msgid "Disable level limitation"
    827824msgstr ""
     
    17031700
    17041701#: admin/views/settings/general/block-bots.php:11
    1705 #: classes/frontend_checks.php:138
     1702#: classes/frontend_checks.php:137
    17061703msgid "You look like a bot"
    17071704msgstr ""
     
    20782075
    20792076#. translators: %1$s is an URL, %2$s is a URL text
    2080 #: classes/ad_group.php:659
     2077#: classes/ad_group.php:663
    20812078msgid "It seems that a caching plugin is activated. Your ads might not rotate properly. The cache busting in Advanced Ads Pro will solve that. <a href=\"%1$s\" target=\"_blank\">%2$s.</a>"
    20822079msgstr ""
     
    23842381#: classes/display-conditions.php:318
    23852382#: classes/visitor-conditions.php:317
    2386 #: includes/admin/class-assets.php:84
     2383#: includes/admin/class-assets.php:82
    23872384#: modules/gadsense/admin/views/external-ads-links.php:17
    23882385#: modules/gadsense/admin/views/external-ads-links.php:22
     
    23932390#: classes/display-conditions.php:318
    23942391#: classes/visitor-conditions.php:317
    2395 #: includes/admin/class-assets.php:85
     2392#: includes/admin/class-assets.php:83
    23962393msgid "and"
    23972394msgstr ""
     
    25642561msgstr ""
    25652562
    2566 #: classes/frontend_checks.php:123
     2563#: classes/frontend_checks.php:122
    25672564msgid "Random AdSense ads"
    25682565msgstr ""
    25692566
    2570 #: classes/frontend_checks.php:152
     2567#: classes/frontend_checks.php:151
    25712568msgid "Ad blocker enabled"
    25722569msgstr ""
    25732570
    2574 #: classes/frontend_checks.php:164
     2571#: classes/frontend_checks.php:163
    25752572msgid "<em>%s</em> filter does not exist"
    25762573msgstr ""
    25772574
    2578 #: classes/frontend_checks.php:180
     2575#: classes/frontend_checks.php:179
    25792576msgid "Ads are disabled in the content of this page"
    25802577msgstr ""
    25812578
    2582 #: classes/frontend_checks.php:192
     2579#: classes/frontend_checks.php:191
    25832580msgid "the current post ID is 0 "
    25842581msgstr ""
    25852582
    2586 #: classes/frontend_checks.php:211
     2583#: classes/frontend_checks.php:210
    25872584msgid "Ads are disabled on this page"
    25882585msgstr ""
    25892586
    2590 #: classes/frontend_checks.php:225
     2587#: classes/frontend_checks.php:224
    25912588msgid "Ads are disabled on all pages"
    25922589msgstr ""
    25932590
    2594 #: classes/frontend_checks.php:240
     2591#: classes/frontend_checks.php:239
    25952592msgid "Ads are disabled on 404 pages"
    25962593msgstr ""
    25972594
    2598 #: classes/frontend_checks.php:254
     2595#: classes/frontend_checks.php:253
    25992596msgid "Ads are disabled on non singular pages"
    26002597msgstr ""
    26012598
    2602 #: classes/frontend_checks.php:268
     2599#: classes/frontend_checks.php:267
    26032600msgid "Ad IDs: %s"
    26042601msgstr ""
    26052602
     2603#: classes/frontend_checks.php:295
     2604msgid "AdSense violation"
     2605msgstr ""
     2606
    26062607#: classes/frontend_checks.php:296
    2607 msgid "AdSense violation"
     2608msgid "Ad is hidden"
    26082609msgstr ""
    26092610
    26102611#: classes/frontend_checks.php:297
    2611 msgid "Ad is hidden"
    2612 msgstr ""
    2613 
    2614 #: classes/frontend_checks.php:298
    26152612msgid "IDs: %s"
    26162613msgstr ""
    26172614
    2618 #: classes/frontend_checks.php:314
     2615#: classes/frontend_checks.php:313
    26192616msgid "The following responsive AdSense ads are not showing up: %s"
    26202617msgstr ""
    26212618
    2622 #: classes/frontend_checks.php:331
     2619#: classes/frontend_checks.php:330
    26232620msgid "Consent not given"
    26242621msgstr ""
    26252622
    2626 #: classes/frontend_checks.php:348
     2623#: classes/frontend_checks.php:347
    26272624msgid "Enable TCF integration"
    26282625msgstr ""
    26292626
    2630 #: classes/frontend_checks.php:363
     2627#: classes/frontend_checks.php:362
    26312628msgid "Debug Google Ad Manager"
    26322629msgstr ""
    26332630
    2634 #: classes/frontend_checks.php:380
     2631#: classes/frontend_checks.php:379
    26352632msgid "highlight ads"
    26362633msgstr ""
    26372634
    2638 #: classes/frontend_checks.php:500
     2635#: classes/frontend_checks.php:499
    26392636msgid "Ad Health"
    26402637msgstr ""
    26412638
    2642 #: classes/frontend_checks.php:515
     2639#: classes/frontend_checks.php:514
    26432640msgid "Show %d more notifications"
    26442641msgstr ""
    26452642
    2646 #: classes/frontend_checks.php:534
     2643#: classes/frontend_checks.php:533
    26472644msgid "Everything is fine"
    26482645msgstr ""
    26492646
    2650 #: classes/frontend_checks.php:605
     2647#: classes/frontend_checks.php:604
    26512648msgid "the following code is used for automatic error detection and only visible to admins"
    26522649msgstr ""
    26532650
    26542651#. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
    2655 #: classes/in-content-injector.php:608
     2652#: classes/in-content-injector.php:610
    26562653msgid "Set <em>%s</em> to show more ads"
    26572654msgstr ""
     
    27612758msgstr ""
    27622759
     2760#: includes/admin/class-assets.php:84
     2761msgid "After which paragraph?"
     2762msgstr ""
     2763
    27632764#: includes/admin/class-assets.php:86
    2764 msgid "After which paragraph?"
    2765 msgstr ""
    2766 
    2767 #: includes/admin/class-assets.php:88
    27682765#: modules/gadsense/includes/class-adsense-report.php:159
    27692766msgid "Today"
    27702767msgstr ""
    27712768
    2772 #: includes/admin/class-assets.php:89
     2769#: includes/admin/class-assets.php:87
    27732770#: modules/gadsense/includes/class-adsense-report.php:160
    27742771msgid "Yesterday"
    27752772msgstr ""
    27762773
    2777 #: includes/admin/class-assets.php:90
     2774#: includes/admin/class-assets.php:88
    27782775#: modules/gadsense/includes/class-adsense-report.php:163
    27792776msgid "This Month"
     
    27812778
    27822779#. translators: 1: The number of days.
    2783 #: includes/admin/class-assets.php:92
     2780#: includes/admin/class-assets.php:90
    27842781#: modules/gadsense/includes/class-adsense-report.php:162
    27852782#: modules/gadsense/includes/class-adsense-report.php:165
     
    27882785
    27892786#. translators: 1: An error message.
    2790 #: includes/admin/class-assets.php:94
     2787#: includes/admin/class-assets.php:92
    27912788msgid "An error occurred: %1$s"
    27922789msgstr ""
    27932790
    2794 #: includes/admin/class-assets.php:95
     2791#: includes/admin/class-assets.php:93
    27952792#: modules/gadsense/admin/views/adsense-report.php:24
    27962793msgid "All"
    27972794msgstr ""
    27982795
     2796#: includes/admin/class-assets.php:94
     2797msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
     2798msgstr ""
     2799
     2800#: includes/admin/class-assets.php:95
     2801msgid "Show inactive ads"
     2802msgstr ""
     2803
    27992804#: includes/admin/class-assets.php:96
    2800 msgid "There were no results returned for this ad. Please make sure it is active, generating impressions and double check your ad parameters."
    2801 msgstr ""
    2802 
    2803 #: includes/admin/class-assets.php:97
    2804 msgid "Show inactive ads"
     2805msgid "Hide inactive ads"
    28052806msgstr ""
    28062807
    28072808#: includes/admin/class-assets.php:98
    2808 msgid "Hide inactive ads"
     2809msgid "Permanently delete this placement?"
     2810msgstr ""
     2811
     2812#: includes/admin/class-assets.php:99
     2813msgid "Close"
    28092814msgstr ""
    28102815
    28112816#: includes/admin/class-assets.php:100
    2812 msgid "Permanently delete this placement?"
    2813 msgstr ""
    2814 
    2815 #: includes/admin/class-assets.php:101
    2816 msgid "Close"
    2817 msgstr ""
    2818 
    2819 #: includes/admin/class-assets.php:102
    28202817msgid "Data you have entered has not been saved. Are you sure you want to discard your changes?"
    28212818msgstr ""
     
    30113008
    30123009#. translators: 1: is a link to a support document. 2: closing link
    3013 #: includes/class-autoloader.php:121
     3010#: includes/class-autoloader.php:128
    30143011msgid "Your installation of Advanced Ads is incomplete. If you installed Advanced Ads from GitHub, %1$s please refer to this document%2$s to set up your development environment."
    30153012msgstr ""
    30163013
    30173014#. translators: %s: WP_ENVIRONMENT_TYPES
    3018 #: includes/class-autoloader.php:154
     3015#: includes/class-autoloader.php:172
    30193016msgid "The %s constant is no longer supported."
    30203017msgstr ""
     
    31283125#: includes/groups/types/type-unknown.php:60
    31293126msgid "No description"
     3127msgstr ""
     3128
     3129#: includes/importers/class-api-ads.php:56
     3130msgid "Ads from API"
     3131msgstr ""
     3132
     3133#: includes/importers/class-api-ads.php:65
     3134msgid "For MonetizeMore clients using PubGuru, you will be able to create all of your new ads from api."
     3135msgstr ""
     3136
     3137#. translators: 1: counts 2: Importer title
     3138#: includes/importers/class-api-ads.php:192
     3139msgid "%1$d ads migrated from %2$s"
     3140msgstr ""
     3141
     3142#: includes/importers/class-manager.php:104
     3143msgid "History deleted successfully."
    31303144msgstr ""
    31313145
     
    41384152msgstr ""
    41394153
     4154#: modules/one-click/admin/class-admin.php:60
     4155msgid "MonetizeMore & PubGuru Integration"
     4156msgstr ""
     4157
    41404158#: modules/one-click/admin/class-admin.php:61
    4141 msgid "MonetizeMore & PubGuru Integration"
    4142 msgstr ""
    4143 
    4144 #: modules/one-click/admin/class-admin.php:62
    41454159msgid "Enables MonetizeMore users to link their settings with the PubGuru insights & analytics dashboard."
    41464160msgstr ""
     
    41504164msgstr ""
    41514165
    4152 #: modules/one-click/admin/class-admin.php:74
     4166#: modules/one-click/admin/class-admin.php:76
    41534167msgid "Disconnect now"
    41544168msgstr ""
    41554169
    4156 #: modules/one-click/admin/class-admin.php:100
     4170#: modules/one-click/admin/class-admin.php:101
    41574171msgid "PubGuru OneClick Consent & Privacy Policy"
    41584172msgstr ""
    41594173
    4160 #: modules/one-click/admin/class-admin.php:102
     4174#: modules/one-click/admin/class-admin.php:103
    41614175msgid "Connecting Your With Your PubGuru Account Settings"
    41624176msgstr ""
     
    41674181
    41684182#: modules/one-click/admin/class-ajax.php:78
    4169 msgid "Pubguru successfully connected."
     4183msgid "We have successfully migrated your MonetizeMore Pubguru Ad Units to your WordPress site. The existing placements and ads have been paused."
    41704184msgstr ""
    41714185
     
    41744188msgstr ""
    41754189
     4190#: modules/one-click/admin/class-ajax.php:132
    41764191#: modules/one-click/admin/class-ajax.php:167
    41774192msgid "An error has occurred please try again."
    41784193msgstr ""
    41794194
    4180 #: modules/one-click/modules/adstxt/class-detector.php:88
     4195#: modules/one-click/admin/class-ajax.php:139
     4196msgid "File successfully backed up."
     4197msgstr ""
     4198
     4199#: modules/one-click/modules/adstxt/class-detector.php:93
    41814200msgid "File alert!"
    41824201msgstr ""
    41834202
    4184 #: modules/one-click/modules/adstxt/class-detector.php:88
    4185 msgid "Physical ads.txt found. In order to use PubGuru service you need to delete it."
    4186 msgstr ""
    4187 
    4188 #: modules/one-click/modules/adstxt/class-detector.php:90
    4189 #: modules/one-click/modules/adstxt/class-detector.php:91
     4203#: modules/one-click/modules/adstxt/class-detector.php:93
     4204msgid "Physical ads.txt found. In order to use PubGuru service you need to delete it or back it up."
     4205msgstr ""
     4206
     4207#: modules/one-click/modules/adstxt/class-detector.php:96
     4208#: modules/one-click/modules/adstxt/class-detector.php:97
    41904209msgid "Backup the File"
    41914210msgstr ""
    41924211
    4193 #: modules/one-click/modules/adstxt/class-detector.php:90
     4212#: modules/one-click/modules/adstxt/class-detector.php:96
    41944213msgid "Backing Up"
    41954214msgstr ""
    41964215
    4197 #: modules/one-click/modules/adstxt/class-detector.php:90
     4216#: modules/one-click/modules/adstxt/class-detector.php:96
    41984217msgid "Backed Up"
    41994218msgstr ""
     
    43694388
    43704389#. translators: %s link to privacy policy
    4371 #: views/admin/metabox-pubguru-connect.php:21
     4390#: views/admin/metabox-pubguru-connect.php:23
    43724391msgid "This form is designed exclusively for MonetizeMore customers who wish to integrate Advanced Ads with the PubGuru Dashboard. By selecting \"Connect PGHB,\" you agree to share your domain name to facilitate the connection with your PubGuru account, in alignment with our <a href=\"%s\">Privacy Policy</a>. Rest assured, no additional information is exchanged, and Advanced Ads does not engage in any tracking activities."
    43734392msgstr ""
    43744393
    4375 #: views/admin/metabox-pubguru-connect.php:30
     4394#: views/admin/metabox-pubguru-connect.php:32
    43764395msgid "Connect PGHB"
    43774396msgstr ""
    43784397
    4379 #: views/admin/metabox-pubguru-connect.php:42
     4398#: views/admin/metabox-pubguru-connect.php:43
    43804399msgid "To activate any of the settings with your PubGuru account, please select from the options below. Should you have any inquiries, feel free to <a href=\"https://www.monetizemore.com/contact/\">click here<a/> to reach out to us or send an email to <a href=\"mailto:[email protected]\">[email protected]</a>"
    43814400msgstr ""
    43824401
    4383 #: views/admin/metabox-pubguru-connect.php:52
     4402#: views/admin/metabox-pubguru-connect.php:53
    43844403msgid "Install PubGuru Header Bidding"
    43854404msgstr ""
    43864405
    4387 #: views/admin/metabox-pubguru-connect.php:62
     4406#: views/admin/metabox-pubguru-connect.php:63
     4407msgid "Move the PubGuru Header Bidding script to the footer. Keep this option disabled to maximize revenue. Only enable it if PageSpeed is your priority."
     4408msgstr ""
     4409
     4410#: views/admin/metabox-pubguru-connect.php:75
     4411msgid "Enable ads.txt settings from the <a href=\"https://app.pubguru.com/ads-txt\" target=\"_blank\">PubGuru platform</a>"
     4412msgstr ""
     4413
     4414#: views/admin/metabox-pubguru-connect.php:94
     4415msgid "Install Traffic Cop. 7 days free trial"
     4416msgstr ""
     4417
     4418#: views/admin/metabox-pubguru-connect.php:97
     4419msgid "Install Traffic Cop."
     4420msgstr ""
     4421
     4422#: views/admin/metabox-pubguru-connect.php:107
    43884423msgid "Activate Tag Conversion"
    43894424msgstr ""
    43904425
    4391 #: views/admin/metabox-pubguru-connect.php:74
    4392 msgid "Enable ads.txt settings from the <a href=\"https://app.pubguru.com/ads-txt\" target=\"_blank\">PubGuru platform</a>"
    4393 msgstr ""
    4394 
    4395 #: views/admin/metabox-pubguru-connect.php:93
    4396 msgid "Install Traffic Cop. 7 days free trial"
    4397 msgstr ""
    4398 
    4399 #: views/admin/metabox-pubguru-connect.php:96
    4400 msgid "Install Traffic Cop."
     4426#: views/admin/metabox-pubguru-connect.php:132
     4427msgid "Rollback"
     4428msgstr ""
     4429
     4430#: views/admin/metabox-pubguru-connect.php:133
     4431msgid "Rollback the api changes back to previous state."
    44014432msgstr ""
    44024433
  • advanced-ads/trunk/lib/composer/autoload_classmap.php

    r3134243 r3145275  
    5555    'AdvancedAds\\BuildTools\\Values\\SemanticVersion' => $vendorDir . '/advanced-ads/build-tools/src/Values/SemanticVersion.php',
    5656    'AdvancedAds\\BuildTools\\Values\\Translation' => $vendorDir . '/advanced-ads/build-tools/src/Values/Translation.php',
     57    'AdvancedAds\\Constants' => $baseDir . '/includes/class-constants.php',
    5758    'AdvancedAds\\Entities' => $baseDir . '/includes/class-entities.php',
    5859    'AdvancedAds\\Groups\\Manager' => $baseDir . '/includes/groups/class-manager.php',
     
    6263    'AdvancedAds\\Groups\\Types\\Standard' => $baseDir . '/includes/groups/types/type-standard.php',
    6364    'AdvancedAds\\Groups\\Types\\Unknown' => $baseDir . '/includes/groups/types/type-unknown.php',
     65    'AdvancedAds\\Importers\\Api_Ads' => $baseDir . '/includes/importers/class-api-ads.php',
     66    'AdvancedAds\\Importers\\Importer' => $baseDir . '/includes/importers/abstract-importer.php',
     67    'AdvancedAds\\Importers\\Manager' => $baseDir . '/includes/importers/class-manager.php',
    6468    'AdvancedAds\\Installation\\Capabilities' => $baseDir . '/includes/installation/class-capabilities.php',
    6569    'AdvancedAds\\Installation\\Install' => $baseDir . '/includes/installation/class-install.php',
    6670    'AdvancedAds\\Installation\\Uninstall' => $baseDir . '/includes/installation/class-uninstall.php',
    6771    'AdvancedAds\\Interfaces\\Group_Type' => $baseDir . '/includes/interfaces/interface-group-type.php',
     72    'AdvancedAds\\Interfaces\\Importer' => $baseDir . '/includes/interfaces/interface-importer.php',
    6873    'AdvancedAds\\Interfaces\\Screen_Interface' => $baseDir . '/includes/interfaces/interface-screen.php',
    6974    'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => $baseDir . '/modules/one-click/admin/class-admin.php',
     
    7176    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => $baseDir . '/modules/one-click/modules/adstxt/class-adstxt.php',
    7277    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => $baseDir . '/modules/one-click/modules/adstxt/class-detector.php',
    73     'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => $baseDir . '/modules/one-click/modules/class-auto-ads.php',
    7478    'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => $baseDir . '/modules/one-click/modules/class-header-bidding.php',
    7579    'AdvancedAds\\Modules\\OneClick\\Helpers' => $baseDir . '/modules/one-click/class-helpers.php',
  • advanced-ads/trunk/lib/composer/autoload_static.php

    r3134243 r3145275  
    8585        'AdvancedAds\\BuildTools\\Values\\SemanticVersion' => __DIR__ . '/..' . '/advanced-ads/build-tools/src/Values/SemanticVersion.php',
    8686        'AdvancedAds\\BuildTools\\Values\\Translation' => __DIR__ . '/..' . '/advanced-ads/build-tools/src/Values/Translation.php',
     87        'AdvancedAds\\Constants' => __DIR__ . '/../..' . '/includes/class-constants.php',
    8788        'AdvancedAds\\Entities' => __DIR__ . '/../..' . '/includes/class-entities.php',
    8889        'AdvancedAds\\Groups\\Manager' => __DIR__ . '/../..' . '/includes/groups/class-manager.php',
     
    9293        'AdvancedAds\\Groups\\Types\\Standard' => __DIR__ . '/../..' . '/includes/groups/types/type-standard.php',
    9394        'AdvancedAds\\Groups\\Types\\Unknown' => __DIR__ . '/../..' . '/includes/groups/types/type-unknown.php',
     95        'AdvancedAds\\Importers\\Api_Ads' => __DIR__ . '/../..' . '/includes/importers/class-api-ads.php',
     96        'AdvancedAds\\Importers\\Importer' => __DIR__ . '/../..' . '/includes/importers/abstract-importer.php',
     97        'AdvancedAds\\Importers\\Manager' => __DIR__ . '/../..' . '/includes/importers/class-manager.php',
    9498        'AdvancedAds\\Installation\\Capabilities' => __DIR__ . '/../..' . '/includes/installation/class-capabilities.php',
    9599        'AdvancedAds\\Installation\\Install' => __DIR__ . '/../..' . '/includes/installation/class-install.php',
    96100        'AdvancedAds\\Installation\\Uninstall' => __DIR__ . '/../..' . '/includes/installation/class-uninstall.php',
    97101        'AdvancedAds\\Interfaces\\Group_Type' => __DIR__ . '/../..' . '/includes/interfaces/interface-group-type.php',
     102        'AdvancedAds\\Interfaces\\Importer' => __DIR__ . '/../..' . '/includes/interfaces/interface-importer.php',
    98103        'AdvancedAds\\Interfaces\\Screen_Interface' => __DIR__ . '/../..' . '/includes/interfaces/interface-screen.php',
    99104        'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => __DIR__ . '/../..' . '/modules/one-click/admin/class-admin.php',
     
    101106        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-adstxt.php',
    102107        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-detector.php',
    103         'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => __DIR__ . '/../..' . '/modules/one-click/modules/class-auto-ads.php',
    104108        'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => __DIR__ . '/../..' . '/modules/one-click/modules/class-header-bidding.php',
    105109        'AdvancedAds\\Modules\\OneClick\\Helpers' => __DIR__ . '/../..' . '/modules/one-click/class-helpers.php',
  • advanced-ads/trunk/modules/one-click/admin/class-admin.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick\Admin;
    1111
    12 use AdvancedAds\Assets_Registry;
    1312use AdvancedAds\Utilities\Conditional;
    1413use AdvancedAds\Modules\OneClick\Helpers;
     
    4443        }
    4544
    46         Assets_Registry::enqueue_style( 'app' );
    47         Assets_Registry::enqueue_script( 'app' );
     45        wp_advads()->registry->enqueue_style( 'app' );
     46        wp_advads()->registry->enqueue_script( 'app' );
    4847    }
    4948
     
    6362            'order' => 1000,
    6463            'link'  => '#',
     64            'icon'  => ADVADS_BASE_URL . 'assets/img/add-ons/aa-addons-icons-m2pg.svg',
    6565        ];
    6666
    6767        $addons['monetizemore-connect'] = $defaults + [
    68             'class'      => 'js-m2-show-consent',
    69             'link_title' => __( 'Connect now', 'advanced-ads' ),
     68            'class'        => 'js-pubguru-connect',
     69            'link_title'   => __( 'Connect now', 'advanced-ads' ),
     70            'link_icon'    => 'dashicons-plus',
     71            'link_primary' => true,
    7072        ];
    7173
     
    7375            'class'      => 'js-pubguru-disconnect',
    7476            'link_title' => __( 'Disconnect now', 'advanced-ads' ),
     77            'link_icon'  => 'dashicons-dismiss',
    7578        ];
    7679
    77         if ( $is_connected ) {
    78             $addons['monetizemore-connect']['class'] .= ' hidden';
    79         } else {
    80             $addons['monetizemore-disconnect']['class'] .= ' hidden';
    81         }
     80        $key = $is_connected ? 'monetizemore-connect' : 'monetizemore-disconnect';
     81
     82        $addons[ $key ]['class'] .= ' hidden';
    8283
    8384        return $addons;
     
    111112            </div>
    112113        </div>
     114        <div id="pubguru-notices"></div>
    113115
    114116        <?php
  • advanced-ads/trunk/modules/one-click/admin/class-ajax.php

    r3041809 r3145275  
    1414use AdvancedAds\Modules\OneClick\Helpers;
    1515use AdvancedAds\Modules\OneClick\Options;
     16use AdvancedAds\Framework\Utilities\Params;
    1617use AdvancedAds\Modules\OneClick\AdsTxt\Detector;
    17 use AdvancedAds\Framework\Utilities\Params;
    1818use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1919
     
    7676        wp_send_json_success(
    7777            [
    78                 'message'       => esc_html__( 'Pubguru successfully connected.', 'advanced-ads' ),
     78                'message'       => esc_html__( 'We have successfully migrated your MonetizeMore Pubguru Ad Units to your WordPress site. The existing placements and ads have been paused.', 'advanced-ads' ),
    7979                'hasTrafficCop' => Helpers::has_traffic_cop( $config ),
    8080            ]
     
    107107        check_ajax_referer( 'pubguru_module_changed', 'security' );
    108108
    109         $module     = Params::post( 'module', [] );
    110         $status     = Params::post( 'status', false, FILTER_VALIDATE_BOOLEAN );
    111         $option_key = 'pubguru_module_' . $module;
     109        $module = Params::post( 'module', [] );
     110        $status = Params::post( 'status', false, FILTER_VALIDATE_BOOLEAN );
    112111
    113         update_option( $option_key, $status );
     112        Options::module( $module, $status );
    114113
    115         do_action( 'pubguru_module_status_changed', $module, $status );
     114        $data = apply_filters( 'pubguru_module_status_changed', [], $module, $status );
    116115
    117         $notice = '';
    118 
    119         if ( 'ads_txt' === $module && $status ) {
    120             $detector = new Detector();
    121             if ( $detector->detect_files() ) {
    122                 ob_start();
    123                 $detector->show_notice();
    124                 $notice = ob_get_clean();
    125             }
    126         }
    127 
    128         wp_send_json_success( [ 'notice' => $notice ] );
     116        wp_send_json_success( $data );
    129117    }
    130118
     
    137125        check_ajax_referer( 'pubguru_backup_adstxt', 'security' );
    138126
    139         ( new Detector() )->backup_file();
     127        $notice = '';
     128        $result = ( new Detector() )->backup_file();
     129        if ( false === $result ) {
     130            $notice = sprintf(
     131                '<div class="notice notice-error flex items-center p-4">%s</div>',
     132                esc_html__( 'An error has occurred please try again.', 'advanced-ads' )
     133            );
     134            wp_send_json_error( $notice );
     135        }
    140136
    141         wp_send_json_success();
     137        $notice = sprintf(
     138            '<div class="notice notice-success flex items-center p-4">%s</div>',
     139            esc_html__( 'File successfully backed up.', 'advanced-ads' )
     140        );
     141        wp_send_json_success( $notice );
    142142    }
    143143
  • advanced-ads/trunk/modules/one-click/class-helpers.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Constants;
    1313use AdvancedAds\Utilities\WordPress;
     14use AdvancedAds\Framework\Utilities\Str;
    1415
    1516defined( 'ABSPATH' ) || exit;
     
    1920 */
    2021class Helpers {
    21 
    22     /**
    23      * Is module enabled.
    24      *
    25      * @param string $name name of module.
    26      *
    27      * @return bool
    28      */
    29     public static function is_module_enabled( $name ): bool {
    30         return boolval( get_option( "pubguru_module_{$name}" ) );
    31     }
    3222
    3323    /**
     
    9686
    9787        foreach ( $configs['configs'] as $config ) {
    98             if ( Str::str_contains( $needle, $config['name'] ) ) {
     88            if ( Str::contains( $needle, $config['name'] ) ) {
    9989                return $config['name'];
    10090            }
     
    112102        $ads = self::get_ads_from_config();
    113103
    114         if ( $ads && ! wp_next_scheduled( 'advanced-ads-pghb-auto-ad-creation' ) ) {
    115             wp_schedule_single_event( current_datetime()->getTimestamp() + MINUTE_IN_SECONDS, 'advanced-ads-pghb-auto-ad-creation' );
     104        if ( $ads && ! wp_next_scheduled( Constants::CRON_API_ADS_CREATION ) ) {
     105            wp_schedule_single_event( current_datetime()->getTimestamp() + 5, Constants::CRON_API_ADS_CREATION );
    116106        }
    117107    }
     
    140130                }
    141131            }
     132        } else {
     133            $domain             = WordPress::get_site_domain();
     134            $pubguru_config_ads = [
     135                $domain . '_leaderboard'  => [
     136                    'ad_unit'              => $domain . '_leaderboard',
     137                    'slot'                 => $domain . '_leaderboard',
     138                    'device'               => 'All',
     139                    'placement'            => 'Before Content',
     140                    'placement_conditions' => 'All',
     141                    'in_content_position'  => 'Before',
     142                    'in_content_count'     => 1,
     143                    'in_content_element'   => 'p',
     144                    'in_content_repeat'    => false,
     145                ],
     146                $domain . '_in_content_1' => [
     147                    'ad_unit'              => $domain . '_in_content_1',
     148                    'slot'                 => $domain . '_in_content_1',
     149                    'device'               => 'All',
     150                    'placement'            => 'Before Content',
     151                    'placement_conditions' => 'All',
     152                    'in_content_position'  => 'Before',
     153                    'in_content_count'     => 1,
     154                    'in_content_element'   => 'p',
     155                    'in_content_repeat'    => false,
     156                ],
     157                $domain . '_in_content_2' => [
     158                    'ad_unit'              => $domain . '_in_content_2',
     159                    'slot'                 => $domain . '_in_content_2',
     160                    'device'               => 'All',
     161                    'placement'            => 'After Content',
     162                    'placement_conditions' => 'All',
     163                    'in_content_position'  => 'Aefore',
     164                    'in_content_count'     => 3,
     165                    'in_content_element'   => 'p',
     166                    'in_content_repeat'    => true,
     167                ],
     168            ];
    142169        }
    143170
     
    155182        global $post;
    156183
     184        if ( ! $post ) {
     185            return false;
     186        }
     187
    157188        if ( ! $post_id ) {
    158189            $post_id = $post->ID;
  • advanced-ads/trunk/modules/one-click/class-options.php

    r3041809 r3145275  
    3737        return update_option( self::CONFIG_KEY, $data );
    3838    }
     39
     40    /**
     41     * Read and Write pubguru module status
     42     *
     43     * @param string $module Module name.
     44     * @param bool   $status Module status.
     45     *
     46     * @return bool
     47     */
     48    public static function module( $module, $status = null ): bool {
     49        $option_key = 'pubguru_module_' . $module;
     50
     51        if ( null === $status ) {
     52            return boolval( get_option( $option_key, false ) );
     53        }
     54
     55        update_option( $option_key, $status );
     56
     57        return $status;
     58    }
    3959}
  • advanced-ads/trunk/modules/one-click/modules/adstxt/class-adstxt.php

    r3041809 r3145275  
    1212use AdvancedAds\Utilities\WordPress;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
     14use AdvancedAds\Framework\Utilities\Params;
     15use AdvancedAds\Framework\Utilities\Str;
    1416
    1517defined( 'ABSPATH' ) || exit;
     
    2830        remove_action( 'advanced-ads-plugin-loaded', 'advanced_ads_ads_txt_init' );
    2931
    30         add_action( 'init', [ $this, 'add_rewrite_rules' ] );
    31         add_filter( 'query_vars', [ $this, 'add_query_vars' ] );
    3232        add_action( 'template_redirect', [ $this, 'handle_redirect' ] );
    3333        add_filter( 'allowed_redirect_hosts', [ $this, 'allowed_redirect_hosts' ] );
    34 
    35         if ( is_admin() ) {
    36             ( new Detector() )->hooks();
    37         }
    38     }
    39 
    40     /**
    41      * Add rewrite rules
    42      *
    43      * @return void
    44      */
    45     public function add_rewrite_rules(): void {
    46         global $wp_rewrite;
    47 
    48         if ( ! $wp_rewrite->using_permalinks() ) {
    49             return;
    50         }
    51 
    52         add_rewrite_rule( 'ads\.txt$', $wp_rewrite->index . '?adstxt=1', 'top' );
    53     }
    54 
    55     /**
    56      * Add query var
    57      *
    58      * @param array $vars Array to hold query variables.
    59      *
    60      * @return array
    61      */
    62     public function add_query_vars( $vars ): array {
    63         $vars[] = 'adstxt';
    64         return $vars;
    6534    }
    6635
     
    7140     */
    7241    public function handle_redirect(): void {
    73         if ( empty( get_query_var( 'adstxt' ) ) ) {
     42        if (
     43            'ads-txt' !== get_query_var( 'name' ) ||
     44            Str::contains( Params::server( 'REQUEST_URI' ), 'ads.txt' )
     45        ) {
    7446            return;
    7547        }
    7648
    77         $redirect = sprintf( 'https://adstxt.pubguru.net/%s/ads.txt', WordPress::get_site_domain() );
     49        $redirect = sprintf( 'https://adstxt.pubguru.net/pg/%s/ads.txt', WordPress::get_site_domain() );
    7850        wp_safe_redirect( $redirect, 301 );
    7951        exit;
  • advanced-ads/trunk/modules/one-click/modules/adstxt/class-detector.php

    r3041809 r3145275  
    4040
    4141        if ( $this->detect_files() ) {
    42             add_action( 'pubguru_notices', [ $this, 'show_notice' ] );
     42            add_action( 'all_admin_notices', [ $this, 'show_notice' ] );
    4343        }
    4444    }
     
    4747     * Detect file exists
    4848     *
     49     * @param string $file file name.
     50     *
    4951     * @return bool
    5052     */
    51     public function detect_files(): bool {
     53    public function detect_files( $file = 'ads.txt' ): bool {
    5254        $wp_filesystem = $this->get_filesystem();
    5355        if ( null === $wp_filesystem ) {
     
    5557        }
    5658
    57         return $wp_filesystem->exists( ABSPATH . '/ads.txt' );
     59        return $wp_filesystem->exists( ABSPATH . '/' . $file );
    5860    }
    5961
     
    6466     */
    6567    public function backup_file(): bool {
    66         $wp_filesystem = $this->get_filesystem();
    67         if ( null === $wp_filesystem ) {
    68             return false;
    69         }
     68        $source      = ABSPATH . '/ads.txt';
     69        $destination = $source . '.bak';
     70        return $this->move_file( $source, $destination );
     71    }
    7072
    71         return $wp_filesystem->move( ABSPATH . '/ads.txt', ABSPATH . '/ads.txt.bak' );
     73    /**
     74     * Revert file
     75     *
     76     * @return bool
     77     */
     78    public function revert_file(): bool {
     79        $source      = ABSPATH . '/ads.txt.bak';
     80        $destination = ABSPATH . 'ads.txt';
     81        return $this->move_file( $source, $destination );
    7282    }
    7383
     
    7989    public function show_notice(): void {
    8090        ?>
    81         <div class="flex shadow-lg rounded">
    82             <div class="bg-red-600 p-3 rounded-l flex items-center">
    83                 <svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" class="fill-current text-white w-5" viewBox="0 0 32 32" aria-hidden="true"><path d="M2,16H2A14,14,0,1,0,16,2,14,14,0,0,0,2,16Zm23.15,7.75L8.25,6.85a12,12,0,0,1,16.9,16.9ZM8.24,25.16A12,12,0,0,1,6.84,8.27L23.73,25.16a12,12,0,0,1-15.49,0Z"></path><title>Error</title></svg>
     91        <div class="notice notice-error flex items-center p-4">
     92            <div>
     93                <strong><?php esc_html_e( 'File alert!', 'advanced-ads' ); ?></strong> <?php esc_html_e( 'Physical ads.txt found. In order to use PubGuru service you need to delete it or back it up.', 'advanced-ads' ); ?>
    8494            </div>
    8595
    86             <div class="p-3 bg-white rounded-r w-full flex justify-between items-center">
    87                 <div>
    88                     <span class="font-medium"><?php esc_html_e( 'File alert!', 'advanced-ads' ); ?></span> <?php esc_html_e( 'Physical ads.txt found. In order to use PubGuru service you need to delete it.', 'advanced-ads' ); ?>
    89                 </div>
    90                 <button class="js-btn-backup-adstxt px-3 py-2 rounded text-xs bg-blue-600 text-white hover:bg-blue-700" data-text="<?php esc_attr_e( 'Backup the File', 'advanced-ads' ); ?>" data-loading="<?php esc_attr_e( 'Backing Up', 'advanced-ads' ); ?>" data-done="<?php esc_attr_e( 'Backed Up', 'advanced-ads' ); ?>" data-security="<?php echo wp_create_nonce( 'pubguru_backup_adstxt' ); // phpcs:ignore ?>">
    91                     <?php esc_html_e( 'Backup the File', 'advanced-ads' ); ?>
    92                 </button>
    93             </div>
     96            <button class="!ml-auto button button-primary js-btn-backup-adstxt" data-text="<?php esc_attr_e( 'Backup the File', 'advanced-ads' ); ?>" data-loading="<?php esc_attr_e( 'Backing Up', 'advanced-ads' ); ?>" data-done="<?php esc_attr_e( 'Backed Up', 'advanced-ads' ); ?>" data-security="<?php echo wp_create_nonce( 'pubguru_backup_adstxt' ); // phpcs:ignore ?>">
     97                <?php esc_html_e( 'Backup the File', 'advanced-ads' ); ?>
     98            </button>
    9499        </div>
    95100        <?php
     
    101106     * @return object
    102107     */
    103     public function get_filesystem() {
     108    private function get_filesystem() {
    104109        global $wp_filesystem;
    105110
     
    111116        return $wp_filesystem;
    112117    }
     118
     119    /**
     120     * Handle file operations (backup or revert)
     121     *
     122     * @param string $source      Source file path.
     123     * @param string $destination Destination file path.
     124     *
     125     * @return bool
     126     */
     127    private function move_file( string $source, string $destination ): bool {
     128        $wp_filesystem = $this->get_filesystem();
     129
     130        if ( null === $wp_filesystem || ! $wp_filesystem->is_writable( $source ) ) {
     131            return false;
     132        }
     133
     134        return $wp_filesystem->move( $source, $destination );
     135    }
    113136}
  • advanced-ads/trunk/modules/one-click/modules/class-header-bidding.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Framework\Utilities\Str;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1414
     
    1919 */
    2020class Header_Bidding implements Integration_Interface {
    21 
    22     /**
    23      * Check if has gpt
    24      *
    25      * @var bool
    26      */
    27     private $has_gpt = false;
    28 
    29     /**
    30      * Check if has pubguru tag
    31      *
    32      * @var bool
    33      */
    34     private $has_pubguru = false;
    35 
    36     /**
    37      * Check if has traffic cop atq
    38      *
    39      * @var bool
    40      */
    41     private $has_traffic_cop = false;
    4221
    4322    /**
     
    7251    public function remove_tags( $script ): string {
    7352
    74         if ( Str::str_contains( '/gpt.js', $script ) ) {
    75             $script        = '';
    76             $this->has_gpt = true;
     53        if ( Str::contains( '/gpt.js', $script ) ) {
     54            $script = '';
    7755        }
    7856
    79         if ( Str::str_contains( '//m2d.m2.ai/', $script ) || Str::str_contains( '//c.pubguru.net/', $script ) ) {
    80             $script            = '';
    81             $this->has_gpt     = true;
    82             $this->has_pubguru = true;
     57        if ( Str::contains( '//m2d.m2.ai/', $script ) || Str::contains( '//c.pubguru.net/', $script ) ) {
     58            $script = '';
    8359        }
    8460
    85         if ( Str::str_contains( 'window.pg.atq = window.pg.atq || [];', $script ) ) {
    86             $script                = '';
    87             $this->has_traffic_cop = true;
     61        if ( Str::contains( 'window.pg.atq = window.pg.atq || [];', $script ) ) {
     62            $script = '';
    8863        }
    8964
     
    9974     */
    10075    private function add_script_tag( $page ): string {
    101         $name = Helpers::get_config_file();
     76        $name    = Helpers::get_config_file();
     77        $at_body = Options::module( 'header_bidding_at_body' );
    10278
    10379        if ( $name ) {
    104             $script = [ '<head>' ];
    105 
    106             if ( $this->has_gpt ) {
    107                 $script[] = '<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" async></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
    108                 $script[] = '<script type="text/javascript">window.googletag=window.googletag||{};window.googletag.cmd=window.googletag.cmd||[];';
    109                 $script[] = 'window.googletag.cmd.push(function(){window.__onpageGptEmbed=(new Date()).getTime()})</script>';
     80            $script = [];
     81            if ( ! $at_body ) {
     82                $script[] = '<head>';
    11083            }
    11184
    112             if ( $this->has_pubguru ) {
    113                 $script[] = sprintf( '<script src="//c.pubguru.net/%s" async> </script>', $name ); // phpcs:ignore
    114             }
     85            $script[] = '<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" async></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
     86            $script[] = '<script type="text/javascript">window.googletag=window.googletag||{};window.googletag.cmd=window.googletag.cmd||[];';
     87            $script[] = 'window.googletag.cmd.push(function(){window.__onpageGptEmbed=(new Date()).getTime()})</script>';
     88            $script[] = sprintf( '<script src="//c.pubguru.net/%s" async> </script>', $name ); // phpcs:ignore
    11589
    116             if ( Helpers::is_module_enabled( 'traffic_cop' ) && Helpers::has_traffic_cop() && $this->has_traffic_cop ) {
     90            if ( Options::module( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
    11791                $script[] = '<script>window.pg = window.pg || {};window.pg.atq = window.pg.atq || [];</script>';
    11892            }
    11993
    120             $page = str_replace( '<head>', join( "\n", $script ), $page );
     94            if ( $at_body ) {
     95                $page = $page . join( "\n", $script );
     96            } else {
     97                $page = str_replace(
     98                    '<head>',
     99                    join( "\n", $script ),
     100                    $page
     101                );
     102            }
    121103        }
    122104
  • advanced-ads/trunk/modules/one-click/modules/class-traffic-cop.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
    12 use AdvancedAds\Utilities\Str;
     12use AdvancedAds\Framework\Utilities\Str;
    1313use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1414
     
    3838    public function modify_script_tag( $content ) {
    3939        // Early bail!!
    40         if ( ! Str::str_contains( 'googletag.display', $content ) ) {
     40        if ( ! Str::contains( 'googletag.display', $content ) ) {
    4141            return false;
    4242        }
  • advanced-ads/trunk/modules/one-click/modules/class-workflow.php

    r3041809 r3145275  
    1010namespace AdvancedAds\Modules\OneClick;
    1111
     12use AdvancedAds\Constants;
     13use AdvancedAds\Importers\Api_Ads;
    1214use AdvancedAds\Modules\OneClick\Helpers;
    1315use AdvancedAds\Modules\OneClick\Options;
     16use AdvancedAds\Framework\Utilities\Params;
     17use AdvancedAds\Modules\OneClick\Traffic_Cop;
     18use AdvancedAds\Modules\OneClick\AdsTxt\AdsTxt;
     19use AdvancedAds\Modules\OneClick\AdsTxt\Detector;
    1420use AdvancedAds\Framework\Interfaces\Integration_Interface;
    15 use AdvancedAds\Framework\Utilities\Params;
    16 use AdvancedAds\Modules\OneClick\AdsTxt\AdsTxt;
    17 use AdvancedAds\Modules\OneClick\Traffic_Cop;
    1821
    1922defined( 'ABSPATH' ) || exit;
     
    3841    public function hooks(): void {
    3942        add_action( 'init', [ $this, 'flush_rewrite_rules' ], 999 );
    40         add_action( 'pubguru_module_status_changed', [ $this, 'module_status_changed' ], 10, 1 );
    41         add_action( 'advanced-ads-pghb-auto-ad-creation', [ $this, 'auto_ad_creation' ], 10, 0 );
     43        add_filter( 'pubguru_module_status_changed', [ $this, 'module_status_changed' ], 10, 3 );
     44        add_action( Constants::CRON_API_ADS_CREATION, [ $this, 'auto_ad_creation' ], 10, 0 );
    4245
    4346        if ( false !== Options::pubguru_config() && ! is_admin() ) {
    4447            add_action( 'wp', [ $this, 'init' ] );
    4548
    46             if ( Helpers::is_module_enabled( 'ads_txt' ) ) {
     49            if ( Options::module( 'ads_txt' ) ) {
    4750                ( new AdsTxt() )->hooks();
    4851            }
     52        }
     53
     54        if ( Options::module( 'ads_txt' ) ) {
     55            if ( is_admin() ) {
     56                ( new Detector() )->hooks();
     57            }
     58            remove_action( 'advanced-ads-plugin-loaded', 'advanced_ads_ads_txt_init' );
    4959        }
    5060    }
     
    6474        Page_Parser::get_instance();
    6575
    66         if ( $is_debugging || Helpers::is_module_enabled( 'header_bidding' ) ) {
     76        if ( $is_debugging || Options::module( 'header_bidding' ) ) {
    6777            ( new Header_Bidding() )->hooks();
    6878        }
    6979
    70         if ( $is_debugging || Helpers::is_module_enabled( 'tag_conversion' ) ) {
     80        if ( $is_debugging || Options::module( 'tag_conversion' ) ) {
    7181            ( new Tags_Conversion() )->hooks();
    7282        }
    7383
    74         if ( Helpers::is_module_enabled( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
    75             if ( ! Helpers::is_module_enabled( 'header_bidding' ) ) {
     84        if ( Options::module( 'traffic_cop' ) && Helpers::has_traffic_cop() ) {
     85            if ( ! Options::module( 'header_bidding' ) ) {
    7686                ( new Header_Bidding() )->hooks();
    7787            }
     
    8494     * Handle module status change
    8595     *
     96     * @param array  $data   Data to send back to ajax request.
    8697     * @param string $module Module name.
     98     * @param bool   $status Module status.
    8799     *
    88      * @return void
     100     * @return array
    89101     */
    90     public function module_status_changed( $module ): void {
     102    public function module_status_changed( $data, $module, $status ): array {
    91103        if ( 'ads_txt' === $module ) {
     104            $detector = new Detector();
     105            if ( $status && $detector->detect_files() ) {
     106                ob_start();
     107                $detector->show_notice();
     108                $notice = ob_get_clean();
     109                if ( $notice ) {
     110                    $data['notice'] = $notice;
     111                }
     112            }
     113
     114            if ( ! $status && $detector->detect_files( 'ads.txt.bak' ) ) {
     115                $detector->revert_file();
     116            }
     117
    92118            update_option( self::FLUSH_KEY, 1 );
    93119        }
     120
     121        return $data;
    94122    }
    95123
     
    112140     */
    113141    public function auto_ad_creation(): void {
    114         $ads = Helpers::get_ads_from_config();
    115         // ( new Auto_Ads() )->run( $ads );
     142        ( new Api_Ads() )->import();
    116143    }
    117144}
  • advanced-ads/trunk/packages/composer/LICENSE

    r3134733 r3145275  
     1
    12Copyright (c) Nils Adermann, Jordi Boggiano
    23
     
    1819OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    1920THE SOFTWARE.
     21
  • advanced-ads/trunk/packages/composer/autoload_classmap.php

    r3134733 r3145275  
    2424    'AdvancedAds\\Assets_Registry' => $baseDir . '/includes/class-assets-registry.php',
    2525    'AdvancedAds\\Autoloader' => $baseDir . '/includes/class-autoloader.php',
     26    'AdvancedAds\\Constants' => $baseDir . '/includes/class-constants.php',
    2627    'AdvancedAds\\Entities' => $baseDir . '/includes/class-entities.php',
    2728    'AdvancedAds\\Framework\\Assets_Registry' => $vendorDir . '/advanced-ads/framework/src/class-assets-registry.php',
     
    5859    'AdvancedAds\\Groups\\Types\\Standard' => $baseDir . '/includes/groups/types/type-standard.php',
    5960    'AdvancedAds\\Groups\\Types\\Unknown' => $baseDir . '/includes/groups/types/type-unknown.php',
     61    'AdvancedAds\\Importers\\Api_Ads' => $baseDir . '/includes/importers/class-api-ads.php',
     62    'AdvancedAds\\Importers\\Importer' => $baseDir . '/includes/importers/abstract-importer.php',
     63    'AdvancedAds\\Importers\\Manager' => $baseDir . '/includes/importers/class-manager.php',
    6064    'AdvancedAds\\Installation\\Capabilities' => $baseDir . '/includes/installation/class-capabilities.php',
    6165    'AdvancedAds\\Installation\\Install' => $baseDir . '/includes/installation/class-install.php',
    6266    'AdvancedAds\\Installation\\Uninstall' => $baseDir . '/includes/installation/class-uninstall.php',
    6367    'AdvancedAds\\Interfaces\\Group_Type' => $baseDir . '/includes/interfaces/interface-group-type.php',
     68    'AdvancedAds\\Interfaces\\Importer' => $baseDir . '/includes/interfaces/interface-importer.php',
    6469    'AdvancedAds\\Interfaces\\Screen_Interface' => $baseDir . '/includes/interfaces/interface-screen.php',
    6570    'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => $baseDir . '/modules/one-click/admin/class-admin.php',
     
    6772    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => $baseDir . '/modules/one-click/modules/adstxt/class-adstxt.php',
    6873    'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => $baseDir . '/modules/one-click/modules/adstxt/class-detector.php',
    69     'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => $baseDir . '/modules/one-click/modules/class-auto-ads.php',
    7074    'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => $baseDir . '/modules/one-click/modules/class-header-bidding.php',
    7175    'AdvancedAds\\Modules\\OneClick\\Helpers' => $baseDir . '/modules/one-click/class-helpers.php',
  • advanced-ads/trunk/packages/composer/autoload_static.php

    r3134733 r3145275  
    5353        'AdvancedAds\\Assets_Registry' => __DIR__ . '/../..' . '/includes/class-assets-registry.php',
    5454        'AdvancedAds\\Autoloader' => __DIR__ . '/../..' . '/includes/class-autoloader.php',
     55        'AdvancedAds\\Constants' => __DIR__ . '/../..' . '/includes/class-constants.php',
    5556        'AdvancedAds\\Entities' => __DIR__ . '/../..' . '/includes/class-entities.php',
    5657        'AdvancedAds\\Framework\\Assets_Registry' => __DIR__ . '/..' . '/advanced-ads/framework/src/class-assets-registry.php',
     
    8788        'AdvancedAds\\Groups\\Types\\Standard' => __DIR__ . '/../..' . '/includes/groups/types/type-standard.php',
    8889        'AdvancedAds\\Groups\\Types\\Unknown' => __DIR__ . '/../..' . '/includes/groups/types/type-unknown.php',
     90        'AdvancedAds\\Importers\\Api_Ads' => __DIR__ . '/../..' . '/includes/importers/class-api-ads.php',
     91        'AdvancedAds\\Importers\\Importer' => __DIR__ . '/../..' . '/includes/importers/abstract-importer.php',
     92        'AdvancedAds\\Importers\\Manager' => __DIR__ . '/../..' . '/includes/importers/class-manager.php',
    8993        'AdvancedAds\\Installation\\Capabilities' => __DIR__ . '/../..' . '/includes/installation/class-capabilities.php',
    9094        'AdvancedAds\\Installation\\Install' => __DIR__ . '/../..' . '/includes/installation/class-install.php',
    9195        'AdvancedAds\\Installation\\Uninstall' => __DIR__ . '/../..' . '/includes/installation/class-uninstall.php',
    9296        'AdvancedAds\\Interfaces\\Group_Type' => __DIR__ . '/../..' . '/includes/interfaces/interface-group-type.php',
     97        'AdvancedAds\\Interfaces\\Importer' => __DIR__ . '/../..' . '/includes/interfaces/interface-importer.php',
    9398        'AdvancedAds\\Interfaces\\Screen_Interface' => __DIR__ . '/../..' . '/includes/interfaces/interface-screen.php',
    9499        'AdvancedAds\\Modules\\OneClick\\Admin\\Admin' => __DIR__ . '/../..' . '/modules/one-click/admin/class-admin.php',
     
    96101        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\AdsTxt' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-adstxt.php',
    97102        'AdvancedAds\\Modules\\OneClick\\AdsTxt\\Detector' => __DIR__ . '/../..' . '/modules/one-click/modules/adstxt/class-detector.php',
    98         'AdvancedAds\\Modules\\OneClick\\Auto_Ads' => __DIR__ . '/../..' . '/modules/one-click/modules/class-auto-ads.php',
    99103        'AdvancedAds\\Modules\\OneClick\\Header_Bidding' => __DIR__ . '/../..' . '/modules/one-click/modules/class-header-bidding.php',
    100104        'AdvancedAds\\Modules\\OneClick\\Helpers' => __DIR__ . '/../..' . '/modules/one-click/class-helpers.php',
  • advanced-ads/trunk/readme.txt

    r3134930 r3145275  
    11=== Advanced Ads – Ad Manager & AdSense ===
    22Contributors: webzunft, advancedads
    3 Tags: ads, adsense, amp, ads.txt, ad rotations, ad blocker, amazon, banner, click fraud protection, google ad manager, header code, lazy loading,
     3Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.0
    55Tested up to: 6.5
    66Requires PHP: 7.2
    7 Stable tag: 1.53.2
     7Stable tag: 1.54.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Manage and optimize all ad types. Support for Google AdSense Auto ads, Amazon, image banners, HTML, page builder, ad widget, ad rotations, ads.txt
     11The only complete toolkit for all ad types. Grow your revenue with AdSense, Amazon—or any affiliate network. Get pinpoint targeting and best support!
    1212
    1313== Description ==
     
    3131This is what our users are saying about Advanced Ads:
    3232
    33 > We use this plugin to deliver rotating ads on a community news site, and it’s great. We’ve delivered over a million ad impressions since we launched less than a year ago, using a combination of sidebar, top, sticky and in-content placements — both HTML5 and images. Advanced Ads makes it easy for our small team to deliver a good experience to our users and our advertisers.
     33> We use this plugin to deliver rotating ads on a community news site, and it’s great. We’ve delivered over a million ad impressions since we launched less than a year ago, using a combination of sidebar, top, sticky and in-content placements — both HTML5 ads and images. Advanced Ads makes it easy for our small team to deliver a good experience to our users and our advertisers.
    3434> <i>mytown304 on wp.org</i>
    3535
     
    3737
    3838= Premium Features =
    39 This plugin is the lite version of the Advanced Ads plugin that comes with all the features you will ever need to optimize your ads and increase your revenues, including performance tracking, advanced ad targeting, split tests, click fraud protection, lazy loading, background ads, popups and sticky ads, full AMP support, adblocker detection, the most comfortable Google Ad Manager integration, and tons more. [Click here to purchase the best premium WordPress ad management plugin now!](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-all-access)
     39This plugin is the lite version of the Advanced Ads plugin that comes with all the features you will ever need to optimize your ads and increase your revenues, including performance tracking, advanced ad targeting, split tests, click fraud protection, lazy loading, background ads, floating ads, popups and sticky ads, full AMP support, adblocker detection, the most comfortable Google Ad Manager integration, and tons more. [Click here to purchase the best premium WordPress ad management plugin now!](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-all-access)
    4040
    4141[Full Feature List](https://wpadvancedads.com/features/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
    4242
    43 = ad management =
     43= Ad Management =
    4444
    4545* create and display **unlimited** ad units
     
    4949* inject ads into posts and pages automatically without coding
    5050
    51 = ad types =
     51= Ad Types =
    5252
    5353Choose between different ad types that enable you to:
    5454
    55 * insert ads and banners from all ad and affiliate networks (e.g., [Google AdSense](https://wpadvancedads.com/adsense-ads/), [Amazon Affiliate Program](https://wpadvancedads.com/amazon-affiliate-program-wordpress/), BuySellAds, Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), Ezoic, media.net, [Booking.com](https://wpadvancedads.com/booking-com-ads-wordpress/), Tradedoubler, Awin, Getyourguide, The Moneytizer, Infolinks...)
     55* insert ads and banners from all ad and affiliate networks (e.g., [Google AdSense](https://wpadvancedads.com/adsense-ads/), [Amazon Affiliate Program Amazon Associates](https://wpadvancedads.com/amazon-affiliate-program-wordpress/), BuySellAds, Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), Ezoic, media.net, [Booking.com](https://wpadvancedads.com/booking-com-ads-wordpress/), Tradedoubler, Awin, GetYourGuide, The Moneytizer, Infolinks...)
    5656* dedicated support for all types of Google AdSense ads, including text and display ads, native ads (In-article, In-feed, Multiplex ads), Auto ads, and Auto ads for AMP
    5757* display images and image banners
    5858* create content-rich ads with the WordPress TinyMCE editor
    5959* insert contextual Amazon Native Shopping Ads
    60 * inject HTML, CSS, Javascript or PHP code
    61 * use shortcodes within ads (to also deliver advertisements from another ad plugin like Ad Inserter, AdRotate, Quick AdSense, Ads for WP, or the Google AdSense Plugin WP QUADS)
    62 
    63 = display ads for WordPress =
     60* inject HTML, CSS, Javascript, or PHP code
     61* use shortcodes within ads (to also deliver advertisements from another ad plugin like Ad Inserter, AdRotate, Quick AdSense, AdSanity, Ads for WP, or the Google AdSense plugin WP QUADS)
     62
     63= Display Ads for WordPress =
    6464
    6565* auto-inject ads via placements
    6666* use functions to display ads in template files
    67 * use shortcodes to place ads manually in post content
     67* use shortcodes to place ads manually
    6868* show ads in the sidebar and in widgets
    6969* disable all ads on specific pages
    70 * display multiple ads (ad grids)
    7170* display a customizable ad label, e.g., “Advertisements” above each banner ad
    72 
    73 = display conditions =
     71* display multiple ads in ad grids ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-5))
     72
     73= Display Conditions =
    7474
    7575Show ads based on content. [List of all display conditions](https://wpadvancedads.com/manual/display-conditions/)
     
    7979* archive pages by category, tags, taxonomies
    8080* special page types like 404, attachment and front page
    81 * posts and pages by contained keywords [(keyword targeting)](https://wpadvancedads.com/manual/ads-based-on-keywords/?utm_source=wporg&utm_medium=link&utm_campaign=features) or URL parameters, included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-1)
    8281* hide ads on secondary queries (e.g., posts in sidebars)
    8382* display or hide banners within the post feed
    8483* hide all ads from specific page types, e.g., 404 pages, feed
    8584* hide ads from bots and web crawlers
    86 
    87 = visitor conditions =
     85* posts and pages by contained keywords [(keyword targeting)](https://wpadvancedads.com/manual/ads-based-on-keywords/?utm_source=wporg&utm_medium=link&utm_campaign=features) or URL parameters, included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-1)
     86
     87= Visitor Conditions =
    8888
    8989Serve ads by conditions based on the visitor. [List of all visitor conditions](https://wpadvancedads.com/manual/visitor-conditions/)
     
    9292* display or hide a banner by role and for logged-in visitors
    9393* advanced visitor conditions: geolocation, previously visited URL (referrer), user capability, browser language, browser, and browser width included in [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-2)
     94* frequency capping ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-6))
    9495
    9596> **Fantastic plugin and outstanding support**
     
    9798> djsawyer on wp.org
    9899
    99 = ad injection | placements =
     100= Ad Injection | Placements =
    100101
    101102Placements to insert ads in pre-defined positions in your theme and content. [List of all placements](https://wpadvancedads.com/manual/placements/)
     
    107108* [Page peel banners](https://wpadvancedads.com/page-peel-ads/)
    108109* create [split tests and A/B testing](https://wpadvancedads.com/ab-testing-wordpress/)
    109 * many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
    110110* automatic insertion of any kind of footer and header code, not only advertising
    111111* use the [ad server](https://wpadvancedads.com/ad-server-wordpress/) placement to display ads on other sites
    112 
    113 = mobile devices =
     112* many more ad positions with [add-ons](https://wpadvancedads.com/add-ons/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features)
     113
     114= Mobile Devices =
    114115
    115116* target ads to mobile devices, or tablets, or desktops
    116117* display responsive image ads
    117 * ads only for specific browser sizes using [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3)
    118 * insert ads on AMP pages with [AMP Ads](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-1)
     118* ads only for specific browser sizes [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3)
     119* insert ads on AMP pages [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-1)
    119120
    120121= Google AdSense =
     
    133134* easy Ad Health integration and Google AdSense violation checks
    134135* option to remove the Google AdSense background color
    135 * place Google AdSense In-feed ads using the also free [In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
    136 * assistant for exact sizes of responsive Google AdSense ads with the [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-2)
    137 * convert Google AdSense ads into AMP ads automatically with the [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-3)
    138136* ads.txt generated with the correct AdSense information automatically
    139137* works along with Google Site Kit or can replace it if you want to [control your ad placements](https://wpadvancedads.com/place-adsense-ad-unit-manually/)
     138* place Google AdSense In-feed ads [free In-feed add-on](https://wordpress.org/plugins/advanced-ads-adsense-in-feed/)
     139* assistant for exact sizes of responsive Google AdSense ads [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-2)
     140* convert Google AdSense ads into AMP ads automatically [AMP Ads add-on](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-amp-ads-3)
    140141
    141142https://vimeo.com/577120971
     
    145146> Your app is awesome, congratulations! Google Adsense suggests using your app on its official website, it’s incredible!
    146147
    147 = ads.txt =
     148= Affiliate Marketing =
     149
     150Easily integrate affiliate marketing with a comprehensive toolkit.
     151
     152* unlimited affiliate ads and banners
     153* text link support
     154* affiliate disclosure
     155* automatic affiliate ad insertion
     156* advanced targeting
     157* dedicated AAWP ad type (Amazon Affiliate WordPress Plugin)
     158* integrates with other affiliate plugins like Pretty Links, Thirsty Affiliates, Lasso, and many more
     159* support for all Amazon ad formats
     160* compatible with all affiliate networks
     161* link masking and link cloaking ([Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-7))
     162* affiliate ad tracking ([Tracking add-on](https://wpadvancedads.com/add-ons/tracking/?utm_source=wporg&utm_medium=link&utm_campaign=affiliate-tracking))
     163
     164
     165= Ads.txt =
    148166
    149167* generates an ads.txt with custom content
     
    156174* all add-ons include priority email support
    157175* [All Access](https://wpadvancedads.com/add-ons/all-access/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – includes all available add-ons
    158 * [Advanced Ads Pro](https://wpadvancedads.com/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – powerful tools for ad optimizations: cache-busting, more placements, [lazy loading](https://wpadvancedads.com/lazy-load-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features), ad blocker module, [click fraud protection](https://wpadvancedads.com/manual/click-fraud-protection/?utm_source=wporg&utm_medium=link&utm_campaign=features), [geo targeting](https://wpadvancedads.com/add-ons/geo-targeting/?utm_source=wporg&utm_medium=link&utm_campaign=features), [parallax ads](https://wpadvancedads.com/parallax-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features) and many more
     176* [Advanced Ads Pro](https://wpadvancedads.com/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – powerful tools for ad optimizations: cache-busting, more placements, [lazy loading](https://wpadvancedads.com/lazy-load-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features), ad blocker module, ad refresh, [click fraud protection](https://wpadvancedads.com/manual/click-fraud-protection/?utm_source=wporg&utm_medium=link&utm_campaign=features), [geo targeting](https://wpadvancedads.com/add-ons/geo-targeting/?utm_source=wporg&utm_medium=link&utm_campaign=features), [parallax ads](https://wpadvancedads.com/parallax-ads/?utm_source=wporg&utm_medium=link&utm_campaign=features) and many more
    159177* [Tracking](https://wpadvancedads.com/add-ons/tracking/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – track ad impressions and ad clicks with local methods or Google Analytics
    160178* [AMP Ads](https://wpadvancedads.com/add-ons/amp-ads/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons) – make your ads compatible with AMP and convert Google AdSense ads automatically
     
    167185* [Full Feature List](https://wpadvancedads.com/features/?utm_source=wporg&utm_medium=link&utm_campaign=wp-add-ons)
    168186
    169 = ad blocker =
     187= Ad Blocker =
    170188
    171189* basic features to prevent ads from being removed by AdBlock and other ad blockers
    172190* prevent ad blockers from breaking sites where plugin scripts are running
    173 * ad blocking detection: show alternative content to ad block users with [Advanced Ads Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-3) and improve the monetization of your website
     191* ad blocker detection: show alternative content to ad block users and improve the monetization of your website [Pro](https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=wporg&utm_medium=link&utm_campaign=wp-features-pro-4)
    174192
    175193Learn more on the [plugin homepage](https://wpadvancedads.com).
     
    188206- BuddyPress – [How to add ads on BuddyPress pages](https://wpadvancedads.com/ads-on-buddypress-pages/)
    189207- bbPress – [How to show ads on bbPress pages?](https://wpadvancedads.com/ads-in-bbpress/)
    190 - Cookie Consent, Borlabs Cookies, Complianz, GDPR Cookie Consent, and other content manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
     208- Cookie Consent, Borlabs Cookies, Complianz, GDPR Cookie Consent, and other privacy and consent manager – [How to show ads based on visitors’ consent](https://wpadvancedads.com/manual/ad-cookie-consent/)
    191209- Elementor - [How to create and implement ads in Elementor](https://wpadvancedads.com/elementor-ads/)
    192210- GamiPress – [How to target ads on GamiPress websites](https://wpadvancedads.com/manual/gamipress-ads/)
    193211- Genesis – [Genesis Ads add-on](https://wpadvancedads.com/add-ons/genesis-ads/)
    194 - [IAB TCF 2.0 consent](https://wpadvancedads.com/manual/tcf-consent-wordpress/) – hide ads until users give their consent. Integrating with any CMP, Quantcast Choices, iubenda, Google Funding Choices, cookiebot, etc.
     212- [IAB TCF 2.0 consent](https://wpadvancedads.com/manual/tcf-consent-wordpress/) – hide ads until users give their consent. Integrating with any CMP, InMobi, iubenda, Google Funding Choices, cookiebot, etc.
    195213- LearnDash - [How to integrate ads into LearnDash](https://wpadvancedads.com/learndash-ads/)
    196214- MailPoet - [How to integrate Advanced Ads in MailPoet Newsletters](https://wpadvancedads.com/mailpoet-newsletters/)
     
    201219- WPBakery Page Builder – [Displaying Ads with WPBakery Page Builder](https://wpadvancedads.com/visual-composer-ads/)
    202220- WPML – [Showing different ads per language with WPML](https://wpadvancedads.com/translating-ads-wpml/)
     221- Youzify – [How to integrate ads in Youzify](https://wpadvancedads.com/how-to-integrate-ads-in-youzify/)
    203222
    204223== Installation ==
     
    241260* Ads not showing up? Take a look [here](https://wpadvancedads.com/manual/ads-not-showing-up).
    242261
    243 = What about my users’ privacy and GDPR? =
     262= What about my users’ privacy and GDPR compliance? =
    244263
    245264The plugin comes with Privacy settings that help you gather consent from users before showing ads to them. The feature works for any ads managed with the plugin, including AdSense Auto ads.
     
    257276= Which ad networks are supported? =
    258277
    259 Advanced Ads is compatible with all ad networks and banners from affiliate programs like AWin, Google AdSense, Chitika, Clickbank, Amazon, and also Google Ad Manager (formerly Google DoubleClick for Publishers, DFP), media.net.
    260 
    261 You can also use it to insert additional ad network tags into header or footer of your site without coding.
    262 
    263 AdSense has even a dedicated ad type leveling the specific options this ad network provides.
     278Advanced Ads is compatible with all ad networks and banners from affiliate programs like Awin, Google AdSense, Chitika, Clickbank, CJ Affiliate, Amazon, ShareASale, Impact, Rakuten, Booking.com, GetYourGuide, media.net, and also Google Ad Manager (formerly Google DoubleClick for Publishers, DFP).
     279
     280You can also use it to insert additional ad network tags into your site's header or footer without coding to integrate header bidding.
     281Advanced Ads even provides a dedicated AdSense ad type to leverage this ad network's specific options.
    264282
    265283= PHP functions and shortcodes =
     
    284302`<?php the_ad_placement('header-left'); ?>`
    285303
    286 = Is there a revenue share? =
    287 
    288 There is no revenue share. Advanced Ads doesn’t alter your ad codes in a way that you earn less than you would directly including the ad code in your template.
     304= Is there an ad revenue share? =
     305
     306There is no revenue sharing. Advanced Ads doesn’t alter your ad codes in a way that you earn less than you would directly including the ad code in your template. To implement revenue sharing between multiple authors, follow the instructions of [this tutorial](https://wpadvancedads.com/publisher-revenue-share/).
    289307
    290308= Can I place ads directly in my theme files? =
     
    339357== Changelog ==
    340358
    341 = 1.53.2 (August 13, 2024) =
    342 
    343 - Fix: ensure content from a group shows in all content placements
    344 
    345 = 1.53.1 (August 13, 2024) =
    346 
    347 - Fix: resolve issue with deleting data on uninstall
    348 - Fix: resolve JavaScript error when uninstall
    349 
    350 = 1.53.0 (August 6, 2024) =
    351 
    352 - Improvement: add quick & bulk edit for "disable" ads on post/pages
    353 - Fix: correct handling of conditions array when no conditions are set for an ad
    354 - Fix: add drafted ads to group statistics on the statistic page
     359= 1.54.0 (September 2, 2024) =
     360
     361- Improvement: enhance PubGuru one click integration
     362- Fix: prevent PHP warning when using ad debug
     363- Fix: readd drafted ads to group statistics on the statistic page
     364- Fix: resolve issue with ad blocker detection
  • advanced-ads/trunk/views/admin/metabox-pubguru-connect.php

    r3041809 r3145275  
    77 */
    88
    9 if ( false === $pubguru_config ) : ?>
     9use AdvancedAds\Modules\OneClick\Options;
    1010
    11 <div class="pubguru-not-connected space-y-4">
     11$header_bidding = Options::module( 'header_bidding' );
     12?>
     13<div class="pubguru-not-connected space-y-4<?php echo false === $pubguru_config ? '' : ' hidden'; ?>">
    1214    <label for="m2-connect-consent" class="flex items-center w-full">
    1315        <span class="self-start">
     
    2830
    2931    <div class="flex items-center gap-x-4">
    30         <button class="button button-primary js-pubguru-connect" disabled type="button"><?php esc_html_e( 'Connect PGHB', 'advanced-ads' ); ?></button>
     32        <button class="button button-primary js-pubguru-connecting" disabled type="button"><?php esc_html_e( 'Connect PGHB', 'advanced-ads' ); ?></button>
    3133        <div class="lds-ripple aa-spinner"><div></div><div></div></div>
    3234    </div>
    3335</div>
    34 <?php endif; ?>
    3536
    3637<div class="pubguru-connected<?php echo false === $pubguru_config ? ' hidden' : ''; ?>">
     
    4748            <div>
    4849                <label for="pubguru-header-bidding" class="advads-ui-switch">
    49                     <input type="checkbox" name="header_bidding" id="pubguru-header-bidding" class="sr-only peer" <?php checked( boolval( get_option( 'pubguru_module_header_bidding', false ) ) ); ?>>
     50                    <input type="checkbox" name="header_bidding" id="pubguru-header-bidding" class="sr-only peer" <?php checked( $header_bidding ); ?>>
    5051                    <div></div>
    5152                    <span>
     
    5556            </div>
    5657
    57             <div>
    58                 <label for="pubguru-tag-conversion" class="advads-ui-switch">
    59                     <input type="checkbox" name="tag_conversion" id="pubguru-tag-conversion" <?php checked( boolval( get_option( 'pubguru_module_tag_conversion', false ) ) ); ?> />
     58            <div<?php echo $header_bidding ? ' style="margin-left: 20px;"' : ' style="display: none;"'; ?>>
     59                <label for="pubguru-header-bidding-at-body" class="advads-ui-switch">
     60                    <input type="checkbox" name="header_bidding_at_body" id="pubguru-header-bidding-at-body" class="sr-only peer" <?php checked( Options::module( 'header_bidding_at_body' ) ); ?>>
    6061                    <div></div>
    6162                    <span>
    62                         <?php esc_html_e( 'Activate Tag Conversion', 'advanced-ads' ); ?>
     63                        <?php esc_html_e( 'Move the PubGuru Header Bidding script to the footer. Keep this option disabled to maximize revenue. Only enable it if PageSpeed is your priority.', 'advanced-ads' ); ?>
    6364                    </span>
    6465                </label>
     
    6768            <div>
    6869                <label for="pubguru-adstxt" class="advads-ui-switch">
    69                     <input type="checkbox" name="ads_txt" id="pubguru-adstxt" <?php checked( boolval( get_option( 'pubguru_module_ads_txt', false ) ) ); ?> />
     70                    <input type="checkbox" name="ads_txt" id="pubguru-adstxt" <?php checked( Options::module( 'ads_txt' ) ); ?> />
    7071                    <div></div>
    7172                    <span>
     
    8687            </div>
    8788
    88             <div>
     89            <div class="hidden">
    8990                <label for="pubguru-traffic-cop" class="advads-ui-switch">
    90                     <input type="checkbox" name="traffic_cop" id="pubguru-traffic-cop" <?php checked( boolval( get_option( 'pubguru_module_traffic_cop', false ) ) ); ?> />
     91                    <input type="checkbox" name="traffic_cop" id="pubguru-traffic-cop" <?php checked( Options::module( 'traffic_cop' ) ); ?> />
    9192                    <div></div>
    9293                    <span class="pg-tc-trail <?php echo $has_traffic_cop ? 'hidden' : ''; ?>">
     
    99100            </div>
    100101
     102            <div class="hidden">
     103                <label for="pubguru-tag-conversion" class="advads-ui-switch">
     104                    <input type="checkbox" name="tag_conversion" id="pubguru-tag-conversion" <?php checked( Options::module( 'tag_conversion' ) ); ?> />
     105                    <div></div>
     106                    <span>
     107                        <?php esc_html_e( 'Activate Tag Conversion', 'advanced-ads' ); ?>
     108                    </span>
     109                </label>
     110            </div>
     111
    101112        </div>
    102113
     
    104115
    105116</div>
     117
     118<?php
     119$session_key = get_option( 'advanced-ads-importer-history' );
     120if ( $session_key ) :
     121    $delete_link = wp_nonce_url(
     122        add_query_arg(
     123            [
     124                'action'      => 'advads_import_delete',
     125                'session_key' => $session_key,
     126            ]
     127        ),
     128        'advads_import_delete'
     129    );
     130    ?>
     131<div class="rollback-block">
     132    <header><?php esc_html_e( 'Rollback', 'advanced-ads' ); ?></header>
     133    <a href="<?php echo esc_url( $delete_link ); ?>" class="button-link !text-red-500"><?php esc_html_e( 'Rollback the api changes back to previous state.', 'advanced-ads' ); ?></a>
     134</div>
     135<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.