Plugin Directory

Changeset 3298118


Ignore:
Timestamp:
05/21/2025 01:36:01 PM (7 months ago)
Author:
advancedads
Message:

Update to version 2.0.9 from GitHub

Location:
advanced-ads
Files:
46 edited
1 copied

Legend:

Unmodified
Added
Removed
  • advanced-ads/tags/2.0.9/admin/includes/class-licenses.php

    r3257709 r3298118  
    88 */
    99
     10use AdvancedAds\Constants;
    1011use AdvancedAds\Utilities\Data;
    1112
     
    1617 */
    1718class Advanced_Ads_Admin_Licenses {
    18     /**
    19      * License API endpoint URL
    20      *
    21      * @const string
    22      */
    23     const API_ENDPOINT = 'https://wpadvancedads.com/license-api/';
    24 
    25     /**
    26      * Add-on slugs and their EDD ID
    27      *
    28      * @const array
    29      */
    30     const ADDON_SLUGS_ID = [
    31         'advanced-ads-gam'        => 215545,
    32         'advanced-ads-layer'      => 686,
    33         'advanced-ads-pro'        => 1742,
    34         'advanced-ads-responsive' => 678,
    35         'advanced-ads-selling'    => 35300,
    36         'advanced-ads-sticky'     => 683,
    37         'advanced-ads-tracking'   => 638,
    38     ];
    39 
    4019    /**
    4120     * Advanced_Ads_Admin_Licenses constructor.
     
    10685            'edd_action' => 'activate_license',
    10786            'license'    => $license_key,
    108             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     87            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    10988            'item_name'  => rawurlencode( $plugin_name ),
    11089            'url'        => home_url(),
     
    12099        // Call the custom API.
    121100        $response = wp_remote_post(
    122             self::API_ENDPOINT,
     101            Constants::API_ENDPOINT,
    123102            [
    124103                'timeout'   => 15,
     
    259238            'edd_action' => 'check_license',
    260239            'license'    => $license_key,
    261             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     240            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    262241            'item_name'  => rawurlencode( $plugin_name ),
    263242        ];
     
    315294            'edd_action' => 'deactivate_license',
    316295            'license'    => $license_key,
    317             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     296            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    318297            'item_name'  => rawurlencode( $plugin_name ),
    319298        ];
     
    321300        // Send the remote request.
    322301        $response = wp_remote_post(
    323             self::API_ENDPOINT,
     302            Constants::API_ENDPOINT,
    324303            [
    325304                'body'      => $api_params,
     
    484463     */
    485464    public function addon_upgrade_filter( $reply, $package, $updater ) {
     465        $key   = null;
     466        $value = null;
     467
    486468        if ( isset( $updater->skin->plugin ) ) {
    487             $plugin_file = $updater->skin->plugin;
     469            $key   = 'path';
     470            $value = $updater->skin->plugin;
    488471        } elseif ( isset( $updater->skin->plugin_info['Name'] ) ) {
    489             $add_on = $this->get_installed_add_on_by_name( $updater->skin->plugin_info['Name'] );
    490             // $add_on['path'] should always be set with out official plugins but might be missing for some local and custom made.
    491             if ( isset( $add_on['path'] ) ) {
    492                 $plugin_file = plugin_basename( $add_on['path'] );
    493             }
    494         }
    495 
    496         if ( isset( $plugin_file ) && $plugin_file ) {
    497             // if AJAX; show direct update link as first possible solution.
    498             if ( wp_doing_ajax() ) {
    499                 $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
    500                 /* translators: %s plugin update link */
    501                 $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
    502             } else {
    503                 /* translators: %s download failed knowledgebase link */
    504                 $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), 'https://wpadvancedads.com/manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
    505             }
     472            $key   = 'name';
     473            $value = $updater->skin->plugin_info['Name'];
     474        }
     475
     476        $add_on = $this->get_installed_add_on_by_key( $key, $value );
     477        if ( ! $add_on || ! isset( $add_on['path'] ) ) {
     478            return $reply;
     479        }
     480
     481        $plugin_file = plugin_basename( $add_on['path'] );
     482        if ( wp_doing_ajax() ) {
     483            $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
     484            /* translators: %s plugin update link */
     485            $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
     486        } else {
     487            /* translators: %s download failed knowledgebase link */
     488            $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), 'https://wpadvancedads.com/manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
    506489        }
    507490
     
    512495     * Search if a name is in the add-on array and return the add-on data of it
    513496     *
    514      * @param string $name name of an add-on.
     497     * @param string $key   key to search for.
     498     * @param string $value value to search for.
    515499     *
    516500     * @return  array    array with the add-on data
    517501     */
    518     private function get_installed_add_on_by_name( $name = '' ) {
     502    private function get_installed_add_on_by_key( $key, $value ) {
     503        // Early bail!!
     504        if ( empty( $key ) || empty( $value ) ) {
     505            return null;
     506        }
     507
    519508        $add_ons = Data::get_addons();
    520 
    521509        if ( is_array( $add_ons ) ) {
    522             foreach ( $add_ons as $key => $_add_on ) {
    523                 if ( $_add_on['name'] === $name ) {
    524                     return $_add_on;
     510            foreach ( $add_ons as $add_on ) {
     511                if ( $add_on[ $key ] === $value ) {
     512                    return $add_on;
    525513                }
    526514            }
     
    570558        // Early bail!!
    571559        if (
    572             self::API_ENDPOINT !== $url
     560            Constants::API_ENDPOINT !== $url
    573561            || (
    574562                empty( $parsed_args['body']['edd_action'] )
  • advanced-ads/tags/2.0.9/advanced-ads.php

    r3283205 r3298118  
    1111 * @wordpress-plugin
    1212 * Plugin Name:       Advanced Ads
    13  * Version:           2.0.8
     13 * Version:           2.0.9
    1414 * Description:       Manage and optimize your ads in WordPress
    1515 * Plugin URI:        https://wpadvancedads.com
     
    3838
    3939define( 'ADVADS_FILE', __FILE__ );
    40 define( 'ADVADS_VERSION', '2.0.8' );
     40define( 'ADVADS_VERSION', '2.0.9' );
    4141
    4242// Load the autoloader.
  • advanced-ads/tags/2.0.9/classes/display-conditions.php

    r3253289 r3298118  
    202202     *
    203203     * @param array $options options of the condition.
    204      * @param mixed $ad false or Ad object.
     204     * @param Ad    $ad Ad object.
    205205     *
    206206     * @return bool false, if ad can’t be delivered
    207207     */
    208     public static function frontend_check( $options = [], $ad = false ) {
     208    public static function frontend_check( $options = [], $ad ) {
     209        // Early bail!!
     210        if ( ! $ad ) {
     211            return true;
     212        }
     213
    209214        $display_conditions = self::get_instance()->conditions;
    210215
     
    936941            $operator = 'is';
    937942        }
    938 
    939         $post      = $ad->get_prop( 'ad_args.post' );
     943        $post      = $ad->get_prop( 'ad_args.post' ) ?? null;
    940944        $post_type = $post['post_type'] ?? false;
    941945
  • advanced-ads/tags/2.0.9/classes/frontend_checks.php

    r3253289 r3298118  
    8686     */
    8787    public function enqueue_scripts() {
    88         if ( advads_is_amp() ) {
     88        if ( Conditional::is_amp() ) {
    8989            return;
    9090        }
     
    458458        $notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
    459459
    460         if ( ! advads_is_amp() ) {
     460        if ( ! Conditional::is_amp() ) {
    461461            $warnings = 0; // Will be updated using JS.
    462462        } else {
     
    679679            echo ob_get_clean();
    680680
    681         if ( advads_is_amp() ) {
     681        if ( Conditional::is_amp() ) {
    682682            return;
    683683        }
     
    10681068        }
    10691069
    1070         if ( advads_is_amp() ) {
     1070        if ( Conditional::is_amp() ) {
    10711071            return $content;
    10721072        }
  • advanced-ads/tags/2.0.9/includes/admin/class-addon-updater.php

    r3257709 r3298118  
    1010namespace AdvancedAds\Admin;
    1111
     12use AdvancedAds\Constants;
     13use AdvancedAds\Utilities\Data;
    1214use Advanced_Ads_Admin_Licenses;
    13 use AdvancedAds\Utilities\Data;
    1415use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1516
     
    7374
    7475            ( new EDD_Updater(
    75                 Advanced_Ads_Admin_Licenses::API_ENDPOINT,
     76                Constants::API_ENDPOINT,
    7677                $_add_on['path'],
    7778                [
    7879                    'version' => $_add_on['version'],
    7980                    'license' => $license_key,
    80                     'item_id' => Advanced_Ads_Admin_Licenses::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     81                    'item_id' => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    8182                    'author'  => 'Advanced Ads',
    8283                ]
  • advanced-ads/tags/2.0.9/includes/class-constants.php

    r3283205 r3298118  
    175175        '1.1.0'  => 'advanced-ads-browser-language',   // Browser Language.
    176176    ];
     177
     178    /**
     179     * License API endpoint URL
     180     *
     181     * @const string
     182     */
     183    const API_ENDPOINT = 'https://wpadvancedads.com/license-api/';
     184
     185    /**
     186     * Add-on slugs and their EDD ID
     187     *
     188     * @const array
     189     */
     190    const ADDON_SLUGS_ID = [
     191        'advanced-ads-gam'        => 215545,
     192        'advanced-ads-layer'      => 686,
     193        'advanced-ads-pro'        => 1742,
     194        'advanced-ads-responsive' => 678,
     195        'advanced-ads-selling'    => 35300,
     196        'advanced-ads-sticky'     => 683,
     197        'advanced-ads-tracking'   => 638,
     198        'slider-ads'              => 1168,
     199    ];
    177200}
  • advanced-ads/tags/2.0.9/includes/frontend/class-ad-display-condition.php

    r3253289 r3298118  
    3636
    3737    /**
    38      * Check if ads are disabled.
    39      *
    40      * @return bool
    41      */
    42     public function is_ad_disabled(): bool {
    43         return defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED;
    44     }
    45 
    46     /**
    4738     * Get the disabled id.
    4839     *
     
    7162
    7263        // Early bail!!
    73         if ( $this->is_ad_disabled() ) {
     64        if ( Conditional::is_ad_disabled() ) {
    7465            return;
    7566        }
  • advanced-ads/tags/2.0.9/includes/frontend/class-manager.php

    r3253289 r3298118  
    1010namespace AdvancedAds\Frontend;
    1111
     12use AdvancedAds\Utilities\Conditional;
    1213use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1314
     
    6061        $this->page_display->run_checks();
    6162
    62         if ( ! $this->page_display->is_ad_disabled() ) {
     63        if ( ! Conditional::is_ad_disabled() ) {
    6364            do_action( 'advanced-ads-frontend' );
    6465        }
  • advanced-ads/tags/2.0.9/includes/frontend/class-scripts.php

    r3253289 r3298118  
    1414use Advanced_Ads_Privacy;
    1515use AdvancedAds\Utilities\WordPress;
     16use AdvancedAds\Utilities\Conditional;
    1617use AdvancedAds\Framework\Utilities\Params;
    1718use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    4142     */
    4243    public function enqueue_scripts(): void {
    43         if ( advads_is_amp() ) {
     44        if ( Conditional::is_amp() ) {
    4445            return;
    4546        }
     
    99100        );
    100101
    101         if ( advads_is_amp() ) {
     102        if ( Conditional::is_amp() ) {
    102103            return;
    103104        }
     
    136137     */
    137138    public function print_footer_scripts(): void {
    138         if ( advads_is_amp() ) {
     139        if ( Conditional::is_amp() ) {
    139140            return;
    140141        }
  • advanced-ads/tags/2.0.9/includes/importers/class-manager.php

    r3145275 r3298118  
    1212use WP_Error;
    1313use AdvancedAds\Utilities\WordPress;
     14use AdvancedAds\Utilities\Conditional;
    1415use AdvancedAds\Framework\Utilities\Params;
    1516use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    6970    public function handle_action(): void {
    7071        // Early bail!!
     72        if ( ! Conditional::user_cap( 'advanced_ads_edit_ads' ) ) {
     73            return;
     74        }
     75
    7176        $action = WordPress::current_action();
    7277
  • advanced-ads/tags/2.0.9/includes/utilities/class-conditional.php

    r3253289 r3298118  
    121121
    122122    /**
     123     * Check if ads are disabled.
     124     *
     125     * @return bool
     126     */
     127    public static function is_ad_disabled(): bool {
     128        return defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED;
     129    }
     130
     131    /**
    123132     * Check if any add-on is activated
    124133     *
    125134     * @return bool true if there is any add-on activated
    126135     */
    127     public static function is_any_addon_activated() {
     136    public static function is_any_addon_activated(): bool {
    128137        return has_action( 'advanced-ads-loaded' );
     138    }
     139
     140    /**
     141     * Check if the current page is an AMP page.
     142     *
     143     * @return bool
     144     */
     145    public static function is_amp(): bool {
     146        return function_exists( 'advads_is_amp' ) && advads_is_amp();
    129147    }
    130148
     
    136154    public static function is_ua_bot(): bool {
    137155        // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page.
    138         if ( advads_is_amp() ) {
     156        if ( self::is_amp() ) {
    139157            return false;
    140158        }
  • advanced-ads/tags/2.0.9/includes/utilities/class-data.php

    r3257709 r3298118  
    4444                'advanced-ads-sticky',
    4545                'advanced-ads-tracking',
     46                'slider-ads',
    4647            ];
    4748
  • advanced-ads/tags/2.0.9/languages/advanced-ads.pot

    r3283205 r3298118  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 2.0.7\n"
     5"Project-Id-Version: Advanced Ads 2.0.8\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: 2025-04-28T07:32:04+00:00\n"
     12"POT-Creation-Date: 2025-05-21T13:33:32+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    280280msgstr ""
    281281
    282 #: admin/includes/class-licenses.php:86
     282#: admin/includes/class-licenses.php:65
    283283msgid "Error while trying to register the license. Please contact support."
    284284msgstr ""
    285285
    286 #: admin/includes/class-licenses.php:91
     286#: admin/includes/class-licenses.php:70
    287287#: admin/views/setting-license.php:84
    288288msgid "Please enter a valid license key"
    289289msgstr ""
    290290
    291 #: admin/includes/class-licenses.php:132
    292 #: admin/includes/class-licenses.php:333
     291#: admin/includes/class-licenses.php:111
     292#: admin/includes/class-licenses.php:312
    293293msgid "The license status does not change as long as ADVANCED_ADS_SHOW_LICENSE_RESPONSE is enabled in wp-config.php."
    294294msgstr ""
    295295
     296#: admin/includes/class-licenses.php:130
     297msgid "License couldn’t be activated. Please try again later."
     298msgstr ""
     299
     300#: admin/includes/class-licenses.php:149
     301msgid "This is the bundle license key."
     302msgstr ""
     303
     304#: admin/includes/class-licenses.php:150
     305msgid "This is not the correct key for this add-on."
     306msgstr ""
     307
    296308#: admin/includes/class-licenses.php:151
    297 msgid "License couldn’t be activated. Please try again later."
    298 msgstr ""
    299 
    300 #: admin/includes/class-licenses.php:170
    301 msgid "This is the bundle license key."
    302 msgstr ""
    303 
    304 #: admin/includes/class-licenses.php:171
    305 msgid "This is not the correct key for this add-on."
    306 msgstr ""
    307 
    308 #: admin/includes/class-licenses.php:172
    309309msgid "There are no activations left."
    310310msgstr ""
    311311
    312312#. translators: %1$s is a starting link tag, %2$s is the closing one.
    313 #: admin/includes/class-licenses.php:176
     313#: admin/includes/class-licenses.php:155
    314314msgid "You can manage activations in %1$syour account%2$s."
    315315msgstr ""
    316316
    317317#. translators: %1$s is a starting link tag, %2$s is the closing one.
    318 #: admin/includes/class-licenses.php:182
     318#: admin/includes/class-licenses.php:161
    319319msgid "%1$sUpgrade%2$s for more activations."
    320320msgstr ""
    321321
    322322#. translators: %s is a string containing information about the issue.
    323 #: admin/includes/class-licenses.php:196
     323#: admin/includes/class-licenses.php:175
    324324msgid "License is invalid. Reason: %s"
    325325msgstr ""
    326326
    327327#. translators: %s is a list of server information like IP address. Just keep it as is.
    328 #: admin/includes/class-licenses.php:236
     328#: admin/includes/class-licenses.php:215
    329329msgid "Your request was blocked by our firewall. Please send us the following information to unblock you: %s."
    330330msgstr ""
    331331
    332 #: admin/includes/class-licenses.php:299
     332#: admin/includes/class-licenses.php:278
    333333msgid "Error while trying to disable the license. Please contact support."
    334334msgstr ""
    335335
    336 #: admin/includes/class-licenses.php:342
    337 #: admin/includes/class-licenses.php:366
     336#: admin/includes/class-licenses.php:321
     337#: admin/includes/class-licenses.php:345
    338338msgid "License couldn’t be deactivated. Please try again later."
    339339msgstr ""
    340340
    341341#. translators: %s plugin update link
    342 #: admin/includes/class-licenses.php:501
     342#: admin/includes/class-licenses.php:485
    343343msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
    344344msgstr ""
    345345
    346346#. translators: %s download failed knowledgebase link
    347 #: admin/includes/class-licenses.php:504
     347#: admin/includes/class-licenses.php:488
    348348msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
    349349msgstr ""
    350350
    351 #: admin/includes/class-licenses.php:661
     351#: admin/includes/class-licenses.php:649
    352352msgid "License deactivated. Please try again later."
    353353msgstr ""
     
    521521#: admin/views/conditions/condition-string.php:9
    522522#: admin/views/notices/adblock.php:11
    523 #: classes/display-conditions.php:914
     523#: classes/display-conditions.php:919
    524524#: includes/admin/metaboxes/class-ad-layout.php:63
    525525#: includes/admin/metaboxes/class-ad-types.php:63
     
    11271127msgstr ""
    11281128
    1129 #: classes/display-conditions.php:280
     1129#: classes/display-conditions.php:285
    11301130msgid "parent page"
    11311131msgstr ""
    11321132
    1133 #: classes/display-conditions.php:281
     1133#: classes/display-conditions.php:286
    11341134msgid "post meta"
    11351135msgstr ""
    11361136
    1137 #: classes/display-conditions.php:282
     1137#: classes/display-conditions.php:287
    11381138msgid "page template"
    11391139msgstr ""
    11401140
    1141 #: classes/display-conditions.php:283
     1141#: classes/display-conditions.php:288
    11421142msgid "url parameters"
    11431143msgstr ""
    11441144
    1145 #: classes/display-conditions.php:286
     1145#: classes/display-conditions.php:291
    11461146msgid "accelerated mobile pages"
    11471147msgstr ""
    11481148
    1149 #: classes/display-conditions.php:310
     1149#: classes/display-conditions.php:315
    11501150#: classes/visitor-conditions.php:318
    11511151#: includes/admin/class-assets.php:130
     
    11561156msgstr ""
    11571157
    1158 #: classes/display-conditions.php:310
     1158#: classes/display-conditions.php:315
    11591159#: classes/visitor-conditions.php:318
    11601160#: includes/admin/class-assets.php:131
     
    11621162msgstr ""
    11631163
    1164 #: classes/display-conditions.php:639
     1164#: classes/display-conditions.php:644
    11651165msgctxt "display the terms search field on ad edit page"
    11661166msgid "add more terms"
    11671167msgstr ""
    11681168
    1169 #: classes/display-conditions.php:645
     1169#: classes/display-conditions.php:650
    11701170msgid "term name or id"
    11711171msgstr ""
    11721172
    1173 #: classes/display-conditions.php:727
     1173#: classes/display-conditions.php:732
    11741174msgid "ID"
    11751175msgstr ""
    11761176
    1177 #: classes/display-conditions.php:727
     1177#: classes/display-conditions.php:732
    11781178#: includes/admin/class-placement-edit-modal.php:120
    11791179#: views/admin/placements/quick-edit.php:14
     
    11821182msgstr ""
    11831183
    1184 #: classes/display-conditions.php:729
     1184#: classes/display-conditions.php:734
    11851185#: includes/abstracts/abstract-ad.php:830
    11861186#: includes/admin/class-groups-list-table.php:362
     
    11901190msgstr ""
    11911191
    1192 #: classes/display-conditions.php:731
     1192#: classes/display-conditions.php:736
    11931193#: includes/admin/class-groups-list-table.php:362
    11941194#: views/admin/tables/ads/column-date.php:18
     
    11961196msgstr ""
    11971197
    1198 #: classes/display-conditions.php:753
     1198#: classes/display-conditions.php:758
    11991199msgid "title or id"
    12001200msgstr ""
    12011201
    1202 #: classes/display-conditions.php:827
     1202#: classes/display-conditions.php:832
    12031203#: includes/array_ad_conditions.php:59
    12041204msgid "Home Page"
    12051205msgstr ""
    12061206
    1207 #: classes/display-conditions.php:828
     1207#: classes/display-conditions.php:833
    12081208#: includes/array_ad_conditions.php:60
    12091209msgid "show on Home page"
    12101210msgstr ""
    12111211
    1212 #: classes/display-conditions.php:832
     1212#: classes/display-conditions.php:837
    12131213#: includes/array_ad_conditions.php:64
    12141214msgid "Singular Pages"
    12151215msgstr ""
    12161216
    1217 #: classes/display-conditions.php:833
     1217#: classes/display-conditions.php:838
    12181218#: includes/array_ad_conditions.php:65
    12191219msgid "show on singular pages/posts"
    12201220msgstr ""
    12211221
    1222 #: classes/display-conditions.php:837
     1222#: classes/display-conditions.php:842
    12231223#: includes/array_ad_conditions.php:69
    12241224msgid "Archive Pages"
    12251225msgstr ""
    12261226
    1227 #: classes/display-conditions.php:838
     1227#: classes/display-conditions.php:843
    12281228#: includes/array_ad_conditions.php:70
    12291229msgid "show on any type of archive page (category, tag, author and date)"
    12301230msgstr ""
    12311231
    1232 #: classes/display-conditions.php:842
     1232#: classes/display-conditions.php:847
    12331233#: includes/array_ad_conditions.php:74
    12341234msgid "Search Results"
    12351235msgstr ""
    12361236
    1237 #: classes/display-conditions.php:843
     1237#: classes/display-conditions.php:848
    12381238#: includes/array_ad_conditions.php:75
    12391239msgid "show on search result pages"
    12401240msgstr ""
    12411241
    1242 #: classes/display-conditions.php:847
     1242#: classes/display-conditions.php:852
    12431243#: includes/array_ad_conditions.php:79
    12441244msgid "404 Page"
    12451245msgstr ""
    12461246
    1247 #: classes/display-conditions.php:848
     1247#: classes/display-conditions.php:853
    12481248#: includes/array_ad_conditions.php:80
    12491249msgid "show on 404 error page"
    12501250msgstr ""
    12511251
    1252 #: classes/display-conditions.php:852
     1252#: classes/display-conditions.php:857
    12531253#: includes/array_ad_conditions.php:84
    12541254msgid "Attachment Pages"
    12551255msgstr ""
    12561256
    1257 #: classes/display-conditions.php:853
     1257#: classes/display-conditions.php:858
    12581258#: includes/array_ad_conditions.php:85
    12591259msgid "show on attachment pages"
    12601260msgstr ""
    12611261
    1262 #: classes/display-conditions.php:857
     1262#: classes/display-conditions.php:862
    12631263#: includes/array_ad_conditions.php:89
    12641264msgid "Secondary Queries"
    12651265msgstr ""
    12661266
    1267 #: classes/display-conditions.php:858
     1267#: classes/display-conditions.php:863
    12681268#: includes/array_ad_conditions.php:90
    12691269msgid "allow ads in secondary queries"
    12701270msgstr ""
    12711271
    1272 #: classes/display-conditions.php:862
     1272#: classes/display-conditions.php:867
    12731273msgid "RSS Feed"
    12741274msgstr ""
    12751275
    1276 #: classes/display-conditions.php:863
     1276#: classes/display-conditions.php:868
    12771277msgid "allow ads in RSS Feed"
    12781278msgstr ""
    12791279
    1280 #: classes/display-conditions.php:867
     1280#: classes/display-conditions.php:872
    12811281msgid "REST API"
    12821282msgstr ""
    12831283
    1284 #: classes/display-conditions.php:868
     1284#: classes/display-conditions.php:873
    12851285msgid "allow ads in REST API"
    12861286msgstr ""
    12871287
    1288 #: classes/display-conditions.php:903
     1288#: classes/display-conditions.php:908
    12891289msgid "older than"
    12901290msgstr ""
    12911291
    1292 #: classes/display-conditions.php:904
     1292#: classes/display-conditions.php:909
    12931293msgid "younger than"
    12941294msgstr ""
    12951295
    1296 #: classes/display-conditions.php:909
     1296#: classes/display-conditions.php:914
    12971297msgid "days"
    12981298msgstr ""
    12991299
    1300 #: classes/display-conditions.php:912
     1300#: classes/display-conditions.php:917
    13011301msgid "Display ads based on the age of a page or post."
    13021302msgstr ""
     
    16041604#: includes/abstracts/abstract-placement-type.php:63
    16051605#: includes/class-widget.php:128
    1606 #: includes/utilities/class-data.php:295
     1606#: includes/utilities/class-data.php:296
    16071607#: modules/gutenberg/includes/class-gutenberg.php:136
    16081608#: views/admin/tables/ads/filters.php:75
     
    16161616#: includes/class-entities.php:44
    16171617#: includes/class-widget.php:135
    1618 #: includes/utilities/class-data.php:288
     1618#: includes/utilities/class-data.php:289
    16191619#: modules/gutenberg/includes/class-gutenberg.php:135
    16201620#: views/admin/tables/groups/edit-form-modal.php:113
     
    19211921
    19221922#. Translators: 1: add-on name 2: admin URL to license page
    1923 #: includes/admin/class-addon-updater.php:131
     1923#: includes/admin/class-addon-updater.php:132
    19241924msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
    19251925msgstr ""
     
    21702170#: includes/admin/class-list-filters.php:122
    21712171#: modules/gadsense/admin/views/adsense-ad-parameters.php:131
    2172 #: modules/gadsense/includes/class-ad-type-adsense.php:30
     2172#: modules/gadsense/includes/class-ad-type-adsense.php:31
    21732173msgid "Responsive"
    21742174msgstr ""
     
    29132913#: includes/admin/pages/class-placements.php:44
    29142914#: includes/class-widget.php:121
    2915 #: includes/utilities/class-data.php:302
     2915#: includes/utilities/class-data.php:303
    29162916#: modules/gutenberg/includes/class-gutenberg.php:137
    29172917#: views/admin/tables/ads/column-used.php:34
     
    32783278
    32793279#: includes/class-widget.php:119
    3280 #: includes/utilities/class-data.php:286
     3280#: includes/utilities/class-data.php:287
    32813281#: modules/gutenberg/includes/class-gutenberg.php:133
    32823282msgid "--empty--"
     
    34383438msgstr ""
    34393439
    3440 #: includes/importers/class-manager.php:104
     3440#: includes/importers/class-manager.php:109
    34413441msgid "History deleted successfully."
    34423442msgstr ""
     
    41164116
    41174117#: modules/gadsense/admin/views/adsense-account.php:135
    4118 #: modules/gadsense/includes/class-ad-type-adsense.php:95
     4118#: modules/gadsense/includes/class-ad-type-adsense.php:96
    41194119#: modules/gadsense/includes/types/type-adsense.php:142
    41204120msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
     
    42114211
    42124212#: modules/gadsense/admin/views/adsense-ad-parameters.php:132
    4213 #: modules/gadsense/includes/class-ad-type-adsense.php:31
     4213#: modules/gadsense/includes/class-ad-type-adsense.php:32
    42144214msgid "Multiplex"
    42154215msgstr ""
    42164216
    42174217#: modules/gadsense/admin/views/adsense-ad-parameters.php:134
    4218 #: modules/gadsense/includes/class-ad-type-adsense.php:32
     4218#: modules/gadsense/includes/class-ad-type-adsense.php:33
    42194219msgid "Link ads"
    42204220msgstr ""
    42214221
    42224222#: modules/gadsense/admin/views/adsense-ad-parameters.php:137
    4223 #: modules/gadsense/includes/class-ad-type-adsense.php:33
     4223#: modules/gadsense/includes/class-ad-type-adsense.php:34
    42244224msgid "Link ads (Responsive)"
    42254225msgstr ""
    42264226
    42274227#: modules/gadsense/admin/views/adsense-ad-parameters.php:139
    4228 #: modules/gadsense/includes/class-ad-type-adsense.php:34
     4228#: modules/gadsense/includes/class-ad-type-adsense.php:35
    42294229msgid "In-article"
    42304230msgstr ""
    42314231
    42324232#: modules/gadsense/admin/views/adsense-ad-parameters.php:140
    4233 #: modules/gadsense/includes/class-ad-type-adsense.php:35
     4233#: modules/gadsense/includes/class-ad-type-adsense.php:36
    42344234msgid "In-feed"
    42354235msgstr ""
     
    43864386msgstr ""
    43874387
    4388 #: modules/gadsense/includes/class-ad-type-adsense.php:29
    4389 #: modules/gadsense/includes/class-ad-type-adsense.php:47
     4388#: modules/gadsense/includes/class-ad-type-adsense.php:30
     4389#: modules/gadsense/includes/class-ad-type-adsense.php:48
    43904390msgid "Normal"
    43914391msgstr ""
    43924392
    4393 #: modules/gadsense/includes/class-ad-type-adsense.php:136
     4393#: modules/gadsense/includes/class-ad-type-adsense.php:137
    43944394#: modules/gadsense/includes/types/type-adsense.php:183
    43954395msgid "Your AdSense Publisher ID is missing."
     
    50125012msgstr ""
    50135013
    5014 #: public/views/ad-debug.php:20
     5014#: public/views/ad-debug.php:22
    50155015msgid "Ad debug output"
    50165016msgstr ""
    50175017
    5018 #: public/views/ad-debug.php:24
     5018#: public/views/ad-debug.php:26
    50195019msgid "Find solutions in the manual"
    50205020msgstr ""
  • advanced-ads/tags/2.0.9/modules/adblock-finder/public/public.php

    r3253289 r3298118  
    77 */
    88
     9use AdvancedAds\Options;
     10use AdvancedAds\Utilities\Conditional;
    911use AdvancedAds\Framework\Utilities\Arr;
    10 use AdvancedAds\Options;
    1112
    1213/**
     
    2930     */
    3031    public function print_adblock_check_js() {
    31         if ( advads_is_amp() ) {
     32        if ( Conditional::is_amp() ) {
    3233            return;
    3334        }
  • advanced-ads/tags/2.0.9/modules/gadsense/includes/class-ad-type-adsense.php

    r3253289 r3298118  
    1111
    1212use AdvancedAds\Abstracts\Ad;
     13use AdvancedAds\Utilities\Conditional;
    1314use AdvancedAds\Interfaces\Ad_Interface;
    1415
     
    263264
    264265        // Prevent output on AMP pages.
    265         if ( advads_is_amp() ) {
     266        if ( Conditional::is_amp() ) {
    266267            return '';
    267268        }
  • advanced-ads/tags/2.0.9/modules/gadsense/public/public.php

    r3253289 r3298118  
    11<?php // phpcs:ignore WordPress.Files.FileName
     2
     3use AdvancedAds\Utilities\Conditional;
    24
    35/**
     
    5557        }
    5658
    57         if ( defined( 'ADVADS_ADS_DISABLED' ) || advads_is_amp() ) {
     59        if ( Conditional::is_ad_disabled() || Conditional::is_amp() ) {
    5860            return;
    5961        }
     
    149151
    150152        if (
    151             // check if ads are disabled.
    152             ( defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED )
     153            Conditional::is_ad_disabled()
    153154            // check if this an AMP page, we're inside `wp` action so it's safe to use.
    154             || ( ! function_exists( 'advads_is_amp' ) || ! advads_is_amp() )
     155            || ! Conditional::is_amp()
    155156        ) {
    156157            return;
  • advanced-ads/tags/2.0.9/modules/privacy/classes/class-privacy.php

    r3253289 r3298118  
    22
    33use AdvancedAds\Abstracts\Ad;
     4use AdvancedAds\Utilities\Conditional;
     5use AdvancedAds\Framework\Utilities\Str;
    46use AdvancedAds\Framework\Utilities\Params;
    5 use AdvancedAds\Framework\Utilities\Str;
    67
    78/**
     
    5758    public function final_ad_output( $output, Ad $ad ) {
    5859        if (
    59             advads_is_amp() ||
     60            Conditional::is_amp() ||
    6061            ! $this->ad_type_needs_consent( $ad->get_type() ) ||
    6162            ( ! $ad->is_type( 'adsense' ) && $ad->get_prop( 'privacy.ignore-consent' ) )
     
    239240     */
    240241    private function parse_state() {
    241         if ( empty( $this->options['enabled'] ) || advads_is_amp() ) {
     242        if ( empty( $this->options['enabled'] ) || Conditional::is_amp() ) {
    242243            return 'not_needed';
    243244        }
  • advanced-ads/tags/2.0.9/packages/autoload.php

    r2983598 r3298118  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • advanced-ads/tags/2.0.9/packages/composer/InstalledVersions.php

    r3265208 r3298118  
    2727class InstalledVersions
    2828{
     29    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
    2935    /**
    3036     * @var mixed[]|null
     
    324330
    325331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
     341    }
     342
     343    /**
    326344     * @return array[]
    327345     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     
    337355
    338356        if (self::$canGetVendors) {
    339             $selfDir = strtr(__DIR__, '\\', '/');
     357            $selfDir = self::getSelfDir();
    340358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    341359                $vendorDir = strtr($vendorDir, '\\', '/');
  • advanced-ads/tags/2.0.9/public/class-advanced-ads.php

    r3257709 r3298118  
    397397        $injection_enabled = $options['content-injection-enabled'] ?? 'off';
    398398
    399         if ( ( $injection_enabled === 'off' || 0 === $archive_injection_count ) && ( ! is_singular( $public_post_types ) || ( ! advads_is_amp() && ! $this->in_the_loop() && ! $this->was_in_the_loop ) ) ) {
     399        if ( ( $injection_enabled === 'off' || 0 === $archive_injection_count ) && ( ! is_singular( $public_post_types ) || ( ! Conditional::is_amp() && ! $this->in_the_loop() && ! $this->was_in_the_loop ) ) ) {
    400400            return false;
    401401        }
     
    425425         * @return bool `true` if ads are disabled
    426426         */
    427         $ads_disabled = apply_filters( 'advanced-ads-disabled-ads', defined( 'ADVADS_ADS_DISABLED' ), $options );
     427        $ads_disabled = apply_filters( 'advanced-ads-disabled-ads', Conditional::is_ad_disabled(), $options );
    428428
    429429        if ( $ads_disabled ) {
  • advanced-ads/tags/2.0.9/public/views/ad-debug.php

    r3253289 r3298118  
    1212 */
    1313
    14 if ( ! advads_is_amp() ) :
     14use AdvancedAds\Utilities\Conditional;
     15
     16if ( ! Conditional::is_amp() ) :
    1517    ob_start();
    1618        echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  • advanced-ads/tags/2.0.9/readme.txt

    r3283205 r3298118  
    33Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.7
    5 Tested up to: 6.7
     5Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 2.0.8
     7Stable tag: 2.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    361361== Changelog ==
    362362
     363= 2.0.9 (May 21, 2025) =
     364
     365- Improvement: improve amp conditions
     366- Improvement: Test plugin compatibility with WordPress 6.8.
     367- Improvement: add capability check in importer
     368- Improvement: standardize `ADVADS_ADS_DISABLED` check
     369- Improvement: null checks before accessing ad properties
     370- Fix: update failure help link only for Advanced Ads add-ons
     371
    363372= 2.0.8 (April 28, 2025) =
    364373
  • advanced-ads/tags/2.0.9/wp.advads

    r3283205 r3298118  
    33    "name": "Advanced Ads",
    44    "description": "Manage and optimize your ads in WordPress",
    5     "version": "2.0.8",
     5    "version": "2.0.9",
    66    "requireWP": "5.7",
    77    "requirePHP": "7.4",
  • advanced-ads/trunk/admin/includes/class-licenses.php

    r3257709 r3298118  
    88 */
    99
     10use AdvancedAds\Constants;
    1011use AdvancedAds\Utilities\Data;
    1112
     
    1617 */
    1718class Advanced_Ads_Admin_Licenses {
    18     /**
    19      * License API endpoint URL
    20      *
    21      * @const string
    22      */
    23     const API_ENDPOINT = 'https://wpadvancedads.com/license-api/';
    24 
    25     /**
    26      * Add-on slugs and their EDD ID
    27      *
    28      * @const array
    29      */
    30     const ADDON_SLUGS_ID = [
    31         'advanced-ads-gam'        => 215545,
    32         'advanced-ads-layer'      => 686,
    33         'advanced-ads-pro'        => 1742,
    34         'advanced-ads-responsive' => 678,
    35         'advanced-ads-selling'    => 35300,
    36         'advanced-ads-sticky'     => 683,
    37         'advanced-ads-tracking'   => 638,
    38     ];
    39 
    4019    /**
    4120     * Advanced_Ads_Admin_Licenses constructor.
     
    10685            'edd_action' => 'activate_license',
    10786            'license'    => $license_key,
    108             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     87            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    10988            'item_name'  => rawurlencode( $plugin_name ),
    11089            'url'        => home_url(),
     
    12099        // Call the custom API.
    121100        $response = wp_remote_post(
    122             self::API_ENDPOINT,
     101            Constants::API_ENDPOINT,
    123102            [
    124103                'timeout'   => 15,
     
    259238            'edd_action' => 'check_license',
    260239            'license'    => $license_key,
    261             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     240            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    262241            'item_name'  => rawurlencode( $plugin_name ),
    263242        ];
     
    315294            'edd_action' => 'deactivate_license',
    316295            'license'    => $license_key,
    317             'item_id'    => self::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     296            'item_id'    => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    318297            'item_name'  => rawurlencode( $plugin_name ),
    319298        ];
     
    321300        // Send the remote request.
    322301        $response = wp_remote_post(
    323             self::API_ENDPOINT,
     302            Constants::API_ENDPOINT,
    324303            [
    325304                'body'      => $api_params,
     
    484463     */
    485464    public function addon_upgrade_filter( $reply, $package, $updater ) {
     465        $key   = null;
     466        $value = null;
     467
    486468        if ( isset( $updater->skin->plugin ) ) {
    487             $plugin_file = $updater->skin->plugin;
     469            $key   = 'path';
     470            $value = $updater->skin->plugin;
    488471        } elseif ( isset( $updater->skin->plugin_info['Name'] ) ) {
    489             $add_on = $this->get_installed_add_on_by_name( $updater->skin->plugin_info['Name'] );
    490             // $add_on['path'] should always be set with out official plugins but might be missing for some local and custom made.
    491             if ( isset( $add_on['path'] ) ) {
    492                 $plugin_file = plugin_basename( $add_on['path'] );
    493             }
    494         }
    495 
    496         if ( isset( $plugin_file ) && $plugin_file ) {
    497             // if AJAX; show direct update link as first possible solution.
    498             if ( wp_doing_ajax() ) {
    499                 $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
    500                 /* translators: %s plugin update link */
    501                 $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
    502             } else {
    503                 /* translators: %s download failed knowledgebase link */
    504                 $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), 'https://wpadvancedads.com/manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
    505             }
     472            $key   = 'name';
     473            $value = $updater->skin->plugin_info['Name'];
     474        }
     475
     476        $add_on = $this->get_installed_add_on_by_key( $key, $value );
     477        if ( ! $add_on || ! isset( $add_on['path'] ) ) {
     478            return $reply;
     479        }
     480
     481        $plugin_file = plugin_basename( $add_on['path'] );
     482        if ( wp_doing_ajax() ) {
     483            $update_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin_file, 'upgrade-plugin_' . $plugin_file );
     484            /* translators: %s plugin update link */
     485            $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s">Click here to try another method</a>.', 'advanced-ads' ), $update_link );
     486        } else {
     487            /* translators: %s download failed knowledgebase link */
     488            $updater->strings['download_failed'] = sprintf( __( 'Download failed. <a href="%s" target="_blank">Click here to learn why</a>.', 'advanced-ads' ), 'https://wpadvancedads.com/manual/download-failed-updating-add-ons/#utm_source=advanced-ads&utm_medium=link&utm_campaign=download-failed' );
    506489        }
    507490
     
    512495     * Search if a name is in the add-on array and return the add-on data of it
    513496     *
    514      * @param string $name name of an add-on.
     497     * @param string $key   key to search for.
     498     * @param string $value value to search for.
    515499     *
    516500     * @return  array    array with the add-on data
    517501     */
    518     private function get_installed_add_on_by_name( $name = '' ) {
     502    private function get_installed_add_on_by_key( $key, $value ) {
     503        // Early bail!!
     504        if ( empty( $key ) || empty( $value ) ) {
     505            return null;
     506        }
     507
    519508        $add_ons = Data::get_addons();
    520 
    521509        if ( is_array( $add_ons ) ) {
    522             foreach ( $add_ons as $key => $_add_on ) {
    523                 if ( $_add_on['name'] === $name ) {
    524                     return $_add_on;
     510            foreach ( $add_ons as $add_on ) {
     511                if ( $add_on[ $key ] === $value ) {
     512                    return $add_on;
    525513                }
    526514            }
     
    570558        // Early bail!!
    571559        if (
    572             self::API_ENDPOINT !== $url
     560            Constants::API_ENDPOINT !== $url
    573561            || (
    574562                empty( $parsed_args['body']['edd_action'] )
  • advanced-ads/trunk/advanced-ads.php

    r3283205 r3298118  
    1111 * @wordpress-plugin
    1212 * Plugin Name:       Advanced Ads
    13  * Version:           2.0.8
     13 * Version:           2.0.9
    1414 * Description:       Manage and optimize your ads in WordPress
    1515 * Plugin URI:        https://wpadvancedads.com
     
    3838
    3939define( 'ADVADS_FILE', __FILE__ );
    40 define( 'ADVADS_VERSION', '2.0.8' );
     40define( 'ADVADS_VERSION', '2.0.9' );
    4141
    4242// Load the autoloader.
  • advanced-ads/trunk/classes/display-conditions.php

    r3253289 r3298118  
    202202     *
    203203     * @param array $options options of the condition.
    204      * @param mixed $ad false or Ad object.
     204     * @param Ad    $ad Ad object.
    205205     *
    206206     * @return bool false, if ad can’t be delivered
    207207     */
    208     public static function frontend_check( $options = [], $ad = false ) {
     208    public static function frontend_check( $options = [], $ad ) {
     209        // Early bail!!
     210        if ( ! $ad ) {
     211            return true;
     212        }
     213
    209214        $display_conditions = self::get_instance()->conditions;
    210215
     
    936941            $operator = 'is';
    937942        }
    938 
    939         $post      = $ad->get_prop( 'ad_args.post' );
     943        $post      = $ad->get_prop( 'ad_args.post' ) ?? null;
    940944        $post_type = $post['post_type'] ?? false;
    941945
  • advanced-ads/trunk/classes/frontend_checks.php

    r3253289 r3298118  
    8686     */
    8787    public function enqueue_scripts() {
    88         if ( advads_is_amp() ) {
     88        if ( Conditional::is_amp() ) {
    8989            return;
    9090        }
     
    458458        $notices = Advanced_Ads_Ad_Health_Notices::get_number_of_notices();
    459459
    460         if ( ! advads_is_amp() ) {
     460        if ( ! Conditional::is_amp() ) {
    461461            $warnings = 0; // Will be updated using JS.
    462462        } else {
     
    679679            echo ob_get_clean();
    680680
    681         if ( advads_is_amp() ) {
     681        if ( Conditional::is_amp() ) {
    682682            return;
    683683        }
     
    10681068        }
    10691069
    1070         if ( advads_is_amp() ) {
     1070        if ( Conditional::is_amp() ) {
    10711071            return $content;
    10721072        }
  • advanced-ads/trunk/includes/admin/class-addon-updater.php

    r3257709 r3298118  
    1010namespace AdvancedAds\Admin;
    1111
     12use AdvancedAds\Constants;
     13use AdvancedAds\Utilities\Data;
    1214use Advanced_Ads_Admin_Licenses;
    13 use AdvancedAds\Utilities\Data;
    1415use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1516
     
    7374
    7475            ( new EDD_Updater(
    75                 Advanced_Ads_Admin_Licenses::API_ENDPOINT,
     76                Constants::API_ENDPOINT,
    7677                $_add_on['path'],
    7778                [
    7879                    'version' => $_add_on['version'],
    7980                    'license' => $license_key,
    80                     'item_id' => Advanced_Ads_Admin_Licenses::ADDON_SLUGS_ID[ $options_slug ] ?? false,
     81                    'item_id' => Constants::ADDON_SLUGS_ID[ $options_slug ] ?? false,
    8182                    'author'  => 'Advanced Ads',
    8283                ]
  • advanced-ads/trunk/includes/class-constants.php

    r3283205 r3298118  
    175175        '1.1.0'  => 'advanced-ads-browser-language',   // Browser Language.
    176176    ];
     177
     178    /**
     179     * License API endpoint URL
     180     *
     181     * @const string
     182     */
     183    const API_ENDPOINT = 'https://wpadvancedads.com/license-api/';
     184
     185    /**
     186     * Add-on slugs and their EDD ID
     187     *
     188     * @const array
     189     */
     190    const ADDON_SLUGS_ID = [
     191        'advanced-ads-gam'        => 215545,
     192        'advanced-ads-layer'      => 686,
     193        'advanced-ads-pro'        => 1742,
     194        'advanced-ads-responsive' => 678,
     195        'advanced-ads-selling'    => 35300,
     196        'advanced-ads-sticky'     => 683,
     197        'advanced-ads-tracking'   => 638,
     198        'slider-ads'              => 1168,
     199    ];
    177200}
  • advanced-ads/trunk/includes/frontend/class-ad-display-condition.php

    r3253289 r3298118  
    3636
    3737    /**
    38      * Check if ads are disabled.
    39      *
    40      * @return bool
    41      */
    42     public function is_ad_disabled(): bool {
    43         return defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED;
    44     }
    45 
    46     /**
    4738     * Get the disabled id.
    4839     *
     
    7162
    7263        // Early bail!!
    73         if ( $this->is_ad_disabled() ) {
     64        if ( Conditional::is_ad_disabled() ) {
    7465            return;
    7566        }
  • advanced-ads/trunk/includes/frontend/class-manager.php

    r3253289 r3298118  
    1010namespace AdvancedAds\Frontend;
    1111
     12use AdvancedAds\Utilities\Conditional;
    1213use AdvancedAds\Framework\Interfaces\Integration_Interface;
    1314
     
    6061        $this->page_display->run_checks();
    6162
    62         if ( ! $this->page_display->is_ad_disabled() ) {
     63        if ( ! Conditional::is_ad_disabled() ) {
    6364            do_action( 'advanced-ads-frontend' );
    6465        }
  • advanced-ads/trunk/includes/frontend/class-scripts.php

    r3253289 r3298118  
    1414use Advanced_Ads_Privacy;
    1515use AdvancedAds\Utilities\WordPress;
     16use AdvancedAds\Utilities\Conditional;
    1617use AdvancedAds\Framework\Utilities\Params;
    1718use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    4142     */
    4243    public function enqueue_scripts(): void {
    43         if ( advads_is_amp() ) {
     44        if ( Conditional::is_amp() ) {
    4445            return;
    4546        }
     
    99100        );
    100101
    101         if ( advads_is_amp() ) {
     102        if ( Conditional::is_amp() ) {
    102103            return;
    103104        }
     
    136137     */
    137138    public function print_footer_scripts(): void {
    138         if ( advads_is_amp() ) {
     139        if ( Conditional::is_amp() ) {
    139140            return;
    140141        }
  • advanced-ads/trunk/includes/importers/class-manager.php

    r3145275 r3298118  
    1212use WP_Error;
    1313use AdvancedAds\Utilities\WordPress;
     14use AdvancedAds\Utilities\Conditional;
    1415use AdvancedAds\Framework\Utilities\Params;
    1516use AdvancedAds\Framework\Interfaces\Integration_Interface;
     
    6970    public function handle_action(): void {
    7071        // Early bail!!
     72        if ( ! Conditional::user_cap( 'advanced_ads_edit_ads' ) ) {
     73            return;
     74        }
     75
    7176        $action = WordPress::current_action();
    7277
  • advanced-ads/trunk/includes/utilities/class-conditional.php

    r3253289 r3298118  
    121121
    122122    /**
     123     * Check if ads are disabled.
     124     *
     125     * @return bool
     126     */
     127    public static function is_ad_disabled(): bool {
     128        return defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED;
     129    }
     130
     131    /**
    123132     * Check if any add-on is activated
    124133     *
    125134     * @return bool true if there is any add-on activated
    126135     */
    127     public static function is_any_addon_activated() {
     136    public static function is_any_addon_activated(): bool {
    128137        return has_action( 'advanced-ads-loaded' );
     138    }
     139
     140    /**
     141     * Check if the current page is an AMP page.
     142     *
     143     * @return bool
     144     */
     145    public static function is_amp(): bool {
     146        return function_exists( 'advads_is_amp' ) && advads_is_amp();
    129147    }
    130148
     
    136154    public static function is_ua_bot(): bool {
    137155        // show ads on AMP version also for bots in order to allow Google (and maybe others) to cache the page.
    138         if ( advads_is_amp() ) {
     156        if ( self::is_amp() ) {
    139157            return false;
    140158        }
  • advanced-ads/trunk/includes/utilities/class-data.php

    r3257709 r3298118  
    4444                'advanced-ads-sticky',
    4545                'advanced-ads-tracking',
     46                'slider-ads',
    4647            ];
    4748
  • advanced-ads/trunk/languages/advanced-ads.pot

    r3283205 r3298118  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 2.0.7\n"
     5"Project-Id-Version: Advanced Ads 2.0.8\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: 2025-04-28T07:32:04+00:00\n"
     12"POT-Creation-Date: 2025-05-21T13:33:32+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    280280msgstr ""
    281281
    282 #: admin/includes/class-licenses.php:86
     282#: admin/includes/class-licenses.php:65
    283283msgid "Error while trying to register the license. Please contact support."
    284284msgstr ""
    285285
    286 #: admin/includes/class-licenses.php:91
     286#: admin/includes/class-licenses.php:70
    287287#: admin/views/setting-license.php:84
    288288msgid "Please enter a valid license key"
    289289msgstr ""
    290290
    291 #: admin/includes/class-licenses.php:132
    292 #: admin/includes/class-licenses.php:333
     291#: admin/includes/class-licenses.php:111
     292#: admin/includes/class-licenses.php:312
    293293msgid "The license status does not change as long as ADVANCED_ADS_SHOW_LICENSE_RESPONSE is enabled in wp-config.php."
    294294msgstr ""
    295295
     296#: admin/includes/class-licenses.php:130
     297msgid "License couldn’t be activated. Please try again later."
     298msgstr ""
     299
     300#: admin/includes/class-licenses.php:149
     301msgid "This is the bundle license key."
     302msgstr ""
     303
     304#: admin/includes/class-licenses.php:150
     305msgid "This is not the correct key for this add-on."
     306msgstr ""
     307
    296308#: admin/includes/class-licenses.php:151
    297 msgid "License couldn’t be activated. Please try again later."
    298 msgstr ""
    299 
    300 #: admin/includes/class-licenses.php:170
    301 msgid "This is the bundle license key."
    302 msgstr ""
    303 
    304 #: admin/includes/class-licenses.php:171
    305 msgid "This is not the correct key for this add-on."
    306 msgstr ""
    307 
    308 #: admin/includes/class-licenses.php:172
    309309msgid "There are no activations left."
    310310msgstr ""
    311311
    312312#. translators: %1$s is a starting link tag, %2$s is the closing one.
    313 #: admin/includes/class-licenses.php:176
     313#: admin/includes/class-licenses.php:155
    314314msgid "You can manage activations in %1$syour account%2$s."
    315315msgstr ""
    316316
    317317#. translators: %1$s is a starting link tag, %2$s is the closing one.
    318 #: admin/includes/class-licenses.php:182
     318#: admin/includes/class-licenses.php:161
    319319msgid "%1$sUpgrade%2$s for more activations."
    320320msgstr ""
    321321
    322322#. translators: %s is a string containing information about the issue.
    323 #: admin/includes/class-licenses.php:196
     323#: admin/includes/class-licenses.php:175
    324324msgid "License is invalid. Reason: %s"
    325325msgstr ""
    326326
    327327#. translators: %s is a list of server information like IP address. Just keep it as is.
    328 #: admin/includes/class-licenses.php:236
     328#: admin/includes/class-licenses.php:215
    329329msgid "Your request was blocked by our firewall. Please send us the following information to unblock you: %s."
    330330msgstr ""
    331331
    332 #: admin/includes/class-licenses.php:299
     332#: admin/includes/class-licenses.php:278
    333333msgid "Error while trying to disable the license. Please contact support."
    334334msgstr ""
    335335
    336 #: admin/includes/class-licenses.php:342
    337 #: admin/includes/class-licenses.php:366
     336#: admin/includes/class-licenses.php:321
     337#: admin/includes/class-licenses.php:345
    338338msgid "License couldn’t be deactivated. Please try again later."
    339339msgstr ""
    340340
    341341#. translators: %s plugin update link
    342 #: admin/includes/class-licenses.php:501
     342#: admin/includes/class-licenses.php:485
    343343msgid "Download failed. <a href=\"%s\">Click here to try another method</a>."
    344344msgstr ""
    345345
    346346#. translators: %s download failed knowledgebase link
    347 #: admin/includes/class-licenses.php:504
     347#: admin/includes/class-licenses.php:488
    348348msgid "Download failed. <a href=\"%s\" target=\"_blank\">Click here to learn why</a>."
    349349msgstr ""
    350350
    351 #: admin/includes/class-licenses.php:661
     351#: admin/includes/class-licenses.php:649
    352352msgid "License deactivated. Please try again later."
    353353msgstr ""
     
    521521#: admin/views/conditions/condition-string.php:9
    522522#: admin/views/notices/adblock.php:11
    523 #: classes/display-conditions.php:914
     523#: classes/display-conditions.php:919
    524524#: includes/admin/metaboxes/class-ad-layout.php:63
    525525#: includes/admin/metaboxes/class-ad-types.php:63
     
    11271127msgstr ""
    11281128
    1129 #: classes/display-conditions.php:280
     1129#: classes/display-conditions.php:285
    11301130msgid "parent page"
    11311131msgstr ""
    11321132
    1133 #: classes/display-conditions.php:281
     1133#: classes/display-conditions.php:286
    11341134msgid "post meta"
    11351135msgstr ""
    11361136
    1137 #: classes/display-conditions.php:282
     1137#: classes/display-conditions.php:287
    11381138msgid "page template"
    11391139msgstr ""
    11401140
    1141 #: classes/display-conditions.php:283
     1141#: classes/display-conditions.php:288
    11421142msgid "url parameters"
    11431143msgstr ""
    11441144
    1145 #: classes/display-conditions.php:286
     1145#: classes/display-conditions.php:291
    11461146msgid "accelerated mobile pages"
    11471147msgstr ""
    11481148
    1149 #: classes/display-conditions.php:310
     1149#: classes/display-conditions.php:315
    11501150#: classes/visitor-conditions.php:318
    11511151#: includes/admin/class-assets.php:130
     
    11561156msgstr ""
    11571157
    1158 #: classes/display-conditions.php:310
     1158#: classes/display-conditions.php:315
    11591159#: classes/visitor-conditions.php:318
    11601160#: includes/admin/class-assets.php:131
     
    11621162msgstr ""
    11631163
    1164 #: classes/display-conditions.php:639
     1164#: classes/display-conditions.php:644
    11651165msgctxt "display the terms search field on ad edit page"
    11661166msgid "add more terms"
    11671167msgstr ""
    11681168
    1169 #: classes/display-conditions.php:645
     1169#: classes/display-conditions.php:650
    11701170msgid "term name or id"
    11711171msgstr ""
    11721172
    1173 #: classes/display-conditions.php:727
     1173#: classes/display-conditions.php:732
    11741174msgid "ID"
    11751175msgstr ""
    11761176
    1177 #: classes/display-conditions.php:727
     1177#: classes/display-conditions.php:732
    11781178#: includes/admin/class-placement-edit-modal.php:120
    11791179#: views/admin/placements/quick-edit.php:14
     
    11821182msgstr ""
    11831183
    1184 #: classes/display-conditions.php:729
     1184#: classes/display-conditions.php:734
    11851185#: includes/abstracts/abstract-ad.php:830
    11861186#: includes/admin/class-groups-list-table.php:362
     
    11901190msgstr ""
    11911191
    1192 #: classes/display-conditions.php:731
     1192#: classes/display-conditions.php:736
    11931193#: includes/admin/class-groups-list-table.php:362
    11941194#: views/admin/tables/ads/column-date.php:18
     
    11961196msgstr ""
    11971197
    1198 #: classes/display-conditions.php:753
     1198#: classes/display-conditions.php:758
    11991199msgid "title or id"
    12001200msgstr ""
    12011201
    1202 #: classes/display-conditions.php:827
     1202#: classes/display-conditions.php:832
    12031203#: includes/array_ad_conditions.php:59
    12041204msgid "Home Page"
    12051205msgstr ""
    12061206
    1207 #: classes/display-conditions.php:828
     1207#: classes/display-conditions.php:833
    12081208#: includes/array_ad_conditions.php:60
    12091209msgid "show on Home page"
    12101210msgstr ""
    12111211
    1212 #: classes/display-conditions.php:832
     1212#: classes/display-conditions.php:837
    12131213#: includes/array_ad_conditions.php:64
    12141214msgid "Singular Pages"
    12151215msgstr ""
    12161216
    1217 #: classes/display-conditions.php:833
     1217#: classes/display-conditions.php:838
    12181218#: includes/array_ad_conditions.php:65
    12191219msgid "show on singular pages/posts"
    12201220msgstr ""
    12211221
    1222 #: classes/display-conditions.php:837
     1222#: classes/display-conditions.php:842
    12231223#: includes/array_ad_conditions.php:69
    12241224msgid "Archive Pages"
    12251225msgstr ""
    12261226
    1227 #: classes/display-conditions.php:838
     1227#: classes/display-conditions.php:843
    12281228#: includes/array_ad_conditions.php:70
    12291229msgid "show on any type of archive page (category, tag, author and date)"
    12301230msgstr ""
    12311231
    1232 #: classes/display-conditions.php:842
     1232#: classes/display-conditions.php:847
    12331233#: includes/array_ad_conditions.php:74
    12341234msgid "Search Results"
    12351235msgstr ""
    12361236
    1237 #: classes/display-conditions.php:843
     1237#: classes/display-conditions.php:848
    12381238#: includes/array_ad_conditions.php:75
    12391239msgid "show on search result pages"
    12401240msgstr ""
    12411241
    1242 #: classes/display-conditions.php:847
     1242#: classes/display-conditions.php:852
    12431243#: includes/array_ad_conditions.php:79
    12441244msgid "404 Page"
    12451245msgstr ""
    12461246
    1247 #: classes/display-conditions.php:848
     1247#: classes/display-conditions.php:853
    12481248#: includes/array_ad_conditions.php:80
    12491249msgid "show on 404 error page"
    12501250msgstr ""
    12511251
    1252 #: classes/display-conditions.php:852
     1252#: classes/display-conditions.php:857
    12531253#: includes/array_ad_conditions.php:84
    12541254msgid "Attachment Pages"
    12551255msgstr ""
    12561256
    1257 #: classes/display-conditions.php:853
     1257#: classes/display-conditions.php:858
    12581258#: includes/array_ad_conditions.php:85
    12591259msgid "show on attachment pages"
    12601260msgstr ""
    12611261
    1262 #: classes/display-conditions.php:857
     1262#: classes/display-conditions.php:862
    12631263#: includes/array_ad_conditions.php:89
    12641264msgid "Secondary Queries"
    12651265msgstr ""
    12661266
    1267 #: classes/display-conditions.php:858
     1267#: classes/display-conditions.php:863
    12681268#: includes/array_ad_conditions.php:90
    12691269msgid "allow ads in secondary queries"
    12701270msgstr ""
    12711271
    1272 #: classes/display-conditions.php:862
     1272#: classes/display-conditions.php:867
    12731273msgid "RSS Feed"
    12741274msgstr ""
    12751275
    1276 #: classes/display-conditions.php:863
     1276#: classes/display-conditions.php:868
    12771277msgid "allow ads in RSS Feed"
    12781278msgstr ""
    12791279
    1280 #: classes/display-conditions.php:867
     1280#: classes/display-conditions.php:872
    12811281msgid "REST API"
    12821282msgstr ""
    12831283
    1284 #: classes/display-conditions.php:868
     1284#: classes/display-conditions.php:873
    12851285msgid "allow ads in REST API"
    12861286msgstr ""
    12871287
    1288 #: classes/display-conditions.php:903
     1288#: classes/display-conditions.php:908
    12891289msgid "older than"
    12901290msgstr ""
    12911291
    1292 #: classes/display-conditions.php:904
     1292#: classes/display-conditions.php:909
    12931293msgid "younger than"
    12941294msgstr ""
    12951295
    1296 #: classes/display-conditions.php:909
     1296#: classes/display-conditions.php:914
    12971297msgid "days"
    12981298msgstr ""
    12991299
    1300 #: classes/display-conditions.php:912
     1300#: classes/display-conditions.php:917
    13011301msgid "Display ads based on the age of a page or post."
    13021302msgstr ""
     
    16041604#: includes/abstracts/abstract-placement-type.php:63
    16051605#: includes/class-widget.php:128
    1606 #: includes/utilities/class-data.php:295
     1606#: includes/utilities/class-data.php:296
    16071607#: modules/gutenberg/includes/class-gutenberg.php:136
    16081608#: views/admin/tables/ads/filters.php:75
     
    16161616#: includes/class-entities.php:44
    16171617#: includes/class-widget.php:135
    1618 #: includes/utilities/class-data.php:288
     1618#: includes/utilities/class-data.php:289
    16191619#: modules/gutenberg/includes/class-gutenberg.php:135
    16201620#: views/admin/tables/groups/edit-form-modal.php:113
     
    19211921
    19221922#. Translators: 1: add-on name 2: admin URL to license page
    1923 #: includes/admin/class-addon-updater.php:131
     1923#: includes/admin/class-addon-updater.php:132
    19241924msgid "There might be a new version of %1$s. Please <strong>provide a valid license key</strong> in order to receive updates and support <a href=\"%2$s\">on this page</a>."
    19251925msgstr ""
     
    21702170#: includes/admin/class-list-filters.php:122
    21712171#: modules/gadsense/admin/views/adsense-ad-parameters.php:131
    2172 #: modules/gadsense/includes/class-ad-type-adsense.php:30
     2172#: modules/gadsense/includes/class-ad-type-adsense.php:31
    21732173msgid "Responsive"
    21742174msgstr ""
     
    29132913#: includes/admin/pages/class-placements.php:44
    29142914#: includes/class-widget.php:121
    2915 #: includes/utilities/class-data.php:302
     2915#: includes/utilities/class-data.php:303
    29162916#: modules/gutenberg/includes/class-gutenberg.php:137
    29172917#: views/admin/tables/ads/column-used.php:34
     
    32783278
    32793279#: includes/class-widget.php:119
    3280 #: includes/utilities/class-data.php:286
     3280#: includes/utilities/class-data.php:287
    32813281#: modules/gutenberg/includes/class-gutenberg.php:133
    32823282msgid "--empty--"
     
    34383438msgstr ""
    34393439
    3440 #: includes/importers/class-manager.php:104
     3440#: includes/importers/class-manager.php:109
    34413441msgid "History deleted successfully."
    34423442msgstr ""
     
    41164116
    41174117#: modules/gadsense/admin/views/adsense-account.php:135
    4118 #: modules/gadsense/includes/class-ad-type-adsense.php:95
     4118#: modules/gadsense/includes/class-ad-type-adsense.php:96
    41194119#: modules/gadsense/includes/types/type-adsense.php:142
    41204120msgid "The Publisher ID has an incorrect format. (must start with \"pub-\")"
     
    42114211
    42124212#: modules/gadsense/admin/views/adsense-ad-parameters.php:132
    4213 #: modules/gadsense/includes/class-ad-type-adsense.php:31
     4213#: modules/gadsense/includes/class-ad-type-adsense.php:32
    42144214msgid "Multiplex"
    42154215msgstr ""
    42164216
    42174217#: modules/gadsense/admin/views/adsense-ad-parameters.php:134
    4218 #: modules/gadsense/includes/class-ad-type-adsense.php:32
     4218#: modules/gadsense/includes/class-ad-type-adsense.php:33
    42194219msgid "Link ads"
    42204220msgstr ""
    42214221
    42224222#: modules/gadsense/admin/views/adsense-ad-parameters.php:137
    4223 #: modules/gadsense/includes/class-ad-type-adsense.php:33
     4223#: modules/gadsense/includes/class-ad-type-adsense.php:34
    42244224msgid "Link ads (Responsive)"
    42254225msgstr ""
    42264226
    42274227#: modules/gadsense/admin/views/adsense-ad-parameters.php:139
    4228 #: modules/gadsense/includes/class-ad-type-adsense.php:34
     4228#: modules/gadsense/includes/class-ad-type-adsense.php:35
    42294229msgid "In-article"
    42304230msgstr ""
    42314231
    42324232#: modules/gadsense/admin/views/adsense-ad-parameters.php:140
    4233 #: modules/gadsense/includes/class-ad-type-adsense.php:35
     4233#: modules/gadsense/includes/class-ad-type-adsense.php:36
    42344234msgid "In-feed"
    42354235msgstr ""
     
    43864386msgstr ""
    43874387
    4388 #: modules/gadsense/includes/class-ad-type-adsense.php:29
    4389 #: modules/gadsense/includes/class-ad-type-adsense.php:47
     4388#: modules/gadsense/includes/class-ad-type-adsense.php:30
     4389#: modules/gadsense/includes/class-ad-type-adsense.php:48
    43904390msgid "Normal"
    43914391msgstr ""
    43924392
    4393 #: modules/gadsense/includes/class-ad-type-adsense.php:136
     4393#: modules/gadsense/includes/class-ad-type-adsense.php:137
    43944394#: modules/gadsense/includes/types/type-adsense.php:183
    43954395msgid "Your AdSense Publisher ID is missing."
     
    50125012msgstr ""
    50135013
    5014 #: public/views/ad-debug.php:20
     5014#: public/views/ad-debug.php:22
    50155015msgid "Ad debug output"
    50165016msgstr ""
    50175017
    5018 #: public/views/ad-debug.php:24
     5018#: public/views/ad-debug.php:26
    50195019msgid "Find solutions in the manual"
    50205020msgstr ""
  • advanced-ads/trunk/modules/adblock-finder/public/public.php

    r3253289 r3298118  
    77 */
    88
     9use AdvancedAds\Options;
     10use AdvancedAds\Utilities\Conditional;
    911use AdvancedAds\Framework\Utilities\Arr;
    10 use AdvancedAds\Options;
    1112
    1213/**
     
    2930     */
    3031    public function print_adblock_check_js() {
    31         if ( advads_is_amp() ) {
     32        if ( Conditional::is_amp() ) {
    3233            return;
    3334        }
  • advanced-ads/trunk/modules/gadsense/includes/class-ad-type-adsense.php

    r3253289 r3298118  
    1111
    1212use AdvancedAds\Abstracts\Ad;
     13use AdvancedAds\Utilities\Conditional;
    1314use AdvancedAds\Interfaces\Ad_Interface;
    1415
     
    263264
    264265        // Prevent output on AMP pages.
    265         if ( advads_is_amp() ) {
     266        if ( Conditional::is_amp() ) {
    266267            return '';
    267268        }
  • advanced-ads/trunk/modules/gadsense/public/public.php

    r3253289 r3298118  
    11<?php // phpcs:ignore WordPress.Files.FileName
     2
     3use AdvancedAds\Utilities\Conditional;
    24
    35/**
     
    5557        }
    5658
    57         if ( defined( 'ADVADS_ADS_DISABLED' ) || advads_is_amp() ) {
     59        if ( Conditional::is_ad_disabled() || Conditional::is_amp() ) {
    5860            return;
    5961        }
     
    149151
    150152        if (
    151             // check if ads are disabled.
    152             ( defined( 'ADVADS_ADS_DISABLED' ) && ADVADS_ADS_DISABLED )
     153            Conditional::is_ad_disabled()
    153154            // check if this an AMP page, we're inside `wp` action so it's safe to use.
    154             || ( ! function_exists( 'advads_is_amp' ) || ! advads_is_amp() )
     155            || ! Conditional::is_amp()
    155156        ) {
    156157            return;
  • advanced-ads/trunk/modules/privacy/classes/class-privacy.php

    r3253289 r3298118  
    22
    33use AdvancedAds\Abstracts\Ad;
     4use AdvancedAds\Utilities\Conditional;
     5use AdvancedAds\Framework\Utilities\Str;
    46use AdvancedAds\Framework\Utilities\Params;
    5 use AdvancedAds\Framework\Utilities\Str;
    67
    78/**
     
    5758    public function final_ad_output( $output, Ad $ad ) {
    5859        if (
    59             advads_is_amp() ||
     60            Conditional::is_amp() ||
    6061            ! $this->ad_type_needs_consent( $ad->get_type() ) ||
    6162            ( ! $ad->is_type( 'adsense' ) && $ad->get_prop( 'privacy.ignore-consent' ) )
     
    239240     */
    240241    private function parse_state() {
    241         if ( empty( $this->options['enabled'] ) || advads_is_amp() ) {
     242        if ( empty( $this->options['enabled'] ) || Conditional::is_amp() ) {
    242243            return 'not_needed';
    243244        }
  • advanced-ads/trunk/packages/autoload.php

    r2983598 r3298118  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • advanced-ads/trunk/packages/composer/InstalledVersions.php

    r3265208 r3298118  
    2727class InstalledVersions
    2828{
     29    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
    2935    /**
    3036     * @var mixed[]|null
     
    324330
    325331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
     341    }
     342
     343    /**
    326344     * @return array[]
    327345     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     
    337355
    338356        if (self::$canGetVendors) {
    339             $selfDir = strtr(__DIR__, '\\', '/');
     357            $selfDir = self::getSelfDir();
    340358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    341359                $vendorDir = strtr($vendorDir, '\\', '/');
  • advanced-ads/trunk/public/class-advanced-ads.php

    r3257709 r3298118  
    397397        $injection_enabled = $options['content-injection-enabled'] ?? 'off';
    398398
    399         if ( ( $injection_enabled === 'off' || 0 === $archive_injection_count ) && ( ! is_singular( $public_post_types ) || ( ! advads_is_amp() && ! $this->in_the_loop() && ! $this->was_in_the_loop ) ) ) {
     399        if ( ( $injection_enabled === 'off' || 0 === $archive_injection_count ) && ( ! is_singular( $public_post_types ) || ( ! Conditional::is_amp() && ! $this->in_the_loop() && ! $this->was_in_the_loop ) ) ) {
    400400            return false;
    401401        }
     
    425425         * @return bool `true` if ads are disabled
    426426         */
    427         $ads_disabled = apply_filters( 'advanced-ads-disabled-ads', defined( 'ADVADS_ADS_DISABLED' ), $options );
     427        $ads_disabled = apply_filters( 'advanced-ads-disabled-ads', Conditional::is_ad_disabled(), $options );
    428428
    429429        if ( $ads_disabled ) {
  • advanced-ads/trunk/public/views/ad-debug.php

    r3253289 r3298118  
    1212 */
    1313
    14 if ( ! advads_is_amp() ) :
     14use AdvancedAds\Utilities\Conditional;
     15
     16if ( ! Conditional::is_amp() ) :
    1517    ob_start();
    1618        echo Advanced_Ads_Utils::get_inline_asset( ob_get_clean() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  • advanced-ads/trunk/readme.txt

    r3283205 r3298118  
    33Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.7
    5 Tested up to: 6.7
     5Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 2.0.8
     7Stable tag: 2.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    361361== Changelog ==
    362362
     363= 2.0.9 (May 21, 2025) =
     364
     365- Improvement: improve amp conditions
     366- Improvement: Test plugin compatibility with WordPress 6.8.
     367- Improvement: add capability check in importer
     368- Improvement: standardize `ADVADS_ADS_DISABLED` check
     369- Improvement: null checks before accessing ad properties
     370- Fix: update failure help link only for Advanced Ads add-ons
     371
    363372= 2.0.8 (April 28, 2025) =
    364373
  • advanced-ads/trunk/wp.advads

    r3283205 r3298118  
    33    "name": "Advanced Ads",
    44    "description": "Manage and optimize your ads in WordPress",
    5     "version": "2.0.8",
     5    "version": "2.0.9",
    66    "requireWP": "5.7",
    77    "requirePHP": "7.4",
Note: See TracChangeset for help on using the changeset viewer.