Pinterest "Pin It" Button - Version 2.0.4

Version Description

  • Various performance enhancements.
Download this release

Release Info

Developer pderksen
Plugin Icon 128x128 Pinterest "Pin It" Button
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.0.3 to 2.0.4

class-pinterest-pin-it-button.php CHANGED
@@ -8,8 +8,9 @@
8
  */
9
 
10
  // Exit if accessed directly.
11
- if ( ! defined( 'ABSPATH' ) )
12
  exit;
 
13
 
14
  class Pinterest_Pin_It_Button {
15
 
@@ -27,7 +28,7 @@ class Pinterest_Pin_It_Button {
27
  * and README.txt changelog
28
  **************************************/
29
 
30
- protected $version = '2.0.3';
31
 
32
  /**
33
  * Unique identifier for your plugin.
@@ -115,7 +116,7 @@ class Pinterest_Pin_It_Button {
115
  */
116
  public function check_wp_version() {
117
  global $wp_version;
118
- $required_wp_version = '3.5.2';
119
 
120
  if ( version_compare( $wp_version, $required_wp_version, '<' ) ) {
121
  deactivate_plugins( PIB_MAIN_FILE );
@@ -147,20 +148,28 @@ class Pinterest_Pin_It_Button {
147
  */
148
  public function setup_constants() {
149
  // Plugin slug.
150
- if ( ! defined( 'PIB_PLUGIN_SLUG' ) )
151
  define( 'PIB_PLUGIN_SLUG', $this->plugin_slug );
 
152
 
153
  // Plugin version.
154
- if ( ! defined( 'PIB_VERSION' ) )
155
  define( 'PIB_VERSION', $this->version );
 
156
 
157
  // Plugin title.
158
- if ( ! defined( 'PIB_PLUGIN_TITLE' ) )
159
  define( 'PIB_PLUGIN_TITLE', $this->get_plugin_title() );
 
160
 
161
  // Plugin folder URL.
162
- if ( ! defined( 'PIB_PLUGIN_URL' ) )
163
  define( 'PIB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
 
 
 
 
 
164
  }
165
 
166
  /**
@@ -251,11 +260,14 @@ class Pinterest_Pin_It_Button {
251
  */
252
  public function enqueue_styles() {
253
  global $pib_options;
254
-
255
- // Check to see if setting to disable is true first.
256
- if ( empty( $pib_options['disable_css'] ) ) {
257
- wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'css/public.css', __FILE__ ), array(), $this->version );
 
 
258
  }
 
259
  }
260
 
261
  /**
@@ -265,12 +277,14 @@ class Pinterest_Pin_It_Button {
265
  */
266
  public function enqueue_scripts() {
267
  global $pib_options;
268
-
269
- // If this option is empty then it means we can load the pinit.js, otherwise do not load it
270
- if( empty( $pib_options['no_pinit_js'] ) ) {
271
- // Enqueue Pinterest JS plugin boilerplate style. Don't tack on plugin version.
272
- // We DO NOT include the plugin slug here. This is so that this can be uniform across all of our plugins
273
- wp_enqueue_script( 'pinterest-pinit-js', '//assets.pinterest.com/js/pinit.js', array(), null, true );
 
 
274
  }
275
  }
276
 
@@ -351,6 +365,8 @@ class Pinterest_Pin_It_Button {
351
  'pib_url_of_img',
352
  'pib_description'
353
  );
 
 
354
 
355
  // Record sharing disable
356
 
8
  */
9
 
10
  // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
  exit;
13
+ }
14
 
15
  class Pinterest_Pin_It_Button {
16
 
28
  * and README.txt changelog
29
  **************************************/
30
 
31
+ protected $version = '2.0.4';
32
 
33
  /**
34
  * Unique identifier for your plugin.
116
  */
117
  public function check_wp_version() {
118
  global $wp_version;
119
+ $required_wp_version = '3.6.1';
120
 
121
  if ( version_compare( $wp_version, $required_wp_version, '<' ) ) {
122
  deactivate_plugins( PIB_MAIN_FILE );
148
  */
149
  public function setup_constants() {
150
  // Plugin slug.
151
+ if ( ! defined( 'PIB_PLUGIN_SLUG' ) ) {
152
  define( 'PIB_PLUGIN_SLUG', $this->plugin_slug );
153
+ }
154
 
155
  // Plugin version.
156
+ if ( ! defined( 'PIB_VERSION' ) ) {
157
  define( 'PIB_VERSION', $this->version );
158
+ }
159
 
160
  // Plugin title.
161
+ if ( ! defined( 'PIB_PLUGIN_TITLE' ) ) {
162
  define( 'PIB_PLUGIN_TITLE', $this->get_plugin_title() );
163
+ }
164
 
165
  // Plugin folder URL.
166
+ if ( ! defined( 'PIB_PLUGIN_URL' ) ) {
167
  define( 'PIB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
168
+ }
169
+
170
+ if( ! defined( 'PINPLUGIN_BASE_URL' ) ) {
171
+ define( 'PINPLUGIN_BASE_URL', 'http://pinplugins.com/' );
172
+ }
173
  }
174
 
175
  /**
260
  */
261
  public function enqueue_styles() {
262
  global $pib_options;
263
+
264
+ if( ! in_array( 'no_buttons', pib_render_button() ) ) {
265
+ // Check to see if setting to disable is true first.
266
+ if ( empty( $pib_options['disable_css'] ) ) {
267
+ wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'css/public.css', __FILE__ ), array(), $this->version );
268
+ }
269
  }
270
+
271
  }
272
 
273
  /**
277
  */
278
  public function enqueue_scripts() {
279
  global $pib_options;
280
+
281
+ if( ! in_array( 'no_buttons', pib_render_button() ) ) {
282
+ // If this option is empty then it means we can load the pinit.js, otherwise do not load it
283
+ if( empty( $pib_options['no_pinit_js'] ) ) {
284
+ // Enqueue Pinterest JS plugin boilerplate style. Don't tack on plugin version.
285
+ // We DO NOT include the plugin slug here. This is so that this can be uniform across all of our plugins
286
+ wp_enqueue_script( 'pinterest-pinit-js', '//assets.pinterest.com/js/pinit.js', array(), null, true );
287
+ }
288
  }
289
  }
290
 
365
  'pib_url_of_img',
366
  'pib_description'
367
  );
368
+
369
+ $post_meta_fields = apply_filters( 'pib_post_meta_fields', $post_meta_fields );
370
 
371
  // Record sharing disable
372
 
includes/admin-notices.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  /**
16
  * Register admin notices that are used when plugin settings are saved
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  /**
17
  * Register admin notices that are used when plugin settings are saved
includes/hooks-examples.php CHANGED
@@ -4,6 +4,11 @@
4
  * FILTER HOOKS
5
  ************************/
6
 
 
 
 
 
 
7
  /**
8
  * Modifies the HTML output of the shortcode button
9
  *
4
  * FILTER HOOKS
5
  ************************/
6
 
7
+ // Exit if accessed directly.
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
  /**
13
  * Modifies the HTML output of the shortcode button
14
  *
includes/misc-functions.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
 
16
  /*
@@ -49,7 +50,7 @@ function pib_ga_campaign_url( $base_url, $source, $medium, $campaign ) {
49
  }
50
 
51
  /**
52
- * Render RSS items from pinterestplugin.com in unordered list.
53
  * http://codex.wordpress.org/Function_Reference/fetch_feed
54
  *
55
  * @since 2.0.0
@@ -59,7 +60,7 @@ function pib_rss_news() {
59
  include_once( ABSPATH . WPINC . '/feed.php' );
60
 
61
  // Get a SimplePie feed object from the specified feed source.
62
- $rss = fetch_feed( 'http://pinterestplugin.com/feed/' );
63
 
64
  if ( ! is_wp_error( $rss ) ) {
65
  // Checks that the object is created correctly.
@@ -139,3 +140,53 @@ function pib_is_article_rich_pins_active() {
139
  function pib_is_wc_rich_pins_active() {
140
  return class_exists( 'WooCommerce_Rich_Pins' );
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
 
17
  /*
50
  }
51
 
52
  /**
53
+ * Render RSS items from pinplugins.com in unordered list.
54
  * http://codex.wordpress.org/Function_Reference/fetch_feed
55
  *
56
  * @since 2.0.0
60
  include_once( ABSPATH . WPINC . '/feed.php' );
61
 
62
  // Get a SimplePie feed object from the specified feed source.
63
+ $rss = fetch_feed( PINPLUGIN_BASE_URL . 'feed/' );
64
 
65
  if ( ! is_wp_error( $rss ) ) {
66
  // Checks that the object is created correctly.
140
  function pib_is_wc_rich_pins_active() {
141
  return class_exists( 'WooCommerce_Rich_Pins' );
142
  }
143
+
144
+
145
+ /**
146
+ * Check if we should render the Pinterest button
147
+ *
148
+ * @since 2.0.2
149
+ *
150
+ * @return boolean
151
+ */
152
+ function pib_render_button() {
153
+ global $pib_options, $post;
154
+
155
+ $return = array();
156
+
157
+ //Determine if button displayed on current page from main admin settings
158
+ if (
159
+ ( is_home() && ( ! empty( $pib_options['post_page_types']['display_home_page'] ) ) ) ||
160
+ ( is_front_page() && ( ! empty( $pib_options['post_page_types']['display_front_page'] ) ) ) ||
161
+ ( is_single() && ( ! empty( $pib_options['post_page_types']['display_posts'] ) ) ) ||
162
+ ( is_page() && ( ! empty( $pib_options['post_page_types']['display_pages'] ) ) && !is_front_page() ) ||
163
+
164
+ //archive pages besides categories (tag, author, date, search)
165
+ //http://codex.wordpress.org/Conditional_Tags
166
+ ( is_archive() && ( ! empty( $pib_options['post_page_types']['display_archives'] ) ) &&
167
+ ( is_tag() || is_author() || is_date() || is_search() || is_category() )
168
+ )
169
+ ) {
170
+ // Make sure the button is enabled for this post via post meta setting
171
+ if( ! ( get_post_meta( $post->ID, 'pib_sharing_disabled', 1 ) ) ) {
172
+ $return[] = 'button';
173
+ }
174
+
175
+ }
176
+
177
+ // Check if a shortcode exists
178
+ if( has_shortcode( $post->post_content, 'pinit' ) ) {
179
+ $return[] = 'shortcode';
180
+ }
181
+
182
+ // Check if there is a widget
183
+ if( is_active_widget( false, false, 'pib_button', true ) ) {
184
+ $return[] = 'widget';
185
+ }
186
+
187
+ if( empty( $return ) ) {
188
+ $return[] = 'no_buttons';
189
+ }
190
+
191
+ return $return;
192
+ }
includes/register-settings.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  /**
16
  * Main function to register all of the plugin settings
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  /**
17
  * Main function to register all of the plugin settings
includes/shortcodes.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  /**
16
  * Function to process [pinit] shortcodes
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  /**
17
  * Function to process [pinit] shortcodes
includes/upgrade-plugin.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  // Need to first check if there is currently a version option stored to compare it later
16
  if ( ! get_option( 'pib_version' ) ) {
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  // Need to first check if there is currently a version option stored to compare it later
17
  if ( ! get_option( 'pib_version' ) ) {
includes/widgets.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  /**
16
  * Class functions for the Pin It Button widgets
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  /**
17
  * Class functions for the Pin It Button widgets
pinterest-pin-it-button.php CHANGED
@@ -1,40 +1,47 @@
1
  <?php
 
2
  /**
3
  * Pinterest "Pin It" Button Lite
4
  *
5
  * @package PIB
6
  * @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
7
  * @license GPL-2.0+
8
- * @link http://pinterestplugin.com
9
  * @copyright 2011-2014 Phil Derksen
10
  *
11
  * @wordpress-plugin
12
  * Plugin Name: Pinterest "Pin It" Button Lite
13
- * Plugin URI: http://pinterestplugin.com/pin-it-button-pro/
14
  * Description: Add a Pinterest "Pin It" Button to your site and get your visitors to start pinning your awesome content!
15
- * Version: 2.0.3
16
  * Author: Phil Derksen
17
  * Author URI: http://philderksen.com
18
  * License: GPL-2.0+
19
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
 
20
  */
21
 
22
  // Exit if accessed directly.
23
- if ( ! defined( 'ABSPATH' ) )
24
  exit;
 
 
 
 
 
25
 
26
  // Run a check for Pro first since these 2 plugins cannot be installed at the same time to avoid issues and crashes
27
- if( ! class_exists( 'Pinterest_Pin_It_Button_Pro' ) ) {
28
- if( ! class_exists( 'Pinterest_Pin_It_Button' ) )
29
  require_once( plugin_dir_path( __FILE__ ) . 'class-pinterest-pin-it-button.php' );
 
30
 
31
  // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
32
  register_activation_hook( __FILE__, array( 'Pinterest_Pin_It_Button', 'activate' ) );
33
 
34
  Pinterest_Pin_It_Button::get_instance();
 
35
  } else {
36
  echo "You already have Pinterest Pin It Button Pro installed. To downgrade please deactivate and delete the Pro plugin first.";
37
  die();
38
  }
39
-
40
- define( 'PIB_MAIN_FILE', __FILE__ );
1
  <?php
2
+
3
  /**
4
  * Pinterest "Pin It" Button Lite
5
  *
6
  * @package PIB
7
  * @author Phil Derksen <pderksen@gmail.com>, Nick Young <mycorpweb@gmail.com>
8
  * @license GPL-2.0+
9
+ * @link http://pinplugins.com
10
  * @copyright 2011-2014 Phil Derksen
11
  *
12
  * @wordpress-plugin
13
  * Plugin Name: Pinterest "Pin It" Button Lite
14
+ * Plugin URI: http://pinplugins.com/pin-it-button-pro/
15
  * Description: Add a Pinterest "Pin It" Button to your site and get your visitors to start pinning your awesome content!
16
+ * Version: 2.0.4
17
  * Author: Phil Derksen
18
  * Author URI: http://philderksen.com
19
  * License: GPL-2.0+
20
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
21
+ * GitHub Plugin URI: https://github.com/pderksen/WP-Pinterest-Pin-It-Button
22
  */
23
 
24
  // Exit if accessed directly.
25
+ if ( ! defined( 'ABSPATH' ) ) {
26
  exit;
27
+ }
28
+
29
+ if ( ! defined( 'PIB_MAIN_FILE' ) ) {
30
+ define( 'PIB_MAIN_FILE', __FILE__ );
31
+ }
32
 
33
  // Run a check for Pro first since these 2 plugins cannot be installed at the same time to avoid issues and crashes
34
+ if ( ! class_exists( 'Pinterest_Pin_It_Button_Pro' ) ) {
35
+ if ( ! class_exists( 'Pinterest_Pin_It_Button' ) ) {
36
  require_once( plugin_dir_path( __FILE__ ) . 'class-pinterest-pin-it-button.php' );
37
+ }
38
 
39
  // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
40
  register_activation_hook( __FILE__, array( 'Pinterest_Pin_It_Button', 'activate' ) );
41
 
42
  Pinterest_Pin_It_Button::get_instance();
43
+
44
  } else {
45
  echo "You already have Pinterest Pin It Button Pro installed. To downgrade please deactivate and delete the Pro plugin first.";
46
  die();
47
  }
 
 
readme.txt CHANGED
@@ -38,7 +38,7 @@ No need to copy and paste code throughout your WordPress site.
38
  * WooCommerce compatibility.
39
  * Customer support and automatic updates.
40
 
41
- [Start Getting Pinned Like Crazy with "Pin It" Button Pro!](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
42
 
43
  ###A Few Stats on Pinterest###
44
 
@@ -60,7 +60,7 @@ No need to copy and paste code throughout your WordPress site.
60
 
61
  [See a "Pin It" Button Pro Demo](http://bruisesandbandaids.com/2011/newborn-photography-props/) (shows off the share bar and image hover features)
62
 
63
- [Setup an Eye-Catching Button in Minutes with "Pin It" Button Pro!](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
64
 
65
  This plugin (as well as the Pro version) is in full compliance with the [official "Pin It" button developer guidelines](http://developers.pinterest.com/pin_it/).
66
 
@@ -106,7 +106,7 @@ A popular known plugin that does this is **Google Analytics for WordPress**. Try
106
 
107
  Your theme must implement **wp_footer()** in the footer.php file, otherwise JavaScript will not load correctly. You can test if this is the issue by switching to a WordPress stock theme such as twenty-twelve temporarily.
108
 
109
- [Visit the complete knowledgebase](http://pinterestplugin.com/pin-it-button-faq?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite) for additional help and troubleshooting tips.
110
 
111
  CSS styling and shortcode help available within the plugin admin.
112
 
@@ -122,6 +122,10 @@ CSS styling and shortcode help available within the plugin admin.
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 2.0.3 =
126
 
127
  * Added action and filter hooks for extensibility.
38
  * WooCommerce compatibility.
39
  * Customer support and automatic updates.
40
 
41
+ [Start Getting Pinned Like Crazy with "Pin It" Button Pro!](http://pinplugins.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
42
 
43
  ###A Few Stats on Pinterest###
44
 
60
 
61
  [See a "Pin It" Button Pro Demo](http://bruisesandbandaids.com/2011/newborn-photography-props/) (shows off the share bar and image hover features)
62
 
63
+ [Setup an Eye-Catching Button in Minutes with "Pin It" Button Pro!](http://pinplugins.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
64
 
65
  This plugin (as well as the Pro version) is in full compliance with the [official "Pin It" button developer guidelines](http://developers.pinterest.com/pin_it/).
66
 
106
 
107
  Your theme must implement **wp_footer()** in the footer.php file, otherwise JavaScript will not load correctly. You can test if this is the issue by switching to a WordPress stock theme such as twenty-twelve temporarily.
108
 
109
+ [Visit the complete knowledgebase](http://pinplugins.com/pin-it-button-faq?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite) for additional help and troubleshooting tips.
110
 
111
  CSS styling and shortcode help available within the plugin admin.
112
 
122
 
123
  == Changelog ==
124
 
125
+ = 2.0.4 =
126
+
127
+ * Various performance enhancements.
128
+
129
  = 2.0.3 =
130
 
131
  * Added action and filter hooks for extensibility.
uninstall.php CHANGED
@@ -17,9 +17,11 @@ delete_option( 'pib_category_fields_option' );
17
  $general = get_option( 'pib_settings_general' );
18
 
19
  // If the the option to save settings is checked then do nothing, otherwise delete all options and post meta
20
- if ( $general['uninstall_save_settings'] ) {
21
  // Do nothing
22
  } else {
 
 
23
  // Delete options
24
  delete_option( 'pib_settings_general' );
25
  delete_option( 'pib_settings_post_visibility' );
@@ -28,13 +30,32 @@ if ( $general['uninstall_save_settings'] ) {
28
  delete_option( 'pib_upgrade_has_run' );
29
  delete_option( 'pib_version' );
30
  delete_option( 'pib_show_admin_install_notice' );
31
-
 
32
  // Delete widget options
33
  delete_option( 'widget_pib_button' );
34
 
35
- // Delete post meta
36
  delete_post_meta_by_key( 'pib_sharing_disabled' );
37
  delete_post_meta_by_key( 'pib_url_of_webpage' );
38
  delete_post_meta_by_key( 'pib_url_of_img' );
39
  delete_post_meta_by_key( 'pib_description' );
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  $general = get_option( 'pib_settings_general' );
18
 
19
  // If the the option to save settings is checked then do nothing, otherwise delete all options and post meta
20
+ if ( ! empty( $general['uninstall_save_settings'] ) ) {
21
  // Do nothing
22
  } else {
23
+
24
+ // Lite
25
  // Delete options
26
  delete_option( 'pib_settings_general' );
27
  delete_option( 'pib_settings_post_visibility' );
30
  delete_option( 'pib_upgrade_has_run' );
31
  delete_option( 'pib_version' );
32
  delete_option( 'pib_show_admin_install_notice' );
33
+ delete_option( 'pib_settings_advanced' );
34
+
35
  // Delete widget options
36
  delete_option( 'widget_pib_button' );
37
 
38
+ // Delete post meta
39
  delete_post_meta_by_key( 'pib_sharing_disabled' );
40
  delete_post_meta_by_key( 'pib_url_of_webpage' );
41
  delete_post_meta_by_key( 'pib_url_of_img' );
42
  delete_post_meta_by_key( 'pib_description' );
43
+
44
+ // Pro
45
+ // Delete ALL Pro settings and keys
46
+ delete_option( 'pib_settings_image_hover' );
47
+ delete_option( 'pib_settings_image_misc' );
48
+ delete_option( 'pib_settings_share_bar' );
49
+ delete_option( 'pib_settings_support' );
50
+ delete_option( 'pib_sharebar_buttons' );
51
+
52
+
53
+ // Pro Misc options
54
+ delete_option( 'pib_edd_sl_license_active' );
55
+ delete_option( 'pib_lite_deactivation_notice' );
56
+
57
+ // Pro post meta options
58
+ delete_post_meta_by_key( 'pib_utm_meta' );
59
+ delete_post_meta_by_key( 'pib_override_hover_description' );
60
+ delete_post_meta_by_key( 'pib_override_below_description' );
61
+ }
views/admin-help.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  ?>
16
 
@@ -216,7 +217,7 @@ if ( ! defined( 'ABSPATH' ) )
216
  ); ?>
217
  </p>
218
  <p>
219
- <?php printf( __( 'Visit the <a href="%s" target="_blank">Knowledgebase</a> for additional help.', 'pib' ), 'http://pinterestplugin.com/support' ); ?>
220
  </p>
221
 
222
  </div><!-- #pib-settings-content -->
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  ?>
17
 
217
  ); ?>
218
  </p>
219
  <p>
220
+ <?php printf( __( 'Visit the <a href="%s" target="_blank">Knowledgebase</a> for additional help.', 'pib' ), PINPLUGIN_BASE_URL . 'support' ); ?>
221
  </p>
222
 
223
  </div><!-- #pib-settings-content -->
views/admin-install-notice.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  ?>
16
 
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  ?>
17
 
views/admin-sidebar.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
  ?>
15
 
16
  <div class="sidebar-container">
@@ -37,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) )
37
  <?php _e( 'Get all of these and more with Pinterest "Pin It" Button Pro!', 'pib' ); ?>
38
  </p>
39
 
40
- <a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/pin-it-button-pro/', 'pib_lite_2', 'sidebar_link', 'pro_upgrade' ); ?>"
41
  class="btn btn-large btn-block btn-danger" target="_blank">
42
  <?php _e( 'Upgrade to Pro Now', 'pib' ); ?></a>
43
  <br/>
@@ -55,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) )
55
  <?php _e( 'Running a WooCommerce store and want to give your product pins a boost? There\'s a plugin for that.', 'pib' ); ?>
56
  </p>
57
  <p>
58
- <a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/plugins/product-rich-pins-for-woocommerce/', 'pib_lite_2', 'sidebar_link', 'wc_rich_pins' ); ?>"
59
  class="btn btn-small btn-block btn-inverse" target="_blank">
60
  <?php _e( 'Check out Rich Pins for WooCommerce', 'pib' ); ?>
61
  </a>
@@ -76,7 +77,7 @@ if ( ! defined( 'ABSPATH' ) )
76
  <?php _e( 'Want give your pins a boost with <strong>Article Rich Pins</strong>? There\'s a plugin for that.', 'pib' ); ?>
77
  </p>
78
  <p>
79
- <a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/plugins/article-rich-pins/', 'pib_lite_2', 'sidebar_link', 'article_rich_pins' ); ?>"
80
  class="btn btn-small btn-block btn-inverse" target="_blank">
81
  <?php _e( 'Check out Article Rich Pins', 'pib' ); ?>
82
  </a>
@@ -109,7 +110,7 @@ if ( ! defined( 'ABSPATH' ) )
109
  </li>
110
  <li>
111
  <i class="fui-arrow-right"></i>
112
- <a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/support', 'pib_lite_2', 'sidebar_link', 'support' ); ?>" target="_blank">
113
  <?php _e( 'Knowledgebase', 'pib' ); ?></a>
114
  </li>
115
  </ul>
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
  ?>
16
 
17
  <div class="sidebar-container">
38
  <?php _e( 'Get all of these and more with Pinterest "Pin It" Button Pro!', 'pib' ); ?>
39
  </p>
40
 
41
+ <a href="<?php echo pib_ga_campaign_url( PINPLUGIN_BASE_URL . 'pin-it-button-pro/', 'pib_lite_2', 'sidebar_link', 'pro_upgrade' ); ?>"
42
  class="btn btn-large btn-block btn-danger" target="_blank">
43
  <?php _e( 'Upgrade to Pro Now', 'pib' ); ?></a>
44
  <br/>
56
  <?php _e( 'Running a WooCommerce store and want to give your product pins a boost? There\'s a plugin for that.', 'pib' ); ?>
57
  </p>
58
  <p>
59
+ <a href="<?php echo pib_ga_campaign_url( PINPLUGIN_BASE_URL . 'plugins/product-rich-pins-for-woocommerce/', 'pib_lite_2', 'sidebar_link', 'wc_rich_pins' ); ?>"
60
  class="btn btn-small btn-block btn-inverse" target="_blank">
61
  <?php _e( 'Check out Rich Pins for WooCommerce', 'pib' ); ?>
62
  </a>
77
  <?php _e( 'Want give your pins a boost with <strong>Article Rich Pins</strong>? There\'s a plugin for that.', 'pib' ); ?>
78
  </p>
79
  <p>
80
+ <a href="<?php echo pib_ga_campaign_url( PINPLUGIN_BASE_URL . 'plugins/article-rich-pins/', 'pib_lite_2', 'sidebar_link', 'article_rich_pins' ); ?>"
81
  class="btn btn-small btn-block btn-inverse" target="_blank">
82
  <?php _e( 'Check out Article Rich Pins', 'pib' ); ?>
83
  </a>
110
  </li>
111
  <li>
112
  <i class="fui-arrow-right"></i>
113
+ <a href="<?php echo pib_ga_campaign_url( PINPLUGIN_BASE_URL . 'support', 'pib_lite_2', 'sidebar_link', 'support' ); ?>" target="_blank">
114
  <?php _e( 'Knowledgebase', 'pib' ); ?></a>
115
  </li>
116
  </ul>
views/admin.php CHANGED
@@ -12,8 +12,9 @@
12
  */
13
 
14
  // Exit if accessed directly.
15
- if ( ! defined( 'ABSPATH' ) )
16
  exit;
 
17
 
18
  global $pib_options;
19
  $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
12
  */
13
 
14
  // Exit if accessed directly.
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
+ }
18
 
19
  global $pib_options;
20
  $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general';
views/post-meta-display.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
  global $pib_options, $post, $pib_vars;
16
 
@@ -60,4 +61,9 @@ $pib_description = get_post_meta( $post->ID, 'pib_description', true);
60
  <?php _e( 'If unchecked the button ' . $pib_vars['post_meta_message'] . ' will always be hidden for this post/page.', 'pib' ); ?>
61
  </p>
62
 
 
 
 
 
 
63
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
  global $pib_options, $post, $pib_vars;
17
 
61
  <?php _e( 'If unchecked the button ' . $pib_vars['post_meta_message'] . ' will always be hidden for this post/page.', 'pib' ); ?>
62
  </p>
63
 
64
+ <?php
65
+ // Now using an action to easily add more post meta options
66
+ do_action( 'pib_post_meta_options' );
67
+ ?>
68
+
69
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
views/public.php CHANGED
@@ -9,8 +9,9 @@
9
  */
10
 
11
  // Exit if accessed directly.
12
- if ( ! defined( 'ABSPATH' ) )
13
  exit;
 
14
 
15
 
16
  /**
@@ -20,15 +21,17 @@ if ( ! defined( 'ABSPATH' ) )
20
  */
21
  function pib_add_custom_css() {
22
  global $pib_options;
 
 
 
 
 
23
 
24
- // Only add the custom CSS if it actually exists.
25
- if ( ! empty( $pib_options['custom_css'] ) ) {
26
- $custom_css = trim( $pib_options['custom_css'] );
27
-
28
- echo "\n" .
29
- '<style type="text/css">' . "\n" .
30
- $custom_css . "\n" . // Render custom CSS.
31
- '</style>' . "\n";
32
  }
33
  }
34
  add_action( 'wp_head', 'pib_add_custom_css' );
@@ -90,11 +93,21 @@ function pib_button_base( $button_type, $post_url, $image_url, $description, $co
90
  // Set description to post title if still blank.
91
  if ( empty( $description ) )
92
  $description = get_the_title( $postID );
 
 
 
 
 
 
 
 
 
 
93
 
94
  // Link href always needs all the parameters in it for the count bubble to work.
95
  // Pinterest points out to use protocol-agnostic URL for popup.
96
  $link_href = '//www.pinterest.com/pin/create/button/' .
97
- '?url=' . rawurlencode( $post_url ) .
98
  '&media=' . rawurlencode( $image_url ) .
99
  '&description=' . rawurlencode( wp_strip_all_tags( $description ) );
100
 
@@ -200,18 +213,7 @@ function pib_render_content( $content ) {
200
  return $content;
201
 
202
  //Determine if button displayed on current page from main admin settings
203
- if (
204
- ( is_home() && ( ! empty( $pib_options['post_page_types']['display_home_page'] ) ) ) ||
205
- ( is_front_page() && ( ! empty( $pib_options['post_page_types']['display_front_page'] ) ) ) ||
206
- ( is_single() && ( ! empty( $pib_options['post_page_types']['display_posts'] ) ) ) ||
207
- ( is_page() && ( ! empty( $pib_options['post_page_types']['display_pages'] ) ) && !is_front_page() ) ||
208
-
209
- //archive pages besides categories (tag, author, date, search)
210
- //http://codex.wordpress.org/Conditional_Tags
211
- ( is_archive() && ( ! empty( $pib_options['post_page_types']['display_archives'] ) ) &&
212
- ( is_tag() || is_author() || is_date() || is_search() || is_category() )
213
- )
214
- ) {
215
  if ( ! empty( $pib_options['post_page_placement']['display_above_content'] ) ) {
216
  $content = pib_button_html() . $content;
217
  }
@@ -255,3 +257,6 @@ function pib_render_content_excerpt( $content ) {
255
  return $content;
256
  }
257
  add_filter( 'the_excerpt', 'pib_render_content_excerpt', 100 );
 
 
 
9
  */
10
 
11
  // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
+ }
15
 
16
 
17
  /**
21
  */
22
  function pib_add_custom_css() {
23
  global $pib_options;
24
+
25
+ if( ! in_array( 'no_buttons', pib_render_button() ) ) {
26
+ // Only add the custom CSS if it actually exists.
27
+ if ( ! empty( $pib_options['custom_css'] ) ) {
28
+ $custom_css = trim( $pib_options['custom_css'] );
29
 
30
+ echo "\n" .
31
+ '<style type="text/css">' . "\n" .
32
+ $custom_css . "\n" . // Render custom CSS.
33
+ '</style>' . "\n";
34
+ }
 
 
 
35
  }
36
  }
37
  add_action( 'wp_head', 'pib_add_custom_css' );
93
  // Set description to post title if still blank.
94
  if ( empty( $description ) )
95
  $description = get_the_title( $postID );
96
+
97
+ $utm = '';
98
+ $utm_meta = get_post_meta( $post->ID, 'pib_utm_meta', true );
99
+
100
+ if( ! empty( $utm_meta ) ) {
101
+ $utm = clean_and_encode_utm( $post_url, $utm_meta );
102
+ } else if( ! empty( $pib_options['utm_string'] ) ) {
103
+ $utm = clean_and_encode_utm( $post_url, $pib_options['utm_string'] );
104
+ }
105
+
106
 
107
  // Link href always needs all the parameters in it for the count bubble to work.
108
  // Pinterest points out to use protocol-agnostic URL for popup.
109
  $link_href = '//www.pinterest.com/pin/create/button/' .
110
+ '?url=' . rawurlencode( $post_url ) . $utm .
111
  '&media=' . rawurlencode( $image_url ) .
112
  '&description=' . rawurlencode( wp_strip_all_tags( $description ) );
113
 
213
  return $content;
214
 
215
  //Determine if button displayed on current page from main admin settings
216
+ if ( in_array( 'button', pib_render_button() ) ) {
 
 
 
 
 
 
 
 
 
 
 
217
  if ( ! empty( $pib_options['post_page_placement']['display_above_content'] ) ) {
218
  $content = pib_button_html() . $content;
219
  }
257
  return $content;
258
  }
259
  add_filter( 'the_excerpt', 'pib_render_content_excerpt', 100 );
260
+
261
+
262
+