Plugin Directory

Changeset 3187581


Ignore:
Timestamp:
11/13/2024 12:25:25 PM (13 months ago)
Author:
advancedads
Message:

Update to version 1.56.0 from GitHub

Location:
advanced-ads
Files:
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • advanced-ads/tags/1.56.0/admin/includes/class-meta-box.php

    r3170554 r3187581  
    661661        }
    662662
    663         $currencies  = [ 'EUR', 'USD' ];
     663        $currencies  = [ 'EUR', 'USD', 'GBP', 'CHF' ];
    664664        $feed_url    = 'https://wpadvancedads.com/category/tutorials/feed/';
    665665        $campaign    = 'dashboard';
  • advanced-ads/tags/1.56.0/admin/views/support.php

    r3086263 r3187581  
    7373<?php endif; ?>
    7474</div>
     75<?php AdvancedAds\Modules\ProductExperimentationFramework\Module::get_instance()->render( 'support' ); ?>
  • advanced-ads/tags/1.56.0/advanced-ads.php

    r3170554 r3187581  
    1313 * Plugin URI:        https://wpadvancedads.com
    1414 * Description:       Manage and optimize your ads in WordPress
    15  * Version:           1.55.0
     15 * Version:           1.56.0
    1616 * Author:            Advanced Ads
    1717 * Author URI:        https://wpadvancedads.com
     
    3434
    3535define( 'ADVADS_FILE', __FILE__ );
    36 define( 'ADVADS_VERSION', '1.55.0' );
     36define( 'ADVADS_VERSION', '1.56.0' );
    3737
    3838// Load the autoloader.
  • advanced-ads/tags/1.56.0/classes/in-content-injector.php

    r3170554 r3187581  
    8383        if ( in_array( $tag_option, [ 'img', 'iframe', 'custom' ], true ) ) {
    8484            $defaults['allowEmpty'] = true;
     85        }
     86
     87        // Merge the options if possible. If there are common keys, we don't merge them to prevent overriding and unexpected behavior.
     88        $common_keys = array_intersect_key( $options, $placement_opts );
     89        if ( empty( $common_keys ) ) {
     90            $options = array_merge( $options, $placement_opts );
    8591        }
    8692
  • advanced-ads/tags/1.56.0/languages/advanced-ads.pot

    r3170554 r3187581  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 1.54.1\n"
     5"Project-Id-Version: Advanced Ads 1.55.0\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-10-16T11:58:57+00:00\n"
     12"POT-Creation-Date: 2024-11-13T12:24:30+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
     
    817817
    818818#: admin/includes/class-settings.php:178
    819 #: classes/in-content-injector.php:611
     819#: classes/in-content-injector.php:617
    820820msgid "Disable level limitation"
    821821msgstr ""
     
    26482648
    26492649#. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
    2650 #: classes/in-content-injector.php:610
     2650#: classes/in-content-injector.php:616
    26512651msgid "Set <em>%s</em> to show more ads"
    26522652msgstr ""
     
    41864186msgstr ""
    41874187
    4188 #: modules/one-click/admin/class-ajax.php:135
    4189 #: modules/one-click/admin/class-ajax.php:170
     4188#. translators: 1 is the opening link to the Advanced Ads website, 2 the closing link
     4189#: modules/one-click/admin/class-ajax.php:136
     4190msgid "The backup of your ads.txt file has failed. Please ensure that a manual backup is created You can find detailed instructions on how to manually back up your ads.txt file in the manual. %1$sManual%2$s"
     4191msgstr ""
     4192
     4193#: modules/one-click/admin/class-ajax.php:146
     4194msgid "File successfully backed up."
     4195msgstr ""
     4196
     4197#: modules/one-click/admin/class-ajax.php:174
    41904198msgid "An error has occurred please try again."
    4191 msgstr ""
    4192 
    4193 #: modules/one-click/admin/class-ajax.php:142
    4194 msgid "File successfully backed up."
    41954199msgstr ""
    41964200
     
    42164220msgstr ""
    42174221
     4222#: modules/pef/class-module.php:197
     4223#: modules/pef/class-module.php:205
     4224msgid "FROM THE ADVANCED ADS LABS:"
     4225msgstr ""
     4226
     4227#: modules/pef/class-module.php:198
     4228#: modules/pef/class-module.php:206
     4229msgid "The Campaign Manager"
     4230msgstr ""
     4231
     4232#: modules/pef/class-module.php:200
     4233#: modules/pef/class-module.php:208
     4234msgid "Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you."
     4235msgstr ""
     4236
     4237#: modules/pef/class-module.php:201
     4238#: modules/pef/class-module.php:209
     4239msgid "Are you interested in this product concept?"
     4240msgstr ""
     4241
     4242#: modules/pef/class-module.php:202
     4243#: modules/pef/class-module.php:210
     4244msgid "Yes, I want to know more!"
     4245msgstr ""
     4246
    42184247#: modules/privacy/admin/admin.php:51
    42194248msgid "Privacy"
  • advanced-ads/tags/1.56.0/modules/one-click/admin/class-ajax.php

    r3170554 r3187581  
    132132        if ( false === $result ) {
    133133            $notice = sprintf(
    134                 '<div class="notice notice-error flex items-center p-4">%s</div>',
    135                 esc_html__( 'An error has occurred please try again.', 'advanced-ads' )
     134                '<div class="notice notice-error flex items-center p-4">'
     135                /* translators: 1 is the opening link to the Advanced Ads website, 2 the closing link */
     136                . __( 'The backup of your ads.txt file has failed. Please ensure that a manual backup is created You can find detailed instructions on how to manually back up your ads.txt file in the manual. %1$sManual%2$s', 'advanced-ads' )
     137                . '</div>',
     138                '<a href="https://wpadvancedads.com/manual/ads-txt/?utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-ads-txt-oci#Manual_backup_of_the_adstxt_file" target="_blank" class="advads-manual-link" style="display: inline !important;">',
     139                '</a>'
    136140            );
    137141            wp_send_json_error( $notice );
  • advanced-ads/tags/1.56.0/modules/one-click/modules/class-workflow.php

    r3145275 r3187581  
    4949            if ( Options::module( 'ads_txt' ) ) {
    5050                ( new AdsTxt() )->hooks();
     51            }
     52
     53            if ( ! function_exists( 'wp_advads_pro' ) ) {
     54                add_filter( 'advanced-ads-placement-content-offsets', [ $this, 'placement_content_offsets' ], 10, 3 );
    5155            }
    5256        }
     
    142146        ( new Api_Ads() )->import();
    143147    }
     148
     149    /**
     150     * Get offsets for Content placement.
     151     *
     152     * @param array $offsets        Existing Offsets.
     153     * @param array $options        Injection options.
     154     * @param array $placement_opts Placement options.
     155     *
     156     * @return array $offsets New offsets.
     157     */
     158    public function placement_content_offsets( $offsets, $options, $placement_opts ) {
     159        if ( ! isset( $options['paragraph_count'] ) ) {
     160            return $offsets;
     161        }
     162
     163        // "Content" placement, repeat position.
     164        if (
     165            ( ! empty( $placement_opts['repeat'] ) || ! empty( $options['repeat'] ) ) &&
     166            isset( $options['paragraph_id'] ) &&
     167            isset( $options['paragraph_select_from_bottom'] )
     168        ) {
     169
     170            $offsets = [];
     171            for ( $i = $options['paragraph_id'] - 1; $i < $options['paragraph_count']; $i++ ) {
     172                // Select every X number.
     173                if ( 0 === ( $i + 1 ) % $options['paragraph_id'] ) {
     174                    $offsets[] = $options['paragraph_select_from_bottom'] ? $options['paragraph_count'] - 1 - $i : $i;
     175                }
     176            }
     177        }
     178
     179        return $offsets;
     180    }
    144181}
  • advanced-ads/tags/1.56.0/modules/pef/class-module.php

    r3050336 r3187581  
    1414class Module {
    1515    /**
     16     * The singleton
     17     *
     18     * @var Module
     19     */
     20    private static $instance;
     21
     22    /**
     23     * User meta key where the dismiss flag is stored.
     24     *
     25     * @var string
     26     */
     27    const USER_META = 'advanced_ads_pef_dismiss';
     28
     29    /**
    1630     * Current running features
    1731     *
    1832     * @var array[]
    1933     */
    20     const FEATURES = [
    21         'labs-video-ads'             => [
    22             'name'   => 'Video Ads',
    23             'weight' => 1,
    24             'text'   => 'The Advanced Ads team is developing a new feature to support video ads. This enables embedding videos from your WordPress media library and video ad networks. Like image ads, they would be fully compatible with all conditions and placements. We are curious whether our users want us to prioritize this feature.',
    25         ],
    26         'labs-email-notifications'   => [
    27             'name'   => 'Email Notifications',
    28             'weight' => 1,
    29             'text'   => 'The Advanced Ads team is developing a new feature to improve email notifications. Imagine receiving timely reminders in your inbox, giving you ample time to take action. Whether renewing an ad, adjusting ad groups, or checking the statistics after a campaign has ended, you’ll be in the know every step of the way. We are curious whether our users want us to prioritize this feature.',
    30         ],
    31         'labs-image-mapping'         => [
    32             'name'   => 'Image Mapping',
    33             'weight' => 1,
    34             'text'   => 'The Advanced Ads team is developing a new feature to allow serving multiple images with the same ad unit. This workflow can save you time in certain setups and is an alternative to ad groups when it comes to multiple campaigns from the same advertiser. We are curious whether our users want us to prioritize this feature.',
    35         ],
    36         'labs-automated-split-tests' => [
    37             'name'   => 'Automated Split Tests',
    38             'weight' => 1,
    39             'text'   => 'The Advanced Ads team is working on a new feature to simplify your workload: automated split testing. Let us handle the heavy lifting for you by automatically maximizing your ad performance based on the CTR of your ad units. We are curious whether our users want us to prioritize this feature.',
    40         ],
    41         'labs-ad-preview'            => [
    42             'name'   => 'Ad Preview',
    43             'weight' => 1,
    44             'text'   => 'The Advanced Ads team is developing a new feature: ad previews. Simply input the code in the Parameter box, and watch your ad come to life on the Edit Ad page. We are curious whether our users want us to prioritize this feature.',
    45         ],
    46         'labs-animated-ads'          => [
    47             'name'   => 'Animated Ads',
    48             'weight' => 1,
    49             'text'   => 'The Advanced Ads team is developing a new feature to allow animating ads. Captivate your audience with eye-catching effects like flip, slider, and fade. Enhance engagement and leave a lasting impression with dynamic ad displays. We are curious whether our users want us to prioritize this feature.',
    50         ],
    51         'labs-active-view-tracking'  => [
    52             'name'   => 'Active View Tracking',
    53             'weight' => 1,
    54             'text'   => 'The Advanced Ads team is developing a new feature to enable active view tracking. Gain precise insights into ad viewability and upgrade your metrics. With active view tracking, you’ll know if your ad is loaded and visible in the viewport. We are curious whether our users want us to prioritize this feature.',
    55         ],
    56         'labs-ad-schedule-wizard'    => [
    57             'name'   => 'Ad Schedule Wizard',
    58             'weight' => 1,
    59             'text'   => 'The Advanced Ads team is developing a better ad scheduling and planning interface. Simplify your workflow and maximize efficiency. With an improved user experience, managing your ads could be easier than ever. We are curious whether our users want us to prioritize this feature.',
    60         ],
    61         'labs-reports-insights'      => [
    62             'name'   => 'Reports & Insights',
    63             'weight' => 1,
    64             'text'   => 'The Advanced Ads team is improving the reporting. Customize your email reports to focus on the metrics that most matter to you and easily share them as PDFs. Empower yourself with actionable data and streamline communication with stakeholders. We are curious whether our users want us to prioritize this feature.',
    65         ],
    66     ];
    67 
    68     /**
    69      * User meta key where the dismiss flag is stored.
    70      *
    71      * @var string
    72      */
    73     const USER_META = 'advanced_ads_pef_dismiss';
    74 
    75     /**
    76      * The singleton
    77      *
    78      * @var Module
    79      */
    80     private static $instance;
     34    private $features;
    8135
    8236    /**
     
    10256
    10357    /**
    104      * Private constructor
     58     * Singleton design
    10559     */
    10660    private function __construct() {
     61        $this->set_features();
     62
    10763        // Wait for `admin_init` to get the current user.
    10864        add_action( 'admin_init', [ $this, 'admin_init' ] );
     65    }
     66
     67    /**
     68     * Return the singleton. Create it if needed
     69     *
     70     * @return Module
     71     */
     72    public static function get_instance() {
     73        if ( null === self::$instance ) {
     74            self::$instance = new self();
     75        }
     76
     77        return self::$instance;
    10978    }
    11079
     
    11887        if ( $this->get_minor_version( ADVADS_VERSION ) === $this->get_minor_version( $meta ) ) {
    11988            $this->can_display = false;
    120 
    12189            return;
    12290        }
     91
    12392        $this->collect_weights();
    12493        add_action( 'wp_ajax_advanced_ads_pef', [ $this, 'dismiss' ] );
     
    139108
    140109    /**
    141      * Collect feature ID with their weight as recorded in the class constant. Also calculate the weight sum
    142      */
    143     private function collect_weights() {
    144         if ( 0 !== $this->weight_sum ) {
    145             return;
    146         }
    147         foreach ( self::FEATURES as $id => $feature ) {
    148             $this->weights[ $id ] = (int) $feature['weight'];
    149             $this->weight_sum    += $this->weights[ $id ];
    150         }
    151     }
    152 
    153     /**
    154110     * Get a random feature based on weights and a random number
    155111     *
     
    157113     */
    158114    public function get_winner_feature() {
    159         $random_weight  = mt_rand( 1, $this->weight_sum );
     115        $random_weight  = wp_rand( 1, $this->weight_sum );
    160116        $current_weight = 0;
    161         foreach ( self::FEATURES as $id => $feature ) {
     117        foreach ( $this->features as $id => $feature ) {
    162118            $current_weight += $this->weights[ $id ];
    163119            if ( $random_weight <= $current_weight ) {
     
    167123                        'weight' => $this->weights[ $id ],
    168124                    ],
    169                     self::FEATURES[ $id ]
     125                    $this->features[ $id ]
    170126                );
    171127            }
     
    181137     */
    182138    public function render( $screen ) {
     139        // Early bail!!
    183140        if ( ! $this->can_display ) {
    184141            return;
    185142        }
    186143        $winner = $this->get_winner_feature();
     144
    187145        require_once DIR . '/views/template.php';
    188146    }
     
    208166     */
    209167    public function build_link( $winner, $screen ) {
    210         $link  = "https://wpadvancedads.com/advanced-ads-labs/?utm_source=advanced-ads&utm_medium=link&utm_campaign=$screen-aa-labs&utm_term=b";
    211         $link .= str_replace( '.', '-', ADVADS_VERSION ) . "w{$winner['weight']}-{$this->weight_sum}&utm_content={$winner['id']}";
    212 
    213         return $link;
    214     }
    215 
    216     /**
    217      * Return the singleton. Create it if needed
    218      *
    219      * @return Module
    220      */
    221     public static function get_instance() {
    222         if ( null === self::$instance ) {
    223             self::$instance = new self();
    224         }
    225 
    226         return self::$instance;
     168        $utm_source   = 'advanced-ads';
     169        $utm_medium   = 'link';
     170        $utm_campaign = sprintf( '%s-aa-labs', $screen );
     171        $utm_term     = sprintf(
     172            'b%sw%d-%d',
     173            str_replace( '.', '-', ADVADS_VERSION ),
     174            $winner['weight'],
     175            $this->weight_sum
     176        );
     177        $utm_content  = $winner['id'];
     178
     179        return sprintf(
     180            'https://wpadvancedads.com/advanced-ads-labs/?utm_source=%s&utm_medium=%s&utm_campaign=%s&utm_term=%s&utm_content=%s',
     181            $utm_source,
     182            $utm_medium,
     183            $utm_campaign,
     184            $utm_term,
     185            $utm_content
     186        );
     187    }
     188
     189    /**
     190     * Set the features/banners
     191     *
     192     * @return void
     193     */
     194    private function set_features() {
     195        $this->features = [
     196            'labs-campaign-manager-ay' => [
     197                'subheading' => __( 'FROM THE ADVANCED ADS LABS:', 'advanced-ads' ),
     198                'heading'    => __( 'The Campaign Manager', 'advanced-ads' ),
     199                'weight'     => 1,
     200                'text'       => __( 'Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you.', 'advanced-ads' ),
     201                'cta'        => __( 'Are you interested in this product concept?', 'advanced-ads' ),
     202                'cta_button' => __( 'Yes, I want to know more!', 'advanced-ads' ),
     203            ],
     204            'labs-campaign-manager-be' => [
     205                'subheading' => __( 'FROM THE ADVANCED ADS LABS:', 'advanced-ads' ),
     206                'heading'    => __( 'The Campaign Manager', 'advanced-ads' ),
     207                'weight'     => 1,
     208                'text'       => __( 'Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you.', 'advanced-ads' ),
     209                'cta'        => __( 'Are you interested in this product concept?', 'advanced-ads' ),
     210                'cta_button' => __( 'Yes, I want to know more!', 'advanced-ads' ),
     211            ],
     212        ];
     213    }
     214
     215    /**
     216     * Collect feature ID with their weight as recorded in the class constant. Also calculate the weight sum
     217     */
     218    private function collect_weights() {
     219        if ( 0 !== $this->weight_sum ) {
     220            return;
     221        }
     222        foreach ( $this->features as $id => $feature ) {
     223            $this->weights[ $id ] = (int) $feature['weight'];
     224            $this->weight_sum    += $this->weights[ $id ];
     225        }
    227226    }
    228227}
  • advanced-ads/tags/1.56.0/modules/pef/main.php

    r3086263 r3187581  
    1515    return;
    1616}
     17
     18Module::get_instance();
  • advanced-ads/tags/1.56.0/modules/pef/views/template.php

    r3050336 r3187581  
    124124    <div class="aa_overview_pef_upper">
    125125        <p class="aa_overview_pef_dismiss"><a class="dashicons dashicons-dismiss" href="#"></a></p>
    126         <p class="aa_overview_pef_subhead">Shout-outs from the Advanced Ads Labs</p>
    127         <h3 class="aa_overview_pef_head"><?php echo esc_html( $winner['name'] ); ?></h3>
    128         <p class="aa_overview_pef_copy"><?php echo esc_html( $winner['text'] ); ?></p>
     126        <p class="aa_overview_pef_subhead"><?php echo esc_html( $winner['subheading'] ); ?></p>
     127        <h3 class="aa_overview_pef_head"><?php echo esc_html( $winner['heading'] ); ?></h3>
     128        <p class="aa_overview_pef_copy"><?php echo wp_kses_post( $winner['text'] ); ?></p>
    129129    </div>
    130130    <div class="aa_overview_pef_lower">
    131         <p class="aa_overview_pef_cta">Does this feature appeal to you?<a class="aa_overview_pef_button" href="<?php echo esc_url( $this->build_link( $winner, $screen ) ); ?>" target="_blank">Yes, focus on it!</a>
     131        <p class="aa_overview_pef_cta">
     132            <?php echo esc_html( $winner['cta'] ); ?>
     133            <a class="aa_overview_pef_button" href="<?php echo esc_url( $this->build_link( $winner, $screen ) ); ?>" target="_blank">
     134                <?php echo esc_html( $winner['cta_button'] ); ?>
     135            </a>
    132136        </p>
    133137    </div>
  • advanced-ads/tags/1.56.0/readme.txt

    r3170554 r3187581  
    33Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.0
    5 Tested up to: 6.5
     5Tested up to: 6.6
    66Requires PHP: 7.2
    7 Stable tag: 1.55.0
     7Stable tag: 1.56.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    357357== Changelog ==
    358358
    359 = 1.55.0 (October 16, 2024) =
    360 
    361 - Improvement: add manual links to some settings
     359= 1.56.0 (November 13, 2024) =
     360
     361- Improvement: optimize code structure slightly for better performance
    362362- Improvement: enhance PubGuru one click integration
    363 - Fix: correct an issue with repeating ads before a heading
  • advanced-ads/tags/1.56.0/views/admin/screens/dashboard.php

    r3086263 r3187581  
    77 */
    88
     9use AdvancedAds\Modules\ProductExperimentationFramework\Module;
     10
    911?>
    1012<div class="wrap">
    1113    <div id="advads-overview">
     14        <?php Module::get_instance()->render( 'overview' ); ?>
    1215        <?php Advanced_Ads_Overview_Widgets_Callbacks::setup_overview_widgets(); ?>
    1316    </div>
  • advanced-ads/trunk/admin/includes/class-meta-box.php

    r3170554 r3187581  
    661661        }
    662662
    663         $currencies  = [ 'EUR', 'USD' ];
     663        $currencies  = [ 'EUR', 'USD', 'GBP', 'CHF' ];
    664664        $feed_url    = 'https://wpadvancedads.com/category/tutorials/feed/';
    665665        $campaign    = 'dashboard';
  • advanced-ads/trunk/admin/views/support.php

    r3086263 r3187581  
    7373<?php endif; ?>
    7474</div>
     75<?php AdvancedAds\Modules\ProductExperimentationFramework\Module::get_instance()->render( 'support' ); ?>
  • advanced-ads/trunk/advanced-ads.php

    r3170554 r3187581  
    1313 * Plugin URI:        https://wpadvancedads.com
    1414 * Description:       Manage and optimize your ads in WordPress
    15  * Version:           1.55.0
     15 * Version:           1.56.0
    1616 * Author:            Advanced Ads
    1717 * Author URI:        https://wpadvancedads.com
     
    3434
    3535define( 'ADVADS_FILE', __FILE__ );
    36 define( 'ADVADS_VERSION', '1.55.0' );
     36define( 'ADVADS_VERSION', '1.56.0' );
    3737
    3838// Load the autoloader.
  • advanced-ads/trunk/classes/in-content-injector.php

    r3170554 r3187581  
    8383        if ( in_array( $tag_option, [ 'img', 'iframe', 'custom' ], true ) ) {
    8484            $defaults['allowEmpty'] = true;
     85        }
     86
     87        // Merge the options if possible. If there are common keys, we don't merge them to prevent overriding and unexpected behavior.
     88        $common_keys = array_intersect_key( $options, $placement_opts );
     89        if ( empty( $common_keys ) ) {
     90            $options = array_merge( $options, $placement_opts );
    8591        }
    8692
  • advanced-ads/trunk/languages/advanced-ads.pot

    r3170554 r3187581  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Advanced Ads 1.54.1\n"
     5"Project-Id-Version: Advanced Ads 1.55.0\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-10-16T11:58:57+00:00\n"
     12"POT-Creation-Date: 2024-11-13T12:24:30+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
     
    817817
    818818#: admin/includes/class-settings.php:178
    819 #: classes/in-content-injector.php:611
     819#: classes/in-content-injector.php:617
    820820msgid "Disable level limitation"
    821821msgstr ""
     
    26482648
    26492649#. translators: %s stands for the name of the "Disable level limitation" option and automatically translated as well
    2650 #: classes/in-content-injector.php:610
     2650#: classes/in-content-injector.php:616
    26512651msgid "Set <em>%s</em> to show more ads"
    26522652msgstr ""
     
    41864186msgstr ""
    41874187
    4188 #: modules/one-click/admin/class-ajax.php:135
    4189 #: modules/one-click/admin/class-ajax.php:170
     4188#. translators: 1 is the opening link to the Advanced Ads website, 2 the closing link
     4189#: modules/one-click/admin/class-ajax.php:136
     4190msgid "The backup of your ads.txt file has failed. Please ensure that a manual backup is created You can find detailed instructions on how to manually back up your ads.txt file in the manual. %1$sManual%2$s"
     4191msgstr ""
     4192
     4193#: modules/one-click/admin/class-ajax.php:146
     4194msgid "File successfully backed up."
     4195msgstr ""
     4196
     4197#: modules/one-click/admin/class-ajax.php:174
    41904198msgid "An error has occurred please try again."
    4191 msgstr ""
    4192 
    4193 #: modules/one-click/admin/class-ajax.php:142
    4194 msgid "File successfully backed up."
    41954199msgstr ""
    41964200
     
    42164220msgstr ""
    42174221
     4222#: modules/pef/class-module.php:197
     4223#: modules/pef/class-module.php:205
     4224msgid "FROM THE ADVANCED ADS LABS:"
     4225msgstr ""
     4226
     4227#: modules/pef/class-module.php:198
     4228#: modules/pef/class-module.php:206
     4229msgid "The Campaign Manager"
     4230msgstr ""
     4231
     4232#: modules/pef/class-module.php:200
     4233#: modules/pef/class-module.php:208
     4234msgid "Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you."
     4235msgstr ""
     4236
     4237#: modules/pef/class-module.php:201
     4238#: modules/pef/class-module.php:209
     4239msgid "Are you interested in this product concept?"
     4240msgstr ""
     4241
     4242#: modules/pef/class-module.php:202
     4243#: modules/pef/class-module.php:210
     4244msgid "Yes, I want to know more!"
     4245msgstr ""
     4246
    42184247#: modules/privacy/admin/admin.php:51
    42194248msgid "Privacy"
  • advanced-ads/trunk/modules/one-click/admin/class-ajax.php

    r3170554 r3187581  
    132132        if ( false === $result ) {
    133133            $notice = sprintf(
    134                 '<div class="notice notice-error flex items-center p-4">%s</div>',
    135                 esc_html__( 'An error has occurred please try again.', 'advanced-ads' )
     134                '<div class="notice notice-error flex items-center p-4">'
     135                /* translators: 1 is the opening link to the Advanced Ads website, 2 the closing link */
     136                . __( 'The backup of your ads.txt file has failed. Please ensure that a manual backup is created You can find detailed instructions on how to manually back up your ads.txt file in the manual. %1$sManual%2$s', 'advanced-ads' )
     137                . '</div>',
     138                '<a href="https://wpadvancedads.com/manual/ads-txt/?utm_source=advanced-ads&utm_medium=link&utm_campaign=notice-ads-txt-oci#Manual_backup_of_the_adstxt_file" target="_blank" class="advads-manual-link" style="display: inline !important;">',
     139                '</a>'
    136140            );
    137141            wp_send_json_error( $notice );
  • advanced-ads/trunk/modules/one-click/modules/class-workflow.php

    r3145275 r3187581  
    4949            if ( Options::module( 'ads_txt' ) ) {
    5050                ( new AdsTxt() )->hooks();
     51            }
     52
     53            if ( ! function_exists( 'wp_advads_pro' ) ) {
     54                add_filter( 'advanced-ads-placement-content-offsets', [ $this, 'placement_content_offsets' ], 10, 3 );
    5155            }
    5256        }
     
    142146        ( new Api_Ads() )->import();
    143147    }
     148
     149    /**
     150     * Get offsets for Content placement.
     151     *
     152     * @param array $offsets        Existing Offsets.
     153     * @param array $options        Injection options.
     154     * @param array $placement_opts Placement options.
     155     *
     156     * @return array $offsets New offsets.
     157     */
     158    public function placement_content_offsets( $offsets, $options, $placement_opts ) {
     159        if ( ! isset( $options['paragraph_count'] ) ) {
     160            return $offsets;
     161        }
     162
     163        // "Content" placement, repeat position.
     164        if (
     165            ( ! empty( $placement_opts['repeat'] ) || ! empty( $options['repeat'] ) ) &&
     166            isset( $options['paragraph_id'] ) &&
     167            isset( $options['paragraph_select_from_bottom'] )
     168        ) {
     169
     170            $offsets = [];
     171            for ( $i = $options['paragraph_id'] - 1; $i < $options['paragraph_count']; $i++ ) {
     172                // Select every X number.
     173                if ( 0 === ( $i + 1 ) % $options['paragraph_id'] ) {
     174                    $offsets[] = $options['paragraph_select_from_bottom'] ? $options['paragraph_count'] - 1 - $i : $i;
     175                }
     176            }
     177        }
     178
     179        return $offsets;
     180    }
    144181}
  • advanced-ads/trunk/modules/pef/class-module.php

    r3050336 r3187581  
    1414class Module {
    1515    /**
     16     * The singleton
     17     *
     18     * @var Module
     19     */
     20    private static $instance;
     21
     22    /**
     23     * User meta key where the dismiss flag is stored.
     24     *
     25     * @var string
     26     */
     27    const USER_META = 'advanced_ads_pef_dismiss';
     28
     29    /**
    1630     * Current running features
    1731     *
    1832     * @var array[]
    1933     */
    20     const FEATURES = [
    21         'labs-video-ads'             => [
    22             'name'   => 'Video Ads',
    23             'weight' => 1,
    24             'text'   => 'The Advanced Ads team is developing a new feature to support video ads. This enables embedding videos from your WordPress media library and video ad networks. Like image ads, they would be fully compatible with all conditions and placements. We are curious whether our users want us to prioritize this feature.',
    25         ],
    26         'labs-email-notifications'   => [
    27             'name'   => 'Email Notifications',
    28             'weight' => 1,
    29             'text'   => 'The Advanced Ads team is developing a new feature to improve email notifications. Imagine receiving timely reminders in your inbox, giving you ample time to take action. Whether renewing an ad, adjusting ad groups, or checking the statistics after a campaign has ended, you’ll be in the know every step of the way. We are curious whether our users want us to prioritize this feature.',
    30         ],
    31         'labs-image-mapping'         => [
    32             'name'   => 'Image Mapping',
    33             'weight' => 1,
    34             'text'   => 'The Advanced Ads team is developing a new feature to allow serving multiple images with the same ad unit. This workflow can save you time in certain setups and is an alternative to ad groups when it comes to multiple campaigns from the same advertiser. We are curious whether our users want us to prioritize this feature.',
    35         ],
    36         'labs-automated-split-tests' => [
    37             'name'   => 'Automated Split Tests',
    38             'weight' => 1,
    39             'text'   => 'The Advanced Ads team is working on a new feature to simplify your workload: automated split testing. Let us handle the heavy lifting for you by automatically maximizing your ad performance based on the CTR of your ad units. We are curious whether our users want us to prioritize this feature.',
    40         ],
    41         'labs-ad-preview'            => [
    42             'name'   => 'Ad Preview',
    43             'weight' => 1,
    44             'text'   => 'The Advanced Ads team is developing a new feature: ad previews. Simply input the code in the Parameter box, and watch your ad come to life on the Edit Ad page. We are curious whether our users want us to prioritize this feature.',
    45         ],
    46         'labs-animated-ads'          => [
    47             'name'   => 'Animated Ads',
    48             'weight' => 1,
    49             'text'   => 'The Advanced Ads team is developing a new feature to allow animating ads. Captivate your audience with eye-catching effects like flip, slider, and fade. Enhance engagement and leave a lasting impression with dynamic ad displays. We are curious whether our users want us to prioritize this feature.',
    50         ],
    51         'labs-active-view-tracking'  => [
    52             'name'   => 'Active View Tracking',
    53             'weight' => 1,
    54             'text'   => 'The Advanced Ads team is developing a new feature to enable active view tracking. Gain precise insights into ad viewability and upgrade your metrics. With active view tracking, you’ll know if your ad is loaded and visible in the viewport. We are curious whether our users want us to prioritize this feature.',
    55         ],
    56         'labs-ad-schedule-wizard'    => [
    57             'name'   => 'Ad Schedule Wizard',
    58             'weight' => 1,
    59             'text'   => 'The Advanced Ads team is developing a better ad scheduling and planning interface. Simplify your workflow and maximize efficiency. With an improved user experience, managing your ads could be easier than ever. We are curious whether our users want us to prioritize this feature.',
    60         ],
    61         'labs-reports-insights'      => [
    62             'name'   => 'Reports & Insights',
    63             'weight' => 1,
    64             'text'   => 'The Advanced Ads team is improving the reporting. Customize your email reports to focus on the metrics that most matter to you and easily share them as PDFs. Empower yourself with actionable data and streamline communication with stakeholders. We are curious whether our users want us to prioritize this feature.',
    65         ],
    66     ];
    67 
    68     /**
    69      * User meta key where the dismiss flag is stored.
    70      *
    71      * @var string
    72      */
    73     const USER_META = 'advanced_ads_pef_dismiss';
    74 
    75     /**
    76      * The singleton
    77      *
    78      * @var Module
    79      */
    80     private static $instance;
     34    private $features;
    8135
    8236    /**
     
    10256
    10357    /**
    104      * Private constructor
     58     * Singleton design
    10559     */
    10660    private function __construct() {
     61        $this->set_features();
     62
    10763        // Wait for `admin_init` to get the current user.
    10864        add_action( 'admin_init', [ $this, 'admin_init' ] );
     65    }
     66
     67    /**
     68     * Return the singleton. Create it if needed
     69     *
     70     * @return Module
     71     */
     72    public static function get_instance() {
     73        if ( null === self::$instance ) {
     74            self::$instance = new self();
     75        }
     76
     77        return self::$instance;
    10978    }
    11079
     
    11887        if ( $this->get_minor_version( ADVADS_VERSION ) === $this->get_minor_version( $meta ) ) {
    11988            $this->can_display = false;
    120 
    12189            return;
    12290        }
     91
    12392        $this->collect_weights();
    12493        add_action( 'wp_ajax_advanced_ads_pef', [ $this, 'dismiss' ] );
     
    139108
    140109    /**
    141      * Collect feature ID with their weight as recorded in the class constant. Also calculate the weight sum
    142      */
    143     private function collect_weights() {
    144         if ( 0 !== $this->weight_sum ) {
    145             return;
    146         }
    147         foreach ( self::FEATURES as $id => $feature ) {
    148             $this->weights[ $id ] = (int) $feature['weight'];
    149             $this->weight_sum    += $this->weights[ $id ];
    150         }
    151     }
    152 
    153     /**
    154110     * Get a random feature based on weights and a random number
    155111     *
     
    157113     */
    158114    public function get_winner_feature() {
    159         $random_weight  = mt_rand( 1, $this->weight_sum );
     115        $random_weight  = wp_rand( 1, $this->weight_sum );
    160116        $current_weight = 0;
    161         foreach ( self::FEATURES as $id => $feature ) {
     117        foreach ( $this->features as $id => $feature ) {
    162118            $current_weight += $this->weights[ $id ];
    163119            if ( $random_weight <= $current_weight ) {
     
    167123                        'weight' => $this->weights[ $id ],
    168124                    ],
    169                     self::FEATURES[ $id ]
     125                    $this->features[ $id ]
    170126                );
    171127            }
     
    181137     */
    182138    public function render( $screen ) {
     139        // Early bail!!
    183140        if ( ! $this->can_display ) {
    184141            return;
    185142        }
    186143        $winner = $this->get_winner_feature();
     144
    187145        require_once DIR . '/views/template.php';
    188146    }
     
    208166     */
    209167    public function build_link( $winner, $screen ) {
    210         $link  = "https://wpadvancedads.com/advanced-ads-labs/?utm_source=advanced-ads&utm_medium=link&utm_campaign=$screen-aa-labs&utm_term=b";
    211         $link .= str_replace( '.', '-', ADVADS_VERSION ) . "w{$winner['weight']}-{$this->weight_sum}&utm_content={$winner['id']}";
    212 
    213         return $link;
    214     }
    215 
    216     /**
    217      * Return the singleton. Create it if needed
    218      *
    219      * @return Module
    220      */
    221     public static function get_instance() {
    222         if ( null === self::$instance ) {
    223             self::$instance = new self();
    224         }
    225 
    226         return self::$instance;
     168        $utm_source   = 'advanced-ads';
     169        $utm_medium   = 'link';
     170        $utm_campaign = sprintf( '%s-aa-labs', $screen );
     171        $utm_term     = sprintf(
     172            'b%sw%d-%d',
     173            str_replace( '.', '-', ADVADS_VERSION ),
     174            $winner['weight'],
     175            $this->weight_sum
     176        );
     177        $utm_content  = $winner['id'];
     178
     179        return sprintf(
     180            'https://wpadvancedads.com/advanced-ads-labs/?utm_source=%s&utm_medium=%s&utm_campaign=%s&utm_term=%s&utm_content=%s',
     181            $utm_source,
     182            $utm_medium,
     183            $utm_campaign,
     184            $utm_term,
     185            $utm_content
     186        );
     187    }
     188
     189    /**
     190     * Set the features/banners
     191     *
     192     * @return void
     193     */
     194    private function set_features() {
     195        $this->features = [
     196            'labs-campaign-manager-ay' => [
     197                'subheading' => __( 'FROM THE ADVANCED ADS LABS:', 'advanced-ads' ),
     198                'heading'    => __( 'The Campaign Manager', 'advanced-ads' ),
     199                'weight'     => 1,
     200                'text'       => __( 'Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you.', 'advanced-ads' ),
     201                'cta'        => __( 'Are you interested in this product concept?', 'advanced-ads' ),
     202                'cta_button' => __( 'Yes, I want to know more!', 'advanced-ads' ),
     203            ],
     204            'labs-campaign-manager-be' => [
     205                'subheading' => __( 'FROM THE ADVANCED ADS LABS:', 'advanced-ads' ),
     206                'heading'    => __( 'The Campaign Manager', 'advanced-ads' ),
     207                'weight'     => 1,
     208                'text'       => __( 'Advanced Ads’ upcoming new product, the Campaign Manager, will shake up how you sell ad space to clients directly. It bundles a decade of users’ requests and ideas into one standalone product. The core feature set includes a brilliant advertisement schedule screen, grouping ads and reports by client, brushed-up email notifications for timed ads, and more.<br><br>Our team is in the early stages of development, and we would like to see if this product resonates with you.', 'advanced-ads' ),
     209                'cta'        => __( 'Are you interested in this product concept?', 'advanced-ads' ),
     210                'cta_button' => __( 'Yes, I want to know more!', 'advanced-ads' ),
     211            ],
     212        ];
     213    }
     214
     215    /**
     216     * Collect feature ID with their weight as recorded in the class constant. Also calculate the weight sum
     217     */
     218    private function collect_weights() {
     219        if ( 0 !== $this->weight_sum ) {
     220            return;
     221        }
     222        foreach ( $this->features as $id => $feature ) {
     223            $this->weights[ $id ] = (int) $feature['weight'];
     224            $this->weight_sum    += $this->weights[ $id ];
     225        }
    227226    }
    228227}
  • advanced-ads/trunk/modules/pef/main.php

    r3086263 r3187581  
    1515    return;
    1616}
     17
     18Module::get_instance();
  • advanced-ads/trunk/modules/pef/views/template.php

    r3050336 r3187581  
    124124    <div class="aa_overview_pef_upper">
    125125        <p class="aa_overview_pef_dismiss"><a class="dashicons dashicons-dismiss" href="#"></a></p>
    126         <p class="aa_overview_pef_subhead">Shout-outs from the Advanced Ads Labs</p>
    127         <h3 class="aa_overview_pef_head"><?php echo esc_html( $winner['name'] ); ?></h3>
    128         <p class="aa_overview_pef_copy"><?php echo esc_html( $winner['text'] ); ?></p>
     126        <p class="aa_overview_pef_subhead"><?php echo esc_html( $winner['subheading'] ); ?></p>
     127        <h3 class="aa_overview_pef_head"><?php echo esc_html( $winner['heading'] ); ?></h3>
     128        <p class="aa_overview_pef_copy"><?php echo wp_kses_post( $winner['text'] ); ?></p>
    129129    </div>
    130130    <div class="aa_overview_pef_lower">
    131         <p class="aa_overview_pef_cta">Does this feature appeal to you?<a class="aa_overview_pef_button" href="<?php echo esc_url( $this->build_link( $winner, $screen ) ); ?>" target="_blank">Yes, focus on it!</a>
     131        <p class="aa_overview_pef_cta">
     132            <?php echo esc_html( $winner['cta'] ); ?>
     133            <a class="aa_overview_pef_button" href="<?php echo esc_url( $this->build_link( $winner, $screen ) ); ?>" target="_blank">
     134                <?php echo esc_html( $winner['cta_button'] ); ?>
     135            </a>
    132136        </p>
    133137    </div>
  • advanced-ads/trunk/readme.txt

    r3170554 r3187581  
    33Tags: ads, adsense, amazon, affiliate, ad manager
    44Requires at least: 5.0
    5 Tested up to: 6.5
     5Tested up to: 6.6
    66Requires PHP: 7.2
    7 Stable tag: 1.55.0
     7Stable tag: 1.56.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    357357== Changelog ==
    358358
    359 = 1.55.0 (October 16, 2024) =
    360 
    361 - Improvement: add manual links to some settings
     359= 1.56.0 (November 13, 2024) =
     360
     361- Improvement: optimize code structure slightly for better performance
    362362- Improvement: enhance PubGuru one click integration
    363 - Fix: correct an issue with repeating ads before a heading
  • advanced-ads/trunk/views/admin/screens/dashboard.php

    r3086263 r3187581  
    77 */
    88
     9use AdvancedAds\Modules\ProductExperimentationFramework\Module;
     10
    911?>
    1012<div class="wrap">
    1113    <div id="advads-overview">
     14        <?php Module::get_instance()->render( 'overview' ); ?>
    1215        <?php Advanced_Ads_Overview_Widgets_Callbacks::setup_overview_widgets(); ?>
    1316    </div>
Note: See TracChangeset for help on using the changeset viewer.