Plugin Directory

Changeset 3243698


Ignore:
Timestamp:
02/20/2025 08:10:11 AM (10 months ago)
Author:
advancedads
Message:

Update to version 1.1.4 from GitHub

Location:
advanced-ads-adsense-in-feed
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • advanced-ads-adsense-in-feed/tags/1.1.4/advanced-ads-in-feed.php

    r2892716 r3243698  
    44 * Plugin URI:        https://wpadvancedads.com
    55 * Description:       Display AdSense In-feed ads between posts
    6  * Version:           1.1.3
     6 * Version:           1.1.4
    77 * Author:            Advanced Ads
    88 * Author URI:        https://wpadvancedads.com
     
    1717}
    1818
     19define( 'AAIF_FILE', __FILE__ );
     20define( 'AAIF_VERSION', '1.1.4' );
     21
    1922/**
    2023 * Class Advanced_Ads_In_Feed
     
    4447        add_action( 'advanced-ads-placement-options-after', array( $this, 'placement_options' ), 11, 2 );
    4548    }
    46 
    4749
    4850    /**
     
    8890     *
    8991     * @since 1.0
    90      *
    9192     */
    9293    public function inject_in_feed( $post, $wp_query = null ) {
    93         if ( ! $wp_query instanceof WP_Query
    94              || is_feed()
    95              || is_admin()
    96              || $wp_query->is_singular()
    97              || ! $wp_query->in_the_loop
    98              || ! isset( $wp_query->current_post )
    99              || ! $wp_query->is_main_query() ) {
     94        if (
     95            ! $wp_query instanceof WP_Query || is_feed() ||
     96            is_admin() || $wp_query->is_singular() || ! $wp_query->in_the_loop ||
     97            ! isset( $wp_query->current_post ) || ! $wp_query->is_main_query()
     98        ) {
    10099            return;
    101100        }
     
    147146        // load the ad.
    148147        $ad = new Advanced_Ads_Ad( $_item[1] );
    149         if ( isset( $ad->type )
    150              && 'adsense' === $ad->type
    151              && isset( $ad->content )
    152              && strpos( $ad->content, 'in-feed' ) ) {
     148        if (
     149            isset( $ad->type ) && 'adsense' === $ad->type
     150            && isset( $ad->content )
     151            && strpos( $ad->content, 'in-feed' )
     152        ) {
    153153            return true;
    154154        }
     
    229229        }
    230230    }
    231 
    232231}
    233232
    234 new Advanced_Ads_In_Feed();
     233/**
     234 * Halt code remove with new release.
     235 *
     236 * @return void
     237 */
     238function wp_advads_in_feed_halt_code() {
     239    global $advads_halt_notices;
     240
     241    // Early bail!!
     242    if ( ! defined( 'ADVADS_VERSION' ) ) {
     243        return;
     244    }
     245
     246    if ( version_compare( ADVADS_VERSION, '2.0.0', '>=' ) ) {
     247        if ( ! isset( $advads_halt_notices ) ) {
     248            $advads_halt_notices = [];
     249        }
     250        $advads_halt_notices[] = __( 'Advanced Ads – Google AdSense In-feed Placement', 'advanced-ads-adsense-in-feed' );
     251
     252        add_action(
     253            'all_admin_notices',
     254            static function () {
     255                global $advads_halt_notices;
     256
     257                // Early bail!!
     258                if ( 'plugins' === get_current_screen()->base || empty( $advads_halt_notices ) ) {
     259                    return;
     260                }
     261                ?>
     262                <div class="notice notice-error">
     263                    <h2><?php esc_html_e( 'Important Notice', 'advanced-ads-adsense-in-feed' ); ?></h2>
     264                    <p>
     265                        <?php
     266                        echo wp_kses_post(
     267                            sprintf(
     268                                /* translators: %s: Plugin name */
     269                                __( 'Your versions of the Advanced Ads addons listed below are incompatible with <strong>Advanced Ads 2.0</strong> and have been deactivated. Please update them to their latest version. If you cannot update, e.g., due to an expired license, you can <a href="%1$s">roll back to a compatible version of the Advanced Ads plugin</a> at any time or <a href="%2$s">renew your license</a>.', 'advanced-ads-adsense-in-feed' ),
     270                                esc_url( admin_url( 'admin.php?page=advanced-ads-tools&sub_page=version' ) ),
     271                                'https://wpadvancedads.com/account/#h-licenses'
     272                            )
     273                        )
     274                        ?>
     275                    </p>
     276                    <h3><?php esc_html_e( 'The following addons are affected:', 'advanced-ads-adsense-in-feed' ); ?></h3>
     277                    <ul>
     278                        <?php foreach ( $advads_halt_notices as $notice ) : ?>
     279                            <li><strong><?php echo esc_html( $notice ); ?></strong></li>
     280                        <?php endforeach; ?>
     281                    </ul>
     282                </div>
     283                <?php
     284                $advads_halt_notices = [];
     285            }
     286        );
     287
     288        add_action(
     289            'after_plugin_row_' . plugin_basename( __FILE__ ),
     290            static function () {
     291                echo '<tr class="active"><td colspan="5" class="plugin-update colspanchange">';
     292                wp_admin_notice(
     293                    sprintf(
     294                        /* translators: %s: Plugin name */
     295                        __( 'Your version of <strong>Advanced Ads – Google AdSense In-feed Placement</strong> is incompatible with <strong>Advanced Ads 2.0</strong> and has been deactivated. Please update the plugin to the latest version. If you cannot update the plugin, e.g., due to an expired license, you can <a href="%1$s">roll back to a compatible version of the Advanced Ads plugin</a> at any time or <a href="%2$s">renew your license</a>.', 'advanced-ads-pro' ),
     296                        esc_url( admin_url( 'admin.php?page=advanced-ads-tools&sub_page=version' ) ),
     297                        'https://wpadvancedads.com/account/#h-licenses'
     298                    ),
     299                    [
     300                        'type'               => 'error',
     301                        'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
     302                    ]
     303                );
     304                echo '</td></tr>';
     305            }
     306        );
     307        return;
     308    }
     309
     310    // Autoload and activate.
     311    new Advanced_Ads_In_Feed();
     312}
     313
     314add_action( 'plugins_loaded', 'wp_advads_in_feed_halt_code', 5 );
  • advanced-ads-adsense-in-feed/tags/1.1.4/readme.txt

    r3064742 r3243698  
    33Tags: adsense, in-feed, in-feed ads, ads, google adsense, loop, post list, post lists, archive pages, category pages, tag pages
    44Requires at least: 5.0
    5 Tested up to: 6.5
    6 Stable tag: 1.1.3
     5Tested up to: 6.7
     6Stable tag: 1.1.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4242== Changelog ==
    4343
     44= 1.1.4 =
     45* Improvement: add compatibility code for Advanced Ads 2.0
     46
    4447= 1.1.3 =
    4548
  • advanced-ads-adsense-in-feed/trunk/advanced-ads-in-feed.php

    r2892716 r3243698  
    44 * Plugin URI:        https://wpadvancedads.com
    55 * Description:       Display AdSense In-feed ads between posts
    6  * Version:           1.1.3
     6 * Version:           1.1.4
    77 * Author:            Advanced Ads
    88 * Author URI:        https://wpadvancedads.com
     
    1717}
    1818
     19define( 'AAIF_FILE', __FILE__ );
     20define( 'AAIF_VERSION', '1.1.4' );
     21
    1922/**
    2023 * Class Advanced_Ads_In_Feed
     
    4447        add_action( 'advanced-ads-placement-options-after', array( $this, 'placement_options' ), 11, 2 );
    4548    }
    46 
    4749
    4850    /**
     
    8890     *
    8991     * @since 1.0
    90      *
    9192     */
    9293    public function inject_in_feed( $post, $wp_query = null ) {
    93         if ( ! $wp_query instanceof WP_Query
    94              || is_feed()
    95              || is_admin()
    96              || $wp_query->is_singular()
    97              || ! $wp_query->in_the_loop
    98              || ! isset( $wp_query->current_post )
    99              || ! $wp_query->is_main_query() ) {
     94        if (
     95            ! $wp_query instanceof WP_Query || is_feed() ||
     96            is_admin() || $wp_query->is_singular() || ! $wp_query->in_the_loop ||
     97            ! isset( $wp_query->current_post ) || ! $wp_query->is_main_query()
     98        ) {
    10099            return;
    101100        }
     
    147146        // load the ad.
    148147        $ad = new Advanced_Ads_Ad( $_item[1] );
    149         if ( isset( $ad->type )
    150              && 'adsense' === $ad->type
    151              && isset( $ad->content )
    152              && strpos( $ad->content, 'in-feed' ) ) {
     148        if (
     149            isset( $ad->type ) && 'adsense' === $ad->type
     150            && isset( $ad->content )
     151            && strpos( $ad->content, 'in-feed' )
     152        ) {
    153153            return true;
    154154        }
     
    229229        }
    230230    }
    231 
    232231}
    233232
    234 new Advanced_Ads_In_Feed();
     233/**
     234 * Halt code remove with new release.
     235 *
     236 * @return void
     237 */
     238function wp_advads_in_feed_halt_code() {
     239    global $advads_halt_notices;
     240
     241    // Early bail!!
     242    if ( ! defined( 'ADVADS_VERSION' ) ) {
     243        return;
     244    }
     245
     246    if ( version_compare( ADVADS_VERSION, '2.0.0', '>=' ) ) {
     247        if ( ! isset( $advads_halt_notices ) ) {
     248            $advads_halt_notices = [];
     249        }
     250        $advads_halt_notices[] = __( 'Advanced Ads – Google AdSense In-feed Placement', 'advanced-ads-adsense-in-feed' );
     251
     252        add_action(
     253            'all_admin_notices',
     254            static function () {
     255                global $advads_halt_notices;
     256
     257                // Early bail!!
     258                if ( 'plugins' === get_current_screen()->base || empty( $advads_halt_notices ) ) {
     259                    return;
     260                }
     261                ?>
     262                <div class="notice notice-error">
     263                    <h2><?php esc_html_e( 'Important Notice', 'advanced-ads-adsense-in-feed' ); ?></h2>
     264                    <p>
     265                        <?php
     266                        echo wp_kses_post(
     267                            sprintf(
     268                                /* translators: %s: Plugin name */
     269                                __( 'Your versions of the Advanced Ads addons listed below are incompatible with <strong>Advanced Ads 2.0</strong> and have been deactivated. Please update them to their latest version. If you cannot update, e.g., due to an expired license, you can <a href="%1$s">roll back to a compatible version of the Advanced Ads plugin</a> at any time or <a href="%2$s">renew your license</a>.', 'advanced-ads-adsense-in-feed' ),
     270                                esc_url( admin_url( 'admin.php?page=advanced-ads-tools&sub_page=version' ) ),
     271                                'https://wpadvancedads.com/account/#h-licenses'
     272                            )
     273                        )
     274                        ?>
     275                    </p>
     276                    <h3><?php esc_html_e( 'The following addons are affected:', 'advanced-ads-adsense-in-feed' ); ?></h3>
     277                    <ul>
     278                        <?php foreach ( $advads_halt_notices as $notice ) : ?>
     279                            <li><strong><?php echo esc_html( $notice ); ?></strong></li>
     280                        <?php endforeach; ?>
     281                    </ul>
     282                </div>
     283                <?php
     284                $advads_halt_notices = [];
     285            }
     286        );
     287
     288        add_action(
     289            'after_plugin_row_' . plugin_basename( __FILE__ ),
     290            static function () {
     291                echo '<tr class="active"><td colspan="5" class="plugin-update colspanchange">';
     292                wp_admin_notice(
     293                    sprintf(
     294                        /* translators: %s: Plugin name */
     295                        __( 'Your version of <strong>Advanced Ads – Google AdSense In-feed Placement</strong> is incompatible with <strong>Advanced Ads 2.0</strong> and has been deactivated. Please update the plugin to the latest version. If you cannot update the plugin, e.g., due to an expired license, you can <a href="%1$s">roll back to a compatible version of the Advanced Ads plugin</a> at any time or <a href="%2$s">renew your license</a>.', 'advanced-ads-pro' ),
     296                        esc_url( admin_url( 'admin.php?page=advanced-ads-tools&sub_page=version' ) ),
     297                        'https://wpadvancedads.com/account/#h-licenses'
     298                    ),
     299                    [
     300                        'type'               => 'error',
     301                        'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
     302                    ]
     303                );
     304                echo '</td></tr>';
     305            }
     306        );
     307        return;
     308    }
     309
     310    // Autoload and activate.
     311    new Advanced_Ads_In_Feed();
     312}
     313
     314add_action( 'plugins_loaded', 'wp_advads_in_feed_halt_code', 5 );
  • advanced-ads-adsense-in-feed/trunk/readme.txt

    r3064742 r3243698  
    33Tags: adsense, in-feed, in-feed ads, ads, google adsense, loop, post list, post lists, archive pages, category pages, tag pages
    44Requires at least: 5.0
    5 Tested up to: 6.5
    6 Stable tag: 1.1.3
     5Tested up to: 6.7
     6Stable tag: 1.1.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4242== Changelog ==
    4343
     44= 1.1.4 =
     45* Improvement: add compatibility code for Advanced Ads 2.0
     46
    4447= 1.1.3 =
    4548
Note: See TracChangeset for help on using the changeset viewer.