Plugin Directory

Changeset 3093425


Ignore:
Timestamp:
05/27/2024 06:14:26 PM (22 months ago)
Author:
creativehassan
Message:

Updated for latest WP and Security Patch

Location:
snap-pixel
Files:
28 added
3 edited

Legend:

Unmodified
Added
Removed
  • snap-pixel/trunk/admin/snapchat_pixel_backend.php

    r3090062 r3093425  
    133133            </div>
    134134        </div>
     135        <?php echo wp_nonce_field('snapchat_pixel_security', 'snapchat_pixel_nonce'); ?>
    135136        <p class="submit"><input type="submit" name="save_snapchat_pixel" id="submit" class="button button-primary"
    136137                                 value="<?php echo __('Save Changes', $this->plugin_name); ?>"></p>
  • snap-pixel/trunk/readme.txt

    r3090062 r3093425  
    88Tested up to: 6.0
    99Requires PHP: 5.6
    10 Stable tag: 1.5.8
     10Stable tag: 1.6.0
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9696= 1.5.8 =
    9797* Security fix applied
     98= 1.6.0 =
     99* Security fix applied
  • snap-pixel/trunk/snapchat-pixel.php

    r3090062 r3093425  
    44 * Plugin URI:  https://wordpress.org/plugins/snap-pixel
    55 * Description: Snapchat (Snap Pixel) to measure the cross-device impact of campaigns. It is best suited for your direct response goals, such as driving leads, Subscriptions, or product sales.
    6  * Version:     1.5.8
     6 * Version:     1.6.0
    77 * Author:      Hassan Ali
    88 * Author URI:  https://creativehassan.com
     
    189189
    190190        public function snapchat_pixel_backend(){
    191             if(isset($_REQUEST['woo_activate'])){
    192                 $woo_activate = isset($_REQUEST['woo_activate']) ? esc_attr($_REQUEST['woo_activate']) : '';
    193                 update_option('snapchat_pixel_wooacces', $woo_activate);
    194             }
    195             if(isset($_POST['save_snapchat_pixel'])){
    196                 if(isset($_POST['snapchat_pixel_code'])) {
    197                     $raw_data = wp_unslash($_POST['snapchat_pixel_code']);
    198 
    199                     $sanitized_data = array(
    200                         'pixel_id' => $this->sanitize_pixel_id($raw_data['pixel_id']),
    201                         'user_email' => sanitize_email($raw_data['user_email']),
    202                         'homepage' => isset($raw_data['homepage']) && $raw_data['homepage'] === 'checked' ? 'checked' : '',
    203                         'pages' => isset($raw_data['pages']) && $raw_data['pages'] === 'checked' ? 'checked' : '',
    204                         'posts' => isset($raw_data['posts']) && $raw_data['posts'] === 'checked' ? 'checked' : '',
    205                         'search' => isset($raw_data['search']) && $raw_data['search'] === 'checked' ? 'checked' : '',
    206                         'categories' => isset($raw_data['categories']) && $raw_data['categories'] === 'checked' ? 'checked' : '',
    207                         'tags' => isset($raw_data['tags']) && $raw_data['tags'] === 'checked' ? 'checked' : '',
    208                         'viewcart' => isset($raw_data['viewcart']) && $raw_data['viewcart'] === 'checked' ? 'checked' : '',
    209                         'checkout' => isset($raw_data['checkout']) && $raw_data['checkout'] === 'checked' ? 'checked' : '',
    210                         'paymentinfo' => isset($raw_data['paymentinfo']) && $raw_data['paymentinfo'] === 'checked' ? 'checked' : '',
    211                         'addtocart' => isset($raw_data['addtocart']) && $raw_data['addtocart'] === 'checked' ? 'checked' : '',
    212                         'ajax_addtocart' => isset($raw_data['ajax_addtocart']) && $raw_data['ajax_addtocart'] === 'checked' ? 'checked' : ''
    213                     );
    214 
    215                     // Additional sanitization for 'pixel_id' to prevent XSS
    216                     $sanitized_data['pixel_id'] = esc_attr($sanitized_data['pixel_id']);
    217 
    218                     update_option('snapchat_pixel_code', $sanitized_data);
     191            if ( isset( $_POST['snapchat_pixel_nonce'] ) && wp_verify_nonce( $_POST['snapchat_pixel_nonce'], 'snapchat_pixel_security' ) ) {
     192
     193                if (isset($_POST['save_snapchat_pixel'])) {
     194                    if (isset($_POST['snapchat_pixel_code'])) {
     195                        $raw_data = wp_unslash($_POST['snapchat_pixel_code']);
     196
     197                        $sanitized_data = array(
     198                            'pixel_id' => $this->sanitize_pixel_id($raw_data['pixel_id']),
     199                            'user_email' => sanitize_email($raw_data['user_email']),
     200                            'homepage' => isset($raw_data['homepage']) && $raw_data['homepage'] === 'checked' ? 'checked' : '',
     201                            'pages' => isset($raw_data['pages']) && $raw_data['pages'] === 'checked' ? 'checked' : '',
     202                            'posts' => isset($raw_data['posts']) && $raw_data['posts'] === 'checked' ? 'checked' : '',
     203                            'search' => isset($raw_data['search']) && $raw_data['search'] === 'checked' ? 'checked' : '',
     204                            'categories' => isset($raw_data['categories']) && $raw_data['categories'] === 'checked' ? 'checked' : '',
     205                            'tags' => isset($raw_data['tags']) && $raw_data['tags'] === 'checked' ? 'checked' : '',
     206                            'viewcart' => isset($raw_data['viewcart']) && $raw_data['viewcart'] === 'checked' ? 'checked' : '',
     207                            'checkout' => isset($raw_data['checkout']) && $raw_data['checkout'] === 'checked' ? 'checked' : '',
     208                            'paymentinfo' => isset($raw_data['paymentinfo']) && $raw_data['paymentinfo'] === 'checked' ? 'checked' : '',
     209                            'addtocart' => isset($raw_data['addtocart']) && $raw_data['addtocart'] === 'checked' ? 'checked' : '',
     210                            'ajax_addtocart' => isset($raw_data['ajax_addtocart']) && $raw_data['ajax_addtocart'] === 'checked' ? 'checked' : ''
     211                        );
     212
     213                        // Additional sanitization for 'pixel_id' to prevent XSS
     214                        $sanitized_data['pixel_id'] = esc_attr($sanitized_data['pixel_id']);
     215
     216                        update_option('snapchat_pixel_code', $sanitized_data);
     217                    }
    219218                }
     219            }
     220            // Save WooCommerce Settings
     221            if (isset($_REQUEST['woo_activate'])) {
     222                $woo_activate = isset($_REQUEST['woo_activate']) ? esc_attr($_REQUEST['woo_activate']) : '';
     223                if( $woo_activate == 'yes' ){
     224                    $woo_activate = 'yes';
     225                } else if( $woo_activate == 'no' ){
     226                    $woo_activate = 'no';
     227                } else {
     228                    $woo_activate = 'no';
     229                }
     230                update_option('snapchat_pixel_wooacces', $woo_activate);
    220231            }
    221232
Note: See TracChangeset for help on using the changeset viewer.