Plugin Directory

Changeset 2207108


Ignore:
Timestamp:
12/06/2019 09:38:00 AM (6 years ago)
Author:
cookiepro
Message:

Adding the functionality to enable automatic blocking of google analytics by entering your UA-ID

Location:
cookiepro/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • cookiepro/trunk/class-cookiepro.php

    r2164181 r2207108  
    33 * Plugin Name: CookiePro
    44 * Plugin URI: http://www.onetrust.com/
    5  * Version: 1.0.1
     5 * Version: 1.0.2
    66 * Author: OneTrust, Llc
    77 * Author URI: https://www.onetrust.com/products/cookies/
     
    3232 * CookiePro
    3333 */
     34 
     35 
     36
    3437class Cookiepro {
    3538    /**
     
    4144        $this->plugin->name                     = 'cookiepro';
    4245        $this->plugin->displayName              = 'CookiePro';
    43         $this->plugin->version                  = '1.0.0';
     46        $this->plugin->version                  = '1.0.2';
    4447        $this->plugin->folder                   = plugin_dir_path( __FILE__ );
    4548        $this->plugin->url                      = plugin_dir_url( __FILE__ );
     
    5558        add_action( 'wp_ajax_' . $this->plugin->name . '_dismiss_dashboard_notices', array( &$this, 'dismissdashboardnotices' ) );
    5659        add_action( 'wp_head', array( &$this, 'frontendheader' ) );
    57     }
     60        add_action( 'wp_footer', array( &$this, 'cookiepro_code' ) );
     61    }
     62       
    5863    /** Frontendheader functions. */
    5964    public function frontendheader() {
    6065        $this->output( 'cookiepro_header' );
     66        //$this->output1('cookiepro_analyticsID');
    6167    }
    6268
     
    8389    public function registersettings() {
    8490        register_setting( $this->plugin->name, 'cookiepro_header', 'trim' );
    85     }
     91        register_setting( $this->plugin->name, 'cookiepro_analyticsID', 'trim' );
     92    }
     93   
     94   
     95  /** google analytics disable code **/
     96  public function cookiepro_code() {
     97     
     98      include_once WP_PLUGIN_DIR . '/' . $this->plugin->name . '/views/gaoptout.php';
     99  }
     100 
    86101
    87102
     
    105120                    $this->message = __( 'Changes Saved.' );
    106121                }
     122               
     123                if ( isset( $_REQUEST['cookiepro_analyticsID'] ) ) {
     124                      update_option( 'cookiepro_analyticsID', sanitize_option( '', wp_unslash( $_REQUEST['cookiepro_analyticsID'] ) ) );
     125                   
     126                }               
    107127            }
    108128        }
     
    110130            'cookiepro_header' => esc_html( wp_unslash( get_option( 'cookiepro_header' ) ) ),
    111131        );
     132       
     133        $this->settings1 = array(
     134            'cookiepro_analyticsID' => esc_html( wp_unslash( get_option( 'cookiepro_analyticsID' ) ) ),
     135        );     
     136       
    112137        include_once WP_PLUGIN_DIR . '/' . $this->plugin->name . '/views/settings.php';
    113138    }
     
    154179        echo wp_unslash( $myopt );
    155180    }
     181   
     182    public function output1($setting1){
     183        if ( is_admin() || is_feed() || is_robots() || is_trackback() ) {
     184            return;
     185        }
     186        if ( apply_filters( 'disable_cookiepro', false ) ) {
     187            return;
     188        }
     189        if ( 'cookiepro_analyticsID' === $setting1 && apply_filters( 'cookiepro_analyticsID', false ) ) {
     190            return;
     191        }
     192        $myopt = get_option( $setting1 );
     193        if ( empty( $myopt ) ) {
     194            return;
     195        }
     196        if ( trim( $myopt ) === '' ) {
     197            return;
     198        }
     199        $allowed_html = array(
     200            'a'      => array(
     201                'href'  => array(),
     202                'title' => array(),
     203            ),
     204            'br'     => array(),
     205            'em'     => array(),
     206            'strong' => array(),
     207            'script' => array(
     208                'src'     => array(),
     209                'type'    => array(),
     210                'charset' => array(),
     211            ),
     212        );
     213        echo wp_unslash( $myopt );
     214       
     215    }
    156216    /** Frontendheader functions. */
    157217    public function loadlanguagefiles() {
    158218        load_plugin_textdomain( $this->plugin->name, false, $this->plugin->name . '/languages/' );
    159     }
     219       
     220    }
     221   
    160222}
    161223
    162224$cookiepro = new Cookiepro();
     225
  • cookiepro/trunk/readme.txt

    r2206331 r2207108  
    33Tags: Cookie consent, Cookie compliance, GDPR, Cookie law, EU privacy directive, cookie notice, code, content, css, facebook pixel, footer, footer code, footer scripts, footers, google analytics, head, header, header code, header scripts, headers, insert, insert code, insert scripts, js, meta, meta tags, scripts, wpmu, cookies, cookie consent, cookie banner, preference center, privacy, cookie compliance, cookie notice, privacy policy, cookie policy, cookie script, google tag manager
    44Requires at least: 3.6
    5 Tested up to: 5.2.3
    6 Stable tag: 1.0.1
     5Tested up to: 5.3
     6Stable tag: 1.0.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • cookiepro/trunk/views/dashboard-notices.php

    r2100481 r2207108  
    88 * @license    GPL2
    99 * @link       https://cookiepro.com
    10  * @since      1.0.0
     10 * @since      1.0.2
    1111 */
    1212
  • cookiepro/trunk/views/settings.php

    r2100481 r2207108  
    88 * @license    GPL2
    99 * @link       https://cookiepro.com
    10  * @since      1.0.0
     10 * @since      1.0.2
    1111 */
    1212
     
    158158    </div>
    159159
     160<!--Enable automatic blocking of google analytics start -->
     161
     162    <div id="poststuff">
     163        <div id="post-body" class="metabox-holder columns-2">
     164            <div id="post-body-content">
     165                <div id="normal-sortables" class="meta-box-sortables ui-sortable">
     166                    <div class="postbox">
     167                        <h3 class="hndle">
     168                            <span><?php esc_html_e( 'Enable automatic blocking of google analytics by entering your ID below' ); ?></span>
     169                        </h3>
     170                        <div class="inside">
     171                            <span>Enter Your Analytics Id:</span>
     172                            <form action="options-general.php?page=cookiepro" method="post">
     173                                <input type="text" name="cookiepro_analyticsID" placeholder="UA-XXXXXXXXX-X" value="<?php echo get_option('cookiepro_analyticsID'); ?>" />
     174                                <?php wp_nonce_field( $this->plugin->name, $this->plugin->name . '_nonce' ); ?>
     175                                <p>
     176                                    <input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php esc_html_e( 'Save' ); ?>" />
     177                                </p>
     178                            </form>
     179                        </div>
     180                    </div>
     181                </div>
     182            </div>
     183        </div>
     184    </div>
     185
     186<!--Enable automatic blocking of google analytics end -->
    160187
    161188    <div id="poststuff" >
  • cookiepro/trunk/views/sidebar.php

    r2100481 r2207108  
    88 * @license    GPL2
    99 * @link       https://cookiepro.com
    10  * @since      1.0.0
     10 * @since      1.0.2
    1111 */
    1212
Note: See TracChangeset for help on using the changeset viewer.