Changeset 2062753
- Timestamp:
- 04/04/2019 07:14:57 AM (7 years ago)
- Location:
- storespot
- Files:
-
- 16 edited
- 1 copied
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
tags/1.1.1 (copied) (copied from storespot/trunk)
-
tags/1.1.1/admin/class-storespot-api.php (modified) (3 diffs)
-
tags/1.1.1/includes/class-storespot-activator.php (modified) (1 diff)
-
tags/1.1.1/includes/class-storespot-deactivator.php (modified) (1 diff)
-
tags/1.1.1/includes/class-storespot.php (modified) (3 diffs)
-
tags/1.1.1/public/class-storespot-events.php (modified) (5 diffs)
-
tags/1.1.1/readme.txt (modified) (2 diffs)
-
tags/1.1.1/storespot.php (modified) (2 diffs)
-
trunk/admin/class-storespot-api.php (modified) (3 diffs)
-
trunk/includes/class-storespot-activator.php (modified) (1 diff)
-
trunk/includes/class-storespot-deactivator.php (modified) (1 diff)
-
trunk/includes/class-storespot.php (modified) (3 diffs)
-
trunk/public/class-storespot-events.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/storespot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
storespot/tags/1.1.1/admin/class-storespot-api.php
r2042059 r2062753 16 16 'permission_callback' => array( $this, 'get_settings_permission_check' ), 17 17 )); 18 19 register_rest_route( $this->namespace, '/storespot/feed/', array(20 'methods' => WP_REST_SERVER::READABLE,21 'callback' => array( $this, 'update_storespot_feed' ),22 'permission_callback' => array( $this, 'get_settings_permission_check' ),23 ) );24 18 } 25 19 … … 65 59 66 60 public function get_storespot_settings($request) { 61 $custom_logo_id = get_theme_mod( 'custom_logo' ); 62 $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); 63 67 64 $data = array( 68 65 'settings' => get_option( 'storespot_settings' ), 69 ' feed' => get_option( 'storespot_feed' ),66 'logo' => $image[0], 70 67 'stsp_version' => STORESPOT_VERSION, 71 68 'wp_version' => get_bloginfo( 'version' ), … … 78 75 } 79 76 80 public function update_storespot_feed() {81 do_action('stsp_call_async_feed_update');82 $response = rest_ensure_response(array( 'received' => true ));83 $response->set_status(200);84 return $response;85 }86 87 77 } -
storespot/tags/1.1.1/includes/class-storespot-activator.php
r2042059 r2062753 11 11 'pixel_id' => null, 12 12 'pixel_enabled' => false, 13 'feed_enabled' => false,14 'product_category' => 0,15 13 ]; 16 14 add_option( 'storespot_settings', $options ); 17 add_option( 'storespot_feed', null );18 15 } 19 16 -
storespot/tags/1.1.1/includes/class-storespot-deactivator.php
r2042059 r2062753 3 3 public static function deactivate() { 4 4 delete_option( 'storespot_settings' ); 5 delete_option( 'storespot_feed' );6 5 } 7 6 } -
storespot/tags/1.1.1/includes/class-storespot.php
r2042059 r2062753 43 43 private function load_dependencies() { 44 44 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-storespot-loader.php'; 45 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-productfeed.php';46 45 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-messages.php'; 47 46 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-api.php'; 48 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-async.php';49 47 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-events.php'; 50 48 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-facebook-pixel.php'; … … 52 50 if( 53 51 ! class_exists( 'StoreSpot_Loader' ) || 54 ! class_exists( 'StoreSpot_Product_Feed' ) ||55 52 ! class_exists( 'StoreSpot_Messages' ) || 56 53 ! class_exists( 'StoreSpot_API' ) || 57 54 ! class_exists( 'StoreSpot_Events' ) || 58 ! class_exists( 'StoreSpot_Facebook_Pixel' ) || 59 ! class_exists( 'StoreSpot_Async' ) 55 ! class_exists( 'StoreSpot_Facebook_Pixel' ) 60 56 ) { 61 57 return false; … … 68 64 private function define_admin_hooks() { 69 65 $admin_message = new StoreSpot_Messages(); 70 $async_request = new StoreSpot_Async();71 $products_feed = new StoreSpot_Product_Feed();72 66 $this->loader->add_action( 'admin_notices', $admin_message, 'activation_notice' ); 73 $this->loader->add_action( 'wp_ajax_' . $async_request->get_ajax_action(), $async_request, 'execute' );74 $this->loader->add_action( 'wp_ajax_nopriv_' . $async_request->get_ajax_action(), $async_request, 'execute' );75 $this->loader->add_action( 'stsp_call_async_feed_update', $async_request, 'call' );76 $this->loader->add_action( $async_request->get_feed_action(), $products_feed, 'write_product_feed' );77 67 } 78 68 -
storespot/tags/1.1.1/public/class-storespot-events.php
r2042059 r2062753 17 17 18 18 public function get_facebook_content_id($product) { 19 $product_id = $product->get_id();20 19 return 'stsp_' . $product->get_id(); 21 20 } … … 100 99 $products = $woocommerce->cart->get_cart(); 101 100 $product_ids = array(); 101 $prices = array(); 102 102 foreach ( $products as $item ) { 103 $product_ids[] = $this->get_facebook_content_id( $item['data'] ); 104 } 105 106 $params = array(); 107 $params['content_ids'] = json_encode( $product_ids ); 108 $params['content_type'] = 'product'; 109 $params['value'] = $woocommerce->cart->total; 103 $product = $item['data']; 104 $product_ids[] = $this->get_facebook_content_id( $product ); 105 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 106 } 107 108 $params = array(); 109 $params['content_ids'] = json_encode( $product_ids ); 110 $params['content_type'] = 'product'; 111 $params['value'] = array_sum( $prices ); 110 112 $params['currency'] = get_woocommerce_currency(); 111 113 $this->facebook_pixel->event_code( 'AddToCart', $params ); … … 127 129 128 130 $product_ids = array(); 131 $prices = array(); 129 132 foreach ( $products as $item ) { 130 $product_ids[] = $this->get_facebook_content_id( $item['data'] ); 131 } 132 133 $params = array(); 134 $params['content_ids'] = json_encode( $product_ids ); 135 $params['content_type'] = 'product'; 136 $params['value'] = $woocommerce->cart->total; 133 $product = $item['data']; 134 $product_ids[] = $this->get_facebook_content_id( $product ); 135 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 136 } 137 138 $params = array(); 139 $params['content_ids'] = json_encode( $product_ids ); 140 $params['content_type'] = 'product'; 141 $params['value'] = array_sum( $prices ); 137 142 $params['currency'] = get_woocommerce_currency(); 138 143 … … 151 156 $products = $woocommerce->cart->get_cart(); 152 157 $product_ids = array(); 158 $prices = array(); 153 159 foreach ( $products as $item ) { 154 $product_id[] = $this->get_facebook_content_id( $item['data'] ); 155 } 156 157 $params = array(); 158 $params['content_ids'] = json_encode( $product_ids ); 159 $params['content_type'] = 'product'; 160 $params['value'] = $woocommerce->cart->total; 160 $product = $item['data']; 161 $product_ids[] = $this->get_facebook_content_id( $product ); 162 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 163 } 164 165 $params = array(); 166 $params['content_ids'] = json_encode( $product_ids ); 167 $params['content_type'] = 'product'; 168 $params['value'] = array_sum( $prices ); 161 169 $params['currency'] = get_woocommerce_currency(); 162 170 $params['num_items'] = $woocommerce->cart->get_cart_contents_count(); … … 171 179 172 180 $order = wc_get_order( $order_id ); 173 $content_type = 'product';174 181 $product_ids = array(); 175 182 foreach ( $order->get_items() as $item ) { 176 183 $product = $item->get_product(); 177 184 $product_ids[] = $this->get_facebook_content_id( $product ); 178 if( $product->get_type() == 'variable' ) { 179 $content_type = 'product_group'; 180 } 181 } 182 183 $params = array(); 184 $params['content_ids'] = json_encode( $product_ids ); 185 $params['content_type'] = $content_type; 185 } 186 187 $params = array(); 188 $params['content_ids'] = json_encode( $product_ids ); 189 $params['content_type'] = 'product'; 186 190 $params['value'] = $order->get_total(); 187 191 $params['currency'] = get_woocommerce_currency(); -
storespot/tags/1.1.1/readme.txt
r2042059 r2062753 2 2 Contributors: storespot 3 3 Tags: woocommerce, facebook, dynamic ads, retargeting, woocommerce marketing, remarketing 4 Requires at least: 4. 4.04 Requires at least: 4.5.0 5 5 Tested up to: 5.1 6 6 Requires PHP: 5.6 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 49 49 50 50 == Changelog == 51 = 1.1.1 = 52 * Support for off-site feed generation 51 53 52 54 = 1.1.0 = -
storespot/tags/1.1.1/storespot.php
r2042059 r2062753 4 4 * Plugin URI: https://storespot.io/ 5 5 * Description: Stop leaving money on the table. Automate your retargeting ads with StoreSpot. 6 * Version: 1.1. 06 * Version: 1.1.1 7 7 * Author: StoreSpot 8 8 **/ … … 11 11 if ( ! defined( 'WPINC' ) ) { die; } 12 12 13 define( 'STORESPOT_VERSION', '1.1. 0' );13 define( 'STORESPOT_VERSION', '1.1.1' ); 14 14 15 15 function activate_storespot() { -
storespot/trunk/admin/class-storespot-api.php
r2042059 r2062753 16 16 'permission_callback' => array( $this, 'get_settings_permission_check' ), 17 17 )); 18 19 register_rest_route( $this->namespace, '/storespot/feed/', array(20 'methods' => WP_REST_SERVER::READABLE,21 'callback' => array( $this, 'update_storespot_feed' ),22 'permission_callback' => array( $this, 'get_settings_permission_check' ),23 ) );24 18 } 25 19 … … 65 59 66 60 public function get_storespot_settings($request) { 61 $custom_logo_id = get_theme_mod( 'custom_logo' ); 62 $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); 63 67 64 $data = array( 68 65 'settings' => get_option( 'storespot_settings' ), 69 ' feed' => get_option( 'storespot_feed' ),66 'logo' => $image[0], 70 67 'stsp_version' => STORESPOT_VERSION, 71 68 'wp_version' => get_bloginfo( 'version' ), … … 78 75 } 79 76 80 public function update_storespot_feed() {81 do_action('stsp_call_async_feed_update');82 $response = rest_ensure_response(array( 'received' => true ));83 $response->set_status(200);84 return $response;85 }86 87 77 } -
storespot/trunk/includes/class-storespot-activator.php
r2042059 r2062753 11 11 'pixel_id' => null, 12 12 'pixel_enabled' => false, 13 'feed_enabled' => false,14 'product_category' => 0,15 13 ]; 16 14 add_option( 'storespot_settings', $options ); 17 add_option( 'storespot_feed', null );18 15 } 19 16 -
storespot/trunk/includes/class-storespot-deactivator.php
r2042059 r2062753 3 3 public static function deactivate() { 4 4 delete_option( 'storespot_settings' ); 5 delete_option( 'storespot_feed' );6 5 } 7 6 } -
storespot/trunk/includes/class-storespot.php
r2042059 r2062753 43 43 private function load_dependencies() { 44 44 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-storespot-loader.php'; 45 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-productfeed.php';46 45 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-messages.php'; 47 46 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-api.php'; 48 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-storespot-async.php';49 47 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-events.php'; 50 48 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-storespot-facebook-pixel.php'; … … 52 50 if( 53 51 ! class_exists( 'StoreSpot_Loader' ) || 54 ! class_exists( 'StoreSpot_Product_Feed' ) ||55 52 ! class_exists( 'StoreSpot_Messages' ) || 56 53 ! class_exists( 'StoreSpot_API' ) || 57 54 ! class_exists( 'StoreSpot_Events' ) || 58 ! class_exists( 'StoreSpot_Facebook_Pixel' ) || 59 ! class_exists( 'StoreSpot_Async' ) 55 ! class_exists( 'StoreSpot_Facebook_Pixel' ) 60 56 ) { 61 57 return false; … … 68 64 private function define_admin_hooks() { 69 65 $admin_message = new StoreSpot_Messages(); 70 $async_request = new StoreSpot_Async();71 $products_feed = new StoreSpot_Product_Feed();72 66 $this->loader->add_action( 'admin_notices', $admin_message, 'activation_notice' ); 73 $this->loader->add_action( 'wp_ajax_' . $async_request->get_ajax_action(), $async_request, 'execute' );74 $this->loader->add_action( 'wp_ajax_nopriv_' . $async_request->get_ajax_action(), $async_request, 'execute' );75 $this->loader->add_action( 'stsp_call_async_feed_update', $async_request, 'call' );76 $this->loader->add_action( $async_request->get_feed_action(), $products_feed, 'write_product_feed' );77 67 } 78 68 -
storespot/trunk/public/class-storespot-events.php
r2042059 r2062753 17 17 18 18 public function get_facebook_content_id($product) { 19 $product_id = $product->get_id();20 19 return 'stsp_' . $product->get_id(); 21 20 } … … 100 99 $products = $woocommerce->cart->get_cart(); 101 100 $product_ids = array(); 101 $prices = array(); 102 102 foreach ( $products as $item ) { 103 $product_ids[] = $this->get_facebook_content_id( $item['data'] ); 104 } 105 106 $params = array(); 107 $params['content_ids'] = json_encode( $product_ids ); 108 $params['content_type'] = 'product'; 109 $params['value'] = $woocommerce->cart->total; 103 $product = $item['data']; 104 $product_ids[] = $this->get_facebook_content_id( $product ); 105 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 106 } 107 108 $params = array(); 109 $params['content_ids'] = json_encode( $product_ids ); 110 $params['content_type'] = 'product'; 111 $params['value'] = array_sum( $prices ); 110 112 $params['currency'] = get_woocommerce_currency(); 111 113 $this->facebook_pixel->event_code( 'AddToCart', $params ); … … 127 129 128 130 $product_ids = array(); 131 $prices = array(); 129 132 foreach ( $products as $item ) { 130 $product_ids[] = $this->get_facebook_content_id( $item['data'] ); 131 } 132 133 $params = array(); 134 $params['content_ids'] = json_encode( $product_ids ); 135 $params['content_type'] = 'product'; 136 $params['value'] = $woocommerce->cart->total; 133 $product = $item['data']; 134 $product_ids[] = $this->get_facebook_content_id( $product ); 135 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 136 } 137 138 $params = array(); 139 $params['content_ids'] = json_encode( $product_ids ); 140 $params['content_type'] = 'product'; 141 $params['value'] = array_sum( $prices ); 137 142 $params['currency'] = get_woocommerce_currency(); 138 143 … … 151 156 $products = $woocommerce->cart->get_cart(); 152 157 $product_ids = array(); 158 $prices = array(); 153 159 foreach ( $products as $item ) { 154 $product_id[] = $this->get_facebook_content_id( $item['data'] ); 155 } 156 157 $params = array(); 158 $params['content_ids'] = json_encode( $product_ids ); 159 $params['content_type'] = 'product'; 160 $params['value'] = $woocommerce->cart->total; 160 $product = $item['data']; 161 $product_ids[] = $this->get_facebook_content_id( $product ); 162 $prices[] = number_format( $product->get_price(), 2) * $item['quantity']; 163 } 164 165 $params = array(); 166 $params['content_ids'] = json_encode( $product_ids ); 167 $params['content_type'] = 'product'; 168 $params['value'] = array_sum( $prices ); 161 169 $params['currency'] = get_woocommerce_currency(); 162 170 $params['num_items'] = $woocommerce->cart->get_cart_contents_count(); … … 171 179 172 180 $order = wc_get_order( $order_id ); 173 $content_type = 'product';174 181 $product_ids = array(); 175 182 foreach ( $order->get_items() as $item ) { 176 183 $product = $item->get_product(); 177 184 $product_ids[] = $this->get_facebook_content_id( $product ); 178 if( $product->get_type() == 'variable' ) { 179 $content_type = 'product_group'; 180 } 181 } 182 183 $params = array(); 184 $params['content_ids'] = json_encode( $product_ids ); 185 $params['content_type'] = $content_type; 185 } 186 187 $params = array(); 188 $params['content_ids'] = json_encode( $product_ids ); 189 $params['content_type'] = 'product'; 186 190 $params['value'] = $order->get_total(); 187 191 $params['currency'] = get_woocommerce_currency(); -
storespot/trunk/readme.txt
r2042059 r2062753 2 2 Contributors: storespot 3 3 Tags: woocommerce, facebook, dynamic ads, retargeting, woocommerce marketing, remarketing 4 Requires at least: 4. 4.04 Requires at least: 4.5.0 5 5 Tested up to: 5.1 6 6 Requires PHP: 5.6 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 49 49 50 50 == Changelog == 51 = 1.1.1 = 52 * Support for off-site feed generation 51 53 52 54 = 1.1.0 = -
storespot/trunk/storespot.php
r2042059 r2062753 4 4 * Plugin URI: https://storespot.io/ 5 5 * Description: Stop leaving money on the table. Automate your retargeting ads with StoreSpot. 6 * Version: 1.1. 06 * Version: 1.1.1 7 7 * Author: StoreSpot 8 8 **/ … … 11 11 if ( ! defined( 'WPINC' ) ) { die; } 12 12 13 define( 'STORESPOT_VERSION', '1.1. 0' );13 define( 'STORESPOT_VERSION', '1.1.1' ); 14 14 15 15 function activate_storespot() {
Note: See TracChangeset
for help on using the changeset viewer.