Pinterest "Pin It" Button - Version 1.2.1

Version Description

  • Fixed bug with hiding posts/pages/categories when upgrading from a previous version
Download this release

Release Info

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

Code changes from version 1.3.0 to 1.2.1

css/pinterest-pin-it-button-admin.css CHANGED
@@ -1,4 +1,4 @@
1
- /* Pinterest "Pin It" Button Admin CSS */
2
 
3
  .form-table {
4
  margin-bottom: 10px !important;
@@ -25,6 +25,11 @@
25
  margin: 10px 10px 0 0;
26
  }
27
 
 
 
 
 
 
28
  .pib-settings {
29
  width: 70%;
30
  }
@@ -33,29 +38,22 @@
33
  width: 30%;
34
  }
35
 
36
- .postbox .pib-hndle {
37
- cursor:pointer;
38
- }
39
-
40
- #pib-custom-css {
41
- width: 100%;
42
- }
43
-
44
- .pib-full-width-textbox {
45
- width: 100%;
46
- }
47
-
48
- td.pib-pad-cell-top {
49
- padding-top: 7px;
50
  }
51
 
52
- label.pib-plain-label {
53
- margin: 0;
54
- padding: 0;
55
  }
56
 
57
-
58
- /* BEGIN Mailchimp Embedded Form CSS */
59
 
60
  #email-signup {
61
  /* background-color: #464646; */
@@ -91,9 +89,8 @@ label.pib-plain-label {
91
  #mc_embed_signup .clear {clear:none; display:inline;}
92
  #mc_embed_signup input.email {display:block; padding:8px 0; margin:0 4% 10px 0; text-indent:5px; width:58%; min-width:130px;}
93
 
94
- /* END Mailchimp Embedded Form CSS */
95
-
96
- /* BEGIN Super Conversion Button CSS
97
 
98
  Conversion buttons made simple:
99
  http://www.performable.com/buttons/
@@ -152,5 +149,3 @@ a.awesome:active {
152
 
153
  .red.awesome,.red.awesome:visited{background-color:#CC1100 !important;}
154
  .red.awesome:hover{background-color:#991100 !important;}
155
-
156
- /* END Super Conversion Button CSS */
1
+ /* Pinterest Pin It Button Admin CSS */
2
 
3
  .form-table {
4
  margin-bottom: 10px !important;
25
  margin: 10px 10px 0 0;
26
  }
27
 
28
+ #other-links ul li {
29
+ font-size: 15px;
30
+ line-height: 1.2em;
31
+ }
32
+
33
  .pib-settings {
34
  width: 70%;
35
  }
38
  width: 30%;
39
  }
40
 
41
+ .hndle {
42
+ color:#464646;
43
+ background-color:#F1F1F1;
44
+ font-size:15px;
45
+ padding:7px 10px;
46
+ display:block;
47
+ margin-top:0px;
48
+ font-weight:normal;
49
+ cursor:default !important;
 
 
 
 
 
50
  }
51
 
52
+ .wrap {
53
+ background-position:fixed;
 
54
  }
55
 
56
+ /* Mailchimp embedded form */
 
57
 
58
  #email-signup {
59
  /* background-color: #464646; */
89
  #mc_embed_signup .clear {clear:none; display:inline;}
90
  #mc_embed_signup input.email {display:block; padding:8px 0; margin:0 4% 10px 0; text-indent:5px; width:58%; min-width:130px;}
91
 
92
+ /*
93
+ SUPER CONVERSION BUTTON
 
94
 
95
  Conversion buttons made simple:
96
  http://www.performable.com/buttons/
149
 
150
  .red.awesome,.red.awesome:visited{background-color:#CC1100 !important;}
151
  .red.awesome:hover{background-color:#991100 !important;}
 
 
css/pinterest-pin-it-button.css CHANGED
@@ -2,32 +2,35 @@
2
 
3
  /* DIV surrounding button */
4
  .pin-it-btn-wrapper,
5
- .pin-it-btn-wrapper-shortcode,
6
- .pin-it-btn-wrapper-widget {
7
-
 
8
  }
9
 
10
- .pin-it-btn-wrapper {
11
- padding-bottom: 10px;
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
- /* Latest "clear fix" method: http://css-tricks.com/snippets/css/clear-fix/ */
15
- .pib-clearfix:before,
16
- .pib-clearfix:after {
17
- content:"";
18
- display:table;
19
- }
20
- .pib-clearfix:after {
21
- clear:both;
22
- }
23
- .pib-clearfix {
24
- zoom:1; /* For IE 6/7 (trigger hasLayout) */
25
  }
26
 
27
- .pib-float-left {
28
- float: left;
29
  }
30
 
31
- .pib-float-right {
32
- float: right;
 
 
33
  }
2
 
3
  /* DIV surrounding button */
4
  .pin-it-btn-wrapper,
5
+ .pin-it-btn-shortcode-wrapper {
6
+ height: 30px;
7
+ margin: 0;
8
+ padding: 0;
9
  }
10
 
11
+ /* From Pinterest official html */
12
+ a.pin-it-btn {
13
+ position: absolute;
14
+ background: url(http://assets.pinterest.com/images/pinit6.png);
15
+ font: 11px Arial, sans-serif;
16
+ text-indent: -9999em;
17
+ font-size: .01em;
18
+ color: #CD1F1F;
19
+ height: 20px;
20
+ width: 43px;
21
+ background-position: 0 -7px;
22
  }
23
 
24
+ a.pin-it-btn:hover {
25
+ background-position: 0 -28px;
 
 
 
 
 
 
 
 
 
26
  }
27
 
28
+ a.pin-it-btn:active {
29
+ background-position: 0 -49px;
30
  }
31
 
32
+ /* Widgets */
33
+ .pib_widget_button,
34
+ .pib_widget_follow_button {
35
+ clear: both;
36
  }
img/{pinterest-button-icon-med.png → pinit-button-icon-med.png} RENAMED
File without changes
img/{pinterest-button-icon-small.png → pinit-button-icon-small.png} RENAMED
File without changes
inc/admin-pin-it-button-iframe.html CHANGED
@@ -1,8 +1,9 @@
1
  <html>
2
  <body style="margin: 0; padding: 0;">
3
 
4
- <a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fpinterest-pin-it-button-wordpress-plugin.jpg&description=Pinterest%20%22Pin%20It%22%20Button%20Plugin%20for%20WordPress%20--%20http%3A%2F%2Fpinterestplugin.com" class="pin-it-button" count-layout="horizontal">Pin It</a>
5
- <script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
 
6
 
7
  </body>
8
  </html>
1
  <html>
2
  <body style="margin: 0; padding: 0;">
3
 
4
+ <a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com&media=http%3A%2F%2Fpinterestplugin.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fpinterest-pin-it-button-wordpress-plugin.jpg&description=Pinterest%20%22Pin%20It%22%20Button%20Plugin%20for%20WordPress"
5
+ class="pin-it-button" count-layout="horizontal">Pin It</a>
6
+ <script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
7
 
8
  </body>
9
  </html>
inc/pin-it-button-user-selects-image-iframe.html DELETED
@@ -1,203 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <style type="text/css">
5
- /*
6
- This is a modified version of http://d3io1k5o0zdpqr.cloudfront.net/pinit.html
7
- To avoid conflict with official Pinterest button behavior, a "2"
8
- has been appended to many DOM IDs and JS function names.
9
- */
10
-
11
- body {
12
- margin: 0;
13
- padding: 0;
14
- }
15
- #PinItButton2 {
16
- position: absolute;
17
- background: url(//d3io1k5o0zdpqr.cloudfront.net/images/pinit6.png);
18
- font: 11px Arial, sans-serif;
19
- text-indent: -9999em;
20
- font-size: .01em;
21
- color: #CD1F1F;
22
- height: 20px;
23
- width: 43px;
24
- background-position: 0 -7px;
25
- }
26
- #PinItButton2:hover {
27
- background-position: 0 -28px;
28
- }
29
- #PinItButton2:active {
30
- background-position: 0 -49px;
31
- }
32
- #PinItButton2.pinned {
33
- background-position: 0 -70px !important;
34
- }
35
- #CountPointer2 {
36
- position: absolute;
37
- z-index: 1;
38
- background: url(//d3io1k5o0zdpqr.cloudfront.net/images/pinit6.png);
39
- text-indent: -9999em;
40
- font-size: .01em;
41
- color: #FFF;
42
- }
43
- #CountBubble2 {
44
- position: absolute;
45
- border: 1px solid #C9C5C5;
46
- color: #777;
47
- background-color: #FCF9F9;
48
- border-radius: 1px;
49
- }
50
- body.horizontal #CountPointer2 {
51
- left: 43px;
52
- height: 18px;
53
- width: 4px;
54
- background-position: -43px -8px;
55
- }
56
- body.horizontal #CountBubble2 {
57
- top: 1px;
58
- left: 46px;
59
- height: 10px;
60
- line-height: 10px;
61
- padding: 2px 5px 4px 5px;
62
- font: 10px Arial, Helvetica, sans-serif;
63
- display: inline-block;
64
- }
65
- body.vertical #PinItButton2 {
66
- top: 38px;
67
- }
68
- body.vertical #CountPointer2 {
69
- top: 31px;
70
- height: 7px;
71
- width: 41px;
72
- background-position: 0 0;
73
- }
74
- body.vertical #CountBubble2 {
75
- left: 1px;
76
- height: 21px;
77
- width: 39px;
78
- font: 12px Arial, Helvetica, sans-serif;
79
- line-height: 12px;
80
- padding: 9px 0 0;
81
- text-align: center;
82
- }
83
- body.none #PinItCount2 {
84
- display: none;
85
- }
86
- </style>
87
-
88
- <script type="text/javascript">
89
- var countLayout = 'horizontal';
90
- var alwaysShowCount = false;
91
-
92
- function pinIt2(pinItButton, pinUrl) {
93
- return function(e) {
94
-
95
- parent.execPinmarklet();
96
-
97
- //Bookmarklet will open official create button popup after image selected,
98
- //so this code not needed.
99
-
100
- /*
101
- var t;
102
- if (e.target) t = e.target;
103
- else t = e.srcElement;
104
- if (t.id != pinItButton.id)
105
- return false;
106
-
107
- var modal = window.open(pinUrl, 'signin', 'width=665,height=300');
108
- var wait = function() {
109
- setTimeout(function() {
110
- if (modal == null) {
111
- failure();
112
- return;
113
- }
114
- if (modal.closed)
115
- pinItButton.setAttribute('class', 'pinned');
116
- else
117
- wait();
118
- }, 25);
119
- };
120
-
121
- wait();
122
- */
123
-
124
- return false;
125
- };
126
- }
127
-
128
- function receiveCount(data) {
129
- if (data['error'])
130
- return;
131
-
132
- var targetUrl = data['url'];
133
- var pinItCount = document.getElementById('PinItCount2');
134
- var countBubble = document.getElementById('CountBubble2');
135
-
136
- if (!alwaysShowCount && data['count'] < 1 && countLayout === 'horizontal')
137
- return;
138
-
139
- pinItCount.style.display = 'block';
140
- var count = data['count'];
141
- if (count > 999 && count <= 999999)
142
- count = Math.floor(count / 1000) + "K+";
143
- else if (count > 999999 && count <= 999999999)
144
- count = Math.floor(count / 1000000) + "M+";
145
- else if (count > 999999999)
146
- count = "++";
147
- countBubble.innerHTML = count;
148
- }
149
-
150
- window.onload = function() {
151
- var pinItButton = document.getElementById('PinItButton2');
152
- var pinItCount = document.getElementById('PinItCount2');
153
-
154
- // Parse args
155
- var vars = {}, url = window.location.href;
156
- var pairs = url.slice(url.indexOf('?') + 1).split('&');
157
- for (var i = 0; i < pairs.length; i++) {
158
- var parts = pairs[i].split('=');
159
- vars[parts[0]] = parts[1];
160
- }
161
-
162
- countLayout = vars['layout'] || countLayout;
163
- alwaysShowCount = vars['count'] || alwaysShowCount;
164
-
165
- // Apply count layout class
166
- document.body.className = countLayout;
167
-
168
- // Build pin URL
169
- delete vars['layout'];
170
- delete vars['count'];
171
- var sep = '?', pinUrl = 'http://pinterest.com/pin/create/button/';
172
- for (var i in vars) {
173
- pinUrl += sep + i + '=' + vars[i];
174
- sep = '&';
175
- }
176
-
177
- // Button click handler
178
- if (document.addEventListener)
179
- pinItButton.addEventListener('click', pinIt2(pinItButton, pinUrl), false);
180
- else if (document.attachEvent)
181
- pinItButton.attachEvent('onclick', pinIt2(pinItButton, pinUrl));
182
-
183
- // Request count from API
184
- if (countLayout != 'none' || alwaysShowCount) {
185
- var targetUrl = vars['url'] || vars['media'];
186
- var snode = document.createElement('script');
187
- var hnode = document.getElementsByTagName('head')[0];
188
- snode.setAttribute('async', 'true');
189
- snode.setAttribute('src', '//api.pinterest.com/v1/urls/count.json?callback=receiveCount&url='+targetUrl);
190
- hnode.appendChild(snode);
191
- }
192
- };
193
- </script>
194
- </head>
195
-
196
- <body>
197
- <a href="javascript:void(0)" id="PinItButton2" title="Pin it on Pinterest">Pin it</a>
198
- <div id="PinItCount2" style="display:none;">
199
- <div id="CountPointer2">&laquo;</div>
200
- <div id="CountBubble2">0</div>
201
- </div>
202
- </body>
203
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/pin-it-button-user-selects-image-assets.js DELETED
@@ -1,57 +0,0 @@
1
- //Modified version of http://assets.pinterest.com/js/pinit.js
2
- //Pinterest last updated 3/16/2012
3
- //Added "always-show-count" attribute, updated style widths/heights
4
- //Points to same iFrame html
5
-
6
- (function(){
7
- for(var e=[],c=document.getElementsByTagName("a"),b=0;b<c.length;b++)
8
- e.push(c[b]);
9
- for(;e.length>0;){
10
- c=e.pop();
11
-
12
- //if(!(!c.className||c.className.indexOf("pin-it-button")<0)){
13
-
14
- //Changed class detection to avoid conflict with original pinit.js
15
- if(!(!c.className||c.className.indexOf("pin-it-button2")<0)){
16
-
17
- var d=c.getAttribute("href");
18
- b={};
19
- d=d.slice(d.indexOf("?")+1).split("&");
20
- for(var a=0;a<d.length;a++){
21
- var g=d[a].split("=");
22
- b[g[0]]=g[1]
23
- }
24
- b.layout=c.getAttribute("count-layout");
25
- b.count=c.getAttribute("always-show-count");
26
- a="?";
27
-
28
- //d=window.location.protocol+"//d3io1k5o0zdpqr.cloudfront.net/pinit.html";
29
-
30
- //Point to local JS
31
- d = iFrameBtnUrl;
32
-
33
- for(var f in b)
34
- if(b[f]){
35
- d+=a+f+"="+b[f];
36
- a="&"
37
- }
38
- a=document.createElement("iframe");
39
- a.setAttribute("src",d);
40
- a.setAttribute("scrolling","no");
41
- a.allowTransparency=true;
42
- a.frameBorder=0;
43
- a.style.border="none";
44
- if(b.layout=="none"){
45
- a.style.width="43px";
46
- a.style.height="20px"
47
- }else if(b.layout=="vertical"){
48
- a.style.width="43px";
49
- a.style.height="58px"
50
- }else{
51
- a.style.width="90px";
52
- a.style.height="20px"
53
- }
54
- c.parentNode.replaceChild(a,c)
55
- }
56
- }
57
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/pin-it-button-user-selects-image.js DELETED
@@ -1,9 +0,0 @@
1
- //Added function for firing off pinmarklet.js for "user selects image" button type
2
-
3
- function execPinmarklet() {
4
- var e=document.createElement('script');
5
- e.setAttribute('type','text/javascript');
6
- e.setAttribute('charset','UTF-8');
7
- e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
8
- document.body.appendChild(e);
9
- }
 
 
 
 
 
 
 
 
 
js/pinterest-pin-it-button-admin.js CHANGED
@@ -2,26 +2,24 @@
2
  //jQuery doc ready
3
  //See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
4
  jQuery(document).ready(function($) {
5
-
 
 
 
 
 
6
  //Enable collapse/expand toggle of admin boxes (like WP dashboard)
7
- //Don't use 'dashboard' and 'postbox' scripts built-into WP like WordPress SEO
8
- //plugin as they conflict on other pages
9
 
10
- $(".pib-hndle").toggle(function() {
11
- $(this).next(".inside").slideToggle("fast");
12
- }, function () {
13
- $(this).next(".inside").slideToggle("fast");
14
- });
15
-
16
- $(".pib-handlediv").toggle(function() {
17
- $(this).next(".pib-hndle").next(".inside").slideToggle("fast");
18
- }, function() {
19
- $(this).next(".pib-hndle").next(".inside").slideToggle("fast");
20
- });
21
-
22
- //Submit mailchimp form with link button
23
- $("#mc-embedded-subscribe-link").click(function(event) {
24
- event.preventDefault();
25
- $("#mc-embedded-subscribe-form").submit();
26
- });
27
  });
2
  //jQuery doc ready
3
  //See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
4
  jQuery(document).ready(function($) {
5
+ //Submit mailchimp form with link button
6
+ $("#mc-embedded-subscribe-link").click(function(event) {
7
+ event.preventDefault();
8
+ $("#mc-embedded-subscribe-form").submit();
9
+ });
10
+
11
  //Enable collapse/expand toggle of admin boxes (like WP dashboard)
12
+ $(".inside").show();
 
13
 
14
+ $(".hndle").toggle(function() {
15
+ $(this).next(".inside").slideToggle("fast");
16
+ }, function () {
17
+ $(this).next(".inside").slideToggle("fast");
18
+ });
19
+
20
+ $(".handlediv").toggle(function() {
21
+ $(this).next(".hndle").next(".inside").slideToggle("fast");
22
+ }, function() {
23
+ $(this).next(".hndle").next(".inside").slideToggle("fast");
24
+ });
 
 
 
 
 
 
25
  });
pinterest-pin-it-button.php CHANGED
@@ -1,24 +1,38 @@
1
  <?php
2
  /*
3
  Plugin Name: Pinterest "Pin It" Button
4
- Plugin URI: http://pinterestplugin.com
5
- Description: Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Also includes a shortcode.
 
6
  Author: Phil Derksen
7
- Author URI: http://pinterestplugin.com
8
- Version: 1.3.0
9
- License: GPLv2
10
- Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
11
  */
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  //Set global variables
15
 
16
  if ( ! defined( 'PIB_PLUGIN_BASENAME' ) )
17
  define( 'PIB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
18
-
19
-
 
20
  //Plugin install/activation
21
-
22
  function pib_install() {
23
 
24
  //Deactivate plugin if WP version too low
@@ -28,6 +42,7 @@ function pib_install() {
28
 
29
  //Setup default settings
30
  $pib_options = array(
 
31
  'display_home_page' => 1,
32
  'display_front_page' => 0,
33
  'display_posts' => 1,
@@ -36,106 +51,59 @@ function pib_install() {
36
  'display_above_content' => 0,
37
  'display_below_content' => 1,
38
  'display_on_post_excerpts' => 0,
39
- 'button_style' => 'user_selects_image',
40
- 'count_layout' => 'none',
41
- 'always_show_count' => 0,
42
- 'custom_css' => '',
43
- 'remove_div' => 0
44
  );
45
 
46
  //Save default option values
47
- add_option( 'pib_options', $pib_options );
48
- add_option( 'pib_ignore', 'false');
49
  }
50
 
51
  register_activation_hook( __FILE__, 'pib_install' );
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  //Add settings page to admin menu
55
- //Use $page variable to load ONLY for this admin page
56
 
57
  function pib_create_menu() {
58
- $page = add_menu_page( 'Pin It Button Settings', 'Pin It Button', 'manage_options', __FILE__, 'pib_create_settings_page',
59
- plugins_url( '/img/pinterest-button-icon-small.png', __FILE__ ) );
60
-
61
- add_action('admin_print_styles-' . $page, 'pib_add_admin_css_js');
62
  }
63
 
64
  add_action( 'admin_menu', 'pib_create_menu' );
65
 
66
-
67
  //Add Admin CSS/JS
68
 
69
  function pib_add_admin_css_js() {
70
  wp_enqueue_script( 'jquery' );
71
 
72
  wp_enqueue_style( 'pinterest-pin-it-button', plugins_url( '/css/pinterest-pin-it-button-admin.css' , __FILE__ ) );
73
- wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button-admin.js', __FILE__ ), array( 'jquery' ) );
74
  }
75
 
76
- //Add script and css for Pointer funtionallity
77
-
78
- function pib_add_admin_css_js_pointer() {
79
- wp_enqueue_style( 'wp-pointer' );
80
- wp_enqueue_script( 'wp-pointer' );
81
-
82
- add_action( 'admin_print_footer_scripts', 'pib_admin_print_footer_scripts' );
83
- }
84
-
85
- add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js_pointer' );
86
-
87
-
88
- //Add popup message when plugin installed
89
-
90
- function pib_admin_print_footer_scripts() {
91
- $pib_pointer_content = '<h3>Ready to be Pinned?</h3>';
92
-
93
- $pib_pointer_content .= '<p>' . esc_attr('Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. Now just configure ' .
94
- 'your settings and start getting Pinned!') . '</p>';
95
-
96
- $url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
97
-
98
- global $pagenow;
99
- $pib_ignore = get_option('pib_ignore');
100
-
101
- if ( 'plugins.php' == $pagenow && $pib_ignore == 'false' ) {
102
- ?>
103
-
104
- <script type="text/javascript">
105
- //<![CDATA[
106
- jQuery(document).ready( function($) {
107
-
108
- $('#menu-plugins').pointer({
109
- content: '<?php echo $pib_pointer_content; ?>',
110
- buttons: function( event, t ) {
111
- button = jQuery('<a id="pointer-close" class="button-secondary">' + '<?php echo "Close"; ?>' + '</a>');
112
- button.bind( 'click.pointer', function() {
113
- t.element.pointer('close');
114
- });
115
- return button;
116
- },
117
- position: 'left',
118
- close: function() { }
119
-
120
- }).pointer('open');
121
-
122
- jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary" style="margin-right: 5px;" href="<?php echo esc_attr($url); ?>">' +
123
- '<?php echo "Pin It Button Settings"; ?>' + '</a>');
124
-
125
- jQuery('#pointer-primary').click( function() {
126
- <?php update_option('pblock_ignore' , 'true'); ?>
127
- });
128
-
129
- jQuery('#pointer-close').click( function() {
130
- <?php update_option('pib_ignore' , 'true'); ?>
131
- });
132
- });
133
- //]]>
134
- </script>
135
-
136
- <?php
137
- }
138
- }
139
 
140
 
141
  //Register settings
@@ -146,7 +114,6 @@ function pib_register_settings() {
146
 
147
  add_action( 'admin_init', 'pib_register_settings' );
148
 
149
-
150
  //Create settings page
151
 
152
  function pib_create_settings_page() {
@@ -157,8 +124,8 @@ function pib_create_settings_page() {
157
  ?>
158
  <div class="wrap">
159
 
160
- <a href="http://pinterestplugin.com/" target="_blank"><div id="pinterest-button-icon-32" class="icon32"
161
- style="background: url(<?php echo plugins_url( '/img/pinterest-button-icon-med.png', __FILE__ ); ?>) no-repeat;"><br /></div></a>
162
  <h2>Pinterest "Pin It" Button Settings</h2>
163
 
164
  <div class="metabox-holder">
@@ -167,78 +134,12 @@ function pib_create_settings_page() {
167
  <?php settings_errors(); //Display status messages after action ("settings saved", errors) ?>
168
 
169
  <form method="post" action="options.php">
170
- <?php settings_fields( 'pib-settings-group' ); ?>
171
-
172
- <div id="button-type" class="postbox pib-postbox">
173
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
174
- <h3 class="hndle pib-hndle">What style of button would you like to use?</h3>
175
- <?php
176
-
177
- if ( !isset($pib_options['button_style']) ) {
178
- $pib_options = get_option( 'pib_options' );
179
- $pib_options['button_style'] = 'user_selects_image';
180
- update_option( 'pib_options', $pib_options );
181
- }
182
-
183
- ?>
184
- <table class="form-table inside">
185
- <tr valign="top">
186
- <td>
187
- <input type="radio" id="user_selects_image" value="user_selects_image" name="pib_options[button_style]"
188
- <?php if ($pib_options['button_style'] == 'user_selects_image' || empty($pib_options['button_style']))
189
- echo 'checked="checked"'; ?> />
190
- <label for="display_pinit_button"><strong>User selects image</strong> from popup</label>
191
- </td>
192
- </tr>
193
- <tr valign="top">
194
- <td>
195
- <input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
196
- <?php if ( $pib_options['button_style'] == 'image_selected' ) echo 'checked="checked"'; ?> />
197
- <label for="display_pinit_count_button">Image is <strong>pre-selected</strong></label>
198
- </td>
199
- </tr>
200
- <?php if ( !isset($pib_options['count_layout']) ) {
201
- $pib_options = get_option( 'pib_options' );
202
- $pib_options['count_layout'] = 'none';
203
- update_option( 'pib_options', $pib_options );
204
- } ?>
205
-
206
- <tr valign="top">
207
- <td class="pib-pad-cell-top">
208
- <label for="pib_pin_count" class="pib-plain-label"><?php _e('Pin Count:'); ?></label>
209
- <select id="count_layout" name="pib_options[count_layout]">
210
- <option value="none" <?php if($pib_options['count_layout'] == 'none' || empty($pib_options['count_layout']) ) { echo'selected';} ?>><?php _e('No Count'); ?></option>
211
- <option value="horizontal" <?php if($pib_options['count_layout'] == 'horizontal') { echo'selected';} ?>><?php _e('Horizontal'); ?></option>
212
- <option value="vertical" <?php if($pib_options['count_layout'] == 'vertical') { echo'selected';} ?>><?php _e('Vertical'); ?></option>
213
- </select>
214
- </td>
215
- </tr>
216
-
217
- <tr valign="top">
218
- <td>
219
- <input id="always_show_count" name="pib_options[always_show_count]" type="checkbox" <?php if ( $pib_options['always_show_count'] ) echo 'checked="checked"'; ?> />
220
- <label for="always_show_count">Always show pin count (even when zero)</label>
221
- </td>
222
- </tr>
223
- <tr valign="top">
224
- <td class="pib-pad-cell-top">
225
- To specify the URL to pin, image to pin and/or pin description (other than the defaults), go to the edit screen for those posts and pages
226
- and scroll to the bottom.
227
- </td>
228
- </tr>
229
- <tr valign="top">
230
- <td>
231
- The button style setting applies to <strong>all</strong> "Pin It" buttons displayed on the website (widgets and shortcodes included).
232
- </td>
233
- </tr>
234
- </table>
235
-
236
- </div>
237
 
238
  <div id="pib-options" class="postbox pib-postbox">
239
  <!--Collapsable-->
240
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
241
- <h3 class="hndle pib-hndle">What types of pages should the button appear on?</h3>
242
 
243
  <table class="form-table inside">
244
  <tr valign="top">
@@ -273,26 +174,25 @@ function pib_create_settings_page() {
273
  <td>
274
  <input id="display_archives" name="pib_options[display_archives]" type="checkbox"
275
  <?php if ( $pib_options['display_archives'] ) echo 'checked="checked"'; ?> />
276
- <label for="display_archives">Archives (includes Category, Tag, Author and date-based pages)</label>
277
  </td>
278
  </tr>
279
  <tr valign="top">
280
- <td class="pib-pad-cell-top">
281
- To hide the "Pin It" button for a specific post, page or category, go to the edit screen for that post, page or category,
282
- scroll down to the bottom, and uncheck the "Show" checkbox.
283
  </td>
284
  </tr>
285
  <tr valign="top">
286
  <td>
287
- Head over to <a href="<?php echo admin_url( 'widgets.php' ); ?>">Widgets</a> to add a "Pin It" button to your sidebar.
288
  </td>
289
  </tr>
290
  </table>
291
  </div>
292
 
293
  <div id="button-show" class="postbox pib-postbox">
294
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
295
- <h3 class="hndle pib-hndle">Where on each page should the button appear?</h3>
296
 
297
  <table class="form-table inside">
298
  <tr valign="top">
@@ -313,16 +213,19 @@ function pib_create_settings_page() {
313
  <label for="display_on_post_excerpts">On Post Excerpts</label>
314
  </td>
315
  </tr>
 
 
 
 
 
 
 
316
  </table>
317
  </div>
318
-
319
- <div class="submit">
320
- <input name="Submit" type="submit" value="Save All Settings" class="button-primary" />
321
- </div>
322
 
323
  <div id="style-options" class="postbox pib-postbox">
324
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
325
- <h3 class="hndle pib-hndle">Other CSS and Styling Options</h3>
326
 
327
  <table class="form-table inside">
328
  <tr valign="top">
@@ -332,22 +235,15 @@ function pib_create_settings_page() {
332
  </tr>
333
  <tr valign="top">
334
  <td>
335
- <textarea id="pib-custom-css" name="pib_options[custom_css]" rows="6"><?php echo $custom_css; ?></textarea>
336
  </td>
337
  </tr>
338
-
339
- <?php if ( !isset($pib_options['remove_div']) ) {
340
- $pib_options = get_option( 'pib_options' );
341
- $pib_options['remove_div'] = 0;
342
- update_option( 'pib_options', $pib_options );
343
- } ?>
344
  <tr valign="top">
345
  <td>
346
- <input id="remove_div" name="pib_options[remove_div]" type="checkbox" <?php if ( $pib_options['remove_div']) echo 'checked="checked"'; ?> />
347
- <label for="remove_div">Remove div tag surrounding regular button: <code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code></label>
348
  </td>
349
  </tr>
350
-
351
  <tr valign="top">
352
  <td>
353
  <a href="http://pinterestplugin.com/pin-it-button-custom-css/" target="_blank">See custom CSS examples</a> aligning the button
@@ -357,52 +253,23 @@ function pib_create_settings_page() {
357
  </table>
358
  </div>
359
 
360
- <div class="postbox pib-postbox">
361
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
362
- <h3 class="hndle pib-hndle">Shortcode Instructions</h3>
363
-
364
- <div class="inside">
365
- <p>
366
- Use the shortcode <code>[pinit]</code> to display the button within your content.
367
- </p>
368
- <p>
369
- Use the function <code><?php echo htmlentities('<?php echo do_shortcode(\'[pinit]\'); ?>'); ?></code>
370
- to display within template or theme files.
371
- </p>
372
- <p><strong>Shortcode parameters</strong></p>
373
- <p>
374
- - count: none (default), horizontal, vertical<br/>
375
- - url: URL of the web page to be pinned (defaults to current post/page URL)<br/>
376
- - image_url: URL of the image to be pinned (defaults to first image in post)<br/>
377
- - description: description of the pin (defaults to post title)<br/>
378
- - float: none (default), left, right<br/>
379
- - remove_div: false (default), true -- if true removes surrounding div tag, which also removes float setting<br/>
380
- - always_show_count: false (default), true -- if true will show count even if zero
381
- </p>
382
- <p><strong>Examples</strong></p>
383
- <p>
384
- <code>[pinit count="horizontal"]</code><br/>
385
- <code>[pinit count="vertical" url="http://www.mysite.com" image_url="http://www.mysite.com/myimage.jpg"
386
- description="My favorite image!" float="right"]</code><br/>
387
- </p>
388
- </div>
389
- </div>
390
-
391
- <div class="submit">
392
- <input name="Submit" type="submit" value="Save All Settings" class="button-primary" />
393
- </div>
394
-
395
  </form>
396
  </div>
397
  </div>
398
-
399
- <div class="pib-right-column postbox-container">
400
  <div class="meta-box-sortables ui-sortable">
401
  <div id="email-signup">
402
  <h4>Like This Plugin?</h4>
403
 
404
  <p class="large-text">
405
- Join the mailing list to be notified when new features and plugins are released.
406
  </p>
407
 
408
  <!-- Begin MailChimp Signup Form -->
@@ -425,11 +292,11 @@ function pib_create_settings_page() {
425
  </div>
426
 
427
  <div id="promo-buttons" class="postbox pib-postbox">
428
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
429
- <h3 class="hndle pib-hndle">Spread the Word!</h3>
430
 
431
  <div class="inside">
432
- <p>Could you do me a <strong>huge</strong> favor and share this plugin with others. Thank you so much!</p>
433
 
434
  <table>
435
  <tr>
@@ -444,46 +311,30 @@ function pib_create_settings_page() {
444
  <tr>
445
  <td><?php echo pib_share_pinterest(); ?></td>
446
  </tr>
447
- <tr>
448
- <td>(or <a href="http://wordpress.org/extend/plugins/pinterest-pin-it-button/" target="_blank">rate it on WordPress</a>)</td>
449
- </tr>
450
  </table>
451
  </div>
452
  </div>
453
 
454
- <div class="postbox pib-postbox">
455
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
456
- <h3 class="hndle pib-hndle">Other Links</h3>
457
-
458
- <div class="inside">
459
- <ul>
460
- <li><a href="http://pinterestplugin.com/" target="_blank">Pinterest Plugin Updates</a> (Official Site)</li>
461
- <li><a href="http://wordpress.org/extend/plugins/pinterest-pin-it-button/faq/" target="_blank">Frequently Asked Questions</a></li>
462
- <li><a href="http://pinterestplugin.com/user-support" target="_blank">User Support &amp; Feature Requests</a></li>
463
- </ul>
464
- </div>
465
- </div>
466
- <div class="postbox pib-postbox">
467
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
468
- <h3 class="hndle pib-hndle">More Pinterest Plugins</h3>
469
 
470
  <div class="inside">
471
  <ul>
472
- <li><a href="http://wordpress.org/extend/plugins/pinterest-follow-button/" target="_blank">Pinterest "Follow" Button</a></li>
473
- <li><a href="http://wordpress.org/extend/plugins/pinterest-block/" target="_blank">Pinterest Block</a></li>
474
  </ul>
475
  </div>
476
  </div>
477
- <!--
478
  <div id="news-links" class="postbox pib-postbox">
479
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
480
- <h3 class="hndle pib-hndle">News from PinterestPlugin.com</h3>
481
 
482
  <div class="inside">
483
- <? //echo pib_rss_news(); ?>
484
  </div>
485
  </div>
486
- -->
487
  </div>
488
  </div>
489
 
@@ -492,10 +343,8 @@ function pib_create_settings_page() {
492
  <?php
493
  }
494
 
495
-
496
  //Render rss items from pinterestplugin.com
497
  //http://codex.wordpress.org/Function_Reference/fetch_feed
498
-
499
  function pib_rss_news() {
500
  // Get RSS Feed(s)
501
  include_once(ABSPATH . WPINC . '/feed.php');
@@ -529,7 +378,6 @@ function pib_rss_news() {
529
  <?php
530
  }
531
 
532
-
533
  //Render Facebook Share button
534
  //http://developers.facebook.com/docs/share/
535
  function pib_share_facebook() {
@@ -541,7 +389,6 @@ function pib_share_facebook() {
541
  <?php
542
  }
543
 
544
-
545
  //Render Twitter button
546
  //https://twitter.com/about/resources/buttons
547
  function pib_share_twitter() {
@@ -553,14 +400,13 @@ function pib_share_twitter() {
553
  <?php
554
  }
555
 
556
-
557
  //Render Google +1 button
558
  //http://www.google.com/intl/en/webmasters/+1/button/index.html
559
  function pib_share_google_plus() {
560
  ?>
561
 
562
  <!-- Place this tag where you want the +1 button to render -->
563
- <div class="g-plusone" data-size="medium" data-href="http://pinterestplugin.com/"></div>
564
 
565
  <!-- Place this render call where appropriate -->
566
  <script type="text/javascript">
@@ -574,16 +420,11 @@ function pib_share_google_plus() {
574
  <?php
575
  }
576
 
577
-
578
  //Render Pin It button
579
- //Render in iFrame otherwise it messes up the WP admin left menu
580
-
581
  function pib_share_pinterest() {
582
  ?>
583
-
584
- <iframe src="<?php echo plugins_url( '/inc/admin-pin-it-button-iframe.html' , __FILE__ ) ?>" scrolling="no" frameborder="0" allowtransparency="true"
585
- style="border:none; overflow:hidden; width:90px; height:20px"></iframe>
586
-
587
  <?php
588
  }
589
 
@@ -607,8 +448,7 @@ function pib_like_facebook() {
607
  <?php
608
  }
609
 
610
-
611
- //Add a link to the settings page on the plugins list entry
612
 
613
  function pib_plugin_action_links( $links, $file ) {
614
  if ( $file != PIB_PLUGIN_BASENAME )
@@ -624,70 +464,31 @@ function pib_plugin_action_links( $links, $file ) {
624
 
625
  add_filter( 'plugin_action_links', 'pib_plugin_action_links', 10, 2 );
626
 
627
-
628
  //Adds a meta box to the main column on the Post and Page edit screens
629
 
630
  function pib_sharing_add_meta_box() {
631
- add_meta_box( 'pib_sharing_meta','"Pin It" Button Settings', 'pib_sharing_meta_box_content', 'page', 'advanced', 'high' );
632
- add_meta_box( 'pib_sharing_meta','"Pin It" Button Settings', 'pib_sharing_meta_box_content', 'post', 'advanced', 'high' );
633
  }
634
 
635
  add_action( 'admin_init', 'pib_sharing_add_meta_box' );
636
 
637
-
638
  //Renders the post/page meta box checkbox html
639
 
640
  function pib_sharing_meta_box_content( $post ) {
641
- $pib_options = get_option( 'pib_options' );
642
  $pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled', 1 );
643
 
644
  if ( empty( $pib_sharing_checked ) || $pib_sharing_checked === false )
645
  $pib_sharing_checked = ' checked="checked"';
646
  else
647
- $pib_sharing_checked = '';
648
-
649
- $pib_url_of_webpage = get_post_meta( $post->ID, 'pib_url_of_webpage', true);
650
- $pib_url_of_img = get_post_meta( $post->ID, 'pib_url_of_img', true);
651
- $pib_description = get_post_meta( $post->ID, 'pib_description', true);
652
-
653
- $pib_button_style = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
654
  ?>
655
-
656
- <p>
657
- <em>Button style is inherited from setting saved in <a href='<?php echo 'admin.php?page=' . PIB_PLUGIN_BASENAME ?>'>"Pin It" Button Settings</a>.
658
- Current style: <strong><?php echo $pib_button_style; ?></strong></em>
659
- </p>
660
- <p>
661
- <em>These 3 text fields will be used only if the button style is: <strong>Image pre-selected</strong></em>
662
- </p>
663
- <p>
664
- <table class="form-table inside">
665
- <tr valign="top">
666
- <td>
667
- <label for="pib_url_of_webpage">URL of the web page to be pinned (defaults to current post/page URL):</label><br/>
668
- <input type="text" id="pib_url_of_webpage" name="pib_url_of_webpage" value="<?php echo $pib_url_of_webpage; ?>" class="pib-full-width-textbox"/>
669
- </td>
670
- </tr>
671
- <tr valign="top">
672
- <td>
673
- <label for="pib_url_of_img">URL of the image to be pinned (defaults to first image in post):</label><br/>
674
- <input type="text" id="pib_url_of_img" name="pib_url_of_img" value="<?php echo $pib_url_of_img; ?>" class="pib-full-width-textbox"/>
675
- </td>
676
- </tr>
677
- <tr valign="top">
678
- <td>
679
- <label for="pib_description">Description of the pin (defaults to post title):</label><br/>
680
- <input type="text" id="pib_description" name="pib_description" value="<?php echo $pib_description; ?>" class="pib-full-width-textbox"/>
681
- </td>
682
- </tr>
683
- </table>
684
- <input type="hidden" name="pib_count_status_hidden" value="1" />
685
- </p>
686
 
687
  <p>
688
  <input name="pib_enable_post_sharing" id="pib_enable_post_sharing" value="1" <?php echo $pib_sharing_checked; ?> type="checkbox" />
689
  <label for="pib_enable_post_sharing">Show "Pin It" button on this post/page.</label>
690
  <p class="description">
 
691
  If checked displays the button for this post/page (if <strong>Individual Posts</strong> (for posts) or <strong>WordPress Static "Pages"</strong>
692
  (for pages) is also checked in <a href='<?php echo 'admin.php?page=' . PIB_PLUGIN_BASENAME ?>'>"Pin It" Button Settings</a>).
693
  If unchecked the button will <strong>always</strong> be hidden for this post/page.
@@ -695,10 +496,9 @@ function pib_sharing_meta_box_content( $post ) {
695
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
696
  </p>
697
 
698
- <?php
699
  }
700
 
701
-
702
  //Saves display option for individual post/page
703
 
704
  function pib_sharing_meta_box_save( $post_id ) {
@@ -709,23 +509,10 @@ function pib_sharing_meta_box_save( $post_id ) {
709
  if ( isset( $_POST['post_type'] ) && ( 'post' == $_POST['post_type'] || 'page' == $_POST['post_type'] ) ) {
710
  if ( current_user_can( 'edit_post', $post_id ) ) {
711
  if ( isset( $_POST['pib_sharing_status_hidden'] ) ) {
712
- if ( !isset( $_POST['pib_enable_post_sharing'] ) ) {
713
  update_post_meta( $post_id, 'pib_sharing_disabled', 1 );
714
- }
715
- else {
716
  delete_post_meta( $post_id, 'pib_sharing_disabled' );
717
- }
718
-
719
- if ( isset( $_POST['pib_url_of_webpage'] ) && isset( $_POST['pib_url_of_img'] ) && isset( $_POST['pib_description'] )) {
720
- update_post_meta( $post_id, 'pib_url_of_webpage', $_POST['pib_url_of_webpage'] );
721
- update_post_meta( $post_id, 'pib_url_of_img', $_POST['pib_url_of_img'] );
722
- update_post_meta( $post_id, 'pib_description', $_POST['pib_description'] );
723
- }
724
- else {
725
- delete_post_meta( $post_id, 'pib_url_of_webpage' );
726
- delete_post_meta( $post_id, 'pib_url_of_img' );
727
- delete_post_meta( $post_id, 'pib_description' );
728
- }
729
  }
730
  }
731
  }
@@ -735,40 +522,17 @@ function pib_sharing_meta_box_save( $post_id ) {
735
 
736
  add_action( 'save_post', 'pib_sharing_meta_box_save' );
737
 
738
-
739
- //Add Public CSS/JS (to Header)
740
 
741
  function pib_add_public_css_js() {
742
- wp_enqueue_style( 'pinterest_pin_it_button', plugins_url( '/css/pinterest-pin-it-button.css' , __FILE__ ) );
 
 
 
743
  }
744
 
745
  add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
746
 
747
-
748
- //Add Public JS (to Footer)
749
-
750
- function pib_add_public_js_footer() {
751
- $pib_options = get_option( 'pib_options' );
752
-
753
- // If option #1 selected (user selects image)
754
- if ( $pib_options['button_style'] == 'user_selects_image' ) {
755
- //Save iFrame URL to JS variable
756
- echo '<script type="text/javascript">' .
757
- 'var iFrameBtnUrl = "' . plugins_url( '/inc/pin-it-button-user-selects-image-iframe.html', __FILE__ ) . '"; ' .
758
- '</script>' . "\n";
759
-
760
- echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image.js', __FILE__ ) . '"></script>' . "\n";
761
- echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image-assets.js', __FILE__ ) . '"></script>' . "\n";
762
- }
763
- // If option #2 selected (image pre-selected)
764
- elseif ( $pib_options['button_style'] == 'image_selected' ) {
765
- echo '<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>' . "\n";
766
- }
767
- }
768
-
769
- add_action( 'wp_footer', 'pib_add_public_js_footer' );
770
-
771
-
772
  //Add Custom CSS
773
 
774
  function pib_add_custom_css() {
@@ -782,115 +546,38 @@ function pib_add_custom_css() {
782
 
783
  add_action( 'wp_head', 'pib_add_custom_css' );
784
 
785
-
786
- //Function for rendering "Pin It" button base html
787
-
788
- function pib_button_base( $postUrl, $imageUrl, $description, $countLayout, $alwaysShowCount ) {
789
- //Change css class for "user selects image" button style to avoid conflicts
790
- $pib_options = get_option( 'pib_options' );
791
- $buttonClass = 'pin-it-button';
792
-
793
- if ( $pib_options['button_style'] == 'user_selects_image' ) {
794
- $buttonClass = 'pin-it-button2';
795
- }
796
-
797
- //HTML from Pinterest Goodies 3/19/2012
798
- //<a href="http://pinterest.com/pin/create/button/?url=PAGE&media=IMG&description=DESC" class="pin-it-button" count-layout="horizontal">
799
- //<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
800
-
801
- $btn = '<a href="http://pinterest.com/pin/create/button/?url=' . urlencode($postUrl) .
802
- '&media=' . urlencode($imageUrl) . '&description='. urlencode($description) . '" ' .
803
- 'count-layout="' . $countLayout . '" class="' . $buttonClass . '" ' .
804
- ( $alwaysShowCount ? 'always-show-count="true"' : '' ) .
805
- '><img border="0" style="border:0;" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>';
806
-
807
- return $btn;
808
- }
809
-
810
-
811
  //Button html to render
812
 
813
- function pib_button_html($postID) {
814
- $pib_url_of_webpage = get_post_meta( $postID, 'pib_url_of_webpage', true);
815
- $pib_url_of_img = get_post_meta( $postID, 'pib_url_of_img', true );
816
- $pib_description = get_post_meta( $postID, 'pib_description', true );
817
-
818
- $pib_options = get_option( 'pib_options' );
819
- $countLayout = $pib_options['count_layout'];
820
- $permalink = get_permalink($postID);
821
- $title = get_the_title($postID);
822
- global $post;
823
- $first_img = '';
824
 
825
- //Get url of img and compare width and height
826
- $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
827
- $first_img = $matches [1] [0];
828
-
829
- if (get_post_meta($postID,'pib_sharing_disabled', 1)) {
830
- return "";
831
  }
832
  else {
833
- //if url_of_webpage, url_of_img or description are not set through pinit admin setting page then set default to post/page URL for the attribute url
834
- $pib_url_of_webpage = ( empty( $pib_url_of_webpage ) ? $permalink : $pib_url_of_webpage );
835
- $pib_url_of_img = ( empty( $pib_url_of_img ) ? $first_img : $pib_url_of_img );
836
- $pib_description = ( empty( $pib_description ) ? $title : $pib_description );
837
- $pib_always_show_count = (bool)$pib_options['always_show_count'];
838
-
839
- $baseBtn = pib_button_base($pib_url_of_webpage, $pib_url_of_img, $pib_description, $countLayout, $pib_always_show_count);
840
-
841
- if ( $pib_options['remove_div'] ) {
842
- return $baseBtn;
843
- }
844
- else {
845
- //Surround with div tag
846
- return '<div class="pin-it-btn-wrapper">' . $baseBtn . '</div>';
847
- }
848
- }
849
- }
850
-
851
- //Register shortcode: [pinit url="" image_url="" description="" float="none" remove_div="false" always_show_count="false"]
852
 
853
- function pib_button_shortcode_html($attr) {
854
- $pib_options = get_option( 'pib_options' );
855
- global $post;
856
- $permalink = get_permalink($post->ID);
857
- $title = get_the_title($post->ID);
858
- $first_img = '';
859
-
860
- //Get url of img and compare width and height
861
- $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
862
- $first_img = $matches [1] [0];
863
-
864
- $attr['url'] = ( empty( $attr['url'] ) ? $permalink : $attr['url'] );
865
- $attr['image_url'] = ( empty( $attr['image_url']) ? $first_img : $attr['image_url'] );
866
- $attr['description'] = ( empty( $attr['description'] ) ? $title : $attr['description'] );
867
- $attr['count'] = ( empty( $attr['count'] ) ? 'none' : $attr['count'] );
868
- $remove_div_bool = ( $attr['remove_div'] == 'true' );
869
- $always_show_count_bool = ( $attr['always_show_count'] == 'true' );
870
 
871
- $baseBtn = pib_button_base($attr['url'], $attr['image_url'], $attr['description'], $attr['count'], $always_show_count_bool);
872
 
873
- if ( $remove_div_bool ) {
874
- return $baseBtn;
875
- }
876
- else {
877
- //Surround with div tag
878
- $float_class = '';
879
-
880
- if ( $attr['float'] == 'left' ) {
881
- $float_class = 'pib-float-left';
882
- }
883
- elseif ( $attr['float'] == 'right' ) {
884
- $float_class = 'pib-float-right';
885
- }
886
-
887
- return '<div class="pin-it-btn-wrapper-shortcode ' . $float_class . '">' . $baseBtn . '</div>';
888
- }
889
  }
890
 
891
  add_shortcode( 'pinit', 'pib_button_shortcode_html' );
892
 
893
-
894
  //Render button on pages with regular content
895
 
896
  function pib_render_btn( $content ) {
@@ -904,23 +591,21 @@ function pib_render_btn( $content ) {
904
  ( is_home() && ( $pib_options['display_home_page'] ) ) ||
905
  ( is_front_page() && ( $pib_options['display_front_page'] ) ) ||
906
  ( is_single() && ( $pib_options['display_posts'] ) ) ||
907
- ( is_page() && ( $pib_options['display_pages'] ) && !is_front_page() ) ||
908
-
909
- //archive pages besides categories (tag, author, date, etc)
910
- ( is_archive() && ( $pib_options['display_archives'] ) &&
911
- ( is_tag() || is_author() || is_date() || is_search() )
912
- )
913
  ) {
914
  if ( $pib_options['display_above_content'] ) {
915
  $content = pib_button_html($postID) . $content;
916
  }
 
917
  if ( $pib_options['display_below_content'] ) {
918
  $content .= pib_button_html($postID);
919
  }
920
- }
 
921
 
922
  //Determine if displayed on Category on the base of category edit Screen Option
923
- if ( is_archive() && ( $pib_options['display_archives'] ) ) {
 
924
  $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
925
  $category_ids = get_all_category_ids();
926
  foreach($category_ids as $term_id) {
@@ -963,6 +648,7 @@ function pib_render_btn_excerpt( $content ) {
963
  if ( $pib_options['display_above_content'] ) {
964
  $content = pib_button_html($postID) . $content;
965
  }
 
966
  if ( $pib_options['display_below_content'] ) {
967
  $content .= pib_button_html($postID);
968
  }
@@ -989,6 +675,8 @@ function pib_render_btn_excerpt( $content ) {
989
  }
990
  }
991
  }
 
 
992
  }
993
  }
994
  }
@@ -997,14 +685,10 @@ function pib_render_btn_excerpt( $content ) {
997
 
998
  add_filter( 'the_excerpt', 'pib_render_btn_excerpt' );
999
 
1000
-
1001
  //Option name
1002
-
1003
  define('PIB_CATEGORY_FIELDS', 'pib_category_fields_option');
1004
 
1005
-
1006
  //Add Checkbox to Category Edit Screen
1007
-
1008
  add_action('edit_category_form_fields', 'pib_category_fields');
1009
 
1010
  function pib_category_fields($tag) {
@@ -1044,176 +728,194 @@ function pib_category_fields($tag) {
1044
  <?php
1045
  }
1046
 
1047
-
1048
  // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above
1049
-
1050
  add_action('edited_category', 'update_pib_category_fields');
1051
 
1052
  function update_pib_category_fields($term_id) {
1053
- if ( $_POST['taxonomy'] == 'category' ) {
1054
- $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
1055
- $tag_extra_fields[$term_id]['checkbox'] = strip_tags($_POST['pib_category_field']);
1056
-
1057
- if ( $_POST['pib_category_field'] != true ) {
1058
- $tag_extra_fields[$term_id]['checkbox'] = true;
1059
- update_option( PIB_CATEGORY_FIELDS, $tag_extra_fields );
1060
- }
1061
- if ( $_POST['pib_category_field'] == true ) {
1062
- $tag_extra_fields[$term_id]['checkbox'] = "";
1063
- update_option( PIB_CATEGORY_FIELDS, $tag_extra_fields );
1064
- }
1065
- }
1066
  }
1067
 
1068
-
1069
- //Add Pinterest Pin It Button widget
1070
 
1071
  class Pib_Widget extends WP_Widget {
1072
 
1073
  function __construct() {
1074
- $widget_ops = array('classname' => 'pib-clearfix', 'description' => __( 'Add a Pinterest "Pin It" button to your sidebar with this widget.') );
1075
- $control_ops = array('width' => 400); //doesn't use height
1076
- parent::__construct('pib_button', __('Pinterest "Pin It" Button'), $widget_ops, $control_ops);
1077
  }
1078
 
1079
  function widget( $args, $instance ) {
1080
  extract($args);
1081
 
1082
- $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
1083
- $pib_url_of_webpage_widget = $instance['pib_url_of_webpage_widget'];
1084
- $pib_url_of_img_widget = $instance['pib_url_of_img_widget'];
1085
- $pib_description_widget = $instance['pib_description_widget'];
1086
- $count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
1087
- $float = empty( $instance['float'] ) ? 'none' : $instance['float'];
1088
- $pib_remove_div = (bool)$instance['remove_div'];
1089
- $pib_always_show_count = (bool)$instance['always_show_count'];
1090
-
1091
- $baseBtn = pib_button_base( $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout, $pib_always_show_count );
1092
-
1093
  echo $before_widget;
1094
-
1095
- if ( $title ) {
1096
  echo $before_title . $title . $after_title;
1097
- }
1098
-
1099
- if ( $pib_remove_div ) {
1100
- echo $baseBtn;
1101
- }
1102
- else {
1103
- //Surround with div tag
1104
- $float_class = '';
1105
-
1106
- if ( $float == 'left' ) {
1107
- $float_class = 'pib-float-left';
1108
- }
1109
- elseif ( $float == 'right' ) {
1110
- $float_class = 'pib-float-right';
1111
- }
1112
-
1113
- echo '<div class="pin-it-btn-wrapper-widget ' . $float_class . '">' . $baseBtn . '</div>';
1114
- }
1115
-
1116
  echo $after_widget;
1117
  }
1118
 
1119
  function update( $new_instance, $old_instance ) {
1120
  $instance = $old_instance;
1121
- $new_instance = wp_parse_args( (array) $new_instance, array( 'count_layout' => 'none', 'title' => '',
1122
- 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
1123
  $instance['title'] = strip_tags($new_instance['title']);
1124
- $instance['pib_url_of_webpage_widget'] = strip_tags($new_instance['pib_url_of_webpage_widget']);
1125
- $instance['pib_url_of_img_widget'] = strip_tags($new_instance['pib_url_of_img_widget']);
1126
- $instance['pib_description_widget'] = strip_tags($new_instance['pib_description_widget']);
1127
- $instance['count_layout'] = $new_instance['count_layout'];
1128
- $instance['float'] = $new_instance['float'];
1129
- $instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
1130
- $instance['always_show_count'] = ( $new_instance['always_show_count'] ? 1 : 0 );
1131
-
1132
  return $instance;
1133
  }
1134
 
1135
  function form( $instance ) {
1136
- $instance = wp_parse_args( (array) $instance, array( 'count_layout' => 'none', 'title' => '',
1137
- 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
1138
  $title = strip_tags($instance['title']);
1139
- $pib_url_of_webpage_widget = strip_tags($instance['pib_url_of_webpage_widget']);
1140
- $pib_url_of_img_widget = strip_tags($instance['pib_url_of_img_widget']);
1141
- $pib_description_widget = strip_tags($instance['pib_description_widget']);
1142
- $pib_options = get_option('pib_options');
1143
- $pib_button_style_widget = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
1144
- ?>
1145
-
1146
- <p>
1147
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):'); ?></label>
1148
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
1149
- </p>
1150
- <p>
1151
- <label for="<?php echo $this->get_field_id('count_layout'); ?>"><?php _e('Pin Count:'); ?></label>
1152
- <select name="<?php echo $this->get_field_name('count_layout'); ?>" id="<?php echo $this->get_field_id('count_layout'); ?>">
1153
- <option value="none"<?php selected( $instance['count_layout'], 'none' ); ?>><?php _e('No Count'); ?></option>
1154
- <option value="horizontal"<?php selected( $instance['count_layout'], 'horizontal' ); ?>><?php _e('Horizontal'); ?></option>
1155
- <option value="vertical"<?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e('Vertical'); ?></option>
1156
- </select>
1157
- </p>
1158
- <p>
1159
- <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"/>
1160
- <label for="<?php echo $this->get_field_id('always_show_count'); ?>">Always show pin count (even when zero)</label>
1161
- </p>
1162
- <div class="pib-widget-text-fields">
1163
- <p>
1164
- <em>Button style is inherited from setting saved in <a href='<?php echo 'admin.php?page=' . PIB_PLUGIN_BASENAME ?>'>"Pin It" Button Settings</a>.
1165
- Current style: <strong><?php echo $pib_button_style_widget; ?></strong></em>
1166
- </p>
1167
- <p>
1168
- <em>These 3 text fields will be used only if the button style is <strong>"Image pre-selected"</strong></em>
1169
- </p>
1170
- <p>
1171
- <label for="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>"><?php _e('URL of the web page to be pinned (required):'); ?></label>
1172
- <input class="widefat" id="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>" name="<?php echo $this->get_field_name('pib_url_of_webpage_widget'); ?>" type="text" value="<?php echo esc_attr($pib_url_of_webpage_widget); ?>" />
1173
- </p>
1174
- <p>
1175
- <label for="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>"><?php _e('URL of the image to be pinned (required):'); ?></label>
1176
- <input class="widefat" id="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>" name="<?php echo $this->get_field_name('pib_url_of_img_widget'); ?>" type="text" value="<?php echo esc_attr($pib_url_of_img_widget); ?>" />
1177
- </p>
1178
- <p>
1179
- <label for="<?php echo $this->get_field_id('pib_description_widget'); ?>"><?php _e('Description of the pin (optional):'); ?></label>
1180
- <input class="widefat" id="<?php echo $this->get_field_id('pib_description_widget'); ?>" name="<?php echo $this->get_field_name('pib_description_widget'); ?>" type="text" value="<?php echo esc_attr($pib_description_widget); ?>" />
1181
- </p>
1182
- </div>
1183
 
 
 
 
1184
  <p>
1185
- <label for="<?php echo $this->get_field_id('float'); ?>"><?php _e('Align (float):'); ?></label>
1186
- <select name="<?php echo $this->get_field_name('float'); ?>" id="<?php echo $this->get_field_id('float'); ?>">
1187
- <option value="none"<?php selected( $instance['float'], 'none' ); ?>><?php _e('none (default)'); ?></option>
1188
- <option value="left"<?php selected( $instance['float'], 'left' ); ?>><?php _e('left'); ?></option>
1189
- <option value="right"<?php selected( $instance['float'], 'right' ); ?>><?php _e('right'); ?></option>
1190
- </select>
1191
- </p>
1192
- <p>
1193
- <input class="checkbox" <?php checked($instance['remove_div'], true) ?> id="<?php echo $this->get_field_id('remove_div'); ?>" name="<?php echo $this->get_field_name('remove_div'); ?>" type="checkbox"/>
1194
- <label for="<?php echo $this->get_field_id('remove_div'); ?>">Remove div tag surrounding this widget button (also removes <strong>float</strong> setting)</label>
1195
- </p>
1196
  <?php
1197
  }
1198
  }
1199
 
 
 
1200
 
1201
  // Function that register Pin It Button widget.
1202
-
1203
  function pib_load_widgets() {
1204
  register_widget( 'Pib_Widget' );
1205
  }
1206
 
1207
- //Add function to the widgets_init hook.
1208
- add_action( 'widgets_init', 'pib_load_widgets' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
 
1211
- // JavaScript alert debug function (quick & dirty)
 
1212
 
1213
- function debugToJs($phpVar) {
1214
- echo '<script type="text/javascript"> (function() { alert("' . $phpVar . '"); })() </script>' . "\n";
1215
- //echo '<script type="text/javascript"> (function() { alert(escape("' . $phpVar . '")); })() </script>' . "\n";
1216
- //echo '<script type="text/javascript"> (function() { console.log("' . esc_attr($phpVar) . '"); })() </script>' . "\n";
1217
  }
1218
 
 
 
1219
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Pinterest "Pin It" Button
4
+ Plugin URI: http://pinterestplugin.com/
5
+ Description: Add a Pinterest "Pin It" button to your posts and pages.
6
+ Version: 1.2.1
7
  Author: Phil Derksen
8
+ Author URI: http://pinterestplugin.com/
 
 
 
9
  */
10
 
11
+ /* Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
12
+
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License, version 2, as
15
+ published by the Free Software Foundation.
16
+
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
 
27
  //Set global variables
28
 
29
  if ( ! defined( 'PIB_PLUGIN_BASENAME' ) )
30
  define( 'PIB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
31
+
32
+ define( 'BASE_BTN_HTML', '<a href="javascript:void(0)" class="pin-it-btn" title="Pin It on Pinterest"></a>' );
33
+
34
  //Plugin install/activation
35
+
36
  function pib_install() {
37
 
38
  //Deactivate plugin if WP version too low
42
 
43
  //Setup default settings
44
  $pib_options = array(
45
+ //'admin_activate_notice' => 0,
46
  'display_home_page' => 1,
47
  'display_front_page' => 0,
48
  'display_posts' => 1,
51
  'display_above_content' => 0,
52
  'display_below_content' => 1,
53
  'display_on_post_excerpts' => 0,
54
+ 'remove_div' => 0,
55
+ 'custom_css' => ''
 
 
 
56
  );
57
 
58
  //Save default option values
59
+ update_option( 'pib_options', $pib_options );
60
+
61
  }
62
 
63
  register_activation_hook( __FILE__, 'pib_install' );
64
 
65
+ //Display admin notice only once, then set option to turn off
66
+ //Using saved option instead of session which was causing errors for some
67
+ //TODO Removed until further testing
68
+
69
+ /*
70
+ function pib_plugin_activate_notice() {
71
+ $pib_options = get_option( 'pib_options' );
72
+
73
+ if ( !$pib_options['admin_activate_notice'] ) {
74
+ echo '<div class="updated"><p>' .
75
+ '<strong>Your "Pin It" Button is activated!</strong> ' .
76
+ sprintf( __( '<a href="%1$s" class="activate-notice-link">Customize Your Settings</a>' ),
77
+ 'admin.php?page=' . PIB_PLUGIN_BASENAME ) .
78
+ '</p></div>';
79
+
80
+ $pib_options['admin_activate_notice'] = 1;
81
+ update_option( 'pib_options', $pib_options );
82
+ }
83
+ }
84
+
85
+ add_action('admin_notices', 'pib_plugin_activate_notice');
86
+ */
87
 
88
  //Add settings page to admin menu
 
89
 
90
  function pib_create_menu() {
91
+ add_menu_page( 'Pin It Button Settings', 'Pin It Button', 'manage_options', __FILE__, 'pib_create_settings_page',
92
+ plugins_url( '/img/pinit-button-icon-small.png', __FILE__ ) );
 
 
93
  }
94
 
95
  add_action( 'admin_menu', 'pib_create_menu' );
96
 
 
97
  //Add Admin CSS/JS
98
 
99
  function pib_add_admin_css_js() {
100
  wp_enqueue_script( 'jquery' );
101
 
102
  wp_enqueue_style( 'pinterest-pin-it-button', plugins_url( '/css/pinterest-pin-it-button-admin.css' , __FILE__ ) );
103
+ wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button-admin.js', __FILE__ ), array( 'jquery' ) );
104
  }
105
 
106
+ add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
 
109
  //Register settings
114
 
115
  add_action( 'admin_init', 'pib_register_settings' );
116
 
 
117
  //Create settings page
118
 
119
  function pib_create_settings_page() {
124
  ?>
125
  <div class="wrap">
126
 
127
+ <a href="http://pinterestplugin.com/" target="_blank"><div id="pinit-button-icon-32" class="icon32"
128
+ style="background: url(<?php echo plugins_url( '/img/pinit-button-icon-med.png', __FILE__ ); ?>) no-repeat;"><br /></div></a>
129
  <h2>Pinterest "Pin It" Button Settings</h2>
130
 
131
  <div class="metabox-holder">
134
  <?php settings_errors(); //Display status messages after action ("settings saved", errors) ?>
135
 
136
  <form method="post" action="options.php">
137
+ <?php settings_fields( 'pib-settings-group' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  <div id="pib-options" class="postbox pib-postbox">
140
  <!--Collapsable-->
141
+ <div class="handlediv" title="Click to toggle"><br /></div>
142
+ <h3 class="hndle">What types of pages should the button appear on?</h3>
143
 
144
  <table class="form-table inside">
145
  <tr valign="top">
174
  <td>
175
  <input id="display_archives" name="pib_options[display_archives]" type="checkbox"
176
  <?php if ( $pib_options['display_archives'] ) echo 'checked="checked"'; ?> />
177
+ <label for="display_archives">Archives (includes Category, Tag, Author and time-based pages)</label>
178
  </td>
179
  </tr>
180
  <tr valign="top">
181
+ <td>
182
+ When editing a post, page or category, scroll down to find the option to hide the "Pin It" button for it.
 
183
  </td>
184
  </tr>
185
  <tr valign="top">
186
  <td>
187
+ Go to <a href="<?php echo admin_url( 'widgets.php' ); ?>">Widgets</a> to add a "Pin It" button to the sidebar.
188
  </td>
189
  </tr>
190
  </table>
191
  </div>
192
 
193
  <div id="button-show" class="postbox pib-postbox">
194
+ <div class="handlediv" title="Click to toggle"><br /></div>
195
+ <h3 class="hndle">Where on each page should the button appear?</h3>
196
 
197
  <table class="form-table inside">
198
  <tr valign="top">
213
  <label for="display_on_post_excerpts">On Post Excerpts</label>
214
  </td>
215
  </tr>
216
+ <tr valign="top">
217
+ <td>
218
+ Use the shortcode <code>[pinit]</code> to display the button within content.<br/>
219
+ Use the function <code><?php echo htmlentities('<?php echo do_shortcode(\'[pinit]\'); ?>'); ?></code>
220
+ to display within template or theme files.
221
+ </td>
222
+ </tr>
223
  </table>
224
  </div>
 
 
 
 
225
 
226
  <div id="style-options" class="postbox pib-postbox">
227
+ <div class="handlediv" title="Click to toggle"><br /></div>
228
+ <h3 class="hndle">Additional layout and styling options</h3>
229
 
230
  <table class="form-table inside">
231
  <tr valign="top">
235
  </tr>
236
  <tr valign="top">
237
  <td>
238
+ <textarea name="pib_options[custom_css]" rows="6" cols="8"><?php echo $custom_css; ?></textarea>
239
  </td>
240
  </tr>
 
 
 
 
 
 
241
  <tr valign="top">
242
  <td>
243
+ <input id="remove_div" name="pib_options[remove_div]" type="checkbox" <?php if ( $pib_options['remove_div'] ) echo 'checked="checked"'; ?> />
244
+ <label for="remove_div">Remove surrounding <code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code> tag</label>
245
  </td>
246
  </tr>
 
247
  <tr valign="top">
248
  <td>
249
  <a href="http://pinterestplugin.com/pin-it-button-custom-css/" target="_blank">See custom CSS examples</a> aligning the button
253
  </table>
254
  </div>
255
 
256
+ <table class="form-table inside">
257
+ <tr valign="top">
258
+ <td>
259
+ <input name="Submit" type="submit" value="Save Changes" class="button-primary" />
260
+ </td>
261
+ </tr>
262
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  </form>
264
  </div>
265
  </div>
266
+ <div class="pib-right-column postbox-container">
 
267
  <div class="meta-box-sortables ui-sortable">
268
  <div id="email-signup">
269
  <h4>Like This Plugin?</h4>
270
 
271
  <p class="large-text">
272
+ Join the mailing list to be notified when new features are released.
273
  </p>
274
 
275
  <!-- Begin MailChimp Signup Form -->
292
  </div>
293
 
294
  <div id="promo-buttons" class="postbox pib-postbox">
295
+ <div class="handlediv" title="Click to toggle"><br /></div>
296
+ <h3 class="hndle">Spread the Word!</h3>
297
 
298
  <div class="inside">
299
+ <p>The more people using this plugin the more we can add to it for you. Just take a sec and share it!</p>
300
 
301
  <table>
302
  <tr>
311
  <tr>
312
  <td><?php echo pib_share_pinterest(); ?></td>
313
  </tr>
 
 
 
314
  </table>
315
  </div>
316
  </div>
317
 
318
+ <div id="other-links" class="postbox pib-postbox">
319
+ <div class="handlediv" title="Click to toggle"><br /></div>
320
+ <h3 class="hndle">Other Links</h3>
 
 
 
 
 
 
 
 
 
 
 
 
321
 
322
  <div class="inside">
323
  <ul>
324
+ <li><a href="http://pinterestplugin.com/" target="_blank">Official Site - PinterestPlugin.com</a></li>
325
+ <li><a href="https://pinterestplugin.uservoice.com/" target="_blank">User Support &amp; Feature Requests</a></li>
326
  </ul>
327
  </div>
328
  </div>
329
+
330
  <div id="news-links" class="postbox pib-postbox">
331
+ <div class="handlediv" title="Click to toggle"><br /></div>
332
+ <h3 class="hndle">News from PinterestPlugin.com</h3>
333
 
334
  <div class="inside">
335
+ <? echo pib_rss_news(); ?>
336
  </div>
337
  </div>
 
338
  </div>
339
  </div>
340
 
343
  <?php
344
  }
345
 
 
346
  //Render rss items from pinterestplugin.com
347
  //http://codex.wordpress.org/Function_Reference/fetch_feed
 
348
  function pib_rss_news() {
349
  // Get RSS Feed(s)
350
  include_once(ABSPATH . WPINC . '/feed.php');
378
  <?php
379
  }
380
 
 
381
  //Render Facebook Share button
382
  //http://developers.facebook.com/docs/share/
383
  function pib_share_facebook() {
389
  <?php
390
  }
391
 
 
392
  //Render Twitter button
393
  //https://twitter.com/about/resources/buttons
394
  function pib_share_twitter() {
400
  <?php
401
  }
402
 
 
403
  //Render Google +1 button
404
  //http://www.google.com/intl/en/webmasters/+1/button/index.html
405
  function pib_share_google_plus() {
406
  ?>
407
 
408
  <!-- Place this tag where you want the +1 button to render -->
409
+ <div class="g-plusone" data-size="small" data-annotation="inline" data-href="http://pinterestplugin.com/"></div>
410
 
411
  <!-- Place this render call where appropriate -->
412
  <script type="text/javascript">
420
  <?php
421
  }
422
 
 
423
  //Render Pin It button
 
 
424
  function pib_share_pinterest() {
425
  ?>
426
+ <iframe src='<?php echo plugins_url( '/inc/admin-pin-it-button-iframe.html' , __FILE__ ) ?>' scrolling="no" frameborder="0" allowtransparency="true"
427
+ style="border:none; overflow:hidden; width:px; height:20px"></iframe>
 
 
428
  <?php
429
  }
430
 
448
  <?php
449
  }
450
 
451
+ //Add a link to the settings page to the plugins list
 
452
 
453
  function pib_plugin_action_links( $links, $file ) {
454
  if ( $file != PIB_PLUGIN_BASENAME )
464
 
465
  add_filter( 'plugin_action_links', 'pib_plugin_action_links', 10, 2 );
466
 
 
467
  //Adds a meta box to the main column on the Post and Page edit screens
468
 
469
  function pib_sharing_add_meta_box() {
470
+ add_meta_box( 'pib_sharing_meta','"Pin It" Button Display', 'pib_sharing_meta_box_content', 'page', 'advanced', 'high' );
471
+ add_meta_box( 'pib_sharing_meta','"Pin It" Button Display', 'pib_sharing_meta_box_content', 'post', 'advanced', 'high' );
472
  }
473
 
474
  add_action( 'admin_init', 'pib_sharing_add_meta_box' );
475
 
 
476
  //Renders the post/page meta box checkbox html
477
 
478
  function pib_sharing_meta_box_content( $post ) {
 
479
  $pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled', 1 );
480
 
481
  if ( empty( $pib_sharing_checked ) || $pib_sharing_checked === false )
482
  $pib_sharing_checked = ' checked="checked"';
483
  else
484
+ $pib_sharing_checked = '';
 
 
 
 
 
 
485
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
 
487
  <p>
488
  <input name="pib_enable_post_sharing" id="pib_enable_post_sharing" value="1" <?php echo $pib_sharing_checked; ?> type="checkbox" />
489
  <label for="pib_enable_post_sharing">Show "Pin It" button on this post/page.</label>
490
  <p class="description">
491
+ <!-- <span style="font-size: 11px;"> -->
492
  If checked displays the button for this post/page (if <strong>Individual Posts</strong> (for posts) or <strong>WordPress Static "Pages"</strong>
493
  (for pages) is also checked in <a href='<?php echo 'admin.php?page=' . PIB_PLUGIN_BASENAME ?>'>"Pin It" Button Settings</a>).
494
  If unchecked the button will <strong>always</strong> be hidden for this post/page.
496
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
497
  </p>
498
 
499
+ <?php
500
  }
501
 
 
502
  //Saves display option for individual post/page
503
 
504
  function pib_sharing_meta_box_save( $post_id ) {
509
  if ( isset( $_POST['post_type'] ) && ( 'post' == $_POST['post_type'] || 'page' == $_POST['post_type'] ) ) {
510
  if ( current_user_can( 'edit_post', $post_id ) ) {
511
  if ( isset( $_POST['pib_sharing_status_hidden'] ) ) {
512
+ if ( !isset( $_POST['pib_enable_post_sharing'] ) )
513
  update_post_meta( $post_id, 'pib_sharing_disabled', 1 );
514
+ else
 
515
  delete_post_meta( $post_id, 'pib_sharing_disabled' );
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
  }
518
  }
522
 
523
  add_action( 'save_post', 'pib_sharing_meta_box_save' );
524
 
525
+ //Add Public CSS/JS
 
526
 
527
  function pib_add_public_css_js() {
528
+ wp_enqueue_script( 'jquery' );
529
+
530
+ wp_enqueue_style( 'pinterest-pin-it-button', plugins_url( '/css/pinterest-pin-it-button.css' , __FILE__ ) );
531
+ wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button.js', __FILE__ ), array( 'jquery' ) );
532
  }
533
 
534
  add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  //Add Custom CSS
537
 
538
  function pib_add_custom_css() {
546
 
547
  add_action( 'wp_head', 'pib_add_custom_css' );
548
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  //Button html to render
550
 
551
+ function pib_button_html($postID) {
 
 
 
 
 
 
 
 
 
 
552
 
553
+ $pib_options = get_option( 'pib_options' );
554
+
555
+
556
+ if (get_post_meta($postID,'pib_sharing_disabled', 1)) {
557
+
558
+ return "";
559
  }
560
  else {
561
+
562
+ //Check that remove surrounding div checkbox is selected
563
+ if ( $pib_options['remove_div'] ) {
564
+ return BASE_BTN_HTML;
565
+ } else {
566
+ //Surround with div tag
567
+ return '<div class="pin-it-btn-wrapper">' . BASE_BTN_HTML . '</div>';
568
+ }
569
+ }
 
 
 
 
 
 
 
 
 
 
570
 
571
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
 
573
+ //Register shortcode: [pinit]
574
 
575
+ function pib_button_shortcode_html() {
576
+ return '<div class="pin-it-btn-shortcode-wrapper">' . BASE_BTN_HTML . '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  }
578
 
579
  add_shortcode( 'pinit', 'pib_button_shortcode_html' );
580
 
 
581
  //Render button on pages with regular content
582
 
583
  function pib_render_btn( $content ) {
591
  ( is_home() && ( $pib_options['display_home_page'] ) ) ||
592
  ( is_front_page() && ( $pib_options['display_front_page'] ) ) ||
593
  ( is_single() && ( $pib_options['display_posts'] ) ) ||
594
+ ( is_page() && ( $pib_options['display_pages'] ) )
 
 
 
 
 
595
  ) {
596
  if ( $pib_options['display_above_content'] ) {
597
  $content = pib_button_html($postID) . $content;
598
  }
599
+
600
  if ( $pib_options['display_below_content'] ) {
601
  $content .= pib_button_html($postID);
602
  }
603
+ }
604
+
605
 
606
  //Determine if displayed on Category on the base of category edit Screen Option
607
+ if( is_archive() && ( $pib_options['display_archives'] ) ) {
608
+
609
  $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
610
  $category_ids = get_all_category_ids();
611
  foreach($category_ids as $term_id) {
648
  if ( $pib_options['display_above_content'] ) {
649
  $content = pib_button_html($postID) . $content;
650
  }
651
+
652
  if ( $pib_options['display_below_content'] ) {
653
  $content .= pib_button_html($postID);
654
  }
675
  }
676
  }
677
  }
678
+
679
+
680
  }
681
  }
682
  }
685
 
686
  add_filter( 'the_excerpt', 'pib_render_btn_excerpt' );
687
 
 
688
  //Option name
 
689
  define('PIB_CATEGORY_FIELDS', 'pib_category_fields_option');
690
 
 
691
  //Add Checkbox to Category Edit Screen
 
692
  add_action('edit_category_form_fields', 'pib_category_fields');
693
 
694
  function pib_category_fields($tag) {
728
  <?php
729
  }
730
 
 
731
  // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above
 
732
  add_action('edited_category', 'update_pib_category_fields');
733
 
734
  function update_pib_category_fields($term_id) {
735
+ if($_POST['taxonomy'] == 'category'):
736
+ $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
737
+ $tag_extra_fields[$term_id]['checkbox'] = strip_tags($_POST['pib_category_field']);
738
+ if( $_POST['pib_category_field'] != true){
739
+ $tag_extra_fields[$term_id]['checkbox'] = true;
740
+ update_option(PIB_CATEGORY_FIELDS, $tag_extra_fields );
741
+ }
742
+ if( $_POST['pib_category_field'] == true){
743
+ $tag_extra_fields[$term_id]['checkbox'] = "";
744
+ update_option(PIB_CATEGORY_FIELDS, $tag_extra_fields );
745
+ }
746
+ endif;
 
747
  }
748
 
749
+ //Add Pinterest Pin It Button widget to sidebar
 
750
 
751
  class Pib_Widget extends WP_Widget {
752
 
753
  function __construct() {
754
+ $widget_ops = array('classname' => 'pib_widget_button', 'description' => __( 'Add a "Pin It" button to your sidebar with this widget') );
755
+ parent::__construct('pib_button', __('Pinterest - "Pin It" Button'), $widget_ops);
 
756
  }
757
 
758
  function widget( $args, $instance ) {
759
  extract($args);
760
 
761
+ $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
762
+
 
 
 
 
 
 
 
 
 
763
  echo $before_widget;
764
+ if ( $title )
 
765
  echo $before_title . $title . $after_title;
766
+
767
+ echo '<div class="pin-it-btn-wrapper">' . BASE_BTN_HTML . '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768
  echo $after_widget;
769
  }
770
 
771
  function update( $new_instance, $old_instance ) {
772
  $instance = $old_instance;
773
+ $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '') );
 
774
  $instance['title'] = strip_tags($new_instance['title']);
775
+
 
 
 
 
 
 
 
776
  return $instance;
777
  }
778
 
779
  function form( $instance ) {
780
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
 
781
  $title = strip_tags($instance['title']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
782
 
783
+ ?>
784
+
785
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
786
  <p>
787
+
 
 
 
 
 
 
 
 
 
 
788
  <?php
789
  }
790
  }
791
 
792
+ //Add function to the widgets_init hook.
793
+ add_action( 'widgets_init', 'pib_load_widgets' );
794
 
795
  // Function that register Pin It Button widget.
 
796
  function pib_load_widgets() {
797
  register_widget( 'Pib_Widget' );
798
  }
799
 
800
+ //Add Pinterest Follow Button Widget to sidebar
801
+
802
+ class Pib_Follow_Button_Widget extends WP_Widget {
803
+
804
+ function __construct() {
805
+ $widget_ops = array('classname' => 'pib_widget_follow_button', 'description' => __( 'Add a Pinterest "Follow" button to your sidebar with this widget') );
806
+ parent::__construct('pib_follow_button', __('Pinterest - "Follow" Button'), $widget_ops);
807
+ }
808
+
809
+ function widget( $args, $instance ) {
810
+ extract($args);
811
+
812
+ $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
813
+ $pib_img_option = $instance['pib_follow_button_radio'];
814
+ $pibusername = $instance['pibusername'];
815
+ $newwindow = $instance['newwindow'] ? '1' : '0';
816
+
817
+ echo $before_widget;
818
+ if ( $title )
819
+ echo $before_title . $title . $after_title;
820
+
821
+ if($pib_img_option == 1){
822
+ if($newwindow){
823
+ echo '<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></a>';
824
+ }
825
+ else{
826
+ echo '<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></a>';
827
+ }
828
+ }
829
+ elseif($pib_img_option == 2){
830
+ if($newwindow){
831
+ echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></a>';
832
+ }
833
+ else {
834
+ echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></a>';
835
+ }
836
+ }
837
+ elseif($pib_img_option == 3){
838
+ if($newwindow){
839
+ echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></a>';
840
+ }
841
+ else {
842
+ echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></a>';
843
+ }
844
+ }
845
+ elseif($pib_img_option == 4){
846
+ if($newwindow){
847
+ echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></a>';
848
+ }
849
+ else {
850
+ echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></a>';
851
+ }
852
+ }
853
+
854
+ echo $after_widget;
855
+ }
856
 
857
+ function update( $new_instance, $old_instance ) {
858
+ $instance = $old_instance;
859
+ $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'pibusername' => '', 'pib_follow_button_radio' => '1') );
860
+ $instance['title'] = strip_tags($new_instance['title']);
861
+ $instance['pibusername'] = strip_tags($new_instance['pibusername']);
862
+ $instance['pib_follow_button_radio'] = strip_tags($new_instance['pib_follow_button_radio']);
863
+ $instance['newwindow'] = !empty($new_instance['newwindow']) ? 1 : 0;
864
+
865
+ return $instance;
866
+ }
867
+
868
+ function form( $instance ) {
869
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'pibusername' => '', 'pib_follow_button_radio' => '1') );
870
+ $title = strip_tags($instance['title']);
871
+ $pibusername = strip_tags($instance['pibusername']);
872
+ $pib_follow_button_radio = $instance['pib_follow_button_radio'];
873
+ $newwindow = isset( $instance['newwindow'] ) ? (bool) $instance['newwindow'] : false;
874
+
875
+ ?>
876
+
877
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
878
+ <p>
879
+
880
+ <p><label for="<?php echo $this->get_field_id('pibusername'); ?>"><?php _e('Pinterest Username:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('pibusername'); ?>" name="<?php echo $this->get_field_name('pibusername'); ?>" type="text" value="<?php echo esc_attr($pibusername); ?>" /></p>
881
+ <p>
882
+
883
+ <p><label>Button image:</label></p>
884
+
885
+ <table>
886
+ <tr>
887
+ <td><input type="radio" <?php if($pib_follow_button_radio == 1){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('follow-on-pinterest-button'); ?>" value="1" /></td>
888
+ <td><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></td>
889
+ </tr>
890
+ <tr>
891
+ <td><input type="radio" <?php if($pib_follow_button_radio == 2){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('pinterest-button'); ?>" value="2"/></td>
892
+ <td><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></td>
893
+ </tr>
894
+ <tr>
895
+ <td><input type="radio" <?php if($pib_follow_button_radio == 3){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('big-p-button'); ?>" value="3"/></td>
896
+ <td><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></td>
897
+ </tr>
898
+ <tr>
899
+ <td><input type="radio" <?php if($pib_follow_button_radio == 4){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('small-p-button'); ?>" value="4"/></td>
900
+ <td><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></td>
901
+ </tr>
902
+ </table>
903
+ <br />
904
+ <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('newwindow'); ?>" name="<?php echo $this->get_field_name('newwindow'); ?>" <?php checked( $newwindow ); ?> />
905
+ <label for="<?php echo $this->get_field_id('newwindow'); ?>"><?php _e( 'Open in a new window' ); ?></label><br />
906
+
907
+ <?php
908
+ }
909
+ }
910
 
911
+ //Add function to the widgets_init hook.
912
+ add_action( 'widgets_init', 'pib_load_follow_button_widget' );
913
 
914
+ // Function that registers Follow Button widget.
915
+ function pib_load_follow_button_widget() {
916
+ register_widget( 'Pib_Follow_Button_Widget' );
 
917
  }
918
 
919
+
920
+
921
  ?>
readme.txt CHANGED
@@ -3,33 +3,31 @@ Contributors: pderksen
3
  Tags: pinterest, pin it, social
4
  Requires at least: 3.0
5
  Tested up to: 3.3.1
6
- Stable tag: 1.3.0
7
 
8
  Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images.
9
 
10
  == Description ==
11
 
12
- Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Includes a shortcode and widget.
13
 
14
- ### "Pin It" Button Features: ###
15
 
16
  * Display on various page types: blog home page, front page, posts, pages, archives
17
- * Display within content using a shortcode or on the sidebar using a widget
18
- * Pre-select an image to be pinned or allow the user to select
19
- * Display a horizontal or vertical Pin Count
 
 
 
 
 
20
 
21
  = Resources =
22
 
23
- * [View Live Demo &raquo;](http://bruisesandbandaids.com/2011/newborn-photography-props/ "Learn Your Camera on Manual | Newborn Photography Tips")
24
- * [Pinterest Plugin Updates &raquo;](http://pinterestplugin.com "Pinterest Plugins for WordPress")
25
- * [User Support & Feature Requests &raquo;](http://pinterestplugin.com/user-support "Pinterest Plugins for WordPress User Support")
26
-
27
- = Other Features =
28
-
29
- * Hide on selected posts, pages and categories
30
- * Display above and/or below content
31
- * Optionally display on post excerpts
32
- * Enter custom CSS for fine-tuning layout and styling
33
 
34
  Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
35
 
@@ -39,16 +37,11 @@ Take advantage of the exploding traffic Pinterest is generating by encouraging y
39
 
40
  **Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch, Feb 7, 2012 [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
41
 
42
- = More Pinterest Plugins =
43
-
44
- * [Pinterest "Follow" Button](http://wordpress.org/extend/plugins/pinterest-follow-button/)
45
- * [Pinterest Block](http://wordpress.org/extend/plugins/pinterest-block/)
46
-
47
  == Installation ==
48
 
49
  1. Use the automatic installer in your WordPress admin.
50
  1. Activate the plugin.
51
- 1. Configure the plugin by going to **Pin It Button** that appears in your admin menu.
52
 
53
  Alernatively, you can download this plugin, unzip the contents, then FTP upload to the `/wp-content/plugins/` directory.
54
 
@@ -71,7 +64,7 @@ Here are some things to try. After each one re-test a couple pages on your site
71
 
72
  **How do I display the button in places other than above or below the content?**
73
 
74
- * Use the shortcode `[pinit]` to display the button within content. See shortcode instructions on settings page for attributes you can specify.
75
  * Use the function `<?php echo do_shortcode('[pinit]'); ?>` to display within template or theme files.
76
 
77
  **How do I get the "Pin It" button to line up next to my other social sharing icons?**
@@ -79,11 +72,6 @@ Here are some things to try. After each one re-test a couple pages on your site
79
  * Add custom CSS on the settings screen and optionally remove the surrounding `<div>` tag.
80
  * See some of our [custom CSS examples](http://pinterestplugin.com/pin-it-button-custom-css).
81
 
82
- **I had an old version of the plugin that worked and now it doesn't. Can I get it back?
83
-
84
- * Yes, you can [download previous versions here](http://wordpress.org/extend/plugins/pinterest-pin-it-button/download/).
85
- * You'll need to deactivate and delete the current plugin, then go to Plugins > Add New > Upload to upload the zip file to your site.
86
-
87
  **I'd like to report a bug or submit a feature request.**
88
 
89
  * Go to the [User Support & Feature Requests Forum](http://pinterestplugin.com/user-support)
@@ -92,27 +80,10 @@ Here are some things to try. After each one re-test a couple pages on your site
92
 
93
  1. Settings page
94
  2. Button display below a post
95
- 3. Widget options
96
- 4. Per page settings
97
- 5. Advanced settings
98
 
99
  == Changelog ==
100
 
101
- = 1.3.0 =
102
-
103
- * Added a Pin Count option (horizontal or vertical)
104
- * Added new button style where image is pre-selected (like official Pinterest button)
105
- * Added fields for specifying URL, image URL and description for new button style *image pre-selected*
106
- * Added float option for alignment (none, left or right) to widget and shortcode
107
- * Can now remove shortcode surrounding div tag wrapper
108
- * Can now remove widget surrounding div tag wrapper
109
- * Moved "Follow" button widget to separate plugin: [Pinterest Follow Button Plugin](http://wordpress.org/extend/plugins/pinterest-follow-button/)
110
- * Both button styles now embed iframe (like official Pinterest button)
111
- * External JavaScript now loads in footer for better performance
112
- * Fixed bug where front page was still showing button even when Front Page was unchecked
113
- * Fixed bug where some settings weren't saved when upgrading the plugin
114
- * Fixed bug where tag, author, date and search archive pages were not displaying the button
115
-
116
  = 1.2.1 =
117
 
118
  * Fixed bug with hiding posts/pages/categories when upgrading from a previous version
@@ -172,5 +143,5 @@ Here are some things to try. After each one re-test a couple pages on your site
172
  = 0.1.1 =
173
  * Fixed style sheet reference
174
 
175
- = 0.1.0 =
176
  * Initial release
3
  Tags: pinterest, pin it, social
4
  Requires at least: 3.0
5
  Tested up to: 3.3.1
6
+ Stable tag: trunk
7
 
8
  Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images.
9
 
10
  == Description ==
11
 
12
+ Add a Pinterest "Pin It" Button to your posts and pages.
13
 
14
+ = "Pin It" Button Features: =
15
 
16
  * Display on various page types: blog home page, front page, posts, pages, archives
17
+ * Display above and/or below content
18
+ * Optionally display on post excerpts
19
+ * Hide on selected posts and pages
20
+ * Hide on selected categories
21
+ * Display within content with a shortcode
22
+ * Add custom CSS for fine-tuning layout and styling
23
+ * Add "Pin It" button as a sidebar widget
24
+ * Add a "Follow" on Pinterest button as a sidebar widget
25
 
26
  = Resources =
27
 
28
+ * Official Site: [PinterestPlugin.com](http://pinterestplugin.com)
29
+ * Sample blog using plugin: http://bruisesandbandaids.com
30
+ * [User Support & Feature Requests](http://pinterestplugin.com/user-support)
 
 
 
 
 
 
 
31
 
32
  Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
33
 
37
 
38
  **Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch, Feb 7, 2012 [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
39
 
 
 
 
 
 
40
  == Installation ==
41
 
42
  1. Use the automatic installer in your WordPress admin.
43
  1. Activate the plugin.
44
+ 1. Configure the plugin by going to **Pin It Button** that appears in your admin menu .
45
 
46
  Alernatively, you can download this plugin, unzip the contents, then FTP upload to the `/wp-content/plugins/` directory.
47
 
64
 
65
  **How do I display the button in places other than above or below the content?**
66
 
67
+ * Use the shortcode `[pinit]` to display the button within content.
68
  * Use the function `<?php echo do_shortcode('[pinit]'); ?>` to display within template or theme files.
69
 
70
  **How do I get the "Pin It" button to line up next to my other social sharing icons?**
72
  * Add custom CSS on the settings screen and optionally remove the surrounding `<div>` tag.
73
  * See some of our [custom CSS examples](http://pinterestplugin.com/pin-it-button-custom-css).
74
 
 
 
 
 
 
75
  **I'd like to report a bug or submit a feature request.**
76
 
77
  * Go to the [User Support & Feature Requests Forum](http://pinterestplugin.com/user-support)
80
 
81
  1. Settings page
82
  2. Button display below a post
83
+ 3. Button display next to other sharing buttons
 
 
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  = 1.2.1 =
88
 
89
  * Fixed bug with hiding posts/pages/categories when upgrading from a previous version
143
  = 0.1.1 =
144
  * Fixed style sheet reference
145
 
146
+ = 0.1 =
147
  * Initial release
screenshot-1.png CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
uninstall.php CHANGED
@@ -4,9 +4,12 @@ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
  exit;
5
  }
6
 
 
 
7
  //Remove option records from options table
8
  delete_option( 'pib_options' );
9
  delete_option( 'pib_category_fields_option' );
10
- delete_option( 'pib_ignore' );
 
11
 
12
  ?>
4
  exit;
5
  }
6
 
7
+ //Note this will run on manual deactivate, but should not run when upgrading/overwriting plugin
8
+
9
  //Remove option records from options table
10
  delete_option( 'pib_options' );
11
  delete_option( 'pib_category_fields_option' );
12
+
13
+ //Remove any additional options and custom tables
14
 
15
  ?>