Pinterest "Pin It" Button - Version 1.4.2

Version Description

  • Tested with WordPress 3.5.
  • Added: Option to save settings upon plugin uninstall.
  • Changed: Removed "Always show pin count" option as it's no longer supported by Pinterest.
  • Changed: Iframe option removed as it's no longer supported by Pinterest.
  • Changed: Moved some JavaScript files to load in the footer rather than the header to improve page speed load and compatibility with Pinterest code. Theme must implement wp_footer() to function properly.
  • Fixed: Count="vertical" shortcode fixed.
  • Fixed: Updated button CSS/styles to improve compatibility with more themes.
  • Fixed: Checks theme support for post thumbnails and adds if needed.
  • Fixed: Various minor bug fixes.
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.2

css/pinterest-pin-it-button.css CHANGED
@@ -59,7 +59,11 @@
59
  }
60
 
61
  .pib-sharebar li.pib-share-pinterest {
62
- margin-right: 30px !important;
 
 
 
 
63
  }
64
 
65
  /*** BEGIN Count Bubble CSS ***/
@@ -104,6 +108,8 @@ img.pib-count-img {
104
  max-width: none !important;
105
  padding: 0 !important;
106
  width: auto !important;
 
 
107
  }
108
 
109
  .pib-count-cell {
59
  }
60
 
61
  .pib-sharebar li.pib-share-pinterest {
62
+ margin-right: 50px !important;
63
+ }
64
+
65
+ .pib-sharebar li.pib-share-pinterest a {
66
+ vertical-align: top !important;
67
  }
68
 
69
  /*** BEGIN Count Bubble CSS ***/
108
  max-width: none !important;
109
  padding: 0 !important;
110
  width: auto !important;
111
+ -webkit-box-shadow: 0 0 0 !important;
112
+ box-shadow: 0 0 0 !important;
113
  }
114
 
115
  .pib-count-cell {
inc/admin-display-functions-lite.php CHANGED
@@ -13,7 +13,7 @@ function pib_custom_btn_img_examples_popup() {
13
 
14
  <div class="upgrade-text">
15
  <?php _e( 'These button designs available in "Pin It" Button Pro.', 'pib' ); ?><br/>
16
- <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="button-primary close"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
17
  &nbsp;&nbsp;<a href="#" class="close"><?php _e( 'Close', 'pib' ); ?></a>
18
  </div>
19
  </div>
@@ -28,7 +28,7 @@ function pib_upgrade_banner_top() {
28
  ?>
29
 
30
  <div class="pib-admin-upgrade-banner-top">
31
- <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank">
32
  <img src="//d2ghr62k8k1ljk.cloudfront.net/img/pin-it-button-pro-upgrade-banner.png" alt="<?php _e( 'Upgrade to the Pin It Button Pro Plugin', 'pib' ); ?>" />
33
  </a>
34
  </div>
@@ -72,7 +72,7 @@ function pib_settings_sidebar_lite() {
72
 
73
  <div class="inside">
74
  <p>
75
- &raquo; <a href="http://pinterestplugin.com/support" target="_blank" class="external">
76
  <?php _e( 'Support & Knowledge Base', 'pib' ); ?></a>
77
  </p>
78
  <p>
@@ -87,10 +87,10 @@ function pib_settings_sidebar_lite() {
87
 
88
  <div class="inside">
89
  <ul>
90
- <li>&raquo; <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external">"Pin It" Button Pro</a></li>
91
- <li>&raquo; <a href="http://pinterestplugin.com/top-pinned-posts/" target="_blank" class="external">Top Pinned Posts</a></li>
92
- <li>&raquo; <a href="http://pinterestplugin.com/follow-button" target="_blank" class="external">"Follow" Button</a></li>
93
- <li>&raquo; <a href="http://pinterestplugin.com/pinterest-block" target="_blank" class="external">Pinterest Block</a></li>
94
  </ul>
95
  </div>
96
  </div>
@@ -128,7 +128,7 @@ function pib_share_twitter() {
128
  function pib_share_pinterest() {
129
  ?>
130
  <a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fimg%2Fpinterest-pin-it-button-plugin-for-wordpress.png&description=Add%20a%20Simple%20and%20Flexible%20%22Pin%20It%22%20Button%20to%20Your%20WordPress%20Site%20--%20http%3A%2F%2Fpinterestplugin.com%2F" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
131
- <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
132
  <?php
133
  }
134
 
@@ -165,8 +165,8 @@ add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js_pointer' );
165
  function pib_admin_print_footer_scripts() {
166
  //Check option to hide pointer after initial display
167
  if ( !get_option( 'pib_hide_pointer' ) ) {
168
- $pointer_content = '<h3>' . _( 'Ready to be Pinned?', 'pib' ) . '</h3>';
169
- $pointer_content .= '<p>' . _( 'Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. ' .
170
  'Now just configure your settings and start getting Pinned!', 'pib' ) . '</p>';
171
 
172
  $url = admin_url( 'admin.php?page=' . PIB_BASE_NAME );
13
 
14
  <div class="upgrade-text">
15
  <?php _e( 'These button designs available in "Pin It" Button Pro.', 'pib' ); ?><br/>
16
+ <a href="<?php echo PIB_UPGRADE_URL_BASE . pib_campaign_url( 'custom-button-popup', 'pro-upgrade' ); ?>" target="_blank" class="button-primary close"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
17
  &nbsp;&nbsp;<a href="#" class="close"><?php _e( 'Close', 'pib' ); ?></a>
18
  </div>
19
  </div>
28
  ?>
29
 
30
  <div class="pib-admin-upgrade-banner-top">
31
+ <a href="<?php echo PIB_UPGRADE_URL_BASE . pib_campaign_url( 'banner-top', 'pro-upgrade' ); ?>" target="_blank">
32
  <img src="//d2ghr62k8k1ljk.cloudfront.net/img/pin-it-button-pro-upgrade-banner.png" alt="<?php _e( 'Upgrade to the Pin It Button Pro Plugin', 'pib' ); ?>" />
33
  </a>
34
  </div>
72
 
73
  <div class="inside">
74
  <p>
75
+ &raquo; <a href="http://pinterestplugin.com/support<?php echo pib_campaign_url( 'sidebar-link', 'support-pib-lite' ); ?>" target="_blank" class="external">
76
  <?php _e( 'Support & Knowledge Base', 'pib' ); ?></a>
77
  </p>
78
  <p>
87
 
88
  <div class="inside">
89
  <ul>
90
+ <li>&raquo; <a href="<?php echo PIB_UPGRADE_URL_BASE . pib_campaign_url( 'sidebar-link', 'pro-upgrade' ); ?>" target="_blank" class="external">"Pin It" Button Pro</a></li>
91
+ <li>&raquo; <a href="http://pinterestplugin.com/top-pinned-posts/<?php echo pib_campaign_url( 'sidebar-link', 'top-pinned-posts' ); ?>" target="_blank" class="external">Top Pinned Posts</a></li>
92
+ <li>&raquo; <a href="http://pinterestplugin.com/follow-button<?php echo pib_campaign_url( 'sidebar-link', 'follow-button' ); ?>" target="_blank" class="external">"Follow" Button</a></li>
93
+ <li>&raquo; <a href="http://pinterestplugin.com/pinterest-block<?php echo pib_campaign_url( 'sidebar-link', 'pinterest-block' ); ?>" target="_blank" class="external">Pinterest Block</a></li>
94
  </ul>
95
  </div>
96
  </div>
128
  function pib_share_pinterest() {
129
  ?>
130
  <a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fimg%2Fpinterest-pin-it-button-plugin-for-wordpress.png&description=Add%20a%20Simple%20and%20Flexible%20%22Pin%20It%22%20Button%20to%20Your%20WordPress%20Site%20--%20http%3A%2F%2Fpinterestplugin.com%2F" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
131
+ <script src="//assets.pinterest.com/js/pinit.js"></script>
132
  <?php
133
  }
134
 
165
  function pib_admin_print_footer_scripts() {
166
  //Check option to hide pointer after initial display
167
  if ( !get_option( 'pib_hide_pointer' ) ) {
168
+ $pointer_content = '<h3>' . __( 'Ready to be Pinned?', 'pib' ) . '</h3>';
169
+ $pointer_content .= '<p>' . __( 'Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. ' .
170
  'Now just configure your settings and start getting Pinned!', 'pib' ) . '</p>';
171
 
172
  $url = admin_url( 'admin.php?page=' . PIB_BASE_NAME );
inc/admin-display-functions-shared.php CHANGED
@@ -22,6 +22,8 @@ function pib_settings_page() {
22
  <div id="side-sortables" class="meta-box-sortables ui-sortable">
23
  <?php ( PIB_IS_PRO ? pib_settings_sidebar_pro() : pib_settings_sidebar_lite() ); ?>
24
  </div>
 
 
25
  </div>
26
 
27
  <div id="post-body">
@@ -36,7 +38,7 @@ function pib_settings_page() {
36
 
37
  <div class="postbox pib-postbox">
38
  <?php pib_handlediv(); ?>
39
- <h3 class="hndle pib-hndle"><?php _e( 'Button Click Action & Pin Count Bubble', 'pib' ); ?></h3>
40
 
41
  <table class="form-table inside">
42
  <tr valign="top">
@@ -50,7 +52,7 @@ function pib_settings_page() {
50
  <td>
51
  <input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
52
  <?php checked( $pib_options['button_style'], 'image_selected' ); ?> />
53
- <label for="image_selected"><?php _e( 'Image is <strong>pre-selected</strong>', 'pib' ); ?></label>
54
  </td>
55
  </tr>
56
  <tr valign="top">
@@ -65,30 +67,24 @@ function pib_settings_page() {
65
  </tr>
66
  <tr valign="top">
67
  <td>
68
- <input type="checkbox" id="always_show_count" name="pib_options[always_show_count]" value="1"
69
- <?php checked( (bool)$pib_options['always_show_count'] ); ?> />
70
- <label for="always_show_count"><?php _e( 'Always show pin count', 'pib' ); ?></label>
71
- </td>
72
- </tr>
73
- <tr valign="top">
74
- <td>
75
- <input type="checkbox" id="use_featured_image" name="pib_options[use_featured_image]" value="1"
76
- <?php checked( (bool)$pib_options['use_featured_image'] ); ?>
77
  <?php pib_lite_disabled_attr(); ?> />
78
  <label for="use_featured_image" class="<?php pib_lite_disabled_class(); ?>">
79
- <?php _e( 'Use featured image (pre-selected only)', 'pib' ); ?></label>
80
  <?php pib_pro_label(); ?>
81
  </td>
82
  </tr>
83
  <tr valign="top">
84
  <td class="pib-pad-cell-top">
85
- <?php _e( 'To override defaults for the website address (URL) to pin, image to pin and/or pin description for a post, ' .
86
- 'go to the edit screen for the post (usually at the bottom).', 'pib' ); ?>
87
  </td>
88
  </tr>
89
  <tr valign="top">
90
  <td>
91
- <?php _e( 'Button style setting applies to <strong>all</strong> "Pin It" buttons including widgets and shortcodes. ', 'pib' ); ?>
92
  </td>
93
  </tr>
94
  </table>
@@ -158,7 +154,7 @@ function pib_settings_page() {
158
  <td>
159
  <div class="pib-upgrade-to-pro">
160
  <?php _e( 'Available in "Pin It" Button Pro. ', 'pib' ); ?>
161
- <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
162
  </div>
163
  </td>
164
  </tr>
@@ -235,7 +231,7 @@ function pib_settings_page() {
235
  <td class="pib-pad-cell-top">
236
  <div class="pib-upgrade-to-pro">
237
  <?php _e( 'Available in "Pin It" Button Pro.', 'pib' ); ?>
238
- <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
239
  </div>
240
  </td>
241
  </tr>
@@ -347,6 +343,23 @@ function pib_settings_page() {
347
  </tr>
348
  </table>
349
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
 
351
  <div class="postbox pib-postbox">
352
  <?php pib_handlediv(); ?>
@@ -370,10 +383,6 @@ function pib_settings_page() {
370
  <label for="remove_div">
371
  <?php _e( 'Remove div tag surrounding regular button', 'pib' ); ?> (<code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code>).
372
  <?php _e( 'Already removed if other social sharing buttons enabled.', 'pib' ); ?>
373
-
374
- <?php if ( !PIB_IS_PRO ): ?>
375
- (<strong><a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Pro Feature', 'pib' ); ?></a></strong>)
376
- <?php endif; ?>
377
  </label>
378
  </td>
379
  </tr>
@@ -402,7 +411,6 @@ function pib_settings_page() {
402
  - <?php _e( 'remove_div: false (default), true -- if true removes surrounding div tag ', 'pib' ); ?>
403
  (<code><?php echo htmlentities( '<div class="pin-it-btn-wrapper-shortcode"></div>' ); ?></code>),
404
  <?php _e( 'which also removes float setting', 'pib' ); ?><br/>
405
- - <?php _e( 'always_show_count: false (default), true -- if true will show count even if zero', 'pib' ); ?><br/>
406
  - <?php _e( 'social_buttons: false (default), true -- if true and enabled above, will show Facebook, Twitter & Google +1 buttons', 'pib' ); ?>
407
  <?php pib_pro_label(); ?>
408
  </p>
@@ -432,17 +440,6 @@ function pib_settings_page() {
432
  <?php
433
  }
434
 
435
- //Add Settings link to the left of Deactivate on plugins list page
436
-
437
- function pib_plugin_settings_link( $links ) {
438
- $url = admin_url( 'admin.php?page=' . PIB_BASE_NAME );
439
- $settings_link = '<a href="' . $url . '">Settings</a>';
440
- array_unshift( $links, $settings_link );
441
- return $links;
442
- }
443
-
444
- add_filter( 'plugin_action_links_' . PIB_BASE_NAME, 'pib_plugin_settings_link' );
445
-
446
  //Handle div tag html
447
 
448
  function pib_handlediv() {
@@ -462,7 +459,7 @@ function pib_newsletter_subscribe() {
462
 
463
  <div class="inside">
464
  <p><?php _e( 'Subscribe to get notified of important updates and news for our Pinterest plugins.', 'pib' ); ?></p>
465
- &raquo; <a href="http://pinterestplugin.com/newsletter-from-plugin" target="_blank" class="external">
466
  <?php _e( 'Get Updates', 'pib' ); ?></a>
467
  </div>
468
  </div>
@@ -480,7 +477,7 @@ function pib_plugin_news() {
480
  <h3 class="hndle pib-hndle"><?php _e( 'Pinterest Plugin News', 'pib' ); ?></h3>
481
 
482
  <div class="inside">
483
- <? echo pib_rss_news(); ?>
484
  </div>
485
  </div>
486
 
@@ -516,7 +513,7 @@ function pib_rss_news() {
516
  // Loop through each feed item and display each item as a hyperlink.
517
  foreach ( $rss_items as $item ): ?>
518
  <li>
519
- &raquo; <a href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank" class="external">
520
  <?php echo esc_html( $item->get_title() ); ?></a>
521
  </li>
522
  <?php endforeach; ?>
@@ -551,3 +548,19 @@ function pib_pro_label() {
551
  echo '<span class="pib-pro-label">' . __( 'Pro Feature', 'pib' ) . '</span>';
552
  }
553
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  <div id="side-sortables" class="meta-box-sortables ui-sortable">
23
  <?php ( PIB_IS_PRO ? pib_settings_sidebar_pro() : pib_settings_sidebar_lite() ); ?>
24
  </div>
25
+
26
+ <?php //pib_debug_options(); ?>
27
  </div>
28
 
29
  <div id="post-body">
38
 
39
  <div class="postbox pib-postbox">
40
  <?php pib_handlediv(); ?>
41
+ <h3 class="hndle pib-hndle"><?php _e( 'Button Style & Pin Count', 'pib' ); ?></h3>
42
 
43
  <table class="form-table inside">
44
  <tr valign="top">
52
  <td>
53
  <input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
54
  <?php checked( $pib_options['button_style'], 'image_selected' ); ?> />
55
+ <label for="image_selected"><?php _e( 'Image is <strong>pre-selected</strong> (defaults to first image in post)', 'pib' ); ?></label>
56
  </td>
57
  </tr>
58
  <tr valign="top">
67
  </tr>
68
  <tr valign="top">
69
  <td>
70
+ <input type="checkbox" id="use_featured_image" name="pib_options[use_featured_image]" value="1"
71
+ <?php checked( (bool)$pib_options['use_featured_image'] ); ?>
72
+ <?php //TODO checked( '1', $pib_options['use_featured_image'] ); ?>
 
 
 
 
 
 
73
  <?php pib_lite_disabled_attr(); ?> />
74
  <label for="use_featured_image" class="<?php pib_lite_disabled_class(); ?>">
75
+ <?php _e( 'For pre-selected image, use <strong>featured image</strong> if available', 'pib' ); ?></label>
76
  <?php pib_pro_label(); ?>
77
  </td>
78
  </tr>
79
  <tr valign="top">
80
  <td class="pib-pad-cell-top">
81
+ <?php _e( 'You may individually override what website address (URL), image and description will be pinned for each post. ' .
82
+ 'Go to the post (or page) <strong>edit screen</strong> and scroll to the bottom.', 'pib' ); ?>
83
  </td>
84
  </tr>
85
  <tr valign="top">
86
  <td>
87
+ <?php _e( 'Button style settings apply to <strong>all</strong> "Pin It" buttons including widgets and shortcodes. ', 'pib' ); ?>
88
  </td>
89
  </tr>
90
  </table>
154
  <td>
155
  <div class="pib-upgrade-to-pro">
156
  <?php _e( 'Available in "Pin It" Button Pro. ', 'pib' ); ?>
157
+ <a href="<?php echo PIB_UPGRADE_URL_BASE . pib_campaign_url( 'upgrade-link-custom-button', 'pro-upgrade' ); ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
158
  </div>
159
  </td>
160
  </tr>
231
  <td class="pib-pad-cell-top">
232
  <div class="pib-upgrade-to-pro">
233
  <?php _e( 'Available in "Pin It" Button Pro.', 'pib' ); ?>
234
+ <a href="<?php echo PIB_UPGRADE_URL_BASE . pib_campaign_url( 'upgrade-link-social-buttons', 'pro-upgrade' ); ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
235
  </div>
236
  </td>
237
  </tr>
343
  </tr>
344
  </table>
345
  </div>
346
+
347
+ <div class="postbox pib-postbox">
348
+ <?php pib_handlediv(); ?>
349
+ <h3 class="hndle pib-hndle"><?php _e( 'Admin Settings', 'pib' ); ?></h3>
350
+
351
+ <table class="form-table inside">
352
+ <tr valign="top">
353
+ <td>
354
+ <input id="uninstall_save_settings" name="pib_options[uninstall_save_settings]" type="checkbox" value="1"
355
+ <?php checked( (bool)$pib_options['uninstall_save_settings'] ); ?> />
356
+ <label for="uninstall_save_settings">
357
+ <?php _e( 'Save settings when uninstalling plugin? Useful when upgrading to Pro or reinstalling later.', 'pib' ); ?>
358
+ </label>
359
+ </td>
360
+ </tr>
361
+ </table>
362
+ </div>
363
 
364
  <div class="postbox pib-postbox">
365
  <?php pib_handlediv(); ?>
383
  <label for="remove_div">
384
  <?php _e( 'Remove div tag surrounding regular button', 'pib' ); ?> (<code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code>).
385
  <?php _e( 'Already removed if other social sharing buttons enabled.', 'pib' ); ?>
 
 
 
 
386
  </label>
387
  </td>
388
  </tr>
411
  - <?php _e( 'remove_div: false (default), true -- if true removes surrounding div tag ', 'pib' ); ?>
412
  (<code><?php echo htmlentities( '<div class="pin-it-btn-wrapper-shortcode"></div>' ); ?></code>),
413
  <?php _e( 'which also removes float setting', 'pib' ); ?><br/>
 
414
  - <?php _e( 'social_buttons: false (default), true -- if true and enabled above, will show Facebook, Twitter & Google +1 buttons', 'pib' ); ?>
415
  <?php pib_pro_label(); ?>
416
  </p>
440
  <?php
441
  }
442
 
 
 
 
 
 
 
 
 
 
 
 
443
  //Handle div tag html
444
 
445
  function pib_handlediv() {
459
 
460
  <div class="inside">
461
  <p><?php _e( 'Subscribe to get notified of important updates and news for our Pinterest plugins.', 'pib' ); ?></p>
462
+ &raquo; <a href="http://pinterestplugin.com/newsletter<?php echo pib_campaign_url( 'sidebar-link', 'newsletter' ); ?>" target="_blank" class="external">
463
  <?php _e( 'Get Updates', 'pib' ); ?></a>
464
  </div>
465
  </div>
477
  <h3 class="hndle pib-hndle"><?php _e( 'Pinterest Plugin News', 'pib' ); ?></h3>
478
 
479
  <div class="inside">
480
+ <?php pib_rss_news(); ?>
481
  </div>
482
  </div>
483
 
513
  // Loop through each feed item and display each item as a hyperlink.
514
  foreach ( $rss_items as $item ): ?>
515
  <li>
516
+ &raquo; <a href="<?php echo esc_url( $item->get_permalink() ) . pib_campaign_url( 'sidebar-link', 'blog-post-link' ); ?>" target="_blank" class="external">
517
  <?php echo esc_html( $item->get_title() ); ?></a>
518
  </li>
519
  <?php endforeach; ?>
548
  echo '<span class="pib-pro-label">' . __( 'Pro Feature', 'pib' ) . '</span>';
549
  }
550
  }
551
+
552
+ //Debug options
553
+
554
+ function pib_debug_options() {
555
+ global $pib_options;
556
+ ?>
557
+
558
+ <h4>Debug Options</h4>
559
+ <p>
560
+ <?php foreach ( $pib_options as $option => $value ): ?>
561
+ <?php echo $option . ': ' . $value; ?><br/>
562
+ <?php endforeach; ?>
563
+ </p>
564
+
565
+ <?php
566
+ }
inc/admin-general-functions-shared.php CHANGED
@@ -3,38 +3,63 @@
3
  //*** Admin General Functions - Lite & Pro Shared ***
4
 
5
  //Plugin installation/activation
 
6
 
7
  function pib_install() {
8
  global $pib_options;
9
 
 
 
 
10
  //Deactivate plugin if WP version too low
11
- if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
12
  deactivate_plugins( basename( __FILE__ ) );
13
  }
14
 
15
- //Setup default options for values that don't exist and need to be set to 1/true/value (not 0/false/blank)
16
- //Done this way to preseve options saved in previous versions
17
- if ( !isset( $pib_options['button_style'] ) ) { $pib_options['button_style'] = 'user_selects_image'; }
18
- if ( !isset( $pib_options['count_layout'] ) ) { $pib_options['count_layout'] = 'none'; }
19
-
20
- if ( !isset( $pib_options['custom_btn_img_url'] ) ) { $pib_options['custom_btn_img_url'] = PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL; }
21
-
22
- if ( !isset( $pib_options['share_btn_1'] ) ) { $pib_options['share_btn_1'] = 'pinterest'; }
23
- if ( !isset( $pib_options['share_btn_2'] ) ) { $pib_options['share_btn_2'] = 'facebook'; }
24
- if ( !isset( $pib_options['share_btn_3'] ) ) { $pib_options['share_btn_3'] = 'twitter'; }
25
- if ( !isset( $pib_options['share_btn_4'] ) ) { $pib_options['share_btn_4'] = 'gplus'; }
26
-
27
- if ( !isset( $pib_options['display_home_page'] ) ) { $pib_options['display_home_page'] = 1; }
28
- if ( !isset( $pib_options['display_posts'] ) ) { $pib_options['display_posts'] = 1; }
29
- if ( !isset( $pib_options['display_pages'] ) ) { $pib_options['display_pages'] = 1; }
30
- if ( !isset( $pib_options['display_below_content'] ) ) { $pib_options['display_below_content'] = 1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
 
 
 
 
 
 
 
 
32
  //Save default option values
33
  update_option( 'pib_options', $pib_options );
34
  }
35
 
36
- register_activation_hook( __FILE__, 'pib_install' );
37
-
38
  //Register settings
39
 
40
  function pib_register_settings() {
@@ -68,3 +93,26 @@ function pib_add_admin_css_js() {
68
  wp_enqueue_style( 'pinterest-pin-it-button', PIB_CSS_URL . 'pinterest-pin-it-button-admin.css' );
69
  wp_enqueue_script( 'pinterest-pin-it-button', PIB_JS_URL . 'pinterest-pin-it-button-admin.js', array( 'jquery' ), '' );
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  //*** Admin General Functions - Lite & Pro Shared ***
4
 
5
  //Plugin installation/activation
6
+ //register_activation_hook needs to be in main plugin file
7
 
8
  function pib_install() {
9
  global $pib_options;
10
 
11
+ //Need to retrieve options here
12
+ $pib_options = get_option( 'pib_options' );
13
+
14
  //Deactivate plugin if WP version too low
15
+ if ( version_compare( get_bloginfo( 'version' ), '3.2', '<' ) ) {
16
  deactivate_plugins( basename( __FILE__ ) );
17
  }
18
 
19
+ //Set default options for plugin, but don't overwrite existing values
20
+ //Boolean values should be set to 1 for true, 0 for false
21
+ $default_options = array(
22
+ 'button_style' => 'user_selects_image',
23
+ 'count_layout' => 'none',
24
+
25
+ 'display_home_page' => 1,
26
+ 'display_front_page' => 0,
27
+ 'display_posts' => 1,
28
+ 'display_pages' => 0,
29
+ 'display_archives' => 0,
30
+ 'display_above_content' => 0,
31
+ 'display_below_content' => 1,
32
+ 'display_on_post_excerpts' => 0,
33
+
34
+ 'uninstall_save_settings' => 1,
35
+ 'custom_css' => '',
36
+ 'remove_div' => 0,
37
+
38
+ //Pro options
39
+ 'pib_license_key' => '',
40
+ 'use_featured_image' => 0,
41
+
42
+ 'use_custom_img_btn' => 0,
43
+ 'custom_btn_img_url' => PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL,
44
+ 'use_other_sharing_buttons' => 0,
45
+ 'share_btn_1' => 'pinterest',
46
+ 'share_btn_2' => 'facebook',
47
+ 'share_btn_3' => 'twitter',
48
+ 'share_btn_4' => 'gplus',
49
+ );
50
 
51
+ //Loop through global options and set them to defaults
52
+ //If already set (from previous install - check with isset) don't overwrite
53
+ foreach ( $default_options as $option => $value ) {
54
+ if ( !isset( $pib_options[$option] ) ) {
55
+ $pib_options[$option] = $value;
56
+ }
57
+ }
58
+
59
  //Save default option values
60
  update_option( 'pib_options', $pib_options );
61
  }
62
 
 
 
63
  //Register settings
64
 
65
  function pib_register_settings() {
93
  wp_enqueue_style( 'pinterest-pin-it-button', PIB_CSS_URL . 'pinterest-pin-it-button-admin.css' );
94
  wp_enqueue_script( 'pinterest-pin-it-button', PIB_JS_URL . 'pinterest-pin-it-button-admin.js', array( 'jquery' ), '' );
95
  }
96
+
97
+ //Admin URL
98
+
99
+ function pib_admin_url() {
100
+ return admin_url( 'admin.php?page=pib_pin_it_button' );
101
+ }
102
+
103
+ //Add Settings link to the left of Deactivate on plugins list page
104
+
105
+ function pib_plugin_settings_link( $links ) {
106
+ $url = pib_admin_url();
107
+ $settings_link = '<a href="' . $url . '">Settings</a>';
108
+ array_unshift( $links, $settings_link );
109
+ return $links;
110
+ }
111
+
112
+ add_filter( 'plugin_action_links_' . PIB_BASE_NAME, 'pib_plugin_settings_link' );
113
+
114
+ //Google campaign tracking URL (querystring part)
115
+
116
+ function pib_campaign_url( $medium, $campaign ) {
117
+ return '?utm_source=pib-' . ( PIB_IS_PRO ? 'pro' : 'lite' ) . '&utm_medium=' . $medium . '&utm_campaign=' . $campaign;
118
+ }
inc/public-display-functions.php CHANGED
@@ -14,15 +14,12 @@ function pib_add_public_css_js() {
14
  //Image pre-selected AND use Custom image button
15
  if ( (bool)$pib_options['use_custom_img_btn'] ) {
16
  //Popup small sized window like original Pinterest create pin popup
17
- //***This JS file and others moved back to header (was output in footer previously) because of some theme incompatibilities
18
- //(for starters: Portfolium by WP Shower)
19
- wp_enqueue_script( 'pin-it-button-image-selected', PIB_JS_URL . 'pin-it-button-image-selected.js', array( 'jquery' ) );
20
  }
21
 
22
  //Image pre-selected AND use Stock button (embed code from Pinterest)
23
  else {
24
- //Official iframe + official button image + image pre-selected (original embed code from Pinterest, output their pinit.js in footer)
25
- //This won't work properly if theme doesn't implement wp_footer() hook
26
  wp_enqueue_script( 'pinterest-assets', 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/js/pinit.js', null, '', true );
27
  }
28
  }
@@ -31,7 +28,7 @@ function pib_add_public_css_js() {
31
  //$pib_options['button_style'] == 'user_selects_image' (or blank)
32
  else {
33
  //Fire off Pinterest's pinmarklet.js
34
- wp_enqueue_script( 'pin-it-button-user-selects-image', PIB_JS_URL . 'pin-it-button-user-selects-image.js', array( 'jquery' ) );
35
 
36
  //User selects image AND use Custom image button
37
  if ( (bool)$pib_options['use_custom_img_btn'] ) {
@@ -49,13 +46,13 @@ function pib_add_public_css_js() {
49
  ( ( $pib_options['button_style'] != 'image_selected' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
50
  ( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
51
  ) {
52
- wp_enqueue_script( 'pin-it-button-custom-btn-img', PIB_JS_URL . 'pin-it-button-custom-btn-img.js', array( 'jquery' ) );
53
  }
54
 
55
  //Load other sharing button JS in head (for compatibility with themes not implementing wp_footer() hook)
56
  if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
57
- wp_enqueue_script( 'twitter-embed', PIB_JS_URL . 'twitter-embed.js' );
58
- wp_enqueue_script( 'gplus-embed', PIB_JS_URL . 'gplus-embed.js' );
59
  }
60
  }
61
 
@@ -77,7 +74,7 @@ add_action( 'wp_head', 'pib_add_custom_css' );
77
 
78
  //Function for rendering "Pin It" button base html
79
 
80
- function pib_button_base( $post_url, $image_url, $description, $count_layout, $always_show_count ) {
81
  global $pib_options;
82
 
83
  $btn_class = '';
@@ -95,6 +92,8 @@ function pib_button_base( $post_url, $image_url, $description, $count_layout, $a
95
  else {
96
  //Default non-sprite button image url from Pinterest
97
  $btn_img_url = '//assets.pinterest.com/images/PinExt.png';
 
 
98
  }
99
 
100
  //Image pre-selected
@@ -119,37 +118,37 @@ function pib_button_base( $post_url, $image_url, $description, $count_layout, $a
119
  }
120
 
121
  //HTML from Pinterest Goodies 3/19/2012
122
- //<a href="http://pinterest.com/pin/create/button/?url=[PAGE]&media=[IMG]&description=[DESC]" class="pin-it-button" count-layout="horizontal" always-show-count="true">
123
  //<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
124
  //rel="nobox" is to prevent lightbox popup
125
-
126
  $inner_btn_html = '<img border="0" class="pib-count-img" src="' . $btn_img_url . '" title="Pin It" />';
127
  $full_btn_html = '';
128
 
129
  //Link href always needs all the parameters in it for the count bubble to work
130
- $link_href = 'http://pinterest.com/pin/create/button/?url=' . rawurlencode( $post_url ) . '&media=' . rawurlencode( $image_url ) .
 
131
  '&description='. rawurlencode( $description );
132
 
133
  //Full link html with attributes
134
  $link_html = '<a href="' . $link_href . '" ' .
135
- 'count-layout="' . $count_layout . '" class="' . $btn_class . '" rel="nobox" ' .
136
- ( $always_show_count ? 'always-show-count="true"' : '') . '>' .
137
  $inner_btn_html . '</a>';
138
 
139
  //Count bubble HTML for non-iframe buttons (if count layout specified)
140
  if (
141
  ( ( $pib_options['button_style'] == 'user_selects_image' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
142
- ( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
143
  ) {
144
 
145
- if ( $pib_options['count_layout'] == 'horizontal' ) {
146
 
147
  $full_btn_html = '<table class="pib-count-table pib-count-table-horizontal"><tbody><tr>' . "\n" .
148
  '<td>' . $link_html . '</td>' . "\n" .
149
  '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
150
  '</tr></tbody></table>' . "\n";
151
  }
152
- elseif ( $pib_options['count_layout'] == 'vertical' ) {
153
 
154
  $full_btn_html = '<table class="pib-count-table pib-count-table-vertical"><tbody><tr>' . "\n" .
155
  '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
@@ -204,9 +203,8 @@ function pib_button_html() {
204
  if ( empty( $description ) ) { $description = get_the_title( $postID ); }
205
 
206
  $count_layout = $pib_options['count_layout'];
207
- $always_show_count = (bool)$pib_options['always_show_count'];
208
 
209
- $base_btn = pib_button_base( $post_url, $image_url, $description, $count_layout, $always_show_count );
210
 
211
  //Don't wrap with div if using other sharing buttons or "remove div" is checked
212
  if ( (bool)$pib_options['use_other_sharing_buttons'] || (bool)$pib_options['remove_div'] ) {
@@ -329,3 +327,13 @@ function pib_render_content_excerpt( $content ) {
329
  }
330
 
331
  add_filter( 'the_excerpt', 'pib_render_content_excerpt' );
 
 
 
 
 
 
 
 
 
 
14
  //Image pre-selected AND use Custom image button
15
  if ( (bool)$pib_options['use_custom_img_btn'] ) {
16
  //Popup small sized window like original Pinterest create pin popup
17
+ wp_enqueue_script( 'pin-it-button-image-selected', PIB_JS_URL . 'pin-it-button-image-selected.js', array( 'jquery' ), '', true );
 
 
18
  }
19
 
20
  //Image pre-selected AND use Stock button (embed code from Pinterest)
21
  else {
22
+ //No longer users iframe
 
23
  wp_enqueue_script( 'pinterest-assets', 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/js/pinit.js', null, '', true );
24
  }
25
  }
28
  //$pib_options['button_style'] == 'user_selects_image' (or blank)
29
  else {
30
  //Fire off Pinterest's pinmarklet.js
31
+ wp_enqueue_script( 'pin-it-button-user-selects-image', PIB_JS_URL . 'pin-it-button-user-selects-image.js', array( 'jquery' ), '', true );
32
 
33
  //User selects image AND use Custom image button
34
  if ( (bool)$pib_options['use_custom_img_btn'] ) {
46
  ( ( $pib_options['button_style'] != 'image_selected' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
47
  ( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
48
  ) {
49
+ wp_enqueue_script( 'pin-it-button-custom-btn-img', PIB_JS_URL . 'pin-it-button-custom-btn-img.js', array( 'jquery' ), '', true );
50
  }
51
 
52
  //Load other sharing button JS in head (for compatibility with themes not implementing wp_footer() hook)
53
  if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
54
+ wp_enqueue_script( 'twitter-embed', PIB_JS_URL . 'twitter-embed.js', null, '', true );
55
+ wp_enqueue_script( 'gplus-embed', PIB_JS_URL . 'gplus-embed.js', null, '', true );
56
  }
57
  }
58
 
74
 
75
  //Function for rendering "Pin It" button base html
76
 
77
+ function pib_button_base( $post_url, $image_url, $description, $count_layout ) {
78
  global $pib_options;
79
 
80
  $btn_class = '';
92
  else {
93
  //Default non-sprite button image url from Pinterest
94
  $btn_img_url = '//assets.pinterest.com/images/PinExt.png';
95
+ //New image added on 11/15/2012 if needed:
96
+ //$btn_img_url = '//assets.pinterest.com/images/pidgets/pin_it_button.png';
97
  }
98
 
99
  //Image pre-selected
118
  }
119
 
120
  //HTML from Pinterest Goodies 3/19/2012
121
+ //<a href="http://pinterest.com/pin/create/button/?url=[PAGE]&media=[IMG]&description=[DESC]" class="pin-it-button" count-layout="horizontal">
122
  //<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
123
  //rel="nobox" is to prevent lightbox popup
124
+
125
  $inner_btn_html = '<img border="0" class="pib-count-img" src="' . $btn_img_url . '" title="Pin It" />';
126
  $full_btn_html = '';
127
 
128
  //Link href always needs all the parameters in it for the count bubble to work
129
+ //Link set to "//pinterest.com" as they allow http or https and SSL sites like this better (reported bug)
130
+ $link_href = '//pinterest.com/pin/create/button/?url=' . rawurlencode( $post_url ) . '&media=' . rawurlencode( $image_url ) .
131
  '&description='. rawurlencode( $description );
132
 
133
  //Full link html with attributes
134
  $link_html = '<a href="' . $link_href . '" ' .
135
+ 'count-layout="' . $count_layout . '" class="' . $btn_class . '" rel="nobox">' .
 
136
  $inner_btn_html . '</a>';
137
 
138
  //Count bubble HTML for non-iframe buttons (if count layout specified)
139
  if (
140
  ( ( $pib_options['button_style'] == 'user_selects_image' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
141
+ ( $count_layout != 'none' )
142
  ) {
143
 
144
+ if ( $count_layout == 'horizontal' ) {
145
 
146
  $full_btn_html = '<table class="pib-count-table pib-count-table-horizontal"><tbody><tr>' . "\n" .
147
  '<td>' . $link_html . '</td>' . "\n" .
148
  '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
149
  '</tr></tbody></table>' . "\n";
150
  }
151
+ elseif ( $count_layout == 'vertical' ) {
152
 
153
  $full_btn_html = '<table class="pib-count-table pib-count-table-vertical"><tbody><tr>' . "\n" .
154
  '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
203
  if ( empty( $description ) ) { $description = get_the_title( $postID ); }
204
 
205
  $count_layout = $pib_options['count_layout'];
 
206
 
207
+ $base_btn = pib_button_base( $post_url, $image_url, $description, $count_layout );
208
 
209
  //Don't wrap with div if using other sharing buttons or "remove div" is checked
210
  if ( (bool)$pib_options['use_other_sharing_buttons'] || (bool)$pib_options['remove_div'] ) {
327
  }
328
 
329
  add_filter( 'the_excerpt', 'pib_render_content_excerpt' );
330
+
331
+ //Add thumbnail support to theme if needed
332
+
333
+ function pib_add_thumbnail_support() {
334
+ if ( !current_theme_supports( 'post-thumbnails' ) ) {
335
+ add_theme_support( 'post-thumbnails' );
336
+ }
337
+ }
338
+
339
+ add_action('init', 'pib_add_thumbnail_support');
inc/shortcode.php CHANGED
@@ -1,7 +1,5 @@
1
  <?php
2
 
3
- //Register shortcode: [pinit url="" image_url="" description="" float="none" remove_div="false" always_show_count="false"]
4
-
5
  function pib_button_shortcode_html( $attr ) {
6
  global $pib_options;
7
  global $post;
@@ -46,10 +44,9 @@ function pib_button_shortcode_html( $attr ) {
46
 
47
  $count = ( empty( $attr['count'] ) ? 'none' : $attr['count'] );
48
  $remove_div = ( $attr['remove_div'] == 'true' );
49
- $always_show_count = ( $attr['always_show_count'] == 'true' );
50
  $social_buttons = ( $attr['social_buttons'] == 'true' );
51
 
52
- $base_btn = pib_button_base( $url, $image_url, $description, $count, $always_show_count );
53
 
54
  //Don't wrap with div or use float left/right if using other sharing buttons or "remove div" is checked
55
  if ( $remove_div || $social_buttons ) {
1
  <?php
2
 
 
 
3
  function pib_button_shortcode_html( $attr ) {
4
  global $pib_options;
5
  global $post;
44
 
45
  $count = ( empty( $attr['count'] ) ? 'none' : $attr['count'] );
46
  $remove_div = ( $attr['remove_div'] == 'true' );
 
47
  $social_buttons = ( $attr['social_buttons'] == 'true' );
48
 
49
+ $base_btn = pib_button_base( $url, $image_url, $description, $count );
50
 
51
  //Don't wrap with div or use float left/right if using other sharing buttons or "remove div" is checked
52
  if ( $remove_div || $social_buttons ) {
inc/widget.php CHANGED
@@ -27,9 +27,8 @@ class Pib_Widget extends WP_Widget {
27
  $count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
28
  $float = empty( $instance['float'] ) ? 'none' : $instance['float'];
29
  $pib_remove_div = (bool)$instance['remove_div'];
30
- $pib_always_show_count = (bool)$instance['always_show_count'];
31
 
32
- $base_btn = pib_button_base( $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout, $pib_always_show_count );
33
 
34
  echo $before_widget;
35
 
@@ -68,7 +67,6 @@ class Pib_Widget extends WP_Widget {
68
  $instance['count_layout'] = $new_instance['count_layout'];
69
  $instance['float'] = $new_instance['float'];
70
  $instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
71
- $instance['always_show_count'] = ( $new_instance['always_show_count'] ? 1 : 0 );
72
 
73
  return $instance;
74
  }
@@ -97,10 +95,6 @@ class Pib_Widget extends WP_Widget {
97
  <option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e( 'Vertical' ); ?></option>
98
  </select>
99
  </p>
100
- <p>
101
- <input class="checkbox" <?php checked( $instance['always_show_count'], true) ?> id="<?php echo $this->get_field_id( 'always_show_count' ); ?>" name="<?php echo $this->get_field_name( 'always_show_count' ); ?>" type="checkbox"/>
102
- <label for="<?php echo $this->get_field_id( 'always_show_count' ); ?>"><?php _e( 'Always show pin count (even when zero)' ); ?></label>
103
- </p>
104
  <div class="pib-widget-text-fields">
105
  <p>
106
  <?php _e('Button style is inherited from setting saved in'); ?>
27
  $count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
28
  $float = empty( $instance['float'] ) ? 'none' : $instance['float'];
29
  $pib_remove_div = (bool)$instance['remove_div'];
 
30
 
31
+ $base_btn = pib_button_base( $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout );
32
 
33
  echo $before_widget;
34
 
67
  $instance['count_layout'] = $new_instance['count_layout'];
68
  $instance['float'] = $new_instance['float'];
69
  $instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
 
70
 
71
  return $instance;
72
  }
95
  <option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e( 'Vertical' ); ?></option>
96
  </select>
97
  </p>
 
 
 
 
98
  <div class="pib-widget-text-fields">
99
  <p>
100
  <?php _e('Button style is inherited from setting saved in'); ?>
pib-config.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
-
3
- /***************************
4
- * Global Constants
5
- ***************************/
6
-
7
- define( 'PIB_BASE_NAME', plugin_basename( __FILE__ ) ); // pinterest-pin-it-button/pinterest-pin-it-button
8
- define( 'PIB_BASE_DIR_SHORT', dirname( PIB_BASE_NAME ) ); // pinterest-pin-it-button
9
- define( 'PIB_BASE_DIR_LONG', dirname( __FILE__ ) ); // ../wp-content/plugins/pinterest-pin-it-button (physical file path)
10
- define( 'PIB_INC_DIR', PIB_BASE_DIR_LONG . '/inc/' ); // ../wp-content/plugins/pinterest-pin-it-button/inc/ (physical file path)
11
- define( 'PIB_BASE_URL', plugin_dir_url( __FILE__ ) ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/
12
- define( 'PIB_IMAGES_URL', PIB_BASE_URL . 'img/' ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/img/
13
- define( 'PIB_CSS_URL', PIB_BASE_URL . 'css/' );
14
- define( 'PIB_JS_URL', PIB_BASE_URL . 'js/' );
15
-
16
- define( 'PIB_UPGRADE_URL', 'http://pinterestplugin.com/pin-it-button-pro/' );
17
- define( 'PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL', PIB_IMAGES_URL . 'pin-it-buttons/set01/a04.png' );
18
-
19
- $pib_options = get_option( 'pib_options' );
20
-
21
- /***************************
22
- * Includes
23
- ***************************/
24
-
25
- require_once( PIB_INC_DIR . 'admin-general-functions-shared.php' );
26
- require_once( PIB_INC_DIR . 'admin-display-functions-shared.php' );
27
- require_once( PIB_INC_DIR . 'public-display-functions.php' );
28
-
29
- if ( PIB_IS_PRO ) {
30
- require_once( PIB_INC_DIR . 'admin-general-functions-pro.php' );
31
- require_once( PIB_INC_DIR . 'admin-display-functions-pro.php' );
32
- require_once( PIB_INC_DIR . 'public-display-functions-pro.php' );
33
- }
34
- else {
35
- require_once( PIB_INC_DIR . 'admin-display-functions-lite.php' );
36
- }
37
-
38
- require_once( PIB_INC_DIR . 'widget.php' );
39
- require_once( PIB_INC_DIR . 'shortcode.php' );
40
- require_once( PIB_INC_DIR . 'post-meta.php' );
41
- require_once( PIB_INC_DIR . 'category-meta.php' );
42
-
43
- /***************************
44
- * Debug
45
- ***************************/
46
-
47
- function pib_debug_print( $value ) {
48
- echo '<br/><br/>';
49
- print_r( $value );
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pinterest-pin-it-button.php CHANGED
@@ -5,11 +5,60 @@
5
  Description: Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Includes shortcode and widget.
6
  Author: Phil Derksen
7
  Author URI: http://pinterestplugin.com
8
- Version: 1.4.1
9
  License: GPLv2
10
  Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
11
  */
12
 
13
  define( 'PIB_IS_PRO', false );
14
 
15
- require_once( 'pib-config.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Description: Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Includes shortcode and widget.
6
  Author: Phil Derksen
7
  Author URI: http://pinterestplugin.com
8
+ Version: 1.4.2
9
  License: GPLv2
10
  Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
11
  */
12
 
13
  define( 'PIB_IS_PRO', false );
14
 
15
+ /***************************
16
+ * Global Constants
17
+ ***************************/
18
+
19
+ define( 'PIB_BASE_NAME', plugin_basename( __FILE__ ) ); // pinterest-pin-it-button/pinterest-pin-it-button.php
20
+ define( 'PIB_BASE_DIR_SHORT', dirname( PIB_BASE_NAME ) ); // pinterest-pin-it-button
21
+ define( 'PIB_BASE_DIR_LONG', dirname( __FILE__ ) ); // ../wp-content/plugins/pinterest-pin-it-button (physical file path)
22
+ define( 'PIB_INC_DIR', PIB_BASE_DIR_LONG . '/inc/' ); // ../wp-content/plugins/pinterest-pin-it-button/inc/ (physical file path)
23
+ define( 'PIB_BASE_URL', plugin_dir_url( __FILE__ ) ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/
24
+ define( 'PIB_IMAGES_URL', PIB_BASE_URL . 'img/' ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/img/
25
+ define( 'PIB_CSS_URL', PIB_BASE_URL . 'css/' );
26
+ define( 'PIB_JS_URL', PIB_BASE_URL . 'js/' );
27
+
28
+ define( 'PIB_UPGRADE_URL_BASE', 'http://pinterestplugin.com/pin-it-button-pro/' );
29
+ define( 'PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL', PIB_IMAGES_URL . 'pin-it-buttons/set01/a04.png' );
30
+
31
+ register_activation_hook( __FILE__, 'pib_install' );
32
+
33
+ $pib_options = get_option( 'pib_options' );
34
+
35
+ /***************************
36
+ * Includes
37
+ ***************************/
38
+
39
+ require_once( PIB_INC_DIR . 'admin-general-functions-shared.php' );
40
+ require_once( PIB_INC_DIR . 'admin-display-functions-shared.php' );
41
+ require_once( PIB_INC_DIR . 'public-display-functions.php' );
42
+
43
+ if ( PIB_IS_PRO ) {
44
+ require_once( PIB_INC_DIR . 'admin-general-functions-pro.php' );
45
+ require_once( PIB_INC_DIR . 'admin-display-functions-pro.php' );
46
+ require_once( PIB_INC_DIR . 'public-display-functions-pro.php' );
47
+ }
48
+ else {
49
+ require_once( PIB_INC_DIR . 'admin-display-functions-lite.php' );
50
+ }
51
+
52
+ require_once( PIB_INC_DIR . 'widget.php' );
53
+ require_once( PIB_INC_DIR . 'shortcode.php' );
54
+ require_once( PIB_INC_DIR . 'post-meta.php' );
55
+ require_once( PIB_INC_DIR . 'category-meta.php' );
56
+
57
+ /***************************
58
+ * Debug Code
59
+ ***************************/
60
+
61
+ function pib_debug_print( $value ) {
62
+ print_r( $value );
63
+ echo '<br/>';
64
+ }
readme.txt CHANGED
@@ -1,52 +1,49 @@
1
- === Pinterest "Pin It" Button Lite ===
2
  Contributors: pderksen
3
- Tags: pinterest, pin it, social
4
- Requires at least: 3.1
5
- Tested up to: 3.4.2
6
- Stable tag: 1.4.1
7
 
8
- Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
9
 
10
  == Description ==
11
 
12
- Add a Simple "Pin It" Button to Your Posts in 2 Minutes!
13
 
14
- ###"Pin It" Button Lite Features:###
15
 
16
- * Let the reader select an image from a popup (or)
17
- * Specify image to pin on each post
18
- * Show horizontal, vertical or no pin count
19
  * Show or hide the button on any post, page or category
20
  * Add custom CSS to align with other sharing buttons
21
- * Sidebar widget and shortcode included
22
- * Option for no iframe (fixes display issues on some web hosts)
23
 
24
- ###Additional Features Available in "Pin It" Button Pro:###
25
 
26
- * 30 Custom Button Designs to choose from
27
  * Facebook, Twitter & Google +1 sharing button included
28
  * Allow featured images to be pre-selected when pinning
29
  * Automatic Upgrades & Priority Support
30
 
31
- [Upgrade to "Pin It" Button Pro Now! &raquo;](http://pinterestplugin.com)
32
 
33
- **Resources**
34
 
35
- * [See the "Pin It" Button in Action &raquo;](http://bruisesandbandaids.com/2011/newborn-photography-props/)
36
- * [Premium Pinterest Plugins &raquo;](http://pinterestplugin.com)
37
- * [User Support & Feature Requests &raquo;](http://pinterestplugin.com/support)
 
38
 
39
- Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
40
 
41
- * **Pinterest Drives More Traffic Than Google+, YouTube and LinkedIn Combined** - Mashable [[link]](http://mashable.com/2012/02/01/pinterest-traffic-study/)
42
- * **Pinterest Rate of Referral Now Close to Twitter, Google+** - The Wall Street Journal [[link]](http://blogs.wsj.com/tech-europe/2012/02/03/pinterest-rate-of-referral-now-close-to-twitter-google/)
43
- * **Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
44
 
45
  = More Pinterest Plugins =
46
 
47
- * ["Pin It" Button Pro](http://pinterestplugin.com/pin-it-button-pro/)
48
- * [Top Pinned Posts](http://pinterestplugin.com/top-pinned-posts/)
49
- * ["Follow" Button](http://pinterestplugin.com/follow-button)
50
  * [Pinterest Block](http://pinterestplugin.com/pinterest-block)
51
 
52
  == Installation ==
@@ -58,10 +55,6 @@ Take advantage of the exploding traffic Pinterest is generating by encouraging y
58
  1. Also look for my name as the author (*Phil Derksen*). There are other "Pin It" button plugins which is why this can be confusing.
59
  1. Click "Install Now", then Activate, then head to the new menu item on the left labeled "Pin It Button".
60
 
61
- Here's a video walkthrough of the install process:
62
-
63
- http://www.youtube.com/watch?v=NsEGeVpmD0Y
64
-
65
  **Alternative installation methods:**
66
 
67
  * Download this plugin, then upload through the WordPress admin (Plugins > Add New > Upload)
@@ -83,6 +76,17 @@ Note: If you overwrite the plugin using an FTP upload, you may lose some saved s
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
 
 
 
 
 
 
86
  = 1.4.1 =
87
  * Fixed: Various shortcode fixes.
88
  * Fixed: Moved some JavaScript files that were loaded in the footer to now load in the header to improve compatibility with themes not implementing wp_footer().
1
+ === Pinterest "Pin It" Button ===
2
  Contributors: pderksen
3
+ Tags: pinterest, pin it, pin it button, social
4
+ Requires at least: 3.2
5
+ Tested up to: 3.5
6
+ Stable tag: trunk
7
 
8
+ Easily add a Pinterest "Pin It" Button to your site and encourage your visitors pin your awesome content!
9
 
10
  == Description ==
11
 
12
+ Add a simple Pinterest "Pin It" Button to your posts in 2 minutes!
13
 
14
+ ###Pinterest "Pin It" Button Plugin Features:###
15
 
16
+ * Let the reader select an image from a popup (Pinterest bookmarklet style)
17
+ * (or) Specify the image to pin on each post (Pinterest default)
18
+ * Show horizontal, vertical or no pin count (Pinterest counts per post/URL)
19
  * Show or hide the button on any post, page or category
20
  * Add custom CSS to align with other sharing buttons
21
+ * Sidebar widget and shortcode options included
 
22
 
23
+ ###Additional Features Available in Pinterest "Pin It" Button PRO:###
24
 
25
+ * 30 Custom "Pin It" Button Designs to choose from
26
  * Facebook, Twitter & Google +1 sharing button included
27
  * Allow featured images to be pre-selected when pinning
28
  * Automatic Upgrades & Priority Support
29
 
30
+ [Upgrade to Pinterest "Pin It" Button PRO! &raquo;](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
31
 
32
+ ###Raves###
33
 
34
+ * "The Pinterest 'Pin It' Button is a painless solution for bloggers just getting started with this social network." -- [WP Jedi](http://www.wpjedi.com/pinterest-pin-it-button-for-wordpress/)
35
+ * Top 10 Plugins for February 2012 (the only Pinterest one) -- [ManageWP](http://managewp.com/top-10-wordpress-plugins-of-the-month-february)
36
+ * "If you want to make it easy for Pinterest users to pin your articles, consider using this 'Pin It' button plugin." -- [WP Tavern](http://www.wptavern.com/pin-it-is-the-new-bookmark)
37
+ * "If you're looking for something simple and obtrusive, the Pinterest 'Pin It' Button will suit you." -- [WPMU.org](http://wpmu.org/pinterest-plugins-wordpress/)
38
 
39
+ [See a demo the Pinterest "Pin It" Button &raquo;](http://bruisesandbandaids.com/2011/newborn-photography-props/) (see bottom of the post)
40
 
41
+ [Upgrade to "Pin It" Button Pro Now! &raquo;](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
 
 
42
 
43
  = More Pinterest Plugins =
44
 
45
+ * [Pinterest Top Pinned Posts](http://pinterestplugin.com/top-pinned-posts/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
46
+ * [Pinterest "Follow" Button](http://pinterestplugin.com/follow-button)
 
47
  * [Pinterest Block](http://pinterestplugin.com/pinterest-block)
48
 
49
  == Installation ==
55
  1. Also look for my name as the author (*Phil Derksen*). There are other "Pin It" button plugins which is why this can be confusing.
56
  1. Click "Install Now", then Activate, then head to the new menu item on the left labeled "Pin It Button".
57
 
 
 
 
 
58
  **Alternative installation methods:**
59
 
60
  * Download this plugin, then upload through the WordPress admin (Plugins > Add New > Upload)
76
 
77
  == Changelog ==
78
 
79
+ = 1.4.2 =
80
+ * Tested with WordPress 3.5.
81
+ * Added: Option to save settings upon plugin uninstall.
82
+ * Changed: Removed "Always show pin count" option as it's no longer supported by Pinterest.
83
+ * Changed: Iframe option removed as it's no longer supported by Pinterest.
84
+ * Changed: Moved some JavaScript files to load in the footer rather than the header to improve page speed load and compatibility with Pinterest code. Theme must implement wp_footer() to function properly.
85
+ * Fixed: Count="vertical" shortcode fixed.
86
+ * Fixed: Updated button CSS/styles to improve compatibility with more themes.
87
+ * Fixed: Checks theme support for post thumbnails and adds if needed.
88
+ * Fixed: Various minor bug fixes.
89
+
90
  = 1.4.1 =
91
  * Fixed: Various shortcode fixes.
92
  * Fixed: Moved some JavaScript files that were loaded in the footer to now load in the header to improve compatibility with themes not implementing wp_footer().
uninstall.php CHANGED
@@ -5,16 +5,26 @@ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
5
  exit;
6
  }
7
 
8
- //Remove option records from options table
9
- delete_option( 'pib_options' );
10
- delete_option( 'pib_category_fields_option' );
11
-
12
- //Remove custom post meta fields
13
- $posts = get_posts( array( 'numberposts' => -1 ) );
14
-
15
- foreach( $posts as $post ) {
16
- delete_post_meta( $post->ID, 'pib_sharing_disabled' );
17
- delete_post_meta( $post->ID, 'pib_url_of_webpage' );
18
- delete_post_meta( $post->ID, 'pib_url_of_img' );
19
- delete_post_meta( $post->ID, 'pib_description' );
 
 
 
 
 
 
 
 
 
 
20
  }
5
  exit;
6
  }
7
 
8
+ //Delete plugin options only if value checked
9
+
10
+ global $pib_options;
11
+
12
+ //Need to retrieve options here
13
+ $pib_options = get_option( 'pib_options' );
14
+
15
+ if ( !(bool)$pib_options['uninstall_save_settings'] ) {
16
+
17
+ //Remove option records from options table
18
+ delete_option( 'pib_options' );
19
+ delete_option( 'pib_category_fields_option' );
20
+
21
+ //Remove custom post meta fields
22
+ $posts = get_posts( array( 'numberposts' => -1 ) );
23
+
24
+ foreach( $posts as $post ) {
25
+ delete_post_meta( $post->ID, 'pib_sharing_disabled' );
26
+ delete_post_meta( $post->ID, 'pib_url_of_webpage' );
27
+ delete_post_meta( $post->ID, 'pib_url_of_img' );
28
+ delete_post_meta( $post->ID, 'pib_description' );
29
+ }
30
  }