Plugin Directory

Changeset 1946605


Ignore:
Timestamp:
09/25/2018 08:20:02 AM (8 years ago)
Author:
storespot
Message:

Facebook integration

Location:
storespot
Files:
6 added
5 edited
5 copied

Legend:

Unmodified
Added
Removed
  • storespot/tags/1.0.3/includes/class-storespot-activator.php

    r1944778 r1946605  
    22
    33class StoreSpot_Activator {
     4
    45    public static function activate() {
     6
    57        $options = [
    68            'pixel_id' => '',
     
    810            'product_category' => ''
    911        ];
     12
    1013        add_option( 'storespot_settings', $options );
    1114        set_transient( 'stsp-admin-activation-notice', true, 5 );
     
    1417            wp_schedule_event( time(), 'hourly', 'stsp_product_feed_update' );
    1518        }
     19
    1620    }
     21
    1722}
  • storespot/tags/1.0.3/includes/class-storespot.php

    r1939129 r1946605  
    4242        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-storespot-loader.php';
    4343        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-product-feed.php';
     44        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-messages.php';
    4445        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-api.php';
    4546        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-events.php';
     
    5051    private function define_admin_hooks() {
    5152            $product_feed = new StoreSpot_Product_Feed();
     53            $admin_message = new StoreSpot_Messages();
    5254            $this->loader->add_action( 'update_option_storespot_settings', $product_feed, 'write_product_feed' );
    5355            $this->loader->add_action( 'stsp_product_feed_update', $product_feed, 'write_product_feed' );
     56            $this->loader->add_action( 'admin_notices', $admin_message, 'activation_notice' );
    5457    }
    5558
    5659    private function define_public_hooks() {
    5760        $plugin_public = new StoreSpot_Events( $this->get_plugin_name(), $this->get_version() );
    58         if( $plugin_public->facebook_pixel->get_pixel_id() ) {
     61        $pixel_id = $plugin_public->facebook_pixel->get_pixel_id();
     62        if( $pixel_id && ! $this->fb_integration_installed( $pixel_id ) ) {
    5963            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel' );
    6064            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel_noscript' );
     
    6872            $this->loader->add_action( 'wc_ajax_render_add_to_cart_event', $plugin_public, 'render_ajax_add_to_cart_event' );
    6973        }
     74    }
     75
     76    private function fb_integration_installed($pixel_id) {
     77        $fb_option = get_option('facebook_config');
     78        if ( $fb_option && array_key_exists( 'pixel_id' ) ) {
     79            if ( $fb_option['pixel_id'] == $pixel_id) {
     80                return true;
     81            }
     82        }
     83
     84        return false;
    7085    }
    7186
  • storespot/tags/1.0.3/readme.txt

    r1945614 r1946605  
    55Tested up to: 4.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 > **Note:** This plugin is only really of use to you if you have a StoreSpot account. [**Create one now**](https://storespot.io)
     15> **Note:** This plugin is only really of use to you if you have a StoreSpot account. [**Create one now**](https://storespot.io?ref=wporg)
    1616
    1717---
     
    3939Install and activate the plugin, and we take care of the rest!
    4040
    41 You need a StoreSpot account to work with this plugin. If you don't have one yet, go visit [StoreSpot](https://www.storespot.io)
     41You need a StoreSpot account to work with this plugin. If you don't have one yet, go visit [StoreSpot](https://www.storespot.io?ref=wporg)
    4242
    4343
     
    4949
    5050== Changelog ==
     51
     52= 1.0.3 =
     53* Extended admin notices
     54* Add integration with official Facebook plugin
    5155
    5256= 1.0.2 =
  • storespot/tags/1.0.3/storespot.php

    r1945614 r1946605  
    44 * Plugin URI:   https://storespot.io/
    55 * Description:  Stop leaving money on the table. Automate your retargeting ads with StoreSpot.
    6  * Version:      1.0.2
     6 * Version:      1.0.3
    77 * Author:       StoreSpot
    88**/
    99
    1010if ( ! defined( 'ABSPATH' ) ) { exit; }
    11 
    1211if ( ! defined( 'WPINC' ) ) { die; }
    1312
     
    2423}
    2524
    26 function stsp_admin_activation_notice() {
    27     /* Check transient, if available display notice */
    28     if( get_transient( 'stsp-admin-activation-notice' ) ){
    29             ?>
    30             <div class="updated notice is-dismissible">
    31                     <p>
    32                         Thank you for installing <strong>StoreSpot</strong>!
    33                         You can now go close this tab and finish setting up your
    34                         account in the StoreSpot app.
    35                     </p>
    36             </div>
    37             <?php
    38             /* Delete transient, only display this notice once. */
    39             delete_transient( 'stsp-admin-activation-notice' );
    40     }
    41 }
    42 
    4325register_activation_hook( __FILE__, 'activate_storespot' );
    4426register_deactivation_hook( __FILE__, 'deactivate_storespot' );
    45 add_action( 'admin_notices', 'stsp_admin_activation_notice' );
    4627
    4728require plugin_dir_path( __FILE__ ) . 'includes/class-storespot.php';
  • storespot/trunk/includes/class-storespot-activator.php

    r1944778 r1946605  
    22
    33class StoreSpot_Activator {
     4
    45    public static function activate() {
     6
    57        $options = [
    68            'pixel_id' => '',
     
    810            'product_category' => ''
    911        ];
     12
    1013        add_option( 'storespot_settings', $options );
    1114        set_transient( 'stsp-admin-activation-notice', true, 5 );
     
    1417            wp_schedule_event( time(), 'hourly', 'stsp_product_feed_update' );
    1518        }
     19
    1620    }
     21
    1722}
  • storespot/trunk/includes/class-storespot.php

    r1939129 r1946605  
    4242        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-storespot-loader.php';
    4343        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-product-feed.php';
     44        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-messages.php';
    4445        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-api.php';
    4546        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-events.php';
     
    5051    private function define_admin_hooks() {
    5152            $product_feed = new StoreSpot_Product_Feed();
     53            $admin_message = new StoreSpot_Messages();
    5254            $this->loader->add_action( 'update_option_storespot_settings', $product_feed, 'write_product_feed' );
    5355            $this->loader->add_action( 'stsp_product_feed_update', $product_feed, 'write_product_feed' );
     56            $this->loader->add_action( 'admin_notices', $admin_message, 'activation_notice' );
    5457    }
    5558
    5659    private function define_public_hooks() {
    5760        $plugin_public = new StoreSpot_Events( $this->get_plugin_name(), $this->get_version() );
    58         if( $plugin_public->facebook_pixel->get_pixel_id() ) {
     61        $pixel_id = $plugin_public->facebook_pixel->get_pixel_id();
     62        if( $pixel_id && ! $this->fb_integration_installed( $pixel_id ) ) {
    5963            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel' );
    6064            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel_noscript' );
     
    6872            $this->loader->add_action( 'wc_ajax_render_add_to_cart_event', $plugin_public, 'render_ajax_add_to_cart_event' );
    6973        }
     74    }
     75
     76    private function fb_integration_installed($pixel_id) {
     77        $fb_option = get_option('facebook_config');
     78        if ( $fb_option && array_key_exists( 'pixel_id' ) ) {
     79            if ( $fb_option['pixel_id'] == $pixel_id) {
     80                return true;
     81            }
     82        }
     83
     84        return false;
    7085    }
    7186
  • storespot/trunk/readme.txt

    r1945614 r1946605  
    55Tested up to: 4.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 > **Note:** This plugin is only really of use to you if you have a StoreSpot account. [**Create one now**](https://storespot.io)
     15> **Note:** This plugin is only really of use to you if you have a StoreSpot account. [**Create one now**](https://storespot.io?ref=wporg)
    1616
    1717---
     
    3939Install and activate the plugin, and we take care of the rest!
    4040
    41 You need a StoreSpot account to work with this plugin. If you don't have one yet, go visit [StoreSpot](https://www.storespot.io)
     41You need a StoreSpot account to work with this plugin. If you don't have one yet, go visit [StoreSpot](https://www.storespot.io?ref=wporg)
    4242
    4343
     
    4949
    5050== Changelog ==
     51
     52= 1.0.3 =
     53* Extended admin notices
     54* Add integration with official Facebook plugin
    5155
    5256= 1.0.2 =
  • storespot/trunk/storespot.php

    r1945614 r1946605  
    44 * Plugin URI:   https://storespot.io/
    55 * Description:  Stop leaving money on the table. Automate your retargeting ads with StoreSpot.
    6  * Version:      1.0.2
     6 * Version:      1.0.3
    77 * Author:       StoreSpot
    88**/
    99
    1010if ( ! defined( 'ABSPATH' ) ) { exit; }
    11 
    1211if ( ! defined( 'WPINC' ) ) { die; }
    1312
     
    2423}
    2524
    26 function stsp_admin_activation_notice() {
    27     /* Check transient, if available display notice */
    28     if( get_transient( 'stsp-admin-activation-notice' ) ){
    29             ?>
    30             <div class="updated notice is-dismissible">
    31                     <p>
    32                         Thank you for installing <strong>StoreSpot</strong>!
    33                         You can now go close this tab and finish setting up your
    34                         account in the StoreSpot app.
    35                     </p>
    36             </div>
    37             <?php
    38             /* Delete transient, only display this notice once. */
    39             delete_transient( 'stsp-admin-activation-notice' );
    40     }
    41 }
    42 
    4325register_activation_hook( __FILE__, 'activate_storespot' );
    4426register_deactivation_hook( __FILE__, 'deactivate_storespot' );
    45 add_action( 'admin_notices', 'stsp_admin_activation_notice' );
    4627
    4728require plugin_dir_path( __FILE__ ) . 'includes/class-storespot.php';
Note: See TracChangeset for help on using the changeset viewer.