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

Version Description

Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

Files changed (4) hide show
  1. facebook-pixel-master.php +1 -1
  2. inc/admin_notices.php +17 -19
  3. inc/common.php +21 -41
  4. readme.txt +7 -1
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: 3.0.1
9
  License: GPLv3
10
  */
11
 
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
+ Version: 3.0.2
9
  License: GPLv3
10
  */
11
 
inc/admin_notices.php CHANGED
@@ -33,24 +33,23 @@ $link_2 = 'http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wadmin&
33
 
34
 
35
  //Message for day 1
36
- $day_1_text = '<span class="pysf_note"><b>PixelYourSite Update -</b></span> You can use the new General Event option to create Super Powerful Custom Audiences and this is why we prepared a FREE GUIDE on how to do it: ';
37
- $day_1_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
38
 
39
  //Message for day 2
40
- $day_2_text = '<span class="pysf_note"><b>PixelYourSite General Event -</b></span> The guide about how to build Powerful Custom Audiences will not be FREE for long, so you better download it now: ';
41
- $day_2_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
42
 
43
  //Message for day 3
44
- $day_3_text = '<span class="pysf_note"><b>PixelYourSite Free Guide -</b></span> Last chance to download the FREE guide about how to use General Event Option to build powerful Custom Audiences: ';
45
- $day_3_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
46
 
47
  //Message for day 4 to 7;
48
- $day_4_to_7_text = '<span class="pysf_note"><b>Thank You for using PixelYourSite!</b></span> We put many hours into developing and maintaining this plugin, but having you on board makes us proud and happy. If you like PixelYourSite <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars rating</a>, because it will mean a lot for our team';
49
 
50
 
51
  //Message for day 7 to 12
52
- $day_7_to_12_text = '<span class="pysf_note"><b>PixelYourSite Special Discount:</b></span> Update to PixelYourSite PRO and enable Facebook Dynamic Events: optimize your ads for website actions, create better Custom Audiences, get better conversion reports. <a href="'.$link_2.'" target="_blank">Click here for your discount</a>';
53
-
54
 
55
  $options = array(
56
 
@@ -116,32 +115,31 @@ $options = array(
116
  //Messages when WooCommerce is installed and activated
117
 
118
  //WooCommerce Message for day 1
119
- $woo_day_1_text = 'WooCommerce Day 1 Message';
120
- $woo_day_1_text = '<span class="pysf_note"><b>PixelYourSite Update -</b></span> You can use the new General Event option to create Super Powerful Custom Audiences and this is why we prepared a FREE GUIDE on how to do it: ';
121
- $woo_day_1_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
122
 
123
 
124
 
125
  //WooCommerce Message for day 2
126
  $woo_day_2_text = 'WooCommerce Day 2 Message.';
127
- $woo_day_2_text = '<span class="pysf_note"><b>PixelYourSite Guide -</b></span> The guide on how to use the new General Event has plenty of PRO TIPS on how to create better FB campaings for your WooCommerce site. Grab it now, because it will not be free for long: ';
128
- $woo_day_2_text .= '<a href="http://www.pixelyoursite.com/general-event" target="_blank">CLICK TO DOWNLOAD THE FREE GUIDE</a>';
129
 
130
 
131
  //WooCommerce Message for day 3
132
  $woo_day_3_text = 'WooCommerce Day 3 Message.';
133
- $woo_day_3_text = '<span class="pysf_note"><b>Start With Facebook Dynamic Ads.</b></span> Download PixelYourSite PRO and Product Catalog Feed Plugin Bundle, so you can track your ADS ROI and start with Dynamic Ads in minutes: ';
134
- $woo_day_3_text .= '<a href="http://www.pixelyoursite.com/bundle-offer" target="_blank">Click to download both plugins for a big discount</a>';
135
 
136
 
137
  //WooCommerce Message for day 4 to 7;
138
  $woo_day_4_to_7_text = 'WooCommerce Day 4 to 7 Message.';
139
- $woo_day_4_to_7_text = '<span class="pysf_note"><b>Thank You for using PixelYourSite!</b></span> We put many hours into developing and maintaining this plugin, but having you on board makes us proud and happy. If you like PixelYourSite <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars rating</a>, because it will mean a lot for our team';
140
-
141
 
142
  //WooCommerce Message for day 7 to 12
143
  $woo_day_7_to_12_text = 'WooCommerce Day 7 to 12 Message.';
144
- $woo_day_7_to_12_text = '<span class="pysf_note"><b>Special Offer:</b></span> Update to PixelYourSite PRO and enable fine-tuned Value Tracking. Optimize your ads for website actions, create better Custom Audiences, get better conversion reports. <a href="'.$link_2.'" target="_blank">Click here for your discount</a>';
145
 
146
 
147
 
33
 
34
 
35
  //Message for day 1
36
+ $day_1_text = '<span class="pysf_note"><b>Update to PixelYourSite Pro </b></span> and optimize your FB ads for clicks on links or buttons with Dynamic Events: ';
37
+ $day_1_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click to download PixelYourSite Pro for a big discount</a>';
38
 
39
  //Message for day 2
40
+ $day_2_text = '<span class="pysf_note"><b>Use Dynamic Events: </b></span> and optimize your ads for actions on site (clicks on links or buttons): ';
41
+ $day_2_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Download PixelYourSite Pro for a limited discount</a>';
42
 
43
  //Message for day 3
44
+ $day_3_text = '<span class="pysf_note"><b>Last Chance Now</b></span> With Dynamic Events you can improve List Generation or Affiliate Campaigns. Optimize your FB Ads for actions on your site with PixelYourSite Pro: ';
45
+ $day_3_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Download Now (offer ending soon)</a>';
46
 
47
  //Message for day 4 to 7;
48
+ $day_4_to_7_text = '<span class="pysf_note"><b>Thank You for Using PixelYourSite!</b></span> We put many hours into developing and mantaining this plugin, but having you on board makes us proud and happy. If you like PixelYourSite <a href="https://wordpress.org/support/view/plugin-reviews/pixelyoursite?rate=5#postform" target="_blank">click here to give us a 5 stars rating</a>, because it will mean a lot for our team';
49
 
50
 
51
  //Message for day 7 to 12
52
+ $day_7_to_12_text = '<span class="pysf_note"><b>Grab Your Free Guide Now: </b></span> The new Generarl Event option can be used to create powerful Custom Audiences. Since it is a very useful tool, we made a free guide about how to use it: <a href="http://www.pixelyoursite.com/general-event?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click here for your Guide</a>';
 
53
 
54
  $options = array(
55
 
115
  //Messages when WooCommerce is installed and activated
116
 
117
  //WooCommerce Message for day 1
118
+ $woo_day_1_text = 'WooCommerce Day 2 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. Get both plugins for a fantastic price: ';
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">Click to DOWNLOAD the bundle now (best deal)</a>';
121
 
122
 
123
 
124
  //WooCommerce Message for day 2
125
  $woo_day_2_text = 'WooCommerce Day 2 Message.';
126
+ $woo_day_2_text = '<span class="pysf_note"><b>Customize and Track WooCommerce Conversion Value</b></span> With PixelYourSite Pro you can fine tune each Event value and improve conversion tracking. ';
127
+ $woo_day_2_text .= '<a href="http://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click to download PixelYourSite Pro for a serious discount</a>';
128
 
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>Product Catalog Feed Plugin</b></span> Create unlimited WooCommerce XML feeds for Facebook Dynamic Ads with just a few clicks. ';
133
+ $woo_day_3_text .= '<a href="http://www.pixelyoursite.com/product-catalog-facebook?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click to download Product Catalog Feed</a>';
134
 
135
 
136
  //WooCommerce Message for day 4 to 7;
137
  $woo_day_4_to_7_text = 'WooCommerce Day 4 to 7 Message.';
138
+ $woo_day_4_to_7_text = '<span class="pysf_note"><b>Get Your Free Guide</b></span> We have a new General Event Option that you can use to create Custom Audiences. Since this is a powerful feature, we made a <a href="http://www.pixelyoursite.com/general-event?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Special Guide on how to use it - click here to download</a>';
 
139
 
140
  //WooCommerce Message for day 7 to 12
141
  $woo_day_7_to_12_text = 'WooCommerce Day 7 to 12 Message.';
142
+ $woo_day_7_to_12_text = '<span class="pysf_note"><b>Download Free Guide:</b></span> Find out powerful strategies for your WooCommerce website in the free guide about the General Event option <a href="http://www.pixelyoursite.com/general-event?utm_source=wpadmin-update&utm_medium=update&utm_campaign=update" target="_blank">Click here for your own copy</a>';
143
 
144
 
145
 
inc/common.php CHANGED
@@ -828,61 +828,41 @@ if( !function_exists( 'pys_insert_attribute' ) ) {
828
 
829
  function pys_insert_attribute( $attr_name, $attr_value, $tag, $overwrite = false ) {
830
 
831
- $old_value = false;
832
- $is_javascript = strpos( $attr_name, 'on' ) === 0; // like onclick, onmouseup, onload, etc.
833
- $quote = false; // quotes format. ' or "
 
834
 
835
  $attr_value = trim( $attr_value );
836
 
837
- // check if attribute already exist on tag
838
- if ( preg_match( '#\s' . $attr_name . '="([^"]*)"#iu', $tag, $matches )
839
- || preg_match( '#\s' . $attr_name . "='([^']*)'#iu", $tag, $matches )
840
- ) {
841
-
842
- $old_value = $matches[1];
843
- $quote = false !== stripos( $tag, $attr_name . "='" ) ? "'" : '"';
844
-
845
- }
846
-
847
- // attribute does not currently exist, add it
848
- if ( false === $old_value ) {
849
- return str_ireplace( '>', " $attr_name=\"" . esc_attr( $attr_value ) . '">', $tag );
850
- }
851
 
852
- // overwrite existing value
853
- if ( $overwrite ) {
854
- return str_ireplace( "$attr_name=" . $quote . "$old_value" . $quote,
855
- $attr_name . '="' . esc_attr( $attr_value ) . '"', $tag );
856
  }
857
 
858
- if ( $is_javascript ) {
859
 
860
- // new attribute value should use correct quotes
861
- $attr_value = $quote == "'" ? str_replace( $quote, '"', $attr_value ) : $attr_value;
862
 
863
- // this is a javascript attribute ensure we must add code after any existing codes
864
- $attr_value = ( $last_char = substr( trim( $old_value ), - 1 ) ) && $last_char != '}' && $last_char != ';'
865
- ? $old_value . ';' . $attr_value
866
- : $old_value . $attr_value;
867
 
868
- } else {
869
- // regular attribute, simply append new attribute values if they're not already there
870
-
871
- if ( 0 === stripos( $old_value, $attr_value ) ) {
872
-
873
- // attribute value already exists, no need to add anything
874
-
875
- } else {
876
 
877
- // add new attribute value
878
- $attr_value = $old_value . ' ' . $attr_value;
879
 
880
- }
 
 
881
 
882
  }
883
 
884
- return str_ireplace( "$attr_name=" . $quote . "$old_value" . $quote,
885
- $attr_name . '="' . esc_attr( $attr_value ) . '"', $tag );
886
 
887
  }
888
 
828
 
829
  function pys_insert_attribute( $attr_name, $attr_value, $tag, $overwrite = false ) {
830
 
831
+ // do not modify js attributes
832
+ if( $attr_name == 'on' ) {
833
+ return $tag;
834
+ }
835
 
836
  $attr_value = trim( $attr_value );
837
 
838
+ $dom = new DOMDocument();
839
+ $dom->loadHTML( $tag );
840
+ $node = $dom->getElementsByTagName('a')->item(0);
 
 
 
 
 
 
 
 
 
 
 
841
 
842
+ if( is_null( $node ) ) {
843
+ return $tag;
 
 
844
  }
845
 
846
+ $attribute = $node->getAttribute( $attr_name );
847
 
848
+ // add attribute or override old one
849
+ if( empty( $attribute ) || $overwrite ) {
850
 
851
+ $node->setAttribute( $attr_name, $attr_value );
852
+ return $dom->saveXML( $node );
 
 
853
 
854
+ }
 
 
 
 
 
 
 
855
 
856
+ // append value to exist attribute
857
+ if( $overwrite ) {
858
 
859
+ $value = $attribute . ' ' . $attr_value;
860
+ $node->setAttribute( $attr_name, $value );
861
+ return $dom->saveXML( $node );
862
 
863
  }
864
 
865
+ return $tag;
 
866
 
867
  }
868
 
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.5.2
6
- Stable tag: 3.0.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -196,6 +196,12 @@ We have an article about how to optimize Facebook Ads Reports:
196
 
197
  == Changelog ==
198
 
 
 
 
 
 
 
199
  = PixelYourSite 3.0.1 =
200
 
201
  * Fixing potential problem with importing settings from older versions
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.5.2
6
+ Stable tag: 3.0.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
196
 
197
  == Changelog ==
198
 
199
+ = PixelYourSite 3.0.2 =
200
+
201
+ * Small fixes related to some possible html errors
202
+
203
+ * Admin Notice modiffications
204
+
205
  = PixelYourSite 3.0.1 =
206
 
207
  * Fixing potential problem with importing settings from older versions