Plugin Directory

Changeset 2737582


Ignore:
Timestamp:
06/05/2022 11:19:11 AM (4 years ago)
Author:
namith.jawahar
Message:

Version 2.8.7
1) Quick Taq Options now appear only if the user has Classic Editor activated.
2) Quicktags Compatibility issue with Wordpress 6.0 fixed.

Location:
quick-adsense
Files:
392 added
13 edited

Legend:

Unmodified
Added
Removed
  • quick-adsense/trunk/includes/loader.php

    r2730851 r2737582  
    99function quick_adsense_load_file( $file, $args = [], $echo = false ) {
    1010    if ( ( '' !== $file ) && file_exists( dirname( __FILE__ ) . '/' . $file ) ) {
    11         //phpcs:disable WordPress.PHP.DontExtract.extract_extract
    12         // Usage of extract() is necessary in this content to simulate templating functionality.
    13         extract( $args );
    14         //phpcs:enable
     11        if ( is_array( $args ) ) {
     12            //phpcs:disable WordPress.PHP.DontExtract.extract_extract
     13            // Usage of extract() is necessary in this content to simulate templating functionality.
     14            extract( $args );
     15            //phpcs:enable
     16        }
    1517        ob_start();
    1618        include dirname( __FILE__ ) . '/' . $file;
  • quick-adsense/trunk/includes/quicktags.php

    r2694419 r2737582  
    55
    66add_action(
    7     'admin_print_footer_scripts',
     7    'admin_enqueue_scripts',
    88    function() {
    9         if ( wp_script_is( 'quicktags' ) ) {
    10             $settings = get_option( 'quick_adsense_settings' );
    11             echo '<script type="text/javascript">';
    12             if ( isset( $settings['enable_quicktag_buttons'] ) && ( $settings['enable_quicktag_buttons'] ) ) {
    13                 for ( $i = 1; $i <= 10; $i++ ) {
    14                     if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
    15                         echo 'QTags.addButton("quick_adsense_quicktag_onpost_ad_' . esc_js( $i ) . '", "Ads' . esc_js( $i ) . '", "\n<!--Ads' . esc_js( $i ) . '-->\n", "", "", "Ads' . esc_js( $i ) . '", 201);';
    16                     }
    17                 }
    18                 if ( ! isset( $settings['disable_randomads_quicktag_button'] ) || ( ! $settings['disable_randomads_quicktag_button'] ) ) {
    19                     echo 'QTags.addButton("quick_adsense_quicktag_randomads", "RndAds", "\n<!--RndAds-->\n", "", "", "Random Ads", 201);';
    20                 }
    21                 if ( ! isset( $settings['disable_disablead_quicktag_buttons'] ) || ( ! $settings['disable_disablead_quicktag_buttons'] ) ) {
    22                     echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
    23                     echo 'QTags.addButton("quick_adsense_quicktag_offdef", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
    24                     echo 'QTags.addButton("quick_adsense_quicktag_offwidget", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
    25                 }
    26                 if ( ! isset( $settings['disable_positionad_quicktag_buttons'] ) || ( ! $settings['disable_positionad_quicktag_buttons'] ) ) {
    27                     echo 'QTags.addButton("quick_adsense_quicktag_offbegin", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
    28                     echo 'QTags.addButton("quick_adsense_quicktag_offmiddle", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
    29                     echo 'QTags.addButton("quick_adsense_quicktag_offend", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
    30                     echo 'QTags.addButton("quick_adsense_quicktag_offafmore", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
    31                     echo 'QTags.addButton("quick_adsense_quicktag_offbflastpara", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
     9        $settings = get_option( 'quick_adsense_settings' );
     10        if ( isset( $settings['enable_quicktag_buttons'] ) && ( $settings['enable_quicktag_buttons'] ) ) {
     11            $args = [
     12                'active_ads'         => [],
     13                'enable_randomads'   => ( ( isset( $settings['disable_randomads_quicktag_button'] ) && ( $settings['disable_randomads_quicktag_button'] ) ) ? false : true ),
     14                'enable_disableads'  => ( ( isset( $settings['disable_disablead_quicktag_buttons'] ) && ( $settings['disable_disablead_quicktag_buttons'] ) ) ? false : true ),
     15                'enable_positionads' => ( ( isset( $settings['disable_positionad_quicktag_buttons'] ) && ( $settings['disable_positionad_quicktag_buttons'] ) ) ? false : true ),
     16            ];
     17            for ( $i = 1; $i <= 10; $i++ ) {
     18                if ( '' !== quick_adsense_get_value( $settings, 'onpost_ad_' . $i . '_content', '' ) ) {
     19                    $args['active_ads'][] = $i;
    3220                }
    3321            }
    34 
    35             echo '</script>';
     22            wp_add_inline_script(
     23                'quicktags',
     24                quick_adsense_load_file( 'templates/js/quicktags.php', $args )
     25            );
    3626        }
    3727    }
    3828);
    39 
  • quick-adsense/trunk/includes/templates/adunit-onpost.php

    r2730851 r2737582  
    44    <div class="quick_adsense_onpost_adunits_control">
    55        <?php
    6         echo wp_kses(
    7             quickadsense_get_control(
    8                 'textarea',
    9                 '',
    10                 'quick_adsense_settings_onpost_ad_' . $adunit_index . '_content',
    11                 'quick_adsense_settings[onpost_ad_' . $adunit_index . '_content]',
    12                 quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_content' ),
    13                 null,
    14                 'input',
    15                 'display: block; margin: 0 0 10px 0',
    16                 'Enter Code'
    17             ),
    18             quick_adsense_get_allowed_html()
     6        // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     7        // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
     8        echo quickadsense_get_control(
     9            'textarea',
     10            '',
     11            'quick_adsense_settings_onpost_ad_' . $adunit_index . '_content',
     12            'quick_adsense_settings[onpost_ad_' . $adunit_index . '_content]',
     13            quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_content' ),
     14            null,
     15            'input',
     16            'display: block; margin: 0 0 10px 0',
     17            'Enter Code'
    1918        );
     19        // phpcs:enable
    2020        ?>
    2121        <p class="quick_adsense_onpost_adunits_styling_controls">
  • quick-adsense/trunk/includes/templates/adunit-widget.php

    r2730851 r2737582  
    44    <div class="quick_adsense_widget_adunits_control">
    55        <?php
    6         echo wp_kses(
    7             quickadsense_get_control(
    8                 'textarea',
    9                 '',
    10                 'quick_adsense_settings_widget_ad_' . $adunit_index . '_content',
    11                 'quick_adsense_settings[widget_ad_' . $adunit_index . '_content]',
    12                 quick_adsense_get_value( $args, 'widget_ad_' . $adunit_index . '_content' ),
    13                 null,
    14                 'input',
    15                 'display: block; margin: 0 0 10px 0;',
    16                 'Enter Code'
    17             ),
    18             quick_adsense_get_allowed_html()
     6        // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     7        // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
     8        quickadsense_get_control(
     9            'textarea',
     10            '',
     11            'quick_adsense_settings_widget_ad_' . $adunit_index . '_content',
     12            'quick_adsense_settings[widget_ad_' . $adunit_index . '_content]',
     13            quick_adsense_get_value( $args, 'widget_ad_' . $adunit_index . '_content' ),
     14            null,
     15            'input',
     16            'display: block; margin: 0 0 10px 0;',
     17            'Enter Code'
    1918        );
     19        // phpcs:enable
    2020        ?>
    2121    </div>
  • quick-adsense/trunk/includes/templates/block-general-quicktag.php

    r2694419 r2737582  
    77                quickadsense_get_control(
    88                    'checkbox',
    9                     '<b>Show Quicktag Buttons on the HTML Edit Post SubPanel</b>',
     9                    '<b>Show Quicktag Buttons on the HTML Edit Post SubPanel (Classic Editor)</b>',
    1010                    'quick_adsense_settings_enable_quicktag_buttons',
    1111                    'quick_adsense_settings[enable_quicktag_buttons]',
  • quick-adsense/trunk/includes/templates/js/script-admin-notice.php

    r2694419 r2737582  
     1<?php
     2/**
     3 * This file contains the javascript code to handle admin notice related functions.
     4 */
     5
     6?>
    17jQuery(document).ready(function() {
    28    jQuery('.quick_adsense_adstxt_adsense_notice').on('click', '.notice-dismiss', function() {
  • quick-adsense/trunk/includes/templates/js/script-frontend-stats.php

    r2694419 r2737582  
     1<?php
     2/**
     3 * This file contains the javascript code for stat collection related functions.
     4 */
     5
     6?>
    17jQuery(document).ready(function() {
    28    jQuery(".<?php echo esc_js( quick_adsense_get_value( $args, 'target' ) ); ?>").click(function() {
  • quick-adsense/trunk/includes/templates/section-general.php

    r2730851 r2737582  
    1010quick_adsense_load_file( 'templates/block-general-appearance.php', $args, true );
    1111quick_adsense_load_file( 'templates/block-general-assign-position.php', $args, true );
    12 quick_adsense_load_file( 'templates/block-general-quicktag.php', $args, true );
     12if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
     13    quick_adsense_load_file( 'templates/block-general-quicktag.php', $args, true );
     14}
    1315?>
  • quick-adsense/trunk/includes/templates/section-header-footer.php

    r2727946 r2737582  
    44        <div>
    55            <?php
    6             echo wp_kses(
    7                 quickadsense_get_control(
    8                     'textarea-big',
    9                     '',
    10                     'quick_adsense_settings_header_embed_code',
    11                     'quick_adsense_settings[header_embed_code]',
    12                     quick_adsense_get_value( $args, 'header_embed_code' )
    13                 ),
    14                 quick_adsense_get_allowed_html()
     6            // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     7            // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
     8            echo quickadsense_get_control(
     9                'textarea-big',
     10                '',
     11                'quick_adsense_settings_header_embed_code',
     12                'quick_adsense_settings[header_embed_code]',
     13                quick_adsense_get_value( $args, 'header_embed_code' )
    1514            );
     15            // phpcs:enable
    1616            ?>
    1717        </div>
     
    2020        <div>
    2121            <?php
    22             echo wp_kses(
    23                 quickadsense_get_control(
    24                     'textarea-big',
    25                     '',
    26                     'quick_adsense_settings_footer_embed_code',
    27                     'quick_adsense_settings[footer_embed_code]',
    28                     quick_adsense_get_value( $args, 'footer_embed_code' )
    29                 ),
    30                 quick_adsense_get_allowed_html()
     22            // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     23            // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
     24            echo quickadsense_get_control(
     25                'textarea-big',
     26                '',
     27                'quick_adsense_settings_footer_embed_code',
     28                'quick_adsense_settings[footer_embed_code]',
     29                quick_adsense_get_value( $args, 'footer_embed_code' )
    3130            );
     31            // phpcs:enable
    3232            ?>
    3333        </div>
  • quick-adsense/trunk/includes/templates/section-onpost-content.php

    r2730851 r2737582  
    6767            for ( $i = 1; $i <= 3; $i++ ) {
    6868                $args['adunit_index'] = $i;
    69                 quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
     69                // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     70                // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
     71                echo quick_adsense_load_file( 'templates/adunit-onpost.php', $args );
     72                // phpcs:enable
    7073            }
    7174            ?>
     
    7578            for ( $i = 4; $i <= 10; $i++ ) {
    7679                $args['adunit_index'] = $i;
    77                 quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
     80                // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     81                // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
     82                echo quick_adsense_load_file( 'templates/adunit-onpost.php', $args );
     83                // phpcs:enable
    7884            }
    7985            ?>
  • quick-adsense/trunk/includes/templates/section-widgets.php

    r2730851 r2737582  
    6767            for ( $i = 1; $i <= 3; $i++ ) {
    6868                $args['adunit_index'] = $i;
    69                 quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
     69                // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     70                // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
     71                echo quick_adsense_load_file( 'templates/adunit-widget.php', $args );
     72                // phpcs:enable
    7073            }
    7174            ?>
     
    7578            for ( $i = 4; $i <= 10; $i++ ) {
    7679                $args['adunit_index'] = $i;
    77                 quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
     80                // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
     81                // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
     82                echo quick_adsense_load_file( 'templates/adunit-widget.php', $args );
     83                // phpcs:enable
    7884            }
    7985            ?>
  • quick-adsense/trunk/quick-adsense.php

    r2730851 r2737582  
    66 * Author: namithjawahar
    77 * Author URI: https://smartlogix.co.in/
    8  * Version: 2.8.6
     8 * Version: 2.8.7
    99 */
    1010require_once dirname( __FILE__ ) . '/includes/loader.php';
  • quick-adsense/trunk/readme.txt

    r2730851 r2737582  
    44Requires at least: 5.0
    55Tested up to: 6.0
    6 Stable tag: 2.8.6
     6Stable tag: 2.8.7
    77
    88Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
Note: See TracChangeset for help on using the changeset viewer.