PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) - Version 4.0.3

Version Description

Version 4.0.3 has some important security improvements and it's recommended to update right now.

Download this release

Release Info

Developer PixelYourSite
Plugin Icon 128x128 PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads)
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.2 to 4.0.3

facebook-pixel-master.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
- Version: 4.0.2
9
  License: GPLv3
10
  */
11
 
@@ -16,7 +16,7 @@ if( defined( 'WP_DEBUG' ) && WP_DEBUG == true ) {
16
  error_reporting( E_ALL );
17
  }
18
 
19
- define( 'PYS_FREE_VERSION_REAL', '4.0.2' );
20
  define( 'PYS_FREE_VERSION', '4.0.0'); // for plugin notices capability
21
 
22
  require_once( 'inc/common.php' );
@@ -75,116 +75,155 @@ function pys_free_init() {
75
 
76
  }
77
 
78
- /* Register Admin Page for plugin */
79
- if( !function_exists( 'pys_admin_menu' ) ) {
80
 
81
  add_action( 'admin_menu', 'pys_admin_menu' );
82
  function pys_admin_menu() {
83
 
 
 
 
 
84
  add_menu_page( 'PixelYourSite', 'PixelYourSite', 'manage_options', 'pixel-your-site', 'pys_admin_page_callback', plugins_url( 'pixelyoursite/img/favicon.png' ) );
85
 
86
  }
87
 
88
  }
89
 
90
- /* Admin page display callback */
91
- if( !function_exists( 'pys_admin_page_callback' ) ) {
92
 
93
- function pys_admin_page_callback() {
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
- // update general and woo settings
96
- if( isset($_POST['pys']) ) {
 
 
97
  update_option( 'pixel_your_site', $_POST['pys'] );
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  include( 'inc/html-admin.php' );
101
 
102
  }
103
 
104
  }
105
 
106
- /* Register scripts for plugin admin screen */
107
- if( !function_exists( 'pys_admin_scripts' ) ) {
108
-
109
  add_action( 'admin_enqueue_scripts', 'pys_admin_scripts' );
110
  function pys_admin_scripts() {
111
-
112
  // include only if plugin admin page
113
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'pixel-your-site' ) {
114
-
115
  add_thickbox();
116
-
117
  wp_enqueue_style( 'pys', plugins_url( 'css/admin.css', __FILE__ ), array(), PYS_FREE_VERSION );
118
  wp_enqueue_script( 'pys', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
119
-
120
  wp_localize_script( 'pys', 'pys', array(
121
  'ajax' => admin_url( 'admin-ajax.php' ),
122
  ) );
123
  }
124
-
125
  }
126
-
127
  }
128
 
129
- /* Register front-end scripts. */
130
- if( !function_exists( 'pys_public_scripts' ) ) {
131
-
132
  function pys_public_scripts() {
133
-
134
  $in_footer = (bool) pys_get_option( 'general', 'in_footer', false );
135
-
136
  wp_enqueue_script( 'pys', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION, $in_footer );
137
-
138
  }
139
-
140
  }
141
 
142
- /* Plugin activation. */
143
- if( !function_exists( 'pys_free_plugin_activated' ) ) {
144
-
145
  register_activation_hook( __FILE__, 'pys_free_plugin_activated' );
146
  function pys_free_plugin_activated() {
147
-
 
 
 
 
148
  if ( ! function_exists( 'is_plugin_active' ) ) {
149
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
150
  }
151
-
152
  if ( is_plugin_active( 'pixelyoursite-pro/pixelyoursite-pro.php' ) ) {
153
  wp_die( 'Please deactivate PixelYourSite Pro version First.', 'Plugin Activation' );
154
  }
155
-
156
  $options = get_option( 'pixel_your_site' );
157
  if ( ! $options || ! isset( $options['general']['pixel_id'] ) || empty( $options['general']['pixel_id'] ) ) {
158
  pys_initialize_settings();
159
  }
160
-
161
- //@todo: refactor options names in future releases
162
-
163
  // set plugin activation data and remember version (used in admin notices)
164
- $activation_date = get_option('pysf_activation_date', '');
165
- $version = get_option('pysf_plugin_version', '');
166
-
167
  if ( empty( $activation_date ) || version_compare( $version, PYS_FREE_VERSION, '<' ) ) {
168
  update_option( 'pysf_activation_date', time() );
169
  update_option( 'pysf_plugin_version', PYS_FREE_VERSION );
170
  update_option( 'pysf_notice_dismiss', '' );
171
  update_option( 'woo_pysf_notice_dismiss', '' );
172
  }
173
-
174
  }
175
-
176
  }
177
 
178
- if( !function_exists( 'pys_initialize_settings' ) ) {
179
 
180
  function pys_initialize_settings() {
181
 
 
 
 
 
182
  // set default options values
183
  $defaults = pys_get_default_options();
184
  update_option( 'pixel_your_site', $defaults );
185
 
186
  // migrate settings from old versions
187
- if( get_option( 'woofp_admin_settings' ) ) {
188
 
189
  require_once( 'inc/migrate.php' );
190
  pys_migrate_from_22x();
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
+ Version: 4.0.3
9
  License: GPLv3
10
  */
11
 
16
  error_reporting( E_ALL );
17
  }
18
 
19
+ define( 'PYS_FREE_VERSION_REAL', '4.0.3' );
20
  define( 'PYS_FREE_VERSION', '4.0.0'); // for plugin notices capability
21
 
22
  require_once( 'inc/common.php' );
75
 
76
  }
77
 
78
+ if ( ! function_exists( 'pys_admin_menu' ) ) {
 
79
 
80
  add_action( 'admin_menu', 'pys_admin_menu' );
81
  function pys_admin_menu() {
82
 
83
+ if ( false == current_user_can( 'manage_options' ) ) {
84
+ return;
85
+ }
86
+
87
  add_menu_page( 'PixelYourSite', 'PixelYourSite', 'manage_options', 'pixel-your-site', 'pys_admin_page_callback', plugins_url( 'pixelyoursite/img/favicon.png' ) );
88
 
89
  }
90
 
91
  }
92
 
93
+ if ( ! function_exists( 'pys_restrict_admin_pages' ) ) {
 
94
 
95
+ add_action( 'current_screen', 'pys_restrict_admin_pages' );
96
+ function pys_restrict_admin_pages() {
97
+
98
+ $screen = get_current_screen();
99
+
100
+ if ( $screen->id == 'toplevel_page_pixel-your-site' & false == current_user_can( 'manage_options' ) ) {
101
+ wp_die( __( 'Sorry, you are not allowed to access this page.' ) );
102
+ }
103
+
104
+ }
105
+
106
+ }
107
+
108
+ if ( ! function_exists( 'pys_admin_page_callback' ) ) {
109
 
110
+ function pys_admin_page_callback() {
111
+
112
+ ## update plugin options
113
+ if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'pys_update_options' ) && isset( $_POST['pys'] ) ) {
114
  update_option( 'pixel_your_site', $_POST['pys'] );
115
  }
116
 
117
+ ## delete standard or dynamic events
118
+ if( isset( $_GET['action'] ) && $_GET['action'] == 'pys_delete_events'
119
+ && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'pys_delete_events' )
120
+ && isset( $_GET['events_ids'] ) && isset( $_GET['events_type'] ) ) {
121
+
122
+ pys_delete_events( $_GET['events_ids'], $_GET['events_type'] );
123
+
124
+ $redirect_to = add_query_arg(
125
+ array(
126
+ 'page' => 'pixel-your-site',
127
+ 'active_tab' => $_GET['events_type'] == 'standard' ? 'posts-events' : 'dynamic-events',
128
+ ),
129
+ admin_url( 'admin.php' )
130
+ );
131
+
132
+ wp_safe_redirect( $redirect_to );
133
+
134
+ }
135
+
136
  include( 'inc/html-admin.php' );
137
 
138
  }
139
 
140
  }
141
 
142
+ if ( ! function_exists( 'pys_admin_scripts' ) ) {
143
+
 
144
  add_action( 'admin_enqueue_scripts', 'pys_admin_scripts' );
145
  function pys_admin_scripts() {
146
+
147
  // include only if plugin admin page
148
  if ( isset( $_GET['page'] ) && $_GET['page'] == 'pixel-your-site' ) {
149
+
150
  add_thickbox();
151
+
152
  wp_enqueue_style( 'pys', plugins_url( 'css/admin.css', __FILE__ ), array(), PYS_FREE_VERSION );
153
  wp_enqueue_script( 'pys', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION );
154
+
155
  wp_localize_script( 'pys', 'pys', array(
156
  'ajax' => admin_url( 'admin-ajax.php' ),
157
  ) );
158
  }
159
+
160
  }
161
+
162
  }
163
 
164
+ if ( ! function_exists( 'pys_public_scripts' ) ) {
165
+
 
166
  function pys_public_scripts() {
167
+
168
  $in_footer = (bool) pys_get_option( 'general', 'in_footer', false );
169
+
170
  wp_enqueue_script( 'pys', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), PYS_FREE_VERSION, $in_footer );
171
+
172
  }
173
+
174
  }
175
 
176
+ if ( ! function_exists( 'pys_free_plugin_activated' ) ) {
177
+
 
178
  register_activation_hook( __FILE__, 'pys_free_plugin_activated' );
179
  function pys_free_plugin_activated() {
180
+
181
+ if ( false == is_admin() || false == current_user_can( 'manage_options' ) ) {
182
+ return;
183
+ }
184
+
185
  if ( ! function_exists( 'is_plugin_active' ) ) {
186
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
187
  }
188
+
189
  if ( is_plugin_active( 'pixelyoursite-pro/pixelyoursite-pro.php' ) ) {
190
  wp_die( 'Please deactivate PixelYourSite Pro version First.', 'Plugin Activation' );
191
  }
192
+
193
  $options = get_option( 'pixel_your_site' );
194
  if ( ! $options || ! isset( $options['general']['pixel_id'] ) || empty( $options['general']['pixel_id'] ) ) {
195
  pys_initialize_settings();
196
  }
197
+
 
 
198
  // set plugin activation data and remember version (used in admin notices)
199
+ $activation_date = get_option( 'pysf_activation_date', '' );
200
+ $version = get_option( 'pysf_plugin_version', '' );
201
+
202
  if ( empty( $activation_date ) || version_compare( $version, PYS_FREE_VERSION, '<' ) ) {
203
  update_option( 'pysf_activation_date', time() );
204
  update_option( 'pysf_plugin_version', PYS_FREE_VERSION );
205
  update_option( 'pysf_notice_dismiss', '' );
206
  update_option( 'woo_pysf_notice_dismiss', '' );
207
  }
208
+
209
  }
210
+
211
  }
212
 
213
+ if ( ! function_exists( 'pys_initialize_settings' ) ) {
214
 
215
  function pys_initialize_settings() {
216
 
217
+ if( false == is_admin() || false == current_user_can( 'manage_options' ) ) {
218
+ return;
219
+ }
220
+
221
  // set default options values
222
  $defaults = pys_get_default_options();
223
  update_option( 'pixel_your_site', $defaults );
224
 
225
  // migrate settings from old versions
226
+ if ( get_option( 'woofp_admin_settings' ) ) {
227
 
228
  require_once( 'inc/migrate.php' );
229
  pys_migrate_from_22x();
inc/admin_notices.php CHANGED
@@ -1,5 +1,9 @@
1
  <?php
2
  function woofp_admin_notices($return=false){
 
 
 
 
3
 
4
 
5
  $activation_time = get_option('pysf_activation_date', '');
@@ -116,7 +120,7 @@ $options = array(
116
 
117
  //WooCommerce Message for day 1
118
  $woo_day_1_text = 'WooCommerce Day 1 Message.';
119
- $woo_day_1_text = '<span class="pysf_note"><b>PixelYourSite PRO + Product Catalog Feed Plugin Bundle:</b></span> Track Conversion Value and start with Facebook Dynamic Ads for WooCommerce in minutes. <br>Get <b>PixelYourSite Pro</b> (<i>fine tune Conversion Value</i>, optimize WooCommerce events for Custom Audiences, track post tags and product tags, <b>Traffic Source</b> and UTM, enable Advanced Matching and use <i>Dynamic Events</i>)<br>Get <b>Product Catalog Feed Plugin</b> (create WooCommerce Dynamic Ads Product Catalog XML feeds)<br> ';
120
  $woo_day_1_text .= '<a href="http://www.pixelyoursite.com/bundle-offer?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to DOWNLOAD the bundle now (best deal)</b></a>';
121
 
122
 
@@ -129,7 +133,7 @@ $woo_day_2_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?
129
 
130
  //WooCommerce Message for day 3
131
  $woo_day_3_text = 'WooCommerce Day 3 Message.';
132
- $woo_day_3_text = '<span class="pysf_note"><b>WooCommerce Custom Audiences Optimization:</b></span> Build super-powerful Custom Audiences with PixelYourSite PRO. Track product name, category or product tags, plus shipping and payment methods, client city or country, coupon used and coupons names. All the events will have <b>Traffic Source and UTM</B> (URL Tags). Use them to <b>create highly relevant retargeting campaigns.</b></br>';
133
  $woo_day_3_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to download PixelYourSite Pro for a serious discount</b></a>';
134
 
135
 
@@ -334,6 +338,12 @@ if( isset($_GET['page']) && $_GET['page'] == 'woo-facebookpixel' ){
334
 
335
  function ajax_pysf_notice_dismiss(){
336
 
 
 
 
 
 
 
337
  if ( class_exists( 'WooCommerce' ) ) {
338
  $name = 'woo_pysf_notice_dismiss';
339
  } else {
1
  <?php
2
  function woofp_admin_notices($return=false){
3
+
4
+ if( false == current_user_can( 'manage_options' ) ) {
5
+ return;
6
+ }
7
 
8
 
9
  $activation_time = get_option('pysf_activation_date', '');
120
 
121
  //WooCommerce Message for day 1
122
  $woo_day_1_text = 'WooCommerce Day 1 Message.';
123
+ $woo_day_1_text = '<span class="pysf_note"><b>PixelYourSite PRO + Product Catalog Feed Plugin Bundle:</b></span> Track Conversion Value and start with Facebook Dynamic Ads for WooCommerce in minutes. <br>Get <b>PixelYourSite Pro</b> (<i>fine tune Conversion Value</i>, optimize WooCommerce events for Custom Audiences, track tags, product tags, <b>Traffic Source</b> and UTM, enable Advanced Matching and use <i>Dynamic Events</i>)<br>Get <b>Product Catalog Feed Plugin</b> (create WooCommerce Dynamic Ads Product Catalog XML feeds)<br> ';
124
  $woo_day_1_text .= '<a href="http://www.pixelyoursite.com/bundle-offer?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to DOWNLOAD the bundle now (best deal)</b></a>';
125
 
126
 
133
 
134
  //WooCommerce Message for day 3
135
  $woo_day_3_text = 'WooCommerce Day 3 Message.';
136
+ $woo_day_3_text = '<span class="pysf_note"><b>WooCommerce Custom Audiences Optimization:</b></span> Build super-powerful Custom Audiences with PixelYourSite PRO. Track product name, category or product tags, plus shipping and payment methods, client city or country, coupon used and coupons names. All the events will have <b>Traffic Source and UTM</B> as parameters. Use them to <b>create highly relevant retargeting campaigns.</b></br>';
137
  $woo_day_3_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank"><b>Click to download PixelYourSite Pro for a serious discount</b></a>';
138
 
139
 
338
 
339
  function ajax_pysf_notice_dismiss(){
340
 
341
+ if ( false == current_user_can( 'manage_options' ) ) {
342
+ return;
343
+ }
344
+
345
+ //@todo: verify nonce
346
+
347
  if ( class_exists( 'WooCommerce' ) ) {
348
  $name = 'woo_pysf_notice_dismiss';
349
  } else {
inc/ajax-standard.php CHANGED
@@ -1,14 +1,19 @@
1
  <?php
2
 
3
- /**
4
- * Show Std Event edit modal content.
5
- */
6
- if( !function_exists( 'pys_edit_std_event' ) ) {
7
 
8
  add_action( 'wp_ajax_pys_edit_std_event', 'pys_edit_std_event' );
9
  function pys_edit_std_event() {
10
 
11
- $id = isset( $_REQUEST['id'] ) == true ? $_REQUEST['id'] : uniqid();
 
 
 
 
 
 
 
 
12
  $events = (array) get_option( 'pixel_your_site_std_events' );
13
 
14
  if ( array_key_exists( $id, $events ) ) {
@@ -43,21 +48,27 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
43
  // collect custom params
44
  $custom_params = pys_get_custom_params( $event );
45
 
46
- $table_class = $event['eventtype'];
47
 
48
- $is_custom_currency = isset( $event['custom_currency'] ) ? $event['custom_currency'] : false;
 
 
49
 
50
  ?>
51
 
52
  <form action="" method="post" id="std-event-form">
53
- <input type="hidden" name="action" value="add_std_event">
54
- <input type="hidden" name="std_event[id]" value="<?php echo $id; ?>">
55
 
56
- <table class="layout <?php echo $table_class; ?>">
 
 
 
 
 
57
  <tr>
58
  <td class="legend"><p class="label">URL:</p></td>
59
  <td>
60
- <input type="text" name="std_event[pageurl]" value="<?php echo $event['pageurl']; ?>" id="std-url">
 
61
  <span class="help">Event will trigger when this URL is visited.<br>If you add * at the end of the URL string, it will match all URLs starting with the this string.</span>
62
  </td>
63
  </tr>
@@ -65,7 +76,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
65
  <tr>
66
  <td class="legend"><p class="label">Event type:</p></td>
67
  <td>
68
- <select name="std_event[eventtype]" autocomplete="off" id="std-event-type">
69
  <?php pys_event_types_select_options( $event['eventtype'] ); ?>
70
  </select>
71
  </td>
@@ -74,7 +85,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
74
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
75
  <td class="legend"><p class="label">Value:</p></td>
76
  <td>
77
- <input type="text" name="std_event[value]" value="<?php echo $event['value']; ?>">
78
  <span class="help">Mandatory for purchase event only.</span>
79
  </td>
80
  </tr>
@@ -82,13 +93,13 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
82
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
83
  <td class="legend"><p class="label">Currency:</p></td>
84
  <td>
85
- <select name="std_event[currency]" id="currency" class="<?php echo $is_custom_currency ? 'custom-currency' : null; ?>" >
86
  <option disabled <?php selected( false, $is_custom_currency && $event['currency'] ); ?> >Select Currency</option>
87
  <?php pys_currency_options( $event['currency'] ); ?>
88
  <option disabled></option>
89
  <option value="pys_custom_currency" <?php selected( true, $is_custom_currency ); ?> >Custom Currency</option>
90
  </select>
91
- <input type="text" name="std_event[custom_currency]" value="<?php echo $is_custom_currency ? $event['currency'] : null; ?>" placeholder="Enter custom currency code" class="custom-currency-visible">
92
  <span class="help">Mandatory for purchase event only.</span>
93
  </td>
94
  </tr>
@@ -97,7 +108,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
97
  <td class="legend"><p class="label">content_name:</p></td>
98
  <td>
99
  <input type="text" name="std_event[content_name]"
100
- value="<?php echo $event['content_name']; ?>">
101
  <span class="help">Name of the page/product i.e 'Really Fast Running Shoes'.</span>
102
  </td>
103
  </tr>
@@ -106,7 +117,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
106
  <td class="legend"><p class="label">content_ids:</p></td>
107
  <td>
108
  <input type="text" name="std_event[content_ids]"
109
- value="<?php echo $event['content_ids']; ?>">
110
  <span class="help">Product ids/SKUs associated with the event.</span>
111
  </td>
112
  </tr>
@@ -115,7 +126,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
115
  <td class="legend"><p class="label">content_type:</p></td>
116
  <td>
117
  <input type="text" name="std_event[content_type]"
118
- value="<?php echo $event['content_type']; ?>">
119
  <span class="help">The type of content. i.e product or product_group.</span>
120
  </td>
121
  </tr>
@@ -124,7 +135,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
124
  <td class="legend"><p class="label">content_category:</p></td>
125
  <td>
126
  <input type="text" name="std_event[content_category]"
127
- value="<?php echo $event['content_category']; ?>">
128
  <span class="help">Category of the page/product.</span>
129
  </td>
130
  </tr>
@@ -132,7 +143,8 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
132
  <tr class="InitiateCheckout-visible Purchase-visible">
133
  <td class="legend"><p class="label">num_items:</p></td>
134
  <td>
135
- <input type="text" name="std_event[num_items]" value="<?php echo $event['num_items']; ?>">
 
136
  <span class="help">The number of items in the cart. i.e '3'.</span>
137
  </td>
138
  </tr>
@@ -140,7 +152,8 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
140
  <tr class="Purchase-visible">
141
  <td class="legend"><p class="label">order_id:</p></td>
142
  <td>
143
- <input type="text" name="std_event[order_id]" value="<?php echo $event['order_id']; ?>">
 
144
  <span class="help">The unique order id of the successful purchase. i.e 19.</span>
145
  </td>
146
  </tr>
@@ -149,7 +162,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
149
  <td class="legend"><p class="label">search_string:</p></td>
150
  <td>
151
  <input type="text" name="std_event[search_string]"
152
- value="<?php echo $event['search_string']; ?>">
153
  <span class="help">The string entered by the user for the search. i.e 'Shoes'.</span>
154
  </td>
155
  </tr>
@@ -157,7 +170,7 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
157
  <tr class="CompleteRegistration-visible">
158
  <td class="legend"><p class="label">status:</p></td>
159
  <td>
160
- <input type="text" name="std_event[status]" value="<?php echo $event['status']; ?>">
161
  <span class="help">The status of the registration. i.e completed.</span>
162
  </td>
163
  </tr>
@@ -176,7 +189,8 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
176
  <tr class="CustomEvent-visible tall">
177
  <td class="legend"><p class="label">Event name:</p></td>
178
  <td>
179
- <input type="text" name="std_event[custom_name]" value="<?php echo $event['custom_name']; ?>">
 
180
  </td>
181
  </tr>
182
 
@@ -184,19 +198,22 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
184
 
185
  <?php $param_id = uniqid() . $param; ?>
186
 
187
- <tr class="class-<?php echo $param_id; ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
 
188
  <td class="legend"><p class="label">Param name:</p></td>
189
- <td><input type="text" name="std_event[custom_names][<?php echo $param; ?>]" value="<?php echo $param; ?>"></td>
 
190
  </tr>
191
 
192
- <tr class="class-<?php echo $param_id; ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
193
  <td class="legend"><p class="label">Param value:</p></td>
194
- <td><input type="text" name="std_event[custom_values][<?php echo $param; ?>]" value="<?php echo $value; ?>"></td>
 
195
  </tr>
196
 
197
- <tr class="class-<?php echo $param_id; ?> tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
198
  <td></td>
199
- <td><a href="#" class="remove-param" data-id="<?php echo $param_id; ?>">Remove param</a></td>
200
  </tr>
201
 
202
  <?php endforeach; ?>
@@ -275,7 +292,6 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
275
  $(this).text('Saving...');
276
 
277
  var data = $('#std-event-form').serialize();
278
- data = data + '&action=pys_update_std_event';
279
 
280
  $.ajax({
281
  url: '<?php echo admin_url('admin-ajax.php'); ?>',
@@ -372,56 +388,63 @@ if( !function_exists( 'pys_edit_std_event' ) ) {
372
 
373
  }
374
 
375
- /**
376
- * Update or Add Std Event.
377
- */
378
- if( !function_exists( 'pys_update_std_event' ) ) {
379
 
380
  add_action( 'wp_ajax_pys_update_std_event', 'pys_update_std_event' );
381
  function pys_update_std_event() {
382
 
383
- //@todo: merge with dynamic events function and move to common code
 
 
 
 
 
 
 
 
384
 
385
- $events = (array) get_option( 'pixel_your_site_std_events' );
386
- $event = $_REQUEST['std_event'];
 
 
387
 
388
- $id = $event['id'];
389
- unset( $event['action'] );
390
- unset( $event['id'] );
391
 
392
- if( isset( $event['custom_currency'] ) && ! empty( $event['custom_currency'] ) ) {
393
 
394
- $event['currency'] = strtoupper( $event['custom_currency'] );
395
- $event['custom_currency'] = true;
396
 
397
  }
398
 
399
- if( $event['eventtype'] == 'CustomEvent' ) {
400
 
401
- $custom_name = $event['custom_name'];
402
  $custom_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $custom_name );
403
 
404
- $event['eventtype'] = trim( $custom_name );
405
 
406
  }
407
 
408
- if( isset( $event['custom_names'] ) && is_array( $event['custom_names'] ) ) {
409
 
410
- foreach ( $event['custom_names'] as $key => $value ) {
411
 
412
  $key_name = $value;
413
  $key_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $key_name );
414
 
415
- $event[ $key_name ] = $event['custom_values'][ $key ];
416
 
417
  }
418
 
419
  }
420
 
421
- unset( $event['custom_names'] );
422
- unset( $event['custom_values'] );
423
 
424
- $events[ $id ] = $event;
425
  update_option( 'pixel_your_site_std_events', $events );
426
 
427
  echo json_encode( 'success' );
@@ -431,30 +454,32 @@ if( !function_exists( 'pys_update_std_event' ) ) {
431
 
432
  }
433
 
434
- /**
435
- * Delete Std Event(s).
436
- */
437
- if( !function_exists( 'pys_delete_std_event' ) ) {
438
-
439
- add_action( 'wp_ajax_pys_delete_std_event', 'pys_delete_std_event' );
440
- function pys_delete_std_event() {
441
-
442
- //@todo: merge with dynamic events function and move to common code
443
-
444
- $events = (array) get_option( 'pixel_your_site_std_events' );
445
- $ids = $_REQUEST['ids'];
446
-
447
- // remove requested ids
448
- foreach ( $ids as $id ) {
449
-
450
- unset( $events[ $id ] );
451
 
 
 
452
  }
453
 
454
- update_option( 'pixel_your_site_std_events', $events );
455
 
456
  echo json_encode( 'success' );
457
  exit();
458
- }
459
 
 
 
460
  }
1
  <?php
2
 
3
+ if ( ! function_exists( 'pys_edit_std_event' ) ) {
 
 
 
4
 
5
  add_action( 'wp_ajax_pys_edit_std_event', 'pys_edit_std_event' );
6
  function pys_edit_std_event() {
7
 
8
+ if ( false == current_user_can( 'manage_options' ) ) {
9
+ exit();
10
+ }
11
+
12
+ if ( empty( $_GET['_wpnonce'] ) || false == wp_verify_nonce( $_GET['_wpnonce'], 'pys_show_event_modal' ) ) {
13
+ exit();
14
+ }
15
+
16
+ $id = isset( $_REQUEST['id'] ) == true ? sanitize_text_field( $_REQUEST['id'] ) : uniqid();
17
  $events = (array) get_option( 'pixel_your_site_std_events' );
18
 
19
  if ( array_key_exists( $id, $events ) ) {
48
  // collect custom params
49
  $custom_params = pys_get_custom_params( $event );
50
 
51
+ $table_class = sanitize_text_field( $event['eventtype'] );
52
 
53
+ $is_custom_currency = isset( $event['custom_currency'] )
54
+ ? sanitize_text_field( $event['custom_currency'] )
55
+ : false;
56
 
57
  ?>
58
 
59
  <form action="" method="post" id="std-event-form">
 
 
60
 
61
+ <?php wp_nonce_field( 'pys_update_std_event' ); ?>
62
+
63
+ <input type="hidden" name="action" value="pys_update_std_event">
64
+ <input type="hidden" name="std_event[id]" value="<?php esc_attr_e( $id ); ?>">
65
+
66
+ <table class="layout <?php esc_attr_e( $table_class ); ?>">
67
  <tr>
68
  <td class="legend"><p class="label">URL:</p></td>
69
  <td>
70
+ <input type="text" name="std_event[pageurl]" value="<?php esc_attr_e( $event['pageurl'] ); ?>"
71
+ id="std-url">
72
  <span class="help">Event will trigger when this URL is visited.<br>If you add * at the end of the URL string, it will match all URLs starting with the this string.</span>
73
  </td>
74
  </tr>
76
  <tr>
77
  <td class="legend"><p class="label">Event type:</p></td>
78
  <td>
79
+ <select name="std_event[eventtype]" id="std-event-type">
80
  <?php pys_event_types_select_options( $event['eventtype'] ); ?>
81
  </select>
82
  </td>
85
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
86
  <td class="legend"><p class="label">Value:</p></td>
87
  <td>
88
+ <input type="text" name="std_event[value]" value="<?php esc_attr_e( $event['value'] ); ?>">
89
  <span class="help">Mandatory for purchase event only.</span>
90
  </td>
91
  </tr>
93
  <tr class="ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible">
94
  <td class="legend"><p class="label">Currency:</p></td>
95
  <td>
96
+ <select name="std_event[currency]" id="currency" class="<?php echo $is_custom_currency ? 'custom-currency' : ''; ?>" >
97
  <option disabled <?php selected( false, $is_custom_currency && $event['currency'] ); ?> >Select Currency</option>
98
  <?php pys_currency_options( $event['currency'] ); ?>
99
  <option disabled></option>
100
  <option value="pys_custom_currency" <?php selected( true, $is_custom_currency ); ?> >Custom Currency</option>
101
  </select>
102
+ <input type="text" name="std_event[custom_currency]" value="<?php echo $is_custom_currency ? $event['currency'] : ''; ?>" placeholder="Enter custom currency code" class="custom-currency-visible">
103
  <span class="help">Mandatory for purchase event only.</span>
104
  </td>
105
  </tr>
108
  <td class="legend"><p class="label">content_name:</p></td>
109
  <td>
110
  <input type="text" name="std_event[content_name]"
111
+ value="<?php esc_attr_e( $event['content_name'] ); ?>">
112
  <span class="help">Name of the page/product i.e 'Really Fast Running Shoes'.</span>
113
  </td>
114
  </tr>
117
  <td class="legend"><p class="label">content_ids:</p></td>
118
  <td>
119
  <input type="text" name="std_event[content_ids]"
120
+ value="<?php esc_attr_e( $event['content_ids'] ); ?>">
121
  <span class="help">Product ids/SKUs associated with the event.</span>
122
  </td>
123
  </tr>
126
  <td class="legend"><p class="label">content_type:</p></td>
127
  <td>
128
  <input type="text" name="std_event[content_type]"
129
+ value="<?php esc_attr_e( $event['content_type'] ); ?>">
130
  <span class="help">The type of content. i.e product or product_group.</span>
131
  </td>
132
  </tr>
135
  <td class="legend"><p class="label">content_category:</p></td>
136
  <td>
137
  <input type="text" name="std_event[content_category]"
138
+ value="<?php esc_attr_e( $event['content_category'] ); ?>">
139
  <span class="help">Category of the page/product.</span>
140
  </td>
141
  </tr>
143
  <tr class="InitiateCheckout-visible Purchase-visible">
144
  <td class="legend"><p class="label">num_items:</p></td>
145
  <td>
146
+ <input type="text" name="std_event[num_items]"
147
+ value="<?php esc_attr_e( $event['num_items'] ); ?>">
148
  <span class="help">The number of items in the cart. i.e '3'.</span>
149
  </td>
150
  </tr>
152
  <tr class="Purchase-visible">
153
  <td class="legend"><p class="label">order_id:</p></td>
154
  <td>
155
+ <input type="text" name="std_event[order_id]"
156
+ value="<?php esc_attr_e( $event['order_id'] ); ?>">
157
  <span class="help">The unique order id of the successful purchase. i.e 19.</span>
158
  </td>
159
  </tr>
162
  <td class="legend"><p class="label">search_string:</p></td>
163
  <td>
164
  <input type="text" name="std_event[search_string]"
165
+ value="<?php esc_attr_e( $event['search_string'] ); ?>">
166
  <span class="help">The string entered by the user for the search. i.e 'Shoes'.</span>
167
  </td>
168
  </tr>
170
  <tr class="CompleteRegistration-visible">
171
  <td class="legend"><p class="label">status:</p></td>
172
  <td>
173
+ <input type="text" name="std_event[status]" value="<?php esc_attr_e( $event['status'] ); ?>">
174
  <span class="help">The status of the registration. i.e completed.</span>
175
  </td>
176
  </tr>
189
  <tr class="CustomEvent-visible tall">
190
  <td class="legend"><p class="label">Event name:</p></td>
191
  <td>
192
+ <input type="text" name="std_event[custom_name]"
193
+ value="<?php esc_attr_e( $event['custom_name'] ); ?>">
194
  </td>
195
  </tr>
196
 
198
 
199
  <?php $param_id = uniqid() . $param; ?>
200
 
201
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible
202
+ AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
203
  <td class="legend"><p class="label">Param name:</p></td>
204
+ <td><input type="text" name="std_event[custom_names][<?php esc_attr_e( $param ); ?>]" value="<?php
205
+ esc_attr_e( $param ); ?>"></td>
206
  </tr>
207
 
208
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
209
  <td class="legend"><p class="label">Param value:</p></td>
210
+ <td><input type="text" name="std_event[custom_values][<?php esc_attr_e( $param ); ?>]"
211
+ value="<?php esc_attr_e( $value ); ?>"></td>
212
  </tr>
213
 
214
+ <tr class="class-<?php esc_attr_e( $param_id ); ?> tall ViewContent-visible Search-visible AddToCart-visible AddToWishlist-visible InitiateCheckout-visible AddPaymentInfo-visible Purchase-visible Lead-visible CompleteRegistration-visible CustomEvent-visible">
215
  <td></td>
216
+ <td><a href="#" class="remove-param" data-id="<?php esc_attr_e( $param_id ); ?>">Remove param</a></td>
217
  </tr>
218
 
219
  <?php endforeach; ?>
292
  $(this).text('Saving...');
293
 
294
  var data = $('#std-event-form').serialize();
 
295
 
296
  $.ajax({
297
  url: '<?php echo admin_url('admin-ajax.php'); ?>',
388
 
389
  }
390
 
391
+ if ( ! function_exists( 'pys_update_std_event' ) ) {
 
 
 
392
 
393
  add_action( 'wp_ajax_pys_update_std_event', 'pys_update_std_event' );
394
  function pys_update_std_event() {
395
 
396
+ if ( false == current_user_can( 'manage_options' ) ) {
397
+ return -1;
398
+ }
399
+
400
+ if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'pys_update_std_event'
401
+ || ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'pys_update_std_event' )
402
+ ) {
403
+
404
+ return -1;
405
 
406
+ }
407
+
408
+ $events = (array) get_option( 'pixel_your_site_std_events' );
409
+ $data = $_REQUEST['std_event'];
410
 
411
+ $id = $data['id'];
412
+ unset( $data['action'] );
413
+ unset( $data['id'] );
414
 
415
+ if ( isset( $data['custom_currency'] ) && ! empty( $data['custom_currency'] ) ) {
416
 
417
+ $data['currency'] = strtoupper( $data['custom_currency'] );
418
+ $data['custom_currency'] = true;
419
 
420
  }
421
 
422
+ if ( $data['eventtype'] == 'CustomEvent' ) {
423
 
424
+ $custom_name = $data['custom_name'];
425
  $custom_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $custom_name );
426
 
427
+ $data['eventtype'] = trim( $custom_name );
428
 
429
  }
430
 
431
+ if ( isset( $data['custom_names'] ) && is_array( $data['custom_names'] ) ) {
432
 
433
+ foreach ( $data['custom_names'] as $key => $value ) {
434
 
435
  $key_name = $value;
436
  $key_name = preg_replace( '/[^A-Za-z0-9\_]/u', '', $key_name );
437
 
438
+ $data[ $key_name ] = $data['custom_values'][ $key ];
439
 
440
  }
441
 
442
  }
443
 
444
+ unset( $data['custom_names'] );
445
+ unset( $data['custom_values'] );
446
 
447
+ $events[ $id ] = $data;
448
  update_option( 'pixel_your_site_std_events', $events );
449
 
450
  echo json_encode( 'success' );
454
 
455
  }
456
 
457
+ if ( ! function_exists( 'pys_bulk_delete_std_events' ) ) {
458
+
459
+ add_action( 'wp_ajax_pys_bulk_delete_std_events', 'pys_bulk_delete_std_events' );
460
+ function pys_bulk_delete_std_events() {
461
+
462
+ if ( false == current_user_can( 'manage_options' ) ) {
463
+ return -1;
464
+ }
465
+
466
+ if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'pys_bulk_delete_std_events'
467
+ || ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'pys_bulk_delete_std_events' )
468
+ ) {
469
+
470
+ return -1;
471
+
472
+ }
 
473
 
474
+ if( empty( $_POST['events_ids'] ) ) {
475
+ return -1;
476
  }
477
 
478
+ pys_delete_events( $_POST['events_ids'], 'standard' );
479
 
480
  echo json_encode( 'success' );
481
  exit();
 
482
 
483
+ }
484
+
485
  }
inc/common.php CHANGED
@@ -1264,4 +1264,30 @@ if( !function_exists( 'pys_add_domain_param' ) ) {
1264
 
1265
  }
1266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1267
  }
1264
 
1265
  }
1266
 
1267
+ }
1268
+
1269
+ if( ! function_exists( 'pys_delete_events' ) ) {
1270
+
1271
+ function pys_delete_events( $events_ids, $events_type ) {
1272
+
1273
+ if( $events_type == 'standard' ) {
1274
+ $option_name = 'pixel_your_site_std_events';
1275
+ } else {
1276
+ $option_name = 'pixel_your_site_dyn_events';
1277
+ }
1278
+
1279
+ $events = (array) get_option( $option_name );
1280
+
1281
+ if ( empty( $events ) ) {
1282
+ return;
1283
+ }
1284
+
1285
+ foreach ( $events_ids as $id ) {
1286
+ unset( $events[ $id ] );
1287
+ }
1288
+
1289
+ update_option( $option_name, $events );
1290
+
1291
+ }
1292
+
1293
  }
inc/html-admin.php CHANGED
@@ -27,7 +27,7 @@ $std_events = get_option( 'pixel_your_site_std_events' );
27
  <form action="<?php echo admin_url('admin.php'); ?>?page=pixel-your-site" method="post">
28
  <input type="hidden" name="active_tab" value="<?php echo $pys_active_tab; ?>">
29
 
30
- <?php wp_nonce_field( 'pys-nonce-action', 'pysnonce' ); ?>
31
 
32
  <div id="pys-panel-general" class="pys-panel" <?php echo $pys_active_tab == 'general' ? 'style="display: block;"' : null; ?> >
33
 
27
  <form action="<?php echo admin_url('admin.php'); ?>?page=pixel-your-site" method="post">
28
  <input type="hidden" name="active_tab" value="<?php echo $pys_active_tab; ?>">
29
 
30
+ <?php wp_nonce_field( 'pys_update_options' ); ?>
31
 
32
  <div id="pys-panel-general" class="pys-panel" <?php echo $pys_active_tab == 'general' ? 'style="display: block;"' : null; ?> >
33
 
inc/html-tab-pixel-activate.php CHANGED
@@ -7,7 +7,7 @@
7
  <td class="alignright"><p class="label big">Activate plugin general settings</p></td>
8
  <td>
9
  <input type="checkbox" name="pys[general][enabled]" value="1" class="big"
10
- <?php echo pys_checkbox_state( 'general', 'enabled' ); ?> ></input>
11
  </td>
12
  </tr>
13
  </table>
7
  <td class="alignright"><p class="label big">Activate plugin general settings</p></td>
8
  <td>
9
  <input type="checkbox" name="pys[general][enabled]" value="1" class="big"
10
+ <?php echo pys_checkbox_state( 'general', 'enabled' ); ?> >
11
  </td>
12
  </tr>
13
  </table>
inc/html-tab-pixel-general.php CHANGED
@@ -40,8 +40,8 @@
40
  <td></td>
41
  <td>
42
  <input type="checkbox" name="pys[general][general_event_on_posts_enabled]" value="1"
43
- <?php echo pys_checkbox_state( 'general', 'general_event_on_posts_enabled' ); ?> >Enable on Posts</input>
44
- <span class="help">Will pust post title as <code>content_name</code> and post category name as <code>category_name</code></span>
45
  </td>
46
  </tr>
47
 
@@ -49,7 +49,7 @@
49
  <td></td>
50
  <td>
51
  <input type="checkbox" name="pys[general][general_event_on_pages_enabled]" value="1"
52
- <?php echo pys_checkbox_state( 'general', 'general_event_on_pages_enabled' ); ?> >Enable on Pages</input>
53
  <span class="help">Will pull page title as <code>content_name</code></span>
54
  </td>
55
  </tr>
@@ -58,7 +58,7 @@
58
  <td></td>
59
  <td>
60
  <input type="checkbox" name="pys[general][general_event_on_tax_enabled]" value="1"
61
- <?php echo pys_checkbox_state( 'general', 'general_event_on_tax_enabled' ); ?> >Enable on Taxonomies</input>
62
  <span class="help">Will pull taxonomy name as <code>content_name</code></span>
63
  </td>
64
  </tr>
@@ -68,7 +68,7 @@
68
  <td></td>
69
  <td>
70
  <input type="checkbox" name="pys[general][general_event_on_edd_enabled]" value="1"
71
- <?php echo pys_checkbox_state( 'general', 'general_event_on_edd_enabled' ); ?> >Enable on Easy Digital Downloads Products</input>
72
  <span class="help">Will pull product title as <code>content_name</code> and product category name as <code>category_name</code>, product price as <code>value</code>, currency as <code>currency</code>, post type as <code>content_type</code>.</span>
73
  </td>
74
  </tr>
@@ -94,7 +94,7 @@
94
  <td>
95
  <input type="checkbox" name="pys[general][general_event_on_<?php echo $pt->name; ?>_enabled]" value="1"
96
  <?php echo pys_checkbox_state( 'general', 'general_event_on_' . $pt->name . '_enabled' ); ?>
97
- >Enable on <?php echo $pt->label; ?> Post Type</input>
98
  <span class="help">Will pull <?php echo $pt->name; ?> title as <code>content_name</code> and <?php echo $pt->name; ?> category name as <code>category_name</code>, <code>content_type</code> as <code><?php echo $pt->name; ?></code>.</span>
99
  </td>
100
  </tr>
40
  <td></td>
41
  <td>
42
  <input type="checkbox" name="pys[general][general_event_on_posts_enabled]" value="1"
43
+ <?php echo pys_checkbox_state( 'general', 'general_event_on_posts_enabled' ); ?> >Enable on Posts
44
+ <span class="help">Will put post title as <code>content_name</code> and post category name as <code>category_name</code></span>
45
  </td>
46
  </tr>
47
 
49
  <td></td>
50
  <td>
51
  <input type="checkbox" name="pys[general][general_event_on_pages_enabled]" value="1"
52
+ <?php echo pys_checkbox_state( 'general', 'general_event_on_pages_enabled' ); ?> >Enable on Pages
53
  <span class="help">Will pull page title as <code>content_name</code></span>
54
  </td>
55
  </tr>
58
  <td></td>
59
  <td>
60
  <input type="checkbox" name="pys[general][general_event_on_tax_enabled]" value="1"
61
+ <?php echo pys_checkbox_state( 'general', 'general_event_on_tax_enabled' ); ?> >Enable on Taxonomies
62
  <span class="help">Will pull taxonomy name as <code>content_name</code></span>
63
  </td>
64
  </tr>
68
  <td></td>
69
  <td>
70
  <input type="checkbox" name="pys[general][general_event_on_edd_enabled]" value="1"
71
+ <?php echo pys_checkbox_state( 'general', 'general_event_on_edd_enabled' ); ?> >Enable on Easy Digital Downloads Products
72
  <span class="help">Will pull product title as <code>content_name</code> and product category name as <code>category_name</code>, product price as <code>value</code>, currency as <code>currency</code>, post type as <code>content_type</code>.</span>
73
  </td>
74
  </tr>
94
  <td>
95
  <input type="checkbox" name="pys[general][general_event_on_<?php echo $pt->name; ?>_enabled]" value="1"
96
  <?php echo pys_checkbox_state( 'general', 'general_event_on_' . $pt->name . '_enabled' ); ?>
97
+ >Enable on <?php echo $pt->label; ?> Post Type
98
  <span class="help">Will pull <?php echo $pt->name; ?> title as <code>content_name</code> and <?php echo $pt->name; ?> category name as <code>category_name</code>, <code>content_type</code> as <code><?php echo $pt->name; ?></code>.</span>
99
  </td>
100
  </tr>
inc/html-tab-pixel-id.php CHANGED
@@ -8,7 +8,7 @@
8
  <td>
9
  <input type="text" name="pys[general][pixel_id]"
10
  placeholder="Enter your Facebook Pixel ID"
11
- value="<?php echo pys_get_option( 'general', 'pixel_id' ); ?>">
12
  <span class="help">Where to find the Pixel ID? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Click here for help</a></span>
13
  </td>
14
  </tr>
8
  <td>
9
  <input type="text" name="pys[general][pixel_id]"
10
  placeholder="Enter your Facebook Pixel ID"
11
+ value="<?php esc_attr_e( pys_get_option( 'general', 'pixel_id' ) ); ?>">
12
  <span class="help">Where to find the Pixel ID? <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Click here for help</a></span>
13
  </td>
14
  </tr>
inc/html-tab-std-add-event.php CHANGED
@@ -1,10 +1,22 @@
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
-
4
  <div style="text-align: center; margin-top: 13px;">
5
- <a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event" class="pys-btn pys-btn-big pys-btn-blue thickbox">Add New Event</a>
6
- <p>Add Standard or Custom Events that will trigger when an URL is visited</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  </div>
8
-
9
  </div>
10
  </div>
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
 
3
  <div style="text-align: center; margin-top: 13px;">
4
+
5
+ <?php
6
+
7
+ $show_modal_url = add_query_arg(
8
+ array(
9
+ 'action' => 'pys_edit_std_event',
10
+ '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
11
+ ),
12
+ admin_url( 'admin-ajax.php' )
13
+ );
14
+
15
+ ?>
16
+
17
+ <a href="<?php echo esc_url( $show_modal_url ); ?>" class="pys-btn pys-btn-big pys-btn-blue thickbox">Add New
18
+ Event</a>
19
+ <p>Add Standard or Custom Events that will trigger when an URL is visited</p>
20
  </div>
 
21
  </div>
22
  </div>
inc/html-tab-std-event-general.php CHANGED
@@ -10,7 +10,7 @@
10
  </td>
11
  <td>
12
  <input type="checkbox" name="pys[std][enabled]" value="1"
13
- <?php echo pys_checkbox_state( 'std', 'enabled' ); ?> ></input>
14
  </td>
15
  </tr>
16
  </table>
10
  </td>
11
  <td>
12
  <input type="checkbox" name="pys[std][enabled]" value="1"
13
+ <?php echo pys_checkbox_state( 'std', 'enabled' ); ?> >
14
  </td>
15
  </tr>
16
  </table>
inc/html-tab-std-event-list.php CHANGED
@@ -1,10 +1,23 @@
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">Active Events</h2>
4
-
5
- <div class="tablenav top">
6
- <a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event" class="button button-primary action thickbox">Add new event</a>
7
- <a href="#" class="button btn-delete-std-events action">Delete selected</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </div>
9
 
10
  <table class="widefat fixed pys-list pys-std-events-list">
@@ -19,25 +32,25 @@
19
  </thead>
20
  <tbody>
21
 
22
- <?php if( $std_events = get_option( 'pixel_your_site_std_events' ) ) : ?>
23
-
24
- <?php foreach( $std_events as $key => $params ) : ?>
25
 
26
  <?php
27
 
28
  // skip wrong events
29
- if( ! isset( $params['eventtype'] ) || ! isset( $params['pageurl'] ) ) {
30
  continue;
31
  }
32
 
33
  ?>
34
-
35
- <tr>
36
  <th scope="row" class="check-column">
37
- <input type="checkbox" class="std-event-check" data-id="<?php echo $key; ?>">
38
  </th>
39
 
40
- <td><?php echo $params['eventtype']; ?></td>
41
  <td><pre><?php echo $params['pageurl']; ?></pre></td>
42
  <td>
43
 
@@ -62,16 +75,80 @@
62
 
63
  </td>
64
  <td>
65
- <a href="<?php echo admin_url('admin-ajax.php'); ?>?action=pys_edit_std_event&id=<?php echo $key; ?>" class="button action thickbox">Edit</a>
66
- <a href="#" class="button btn-delete-std-event action" data-id="<?php echo $key; ?>">Delete</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  </td>
68
  </tr>
69
-
70
- <?php endforeach; ?>
71
-
72
  <?php endif; ?>
73
 
74
  </tbody>
75
  </table>
76
  </div>
77
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <div class="pys-box">
2
  <div class="pys-col pys-col-full">
3
  <h2 class="section-title">Active Events</h2>
4
+
5
+ <?php
6
+
7
+ $show_modal_url = add_query_arg(
8
+ array(
9
+ 'action' => 'pys_edit_std_event',
10
+ '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' )
11
+ ),
12
+ admin_url( 'admin-ajax.php' )
13
+ );
14
+
15
+ ?>
16
+
17
+ <div class="tablenav top">
18
+ <a href="<?php echo esc_url( $show_modal_url ); ?>"
19
+ class="button button-primary action thickbox">Add new event</a>
20
+ <a href="#" class="button action" id="pys-bulk-delete-std-events">Delete selected</a>
21
  </div>
22
 
23
  <table class="widefat fixed pys-list pys-std-events-list">
32
  </thead>
33
  <tbody>
34
 
35
+ <?php if ( $std_events = get_option( 'pixel_your_site_std_events' ) ) : ?>
36
+
37
+ <?php foreach ( $std_events as $key => $params ) : ?>
38
 
39
  <?php
40
 
41
  // skip wrong events
42
+ if ( ! isset( $params['eventtype'] ) || ! isset( $params['pageurl'] ) ) {
43
  continue;
44
  }
45
 
46
  ?>
47
+
48
+ <tr>
49
  <th scope="row" class="check-column">
50
+ <input type="checkbox" class="std-event-check" data-id="<?php esc_attr_e( $key ); ?>">
51
  </th>
52
 
53
+ <td><?php esc_html_e( $params['eventtype'] ); ?></td>
54
  <td><pre><?php echo $params['pageurl']; ?></pre></td>
55
  <td>
56
 
75
 
76
  </td>
77
  <td>
78
+
79
+ <?php
80
+
81
+ $edit_event_url = add_query_arg(
82
+ array(
83
+ 'action' => 'pys_edit_std_event',
84
+ '_wpnonce' => wp_create_nonce( 'pys_show_event_modal' ),
85
+ 'id' => $key,
86
+ ),
87
+ admin_url( 'admin-ajax.php' )
88
+ );
89
+
90
+ $delete_event_url = add_query_arg(
91
+ array(
92
+ 'action' => 'pys_delete_events',
93
+ '_wpnonce' => wp_create_nonce( 'pys_delete_events' ),
94
+ 'events_ids' => array( $key ),
95
+ 'events_type' => 'standard'
96
+ ),
97
+ admin_url( 'admin.php?page=pixel-your-site' )
98
+ );
99
+
100
+ ?>
101
+
102
+ <a href="<?php echo esc_url( $edit_event_url ); ?>" class="button action thickbox">Edit</a>
103
+ <a href="<?php echo esc_url( $delete_event_url ); ?>"
104
+ class="button btn-delete-std-event action">Delete</a>
105
+
106
  </td>
107
  </tr>
108
+
109
+ <?php endforeach; ?>
110
+
111
  <?php endif; ?>
112
 
113
  </tbody>
114
  </table>
115
  </div>
116
+ </div>
117
+
118
+ <script type="text/javascript">
119
+ jQuery(function ($) {
120
+
121
+ /**
122
+ * Bulk delete Standard events
123
+ */
124
+ $('#pys-bulk-delete-std-events').on('click', function (e) {
125
+
126
+ e.preventDefault();
127
+ $(this).addClass('disabled');
128
+
129
+ // collect all selected rows to ids array
130
+ var ids = [];
131
+ $.each($('.std-event-check'), function (index, check) {
132
+ if ($(check).prop('checked') == true) {
133
+ ids.push($(check).data('id'));
134
+ }
135
+ });
136
+
137
+ $.ajax({
138
+ url: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
139
+ type: 'post',
140
+ dataType: 'json',
141
+ data: {
142
+ action: 'pys_bulk_delete_std_events',
143
+ _wpnonce: '<?php echo wp_create_nonce( "pys_bulk_delete_std_events" ); ?>',
144
+ events_ids: ids
145
+ }
146
+ })
147
+ .done(function (data) {
148
+ location.href = '<?php echo admin_url( "admin.php?page=pixel-your-site&active_tab=posts-events" ); ?>';
149
+ });
150
+
151
+ });
152
+
153
+ });
154
+ </script>
inc/html-tab-woo-general.php CHANGED
@@ -8,7 +8,7 @@
8
  <table class="layout">
9
  <tr class="tall">
10
  <td colspan="2" class="narrow">
11
- <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong></input>
12
  <span class="help">This will automaticaly add ViewContent on product pages, AddToCart on add to cart button click and cart page, InitiateCheckout on checkout page and Purchase on thank you page. The events will have the required <code>content_ids</code> and <code>content_type</code> parameters.</span>
13
  </td>
14
  </tr>
@@ -16,7 +16,7 @@
16
  <tr>
17
  <td class="alignright"><p class="label">Content ID:</p></td>
18
  <td>
19
- <select name="pys[woo][content_id]" autocomplete="off">
20
  <option <?php selected( 'id', pys_get_option( 'woo', 'content_id' ) ); ?> value="id">Product ID</option>
21
  <option <?php selected( 'sku', pys_get_option( 'woo', 'content_id' ) ); ?> value="sku">Product SKU</option>
22
  </select>
@@ -26,7 +26,7 @@
26
  <tr>
27
  <td class="alignright"><p class="label">Define Variation ID:</p></td>
28
  <td>
29
- <select name="pys[woo][variation_id]" autocomplete="off">
30
  <option <?php selected( 'main', pys_get_option( 'woo', 'variation_id' ) ); ?> value="main">Main product data</option>
31
  <option <?php selected( 'variation', pys_get_option( 'woo', 'variation_id' ) ); ?> value="variation">Variation data</option>
32
  </select>
@@ -51,7 +51,7 @@
51
 
52
  <h2>Custom Audiences Optimization</h2>
53
 
54
- <input type="checkbox" disabled>Enable Additional Parameters</input>
55
  <span class="help">Product name will be pulled as <code>content_name</code>, and Product Category as <code>category_name</code> for all WooCommerce events.</span>
56
  <span class="help" style="margin-bottom: 20px;">The number of items is <code>num_items</code> for InitiateCheckout and Purchase events.</span>
57
 
@@ -64,7 +64,7 @@
64
 
65
  <h2>Tax Options</h2>
66
  Value: &nbsp;&nbsp;
67
- <select autocomplete="off">
68
  <option selected>Includes Tax</option>
69
  </select>
70
 
@@ -96,7 +96,7 @@
96
  <td colspan="2" class="narrow">
97
  <input type="checkbox" name="pys[woo][on_view_content]" value="1" class="woo-option"
98
  <?php echo pys_checkbox_state( 'woo', 'on_view_content' ); ?> >
99
- <strong>Enable ViewContent on Product Pages</strong></input>
100
  </td>
101
  </tr>
102
 
@@ -111,7 +111,7 @@
111
  <tr>
112
  <td></td>
113
  <td>
114
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></input>
115
  <span class="help">Add value and currency - Important for ROI measurement</span>
116
  </td>
117
  </tr>
@@ -124,14 +124,14 @@
124
  <tr class="disabled">
125
  <td class="alignright"><p class="label">Product price</p></td>
126
  <td>
127
- <input type="radio" name="pricea" checked>
128
  </td>
129
  </tr>
130
 
131
  <tr class="disabled">
132
  <td class="alignright"><p class="label">Percent of product price</p></td>
133
  <td>
134
- <input type="radio" name="pricea">
135
  <input type="text">%
136
  </td>
137
  </tr>
@@ -139,7 +139,7 @@
139
  <tr class="disabled">
140
  <td class="alignright"><p class="label">Use Global value</p></td>
141
  <td>
142
- <input type="radio" name="pricea">
143
  <input type="text">
144
  </td>
145
  </tr>
@@ -155,7 +155,7 @@
155
 
156
  <input type="checkbox" name="pys[woo][on_add_to_cart_btn]" value="1" class="woo-option"
157
  <?php echo pys_checkbox_state( 'woo', 'on_add_to_cart_btn' ); ?> >
158
- <strong>Enable AddToCart on add to cart button</strong></input>
159
 
160
  </td>
161
  </tr>
@@ -165,7 +165,7 @@
165
 
166
  <input type="checkbox" name="pys[woo][on_cart_page]" value="1" class="woo-option"
167
  <?php echo pys_checkbox_state( 'woo', 'on_cart_page' ); ?> >
168
- <strong>Enable AddToCart on cart page</strong></input>
169
 
170
  </td>
171
  </tr>
@@ -173,7 +173,7 @@
173
  <tr>
174
  <td></td>
175
  <td>
176
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></input>
177
  <span class="help">add value and currency - Important for ROI measurement</span>
178
  </td>
179
  </tr>
@@ -186,14 +186,14 @@
186
  <tr class="disabled">
187
  <td class="alignright"><p class="label">Product price</p></td>
188
  <td>
189
- <input type="radio" name="priceb" checked>
190
  </td>
191
  </tr>
192
 
193
  <tr class="disabled">
194
  <td class="alignright"><p class="label">Percent of product price</p></td>
195
  <td>
196
- <input type="radio" name="priceb">
197
  <input type="text">%
198
  </td>
199
  </tr>
@@ -201,7 +201,7 @@
201
  <tr class="disabled">
202
  <td class="alignright"><p class="label">Use Global value</p></td>
203
  <td>
204
- <input type="radio" name="priceb">
205
  <input type="text">
206
  </td>
207
  </tr>
@@ -218,7 +218,7 @@
218
 
219
  <input type="checkbox" name="pys[woo][on_checkout_page]" value="1" class="woo-option"
220
  <?php echo pys_checkbox_state( 'woo', 'on_checkout_page' ); ?> >
221
- <strong>Enable InitiateCheckout on Checkout page</strong></input>
222
 
223
  </td>
224
  </tr>
@@ -226,7 +226,7 @@
226
  <tr>
227
  <td></td>
228
  <td>
229
- <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></input>
230
  <span class="help">add value and currency - Important for ROI measurement</span>
231
  </td>
232
  </tr>
@@ -239,14 +239,14 @@
239
  <tr class="disabled">
240
  <td class="alignright"><p class="label">Products price (subtotal)</p></td>
241
  <td>
242
- <input type="radio" name="pricec" checked>
243
  </td>
244
  </tr>
245
 
246
  <tr class="disabled">
247
  <td class="alignright"><p class="label">Percent of products value (subtotal)</p></td>
248
  <td>
249
- <input type="radio" name="pricec">
250
  <input type="text">%
251
  </td>
252
  </tr>
@@ -254,7 +254,7 @@
254
  <tr class="disabled">
255
  <td class="alignright"><p class="label">Use Global value</p></td>
256
  <td>
257
- <input type="radio" name="pricec">
258
  <input type="text">
259
  </td>
260
  </tr>
@@ -292,7 +292,7 @@
292
  <tr class="disabled">
293
  <td class="alignright"><p class="label">Transport is:</p></td>
294
  <td>
295
- <select autocomplete="off" disabled>
296
  <option selected>Included</option>
297
  </select>
298
  </td>
@@ -301,14 +301,14 @@
301
  <tr class="disabled">
302
  <td class="alignright"><p class="label">Total</p></td>
303
  <td>
304
- <input type="radio" name="priced" checked>
305
  </td>
306
  </tr>
307
 
308
  <tr class="disabled">
309
  <td class="alignright"><p class="label">Percent of Total</p></td>
310
  <td>
311
- <input type="radio" name="priced" >
312
  <input type="text">%
313
  </td>
314
  </tr>
@@ -371,21 +371,21 @@
371
  <p><strong>Important:</strong> For the Purchase Event to work, the client must be redirected on the default WooCommerce Thank You page after payment.</p>
372
 
373
  <hr>
374
- <h2 class="section-title">WooCommerce Affliliate Products Events</h2>
375
  <p>You can add an event that will trigger each time an affiliate WooCommerce product button is clicked.</p>
376
  <table class="layout">
377
 
378
  <tr class="tall">
379
  <td colspan="2" class="narrow">
380
- <input type="checkbox" disabled><strong>Activate WooCommerce Affliliate Products Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong></input>
381
  </td>
382
  </tr>
383
 
384
  <tr class="disabled">
385
  <td class="alignright"><p class="label">Event type:</p></td>
386
  <td>
387
- <input type="radio" name="eta" checked>
388
- <select autocomplete="off" disabled>
389
  <option selected>Lead</option>
390
  </select>
391
  </td>
@@ -394,7 +394,7 @@
394
  <tr class="disabled tall">
395
  <td class="alignright"><p class="label">Name of custom event:</p></td>
396
  <td>
397
- <input type="radio" name="eta">
398
  <input type="text">
399
  <span class="help">* The Affiliate event will have all the parameters values specific for selected event.</span>
400
  <span class="help">* The Custom Affiliate event will have value, currency, content_name, content_type, content_ids.</span>
@@ -404,21 +404,21 @@
404
  <tr class="disabled">
405
  <td class="alignright"><p class="label">Do not pull event value</p></td>
406
  <td>
407
- <input type="radio" name="pricex" checked>
408
  </td>
409
  </tr>
410
 
411
  <tr class="disabled">
412
- <td class="alignright"><p class="label">Event Value = Prouct Price</p></td>
413
  <td>
414
- <input type="radio" name="pricex">
415
  </td>
416
  </tr>
417
 
418
  <tr class="disabled">
419
  <td class="alignright"><p class="label">Use Global value</p></td>
420
  <td>
421
- <input type="radio" name="pricex">
422
  <input type="text">
423
  <span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
424
  </td>
@@ -433,15 +433,15 @@
433
 
434
  <tr class="tall">
435
  <td colspan="2" class="narrow">
436
- <input type="checkbox" disabled><strong>Activate PayPal Standard Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong></input>
437
  </td>
438
  </tr>
439
 
440
  <tr class="disabled">
441
  <td class="alignright"><p class="label">Event type:</p></td>
442
  <td>
443
- <input type="radio" name="etb" checked>
444
- <select autocomplete="off" disabled>
445
  <option selected>InitiatePayment</option>
446
  </select>
447
  </td>
@@ -450,7 +450,7 @@
450
  <tr class="disabled tall">
451
  <td class="alignright"><p class="label">Name of custom event:</p></td>
452
  <td>
453
- <input type="radio" name="etb">
454
  <input type="text">
455
  <span class="help">* The PayPal Standard event will have all the parameters values specific for selected event.</span>
456
  <span class="help">* The Custom Affiliate event will have value, currency, content_type, content_ids.</span>
@@ -460,21 +460,21 @@
460
  <tr class="disabled">
461
  <td class="alignright"><p class="label">Do not pull event value</p></td>
462
  <td>
463
- <input type="radio" name="price" checked>
464
  </td>
465
  </tr>
466
 
467
  <tr class="disabled">
468
  <td class="alignright"><p class="label">Event Value = Cart Total</p></td>
469
  <td>
470
- <input type="radio" name="price">
471
  </td>
472
  </tr>
473
 
474
  <tr class="disabled">
475
  <td class="alignright"><p class="label">Use Global value</p></td>
476
  <td>
477
- <input type="radio" name="price">
478
  <input type="text">
479
  <span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
480
  </td>
8
  <table class="layout">
9
  <tr class="tall">
10
  <td colspan="2" class="narrow">
11
+ <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong>
12
  <span class="help">This will automaticaly add ViewContent on product pages, AddToCart on add to cart button click and cart page, InitiateCheckout on checkout page and Purchase on thank you page. The events will have the required <code>content_ids</code> and <code>content_type</code> parameters.</span>
13
  </td>
14
  </tr>
16
  <tr>
17
  <td class="alignright"><p class="label">Content ID:</p></td>
18
  <td>
19
+ <select name="pys[woo][content_id]">
20
  <option <?php selected( 'id', pys_get_option( 'woo', 'content_id' ) ); ?> value="id">Product ID</option>
21
  <option <?php selected( 'sku', pys_get_option( 'woo', 'content_id' ) ); ?> value="sku">Product SKU</option>
22
  </select>
26
  <tr>
27
  <td class="alignright"><p class="label">Define Variation ID:</p></td>
28
  <td>
29
+ <select name="pys[woo][variation_id]">
30
  <option <?php selected( 'main', pys_get_option( 'woo', 'variation_id' ) ); ?> value="main">Main product data</option>
31
  <option <?php selected( 'variation', pys_get_option( 'woo', 'variation_id' ) ); ?> value="variation">Variation data</option>
32
  </select>
51
 
52
  <h2>Custom Audiences Optimization</h2>
53
 
54
+ <input type="checkbox" disabled>Enable Additional Parameters
55
  <span class="help">Product name will be pulled as <code>content_name</code>, and Product Category as <code>category_name</code> for all WooCommerce events.</span>
56
  <span class="help" style="margin-bottom: 20px;">The number of items is <code>num_items</code> for InitiateCheckout and Purchase events.</span>
57
 
64
 
65
  <h2>Tax Options</h2>
66
  Value: &nbsp;&nbsp;
67
+ <select>
68
  <option selected>Includes Tax</option>
69
  </select>
70
 
96
  <td colspan="2" class="narrow">
97
  <input type="checkbox" name="pys[woo][on_view_content]" value="1" class="woo-option"
98
  <?php echo pys_checkbox_state( 'woo', 'on_view_content' ); ?> >
99
+ <strong>Enable ViewContent on Product Pages</strong>
100
  </td>
101
  </tr>
102
 
111
  <tr>
112
  <td></td>
113
  <td>
114
+ <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
115
  <span class="help">Add value and currency - Important for ROI measurement</span>
116
  </td>
117
  </tr>
124
  <tr class="disabled">
125
  <td class="alignright"><p class="label">Product price</p></td>
126
  <td>
127
+ <input type="radio" checked>
128
  </td>
129
  </tr>
130
 
131
  <tr class="disabled">
132
  <td class="alignright"><p class="label">Percent of product price</p></td>
133
  <td>
134
+ <input type="radio">
135
  <input type="text">%
136
  </td>
137
  </tr>
139
  <tr class="disabled">
140
  <td class="alignright"><p class="label">Use Global value</p></td>
141
  <td>
142
+ <input type="radio">
143
  <input type="text">
144
  </td>
145
  </tr>
155
 
156
  <input type="checkbox" name="pys[woo][on_add_to_cart_btn]" value="1" class="woo-option"
157
  <?php echo pys_checkbox_state( 'woo', 'on_add_to_cart_btn' ); ?> >
158
+ <strong>Enable AddToCart on add to cart button</strong>
159
 
160
  </td>
161
  </tr>
165
 
166
  <input type="checkbox" name="pys[woo][on_cart_page]" value="1" class="woo-option"
167
  <?php echo pys_checkbox_state( 'woo', 'on_cart_page' ); ?> >
168
+ <strong>Enable AddToCart on cart page</strong>
169
 
170
  </td>
171
  </tr>
173
  <tr>
174
  <td></td>
175
  <td>
176
+ <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
177
  <span class="help">add value and currency - Important for ROI measurement</span>
178
  </td>
179
  </tr>
186
  <tr class="disabled">
187
  <td class="alignright"><p class="label">Product price</p></td>
188
  <td>
189
+ <input type="radio" checked>
190
  </td>
191
  </tr>
192
 
193
  <tr class="disabled">
194
  <td class="alignright"><p class="label">Percent of product price</p></td>
195
  <td>
196
+ <input type="radio">
197
  <input type="text">%
198
  </td>
199
  </tr>
201
  <tr class="disabled">
202
  <td class="alignright"><p class="label">Use Global value</p></td>
203
  <td>
204
+ <input type="radio">
205
  <input type="text">
206
  </td>
207
  </tr>
218
 
219
  <input type="checkbox" name="pys[woo][on_checkout_page]" value="1" class="woo-option"
220
  <?php echo pys_checkbox_state( 'woo', 'on_checkout_page' ); ?> >
221
+ <strong>Enable InitiateCheckout on Checkout page</strong>
222
 
223
  </td>
224
  </tr>
226
  <tr>
227
  <td></td>
228
  <td>
229
+ <input type="checkbox" disabled>Enable Value - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a>
230
  <span class="help">add value and currency - Important for ROI measurement</span>
231
  </td>
232
  </tr>
239
  <tr class="disabled">
240
  <td class="alignright"><p class="label">Products price (subtotal)</p></td>
241
  <td>
242
+ <input type="radio" checked>
243
  </td>
244
  </tr>
245
 
246
  <tr class="disabled">
247
  <td class="alignright"><p class="label">Percent of products value (subtotal)</p></td>
248
  <td>
249
+ <input type="radio">
250
  <input type="text">%
251
  </td>
252
  </tr>
254
  <tr class="disabled">
255
  <td class="alignright"><p class="label">Use Global value</p></td>
256
  <td>
257
+ <input type="radio">
258
  <input type="text">
259
  </td>
260
  </tr>
292
  <tr class="disabled">
293
  <td class="alignright"><p class="label">Transport is:</p></td>
294
  <td>
295
+ <select disabled>
296
  <option selected>Included</option>
297
  </select>
298
  </td>
301
  <tr class="disabled">
302
  <td class="alignright"><p class="label">Total</p></td>
303
  <td>
304
+ <input type="radio" checked>
305
  </td>
306
  </tr>
307
 
308
  <tr class="disabled">
309
  <td class="alignright"><p class="label">Percent of Total</p></td>
310
  <td>
311
+ <input type="radio">
312
  <input type="text">%
313
  </td>
314
  </tr>
371
  <p><strong>Important:</strong> For the Purchase Event to work, the client must be redirected on the default WooCommerce Thank You page after payment.</p>
372
 
373
  <hr>
374
+ <h2 class="section-title">WooCommerce Affiliate Products Events</h2>
375
  <p>You can add an event that will trigger each time an affiliate WooCommerce product button is clicked.</p>
376
  <table class="layout">
377
 
378
  <tr class="tall">
379
  <td colspan="2" class="narrow">
380
+ <input type="checkbox" disabled><strong>Activate WooCommerce Affiliate Products Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong>
381
  </td>
382
  </tr>
383
 
384
  <tr class="disabled">
385
  <td class="alignright"><p class="label">Event type:</p></td>
386
  <td>
387
+ <input type="radio" checked>
388
+ <select disabled>
389
  <option selected>Lead</option>
390
  </select>
391
  </td>
394
  <tr class="disabled tall">
395
  <td class="alignright"><p class="label">Name of custom event:</p></td>
396
  <td>
397
+ <input type="radio">
398
  <input type="text">
399
  <span class="help">* The Affiliate event will have all the parameters values specific for selected event.</span>
400
  <span class="help">* The Custom Affiliate event will have value, currency, content_name, content_type, content_ids.</span>
404
  <tr class="disabled">
405
  <td class="alignright"><p class="label">Do not pull event value</p></td>
406
  <td>
407
+ <input type="radio" checked>
408
  </td>
409
  </tr>
410
 
411
  <tr class="disabled">
412
+ <td class="alignright"><p class="label">Event Value = Product Price</p></td>
413
  <td>
414
+ <input type="radio">
415
  </td>
416
  </tr>
417
 
418
  <tr class="disabled">
419
  <td class="alignright"><p class="label">Use Global value</p></td>
420
  <td>
421
+ <input type="radio">
422
  <input type="text">
423
  <span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
424
  </td>
433
 
434
  <tr class="tall">
435
  <td colspan="2" class="narrow">
436
+ <input type="checkbox" disabled><strong>Activate PayPal Standard Events - <strong>This is a PRO feature</strong> - <a href="http://www.pixelyoursite.com/facebook-pixel-plugin">Update NOW</a></strong>
437
  </td>
438
  </tr>
439
 
440
  <tr class="disabled">
441
  <td class="alignright"><p class="label">Event type:</p></td>
442
  <td>
443
+ <input type="radio" checked>
444
+ <select disabled>
445
  <option selected>InitiatePayment</option>
446
  </select>
447
  </td>
450
  <tr class="disabled tall">
451
  <td class="alignright"><p class="label">Name of custom event:</p></td>
452
  <td>
453
+ <input type="radio">
454
  <input type="text">
455
  <span class="help">* The PayPal Standard event will have all the parameters values specific for selected event.</span>
456
  <span class="help">* The Custom Affiliate event will have value, currency, content_type, content_ids.</span>
460
  <tr class="disabled">
461
  <td class="alignright"><p class="label">Do not pull event value</p></td>
462
  <td>
463
+ <input type="radio" checked>
464
  </td>
465
  </tr>
466
 
467
  <tr class="disabled">
468
  <td class="alignright"><p class="label">Event Value = Cart Total</p></td>
469
  <td>
470
+ <input type="radio">
471
  </td>
472
  </tr>
473
 
474
  <tr class="disabled">
475
  <td class="alignright"><p class="label">Use Global value</p></td>
476
  <td>
477
+ <input type="radio">
478
  <input type="text">
479
  <span class="help">* Set this if you want a unique global value every time affiliate product clicked.</span>
480
  </td>
js/admin.js CHANGED
@@ -16,59 +16,6 @@ jQuery(function($){
16
 
17
  });
18
 
19
- /* Bulk delete Std events */
20
- $('.btn-delete-std-events').on('click', function(e){
21
- e.preventDefault();
22
- $(this).addClass('disabled');
23
-
24
- // add all selected rows to ids array
25
- var ids = [];
26
- $.each( $('.std-event-check'), function(index, check) {
27
- if ( $(check).prop('checked') == true ) {
28
- ids.push( $(check).data('id') );
29
- }
30
- });
31
-
32
- $.ajax({
33
- url: pys.ajax,
34
- type: 'post',
35
- dataType: 'json',
36
- data: {
37
- action: 'pys_delete_std_event',
38
- ids: ids
39
- }
40
- })
41
- .done(function(data) {
42
- //console.log(data);
43
- location.reload(true);
44
- });
45
-
46
- });
47
-
48
- /* Delete single Std Event */
49
- $('.btn-delete-std-event').on('click', function(e){
50
- e.preventDefault();
51
- $(this).addClass('disabled');
52
-
53
- var ids = [];
54
- ids.push( $(this).data('id') );
55
-
56
- $.ajax({
57
- url: pys.ajax,
58
- type: 'post',
59
- dataType: 'json',
60
- data: {
61
- action: 'pys_delete_std_event',
62
- ids: ids
63
- }
64
- })
65
- .done(function(data) {
66
- //console.log(data);
67
- location.reload(true);
68
- });
69
-
70
- });
71
-
72
  /* Woo events toggle */
73
  // set main switcher state on page load
74
  if($('.woo-option').length == $('.woo-option:checked').length) {
16
 
17
  });
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  /* Woo events toggle */
20
  // set main switcher state on page load
21
  if($('.woo-option').length == $('.woo-option:checked').length) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: PixelYourSite, c0d3fev3r, themister
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Facebook Pixel PayPal
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
- Stable tag: 4.0.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -203,6 +203,10 @@ We have an article about how to optimize Facebook Ads Reports:
203
 
204
  == Changelog ==
205
 
 
 
 
 
206
  = PixelYourSite 4.0.2 =
207
 
208
  * WordDpress 4.7 compatibility checked
@@ -339,6 +343,6 @@ This is a major release, with new design and new features:
339
 
340
  == Upgrade Notice ==
341
 
342
- = 4.0 =
343
 
344
- It is recommended that you DELETE THE CACHE after this update, so that the new JS is loaded. PYS 4.0 comes with an improved way to fire the code. We now use JS, so we can add new features to our plugin, like Delay Events.
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Facebook Pixel PayPal
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
+ Stable tag: 4.0.3
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
203
 
204
  == Changelog ==
205
 
206
+ = PixelYourSite 4.0.3 =
207
+
208
+ * Important security updates
209
+
210
  = PixelYourSite 4.0.2 =
211
 
212
  * WordDpress 4.7 compatibility checked
343
 
344
  == Upgrade Notice ==
345
 
346
+ = 4.0.3 =
347
 
348
+ Version 4.0.3 has some important security improvements and it's recommended to update right now.