Pinterest "Pin It" Button - Version 1.4.0

Version Description

  • Changed/Fixed: Iframe removed when button set to "User selects image". Fixes security issues and display errors on some web hosts.
  • Added: Displays new features available if upgrading "Pin It" Button Pro
Download this release

Release Info

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

Code changes from version 1.3.1 to 1.4.0

css/pinterest-pin-it-button-admin.css CHANGED
@@ -1,5 +1,13 @@
1
  /* Pinterest "Pin It" Button Admin CSS */
2
 
 
 
 
 
 
 
 
 
3
  .form-table {
4
  margin-bottom: 10px !important;
5
  }
@@ -21,20 +29,24 @@
21
  width: 350px;
22
  }
23
 
24
- .postbox .pib-hndle {
25
- cursor: pointer;
26
  }
27
 
28
- .pib-admin-banner {
29
- margin-bottom: 15px;
30
  }
31
 
32
- table#share_plugin_buttons tr td {
33
  padding-right: 10px;
34
  vertical-align: top;
35
  }
36
 
37
- #pib-custom-css {
 
 
 
 
38
  width: 100%;
39
  }
40
 
@@ -42,21 +54,121 @@ td.pib-pad-cell-top {
42
  padding-top: 7px;
43
  }
44
 
 
 
45
  label.pib-plain-label {
46
  margin: 0;
47
  padding: 0;
48
  }
49
 
50
- .inside ul li .label {
51
  vertical-align: top;
52
  }
53
 
54
- .submit-settings {
55
  padding-bottom: 1.5em;
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /* External link icon */
59
  a.external {
60
- background: url(../img/icon-external-link.gif) center right no-repeat;
61
  padding-right: 17px;
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* Pinterest "Pin It" Button Admin CSS */
2
 
3
+ #icon-pib-icon32 {
4
+ background: transparent url('../img/pinterest-button-icon-med.png') no-repeat;
5
+ }
6
+
7
+ .postbox .pib-hndle {
8
+ cursor: pointer;
9
+ }
10
+
11
  .form-table {
12
  margin-bottom: 10px !important;
13
  }
29
  width: 350px;
30
  }
31
 
32
+ .pib-admin-upgrade-banner-top {
33
+ margin-top: 5px;
34
  }
35
 
36
+ .pib-admin-upgrade-banner-top img {
37
+ border: 1px solid #ccc;
38
  }
39
 
40
+ table#share_plugin_buttons td {
41
  padding-right: 10px;
42
  vertical-align: top;
43
  }
44
 
45
+ #pib_license_key {
46
+ width: 250px;
47
+ }
48
+
49
+ #custom_css {
50
  width: 100%;
51
  }
52
 
54
  padding-top: 7px;
55
  }
56
 
57
+ table.
58
+
59
  label.pib-plain-label {
60
  margin: 0;
61
  padding: 0;
62
  }
63
 
64
+ .inside li .label {
65
  vertical-align: top;
66
  }
67
 
68
+ .pib-submit-settings {
69
  padding-bottom: 1.5em;
70
  }
71
 
72
+ .pib-no-margin,
73
+ .pib-no-margin td {
74
+ margin: 0;
75
+ padding: 0;
76
+ }
77
+
78
+ .pib-upgrade-to-pro {
79
+ font: italic 12px sans-serif;
80
+ }
81
+
82
+ .pib-upgrade-to-pro a {
83
+ font-weight: bold;
84
+ }
85
+
86
+ /* Pro Upgrade Styles */
87
+
88
+ /* from twitter bootstrap labels */
89
+ .pib-pro-label {
90
+ font: bold 12px sans-serif;
91
+ line-height: 14px;
92
+ color: #ffffff;
93
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
94
+ white-space: nowrap;
95
+ vertical-align: baseline;
96
+ background-color: #999; /* red: #b94a48 */
97
+ padding: 1px 4px 2px;
98
+ -webkit-border-radius: 3px;
99
+ -moz-border-radius: 3px;
100
+ border-radius: 3px;
101
+ margin-left: 10px;
102
+ }
103
+
104
+ .disabled {
105
+ color: #999;
106
+ cursor: inherit;
107
+ }
108
+
109
  /* External link icon */
110
  a.external {
111
+ background: transparent url('../img/icon-external-link.gif') center right no-repeat;
112
  padding-right: 17px;
113
  }
114
+
115
+ /* Custom image button admin section (outside popup) */
116
+ #custom_img_btn_select_row td table {
117
+ padding-left: 6px;
118
+ }
119
+
120
+ /* Custom image button selector table inside thickbox popup (Pro) */
121
+ #custom_img_btn_selector_form {
122
+ text-align: center;
123
+ }
124
+
125
+ #custom_img_btn_selector_form table {
126
+ margin: 20px auto 0 auto;
127
+ }
128
+
129
+ #custom_img_btn_selector_form td {
130
+ cursor: pointer;
131
+ width: 75px;
132
+ text-align: center;
133
+ height: 50px;
134
+ }
135
+
136
+ #custom_img_btn_selector_form td:hover {
137
+ background-color: #ececec;
138
+ }
139
+
140
+ #custom_img_btn_selector_form p {
141
+ text-align: center;
142
+ }
143
+
144
+ #custom_img_btn_lite_row td {
145
+ padding-right: 15px !important;
146
+ }
147
+
148
+ /* Custom image button examples thickbox popup (lite) */
149
+ #custom_img_btn_examples_container {
150
+ text-align: center;
151
+ margin-top: 20px;
152
+ }
153
+
154
+ #custom_img_btn_examples_container .upgrade-text {
155
+ line-height: 2em;
156
+ }
157
+
158
+ /* Repeating button-primary class font color as thickbox styles override it, so we need to override it in turn.
159
+ Taken from wp-admin/css/colors-fresh.dev.css */
160
+
161
+ #custom_img_btn_examples_container .upgrade-text a.button-primary {
162
+ color: #fff;
163
+ }
164
+
165
+ #custom_img_btn_examples_container .upgrade-text a.button-primary:active {
166
+ color: #eaf2fa;
167
+ }
168
+
169
+ #custom_img_btn_examples_container .upgrade-text a.button-primary:hover,
170
+ #custom_img_btn_examples_container .upgrade-text a.button-primary:focus,
171
+ #custom_img_btn_examples_container .upgrade-text a.button-primary:active {
172
+ border-color: #13455b;
173
+ color: #eaf2fa;
174
+ }
css/pinterest-pin-it-button.css CHANGED
@@ -4,7 +4,6 @@
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 {
@@ -15,13 +14,13 @@
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 {
@@ -31,3 +30,159 @@
31
  .pib-float-right {
32
  float: right;
33
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  .pin-it-btn-wrapper,
5
  .pin-it-btn-wrapper-shortcode,
6
  .pin-it-btn-wrapper-widget {
 
7
  }
8
 
9
  .pin-it-btn-wrapper {
14
  .pib-clearfix:before,
15
  .pib-clearfix:after {
16
  content:"";
17
+ display: table;
18
  }
19
  .pib-clearfix:after {
20
+ clear: both;
21
  }
22
  .pib-clearfix {
23
+ zoom: 1; /* For IE 6/7 (trigger hasLayout) */
24
  }
25
 
26
  .pib-float-left {
30
  .pib-float-right {
31
  float: right;
32
  }
33
+
34
+ /* DIV surrounding Share Bar */
35
+ .pib-sharebar {
36
+ padding: 10px 0 5px;
37
+ margin: 0;
38
+ width: 100% !important;
39
+ }
40
+
41
+ .pib-sharebar ul,
42
+ .pib-sharebar li {
43
+ margin: 0 !important;
44
+ padding: 0 !important;
45
+ list-style: none;
46
+ border: none;
47
+ background: none;
48
+ text-indent: 0;
49
+ }
50
+
51
+ .pib-sharebar li {
52
+ float: left;
53
+ margin: 0 5px 5px 0 !important;
54
+ display: block;
55
+ }
56
+
57
+ .pib-sharebar li.pib-share-pinterest {
58
+ margin-right: 30px !important;
59
+ }
60
+
61
+ /*** BEGIN Count Bubble CSS ***/
62
+
63
+ table.pib-count-table {
64
+ border: 0;
65
+ border-collapse: collapse;
66
+ border-spacing: 0;
67
+ margin: 0;
68
+ padding: 0;
69
+ vertical-align: top;
70
+ width: auto;
71
+ }
72
+
73
+ table.pib-count-table td {
74
+ border: 0;
75
+ margin: 0;
76
+ padding: 0;
77
+ vertical-align: top;
78
+ }
79
+
80
+ table.pib-count-table-horizontal td {
81
+ text-align: left;
82
+ }
83
+
84
+ table.pib-count-table-vertical td {
85
+ text-align: center;
86
+ }
87
+
88
+ img.pib-count-img {
89
+ border: 0 !important;
90
+ margin: 0 !important;
91
+ max-width: none !important;
92
+ padding: 0 !important;
93
+ }
94
+
95
+ .pib-count-cell {
96
+ display: none; /* Initially hidden */
97
+ position: relative;
98
+ }
99
+
100
+ table.pib-count-table-horizontal td.pib-count-cell {
101
+ padding-left: 4px !important;
102
+ }
103
+
104
+ table.pib-count-table-vertical td.pib-count-cell {
105
+ padding-bottom: 4px !important;
106
+ }
107
+
108
+ .pib-count-bubble {
109
+ background-color: #FCF9F9;
110
+ border: 1px solid #C9C5C5;
111
+ border-radius: 1px;
112
+ color: #777;
113
+ display: inline-block;
114
+ position: relative;
115
+ vertical-align: top;
116
+ }
117
+
118
+ table.pib-count-table-horizontal .pib-count-bubble {
119
+ height: 10px;
120
+ font: 10px/10px Arial, Helvetica, sans-serif;
121
+ margin: 0;
122
+ padding: 3px 5px 4px 5px;
123
+ text-align: left;
124
+ width: auto;
125
+ }
126
+
127
+ table.pib-count-table-vertical .pib-count-bubble {
128
+ font: 12px/12px Arial, Helvetica, sans-serif;
129
+ height: 21px;
130
+ margin: 0;
131
+ padding: 9px 0 0 0;
132
+ text-align: center;
133
+ width: 39px;
134
+ }
135
+
136
+ .pib-count-bubble:after,
137
+ .pib-count-bubble:before {
138
+ border: solid transparent;
139
+ content: " ";
140
+ height: 0;
141
+ width: 0;
142
+ position: absolute;
143
+ pointer-events: none;
144
+ }
145
+
146
+ table.pib-count-table-horizontal .pib-count-bubble:after,
147
+ table.pib-count-table-horizontal .pib-count-bubble:before {
148
+ right: 100%;
149
+ }
150
+
151
+ table.pib-count-table-vertical .pib-count-bubble:after,
152
+ table.pib-count-table-vertical .pib-count-bubble:before {
153
+ top: 100%;
154
+ }
155
+
156
+ .pib-count-bubble:after {
157
+ border-width: 3px;
158
+ }
159
+
160
+ table.pib-count-table-horizontal .pib-count-bubble:after {
161
+ border-right-color: #FCF9F9;
162
+ top: 50%;
163
+ margin-top: -3px;
164
+ }
165
+
166
+ table.pib-count-table-vertical .pib-count-bubble:after {
167
+ border-top-color: #FCF9F9;
168
+ left: 50%;
169
+ margin-left: -3px;
170
+ }
171
+
172
+ .pib-count-bubble:before {
173
+ border-width: 4px;
174
+ }
175
+
176
+ table.pib-count-table-horizontal .pib-count-bubble:before {
177
+ border-right-color: #C9C5C5;
178
+ top: 50%;
179
+ margin-top: -4px;
180
+ }
181
+
182
+ table.pib-count-table-vertical .pib-count-bubble:before {
183
+ border-top-color: #C9C5C5;
184
+ left: 50%;
185
+ margin-left: -4px;
186
+ }
187
+
188
+ /*** END Count Bubble CSS ***/
img/pin-it-button-pro-custom-image-examples-small.png ADDED
Binary file
img/pinterest-button-icon-med.png CHANGED
Binary file
img/pinterest-button-icon-small.png CHANGED
Binary file
inc/admin-display-functions-lite.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //*** Admin Display Functions - Lite Only ***
4
+
5
+ //Custom button image examples
6
+
7
+ function pib_custom_btn_img_examples_popup() {
8
+ ?>
9
+
10
+ <div id="custom_img_btn_examples" style="display:none;">
11
+ <div id="custom_img_btn_examples_container">
12
+ <img src="//d2ghr62k8k1ljk.cloudfront.net/img/pin-it-button-pro-custom-image-examples.png" alt="<?php _e( 'Pin It Button Pro Custom Image Examples', 'pib' ); ?>" />
13
+
14
+ <div class="upgrade-text">
15
+ <?php _e( 'These button designs available in "Pin It" Button Pro.', 'pib' ); ?><br/>
16
+ <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="button-primary close"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
17
+ &nbsp;&nbsp;<a href="#" class="close"><?php _e( 'Close', 'pib' ); ?></a>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+ <?php
23
+ }
24
+
25
+ //Upgrade banner
26
+
27
+ function pib_upgrade_banner_top() {
28
+ ?>
29
+
30
+ <div class="pib-admin-upgrade-banner-top">
31
+ <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank">
32
+ <img src="//d2ghr62k8k1ljk.cloudfront.net/img/pin-it-button-pro-upgrade-banner.png" alt="<?php _e( 'Upgrade to the Pin It Button Pro Plugin', 'pib' ); ?>" />
33
+ </a>
34
+ </div>
35
+
36
+ <?php
37
+ }
38
+
39
+ //Settings page sidebar (Lite)
40
+
41
+ function pib_settings_sidebar_lite() {
42
+ ?>
43
+
44
+ <div class="postbox">
45
+ <?php pib_handlediv(); ?>
46
+ <h3 class="hndle pib-hndle"><?php _e( 'Spread the Word', 'pib' ); ?></h3>
47
+
48
+ <div class="inside">
49
+ <p><?php _e( 'Like this plugin? A share would be awesome!', 'pib' ); ?></p>
50
+
51
+ <table id="share_plugin_buttons">
52
+ <tr>
53
+ <td><?php echo pib_share_twitter(); ?></td>
54
+ <td><?php echo pib_share_pinterest(); ?></td>
55
+ </tr>
56
+ <tr>
57
+ <td><?php echo pib_share_facebook(); ?></td>
58
+ <td><?php echo pib_share_gplus(); ?></td>
59
+ </tr>
60
+ </table>
61
+
62
+ <p>
63
+ &raquo; <a href="http://wordpress.org/extend/plugins/pinterest-pin-it-button/" target="_blank" class="external">
64
+ <?php _e( 'Rate it on WordPress', 'pib' ); ?></a>
65
+ </p>
66
+ </div>
67
+ </div>
68
+
69
+ <div class="postbox">
70
+ <?php pib_handlediv(); ?>
71
+ <h3 class="hndle pib-hndle"><?php _e( 'Plugin Support', 'tpp' ); ?></h3>
72
+
73
+ <div class="inside">
74
+ <p>
75
+ &raquo; <a href="http://pinterestplugin.com/support" target="_blank" class="external">
76
+ <?php _e( 'Support & Knowledge Base', 'pib' ); ?></a>
77
+ </p>
78
+ <p>
79
+ <?php _e( 'Priority support provided to licensed users only.', 'pib' ); ?>
80
+ </p>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="postbox">
85
+ <?php pib_handlediv(); ?>
86
+ <h3 class="hndle pib-hndle"><?php _e( 'More Pinterest Plugins', 'pib' ); ?></h3>
87
+
88
+ <div class="inside">
89
+ <ul>
90
+ <li>&raquo; <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external">"Pin It" Button Pro</a></li>
91
+ <li>&raquo; <a href="http://pinterestplugin.com/top-pinned-posts/" target="_blank" class="external">Top Pinned Posts</a></li>
92
+ <li>&raquo; <a href="http://pinterestplugin.com/follow-button" target="_blank" class="external">"Follow" Button</a></li>
93
+ <li>&raquo; <a href="http://pinterestplugin.com/pinterest-block" target="_blank" class="external">Pinterest Block</a></li>
94
+ </ul>
95
+ </div>
96
+ </div>
97
+
98
+ <?php pib_newsletter_subscribe(); ?>
99
+
100
+ <?php pib_plugin_news(); ?>
101
+
102
+ <?php
103
+ }
104
+
105
+ //Render Facebook Like button
106
+ //https://developers.facebook.com/docs/reference/plugins/like/
107
+
108
+ function pib_share_facebook() {
109
+ ?>
110
+ <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fpinterestplugin.com%2F&amp;send=false&amp;layout=button_count&amp;width=96&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=144056775628952" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:96px; height:21px;" allowTransparency="true"></iframe>
111
+ <?php
112
+ }
113
+
114
+ //Render Twitter button
115
+ //https://twitter.com/about/resources/buttons
116
+ //https://dev.twitter.com/docs/tweet-button (scroll down for iframe button version)
117
+
118
+ function pib_share_twitter() {
119
+ ?>
120
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pinterestplugin.com" data-text="I'm using the Pinterest &quot;Pin It&quot; Button Plugin for WordPress. It rocks!">Tweet</a>
121
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
122
+ <?php
123
+ }
124
+
125
+ //Render Pin It button
126
+ //Render in iframe otherwise it messes up the WP admin left menu
127
+
128
+ function pib_share_pinterest() {
129
+ ?>
130
+ <a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fimg%2Fpinterest-pin-it-button-plugin-for-wordpress.png&description=Add%20a%20Simple%20and%20Flexible%20%22Pin%20It%22%20Button%20to%20Your%20WordPress%20Site%20--%20http%3A%2F%2Fpinterestplugin.com%2F" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
131
+ <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
132
+ <?php
133
+ }
134
+
135
+ //Render Google + button
136
+ //https://developers.google.com/+/plugins/+1button/
137
+
138
+ function pib_share_gplus() {
139
+ ?>
140
+ <div class="g-plusone" data-size="medium" data-href="http://pinterestplugin.com"></div>
141
+
142
+ <script type="text/javascript">
143
+ (function() {
144
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
145
+ po.src = 'https://apis.google.com/js/plusone.js';
146
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
147
+ })();
148
+ </script>
149
+ <?php
150
+ }
151
+
152
+ //Add first-install pointer CSS/JS & functionality
153
+
154
+ function pib_add_admin_css_js_pointer() {
155
+ wp_enqueue_style( 'wp-pointer' );
156
+ wp_enqueue_script( 'wp-pointer' );
157
+
158
+ add_action( 'admin_print_footer_scripts', 'pib_admin_print_footer_scripts' );
159
+ }
160
+
161
+ add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js_pointer' );
162
+
163
+ //Add pointer popup message when plugin first installed
164
+
165
+ function pib_admin_print_footer_scripts() {
166
+ //Check option to hide pointer after initial display
167
+ if ( !get_option( 'pib_hide_pointer' ) ) {
168
+ $pointer_content = '<h3>' . _( 'Ready to be Pinned?', 'pib' ) . '</h3>';
169
+ $pointer_content .= '<p>' . _( 'Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. ' .
170
+ 'Now just configure your settings and start getting Pinned!', 'pib' ) . '</p>';
171
+
172
+ $url = admin_url( 'admin.php?page=' . PIB_BASE_NAME );
173
+
174
+ ?>
175
+
176
+ <script type="text/javascript">
177
+ //<![CDATA[
178
+ jQuery(document).ready( function($) {
179
+ $("#menu-plugins").pointer({
180
+ content: '<?php echo $pointer_content; ?>',
181
+ buttons: function( event, t ) {
182
+ button = $('<a id="pointer-close" class="button-secondary"><?php _e( 'Close', 'pib' ); ?></a>');
183
+ button.bind("click.pointer", function() {
184
+ t.element.pointer("close");
185
+ });
186
+ return button;
187
+ },
188
+ position: "left",
189
+ close: function() { }
190
+
191
+ }).pointer("open");
192
+
193
+ $("#pointer-close").after('<a id="pointer-primary" class="button-primary" style="margin-right: 5px;" href="<?php echo $url; ?>">' +
194
+ '<?php _e( 'Pin It Button Settings', 'pib' ); ?>');
195
+ });
196
+ //]]>
197
+ </script>
198
+
199
+ <?php
200
+
201
+ //Update option so this pointer is never seen again
202
+ update_option( 'pib_hide_pointer', 1 );
203
+ }
204
+ }
inc/admin-display-functions-shared.php ADDED
@@ -0,0 +1,550 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //*** Admin Display Functions - Lite & Pro Shared ***
4
+
5
+ function pib_settings_page() {
6
+ global $pib_options;
7
+
8
+ $custom_css = trim( $pib_options['custom_css'] );
9
+ ?>
10
+
11
+ <div class="wrap">
12
+ <?php screen_icon( 'pib-icon32' ); ?>
13
+ <h2><?php _e( 'Pinterest "Pin It" Button ' . pib_pro_or_lite() . ' Settings', 'pib' ); ?></h2>
14
+
15
+ <?php ( PIB_IS_PRO ? '' : pib_upgrade_banner_top() ); ?>
16
+
17
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
18
+
19
+ <!-- Fixed right sidebar like WP post edit screen -->
20
+
21
+ <div id="side-info-column" class="inner-sidebar">
22
+ <div id="side-sortables" class="meta-box-sortables ui-sortable">
23
+ <?php ( PIB_IS_PRO ? pib_settings_sidebar_pro() : pib_settings_sidebar_lite() ); ?>
24
+ </div>
25
+ </div>
26
+
27
+ <div id="post-body">
28
+ <div id="post-body-content">
29
+ <div class="meta-box-sortables ui-sortable">
30
+ <?php settings_errors(); //Display status messages after action ("settings saved", errors) ?>
31
+
32
+ <form method="post" action="options.php">
33
+ <?php settings_fields( 'pib_settings_group' ); ?>
34
+
35
+ <?php if ( PIB_IS_PRO ) { pib_license_key_input(); } ?>
36
+
37
+ <div class="postbox pib-postbox">
38
+ <?php pib_handlediv(); ?>
39
+ <h3 class="hndle pib-hndle"><?php _e( 'Button Click Action & Pin Count Bubble', 'pib' ); ?></h3>
40
+
41
+ <table class="form-table inside">
42
+ <tr valign="top">
43
+ <td>
44
+ <input type="radio" id="user_selects_image" value="user_selects_image" name="pib_options[button_style]"
45
+ <?php checked( ( $pib_options['button_style'] == 'user_selects_image' ) || empty( $pib_options['button_style'] ) ); ?> />
46
+ <label for="user_selects_image"><?php _e( '<strong>User selects image</strong> from popup (no iframe)', 'pib' ); ?></label>
47
+ </td>
48
+ </tr>
49
+ <tr valign="top">
50
+ <td>
51
+ <input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
52
+ <?php checked( $pib_options['button_style'], 'image_selected' ); ?> />
53
+ <label for="image_selected"><?php _e( 'Image is <strong>pre-selected</strong> (embed code/iframe from Pinterest)', 'pib' ); ?></label>
54
+ </td>
55
+ </tr>
56
+ <tr valign="top">
57
+ <td class="pib-pad-cell-top">
58
+ <label for="count_layout" class="pib-plain-label"><?php _e( 'Pin Count:' ); ?></label>
59
+ <select id="count_layout" name="pib_options[count_layout]">
60
+ <option value="none" <?php selected( ( $pib_options['count_layout'] == 'none' ) || empty( $pib_options['count_layout'] ) ); ?>><?php _e( 'No Count' ); ?></option>
61
+ <option value="horizontal" <?php selected( $pib_options['count_layout'], 'horizontal' ); ?>><?php _e( 'Horizontal' ); ?></option>
62
+ <option value="vertical" <?php selected( $pib_options['count_layout'], 'vertical' ); ?>><?php _e( 'Vertical' ); ?></option>
63
+ </select>
64
+ </td>
65
+ </tr>
66
+ <tr valign="top">
67
+ <td>
68
+ <input type="checkbox" id="always_show_count" name="pib_options[always_show_count]" value="1"
69
+ <?php checked( (bool)$pib_options['always_show_count'] ); ?> />
70
+ <label for="always_show_count"><?php _e( 'Always show pin count', 'pib' ); ?></label>
71
+ </td>
72
+ </tr>
73
+ <tr valign="top">
74
+ <td>
75
+ <input type="checkbox" id="use_featured_image" name="pib_options[use_featured_image]" value="1"
76
+ <?php checked( (bool)$pib_options['use_featured_image'] ); ?>
77
+ <?php pib_lite_disabled_attr(); ?> />
78
+ <label for="use_featured_image" class="<?php pib_lite_disabled_class(); ?>">
79
+ <?php _e( 'Use featured image (pre-selected only)', 'pib' ); ?></label>
80
+ <?php pib_pro_label(); ?>
81
+ </td>
82
+ </tr>
83
+ <tr valign="top">
84
+ <td class="pib-pad-cell-top">
85
+ <?php _e( 'To override defaults for the website address (URL) to pin, image to pin and/or pin description for a post, ' .
86
+ 'go to the edit screen for the post (usually at the bottom).', 'pib' ); ?>
87
+ </td>
88
+ </tr>
89
+ <tr valign="top">
90
+ <td>
91
+ <?php _e( 'Button style setting applies to <strong>all</strong> "Pin It" buttons including widgets and shortcodes. ', 'pib' ); ?>
92
+ </td>
93
+ </tr>
94
+ </table>
95
+ </div>
96
+
97
+ <div class="postbox pib-postbox">
98
+ <?php pib_handlediv(); ?>
99
+ <h3 class="hndle pib-hndle">
100
+ <?php _e( 'Custom Button Image', 'pib' ); ?>
101
+ <?php pib_pro_label(); ?>
102
+ </h3>
103
+
104
+ <table class="form-table inside">
105
+
106
+ <?php if ( PIB_IS_PRO ): ?>
107
+
108
+ <tr valign="top">
109
+ <td>
110
+ <input type="checkbox" id="use_custom_img_btn" name="pib_options[use_custom_img_btn]" value="1"
111
+ <?php checked( (bool)$pib_options['use_custom_img_btn'] ); ?> />
112
+ <label for="use_custom_img_btn">
113
+ <?php _e( 'Enable custom button image', 'pib' ); ?>
114
+ </label>
115
+ </td>
116
+ </tr>
117
+ <tr id="custom_img_btn_select_row" valign="top">
118
+ <td>
119
+ <table>
120
+ <tr>
121
+ <td>Current image:</td>
122
+ <td>
123
+ <img id="custom_btn_img" src="<?php echo ( !empty( $pib_options['custom_btn_img_url'] ) ? $pib_options['custom_btn_img_url'] : PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL ); ?>" />
124
+ </td>
125
+ <td>
126
+ <a id="custom_btn_img_select_link" href="#TB_inline?width=600&amp;height=400&amp;inlineId=custom_img_btn_selector" class="thickbox"
127
+ title="Select a Custom Button"><?php _e( 'Select New Button Image', 'pib' ); ?></a>
128
+ </td>
129
+
130
+ <input type="hidden" id="custom_btn_img_url" name="pib_options[custom_btn_img_url]"
131
+ value="<?php echo ( !empty( $pib_options['custom_btn_img_url'] ) ? $pib_options['custom_btn_img_url'] : PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL ); ?>" />
132
+
133
+ <!-- Thickbox popup image selector div in separate function (Pro) -->
134
+ </tr>
135
+ </table>
136
+ </td>
137
+ </tr>
138
+
139
+ <?php else: ?>
140
+
141
+ <tr valign="top">
142
+ <td>
143
+ <table id="custom_img_btn_lite_row" class="pib-no-margin">
144
+ <tr>
145
+ <td><?php _e( 'Custom button image examples', 'pib' ); ?>:</td>
146
+ <td>
147
+ <img src="<?php echo PIB_IMAGES_URL . 'pin-it-button-pro-custom-image-examples-small.png'; ?>" alt="Custom button image preview" />
148
+ </td>
149
+ <td>
150
+ <strong><a href="#TB_inline?width=600&amp;height=400&amp;inlineId=custom_img_btn_examples" class="thickbox"
151
+ title="Custom Button Image Examples"><?php _e( 'See More Button Images', 'pib' ); ?></a></strong>
152
+ </td>
153
+ </tr>
154
+ </table>
155
+ </td>
156
+ </tr>
157
+ <tr valign="top">
158
+ <td>
159
+ <div class="pib-upgrade-to-pro">
160
+ <?php _e( 'Available in "Pin It" Button Pro. ', 'pib' ); ?>
161
+ <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
162
+ </div>
163
+ </td>
164
+ </tr>
165
+
166
+ <?php endif; ?>
167
+ </table>
168
+ </div>
169
+
170
+ <div class="postbox pib-postbox">
171
+ <?php pib_handlediv(); ?>
172
+ <h3 class="hndle pib-hndle">
173
+ <?php _e( 'Facebook, Twitter & Google +1 Buttons', 'pib' ); ?>
174
+ <?php pib_pro_label(); ?>
175
+ </h3>
176
+
177
+ <table class="form-table inside">
178
+
179
+ <?php if ( PIB_IS_PRO ): ?>
180
+
181
+ <tr valign="top">
182
+ <td>
183
+ <input type="checkbox" id="use_other_sharing_buttons" name="pib_options[use_other_sharing_buttons]" value="1"
184
+ <?php checked( (bool)$pib_options['use_other_sharing_buttons'] ); ?> />
185
+ <label for="use_other_sharing_buttons">
186
+ <?php _e( 'Enable other social sharing buttons (Facebook, Twitter and/or Google +1)', 'pib' ); ?>
187
+ </label>
188
+ </td>
189
+ </tr>
190
+
191
+ <?php endif; ?>
192
+
193
+ <tr valign="top">
194
+ <td class="pib-pad-cell-top">
195
+ <label id="share_btn_label" class="pib-plain-label"><?php _e( 'Button order (left to right):', 'pib' ); ?></label>
196
+
197
+ <select id="share_btn_1" name="pib_options[share_btn_1]">
198
+ <option value="none" <?php selected( ( $pib_options['share_btn_1'] == 'none' ) || empty( $pib_options['share_btn_1'] ) ); ?>>-- <?php _e( 'None', 'pib' ); ?> --</option>
199
+ <option value="pinterest" <?php selected( $pib_options['share_btn_1'], 'pinterest' ); ?>>Pinterest</option>
200
+ <option value="facebook" <?php selected( $pib_options['share_btn_1'], 'facebook' ); ?>>Facebook</option>
201
+ <option value="twitter" <?php selected( $pib_options['share_btn_1'], 'twitter' ); ?>>Twitter</option>
202
+ <option value="gplus" <?php selected( $pib_options['share_btn_1'], 'gplus' ); ?>>Google +1</option>
203
+ </select>
204
+
205
+ <select id="share_btn_2" name="pib_options[share_btn_2]">
206
+ <option value="none" <?php selected( ( $pib_options['share_btn_2'] == 'none' ) || empty( $pib_options['share_btn_2'] ) ); ?>>-- <?php _e( 'None', 'pib' ); ?> --</option>
207
+ <option value="pinterest" <?php selected( $pib_options['share_btn_2'], 'pinterest' ); ?>>Pinterest</option>
208
+ <option value="facebook" <?php selected( $pib_options['share_btn_2'], 'facebook' ); ?>>Facebook</option>
209
+ <option value="twitter" <?php selected( $pib_options['share_btn_2'], 'twitter' ); ?>>Twitter</option>
210
+ <option value="gplus" <?php selected( $pib_options['share_btn_2'], 'gplus' ); ?>>Google +1</option>
211
+ </select>
212
+
213
+ <select id="share_btn_3" name="pib_options[share_btn_3]">
214
+ <option value="none" <?php selected( ( $pib_options['share_btn_3'] == 'none' ) || empty( $pib_options['share_btn_3'] ) ); ?>>-- <?php _e( 'None', 'pib' ); ?> --</option>
215
+ <option value="pinterest" <?php selected( $pib_options['share_btn_3'], 'pinterest' ); ?>>Pinterest</option>
216
+ <option value="facebook" <?php selected( $pib_options['share_btn_3'], 'facebook' ); ?>>Facebook</option>
217
+ <option value="twitter" <?php selected( $pib_options['share_btn_3'], 'twitter' ); ?>>Twitter</option>
218
+ <option value="gplus" <?php selected( $pib_options['share_btn_3'], 'gplus' ); ?>>Google +1</option>
219
+ </select>
220
+
221
+ <select id="share_btn_4" name="pib_options[share_btn_4]">
222
+ <option value="none" <?php selected( ( $pib_options['share_btn_4'] == 'none' ) || empty( $pib_options['share_btn_4'] ) ); ?>>-- <?php _e( 'None', 'pib' ); ?> --</option>
223
+ <option value="pinterest" <?php selected( $pib_options['share_btn_4'], 'pinterest' ); ?>>Pinterest</option>
224
+ <option value="facebook" <?php selected( $pib_options['share_btn_4'], 'facebook' ); ?>>Facebook</option>
225
+ <option value="twitter" <?php selected( $pib_options['share_btn_4'], 'twitter' ); ?>>Twitter</option>
226
+ <option value="gplus" <?php selected( $pib_options['share_btn_4'], 'gplus' ); ?>>Google +1</option>
227
+ </select>
228
+
229
+ </td>
230
+ </tr>
231
+
232
+ <?php if ( !PIB_IS_PRO ): ?>
233
+
234
+ <tr valign="top">
235
+ <td class="pib-pad-cell-top">
236
+ <div class="pib-upgrade-to-pro">
237
+ <?php _e( 'Available in "Pin It" Button Pro.', 'pib' ); ?>
238
+ <a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Upgrade Now', 'pib' ); ?></a>
239
+ </div>
240
+ </td>
241
+ </tr>
242
+
243
+ <?php endif; ?>
244
+ </table>
245
+ </div>
246
+
247
+ <div class="pib-submit-settings">
248
+ <input name="submit" type="submit" value="<?php _e( 'Save Changes', 'pib' ); ?>" class="button-primary" />
249
+ </div>
250
+
251
+ <div class="postbox pib-postbox">
252
+ <?php pib_handlediv(); ?>
253
+ <h3 class="hndle pib-hndle"><?php _e( 'Page/Post Visibility', 'pib' ); ?></h3>
254
+
255
+ <table class="form-table inside">
256
+ <tr valign="top">
257
+ <td>
258
+ <?php _e( 'What types of pages should the button appear on?', 'pib' ); ?>
259
+ </td>
260
+ </tr>
261
+ <tr valign="top">
262
+ <td>
263
+ <input id="display_home_page" name="pib_options[display_home_page]" type="checkbox" value="1"
264
+ <?php checked( (bool)$pib_options['display_home_page'] ); ?> />
265
+ <label for="display_home_page"><?php _e( 'Blog Home Page (or Latest Posts Page)', 'pib' ); ?></label>
266
+ </td>
267
+ </tr>
268
+ <tr valign="top">
269
+ <td>
270
+ <input id="display_front_page" name="pib_options[display_front_page]" type="checkbox" value="1"
271
+ <?php checked( (bool)$pib_options['display_front_page'] ); ?> />
272
+ <label for="display_front_page"><?php _e( 'Front Page (different from Home Page only if set in Settings > Reading)', 'pib' ); ?></label>
273
+ </td>
274
+ </tr>
275
+ <tr valign="top">
276
+ <td>
277
+ <input id="display_posts" name="pib_options[display_posts]" type="checkbox" value="1"
278
+ <?php checked( (bool)$pib_options['display_posts'] ); ?> />
279
+ <label for="display_posts"><?php _e( 'Individual Posts', 'pib' ); ?></label>
280
+ </td>
281
+ </tr>
282
+ <tr valign="top">
283
+ <td>
284
+ <input id="display_pages" name="pib_options[display_pages]" type="checkbox" value="1"
285
+ <?php checked( (bool)$pib_options['display_pages'] ); ?> />
286
+ <label for="display_pages"><?php _e( 'WordPress Static "Pages"', 'pib' ); ?></label>
287
+ </td>
288
+ </tr>
289
+ <tr valign="top">
290
+ <td>
291
+ <input id="display_archives" name="pib_options[display_archives]" type="checkbox" value="1"
292
+ <?php checked( (bool)$pib_options['display_archives'] ); ?> />
293
+ <label for="display_archives"><?php _e( 'Archives (includes Category, Tag, Author and date-based pages)', 'pib' ); ?></label>
294
+ </td>
295
+ </tr>
296
+ <tr valign="top">
297
+ <td class="pib-pad-cell-top">
298
+ <?php _e( 'To hide the "Pin It" button for a specific post, page or category, go to the edit screen for that post, page or category,
299
+ scroll down to the bottom, and uncheck the "Show" checkbox.', 'pib' ); ?>
300
+ </td>
301
+ </tr>
302
+ <tr valign="top">
303
+ <td>
304
+ <?php _e( 'Go to Appearance', 'pib' ); ?> &rarr; <a href="<?php echo admin_url( 'widgets.php' ); ?>"><?php _e( 'Widgets', 'pib' ); ?></a>
305
+ <?php _e( 'to add a "Pin It" button to your sidebar.', 'pib' ); ?>
306
+ </td>
307
+ </tr>
308
+ </table>
309
+ </div>
310
+
311
+ <div class="postbox pib-postbox">
312
+ <?php pib_handlediv(); ?>
313
+ <h3 class="hndle pib-hndle"><?php _e( 'Page/Post Placement', 'pib' ); ?></h3>
314
+
315
+ <table class="form-table inside">
316
+ <tr valign="top">
317
+ <td>
318
+ <?php _e( 'Where on each page should the button appear?', 'pib' ); ?>
319
+ </td>
320
+ </tr>
321
+ <tr valign="top">
322
+ <td>
323
+ <input id="display_above_content" name="pib_options[display_above_content]" type="checkbox" value="1"
324
+ <?php checked( (bool)$pib_options['display_above_content'] ); ?> />
325
+ <label for="display_above_content"><?php _e( 'Above Content', 'pib' ); ?></label>
326
+ </td>
327
+ </tr>
328
+ <tr valign="top">
329
+ <td>
330
+ <input id="display_below_content" name="pib_options[display_below_content]" type="checkbox" value="1"
331
+ <?php checked( (bool)$pib_options['display_below_content'] ); ?> />
332
+ <label for="display_below_content"><?php _e( 'Below Content', 'pib' ); ?></label>
333
+ </td>
334
+ </tr>
335
+ <tr valign="top">
336
+ <td>
337
+ <input id="display_on_post_excerpts" name="pib_options[display_on_post_excerpts]" type="checkbox" value="1"
338
+ <?php checked( (bool)$pib_options['display_on_post_excerpts'] ); ?> />
339
+ <label for="display_on_post_excerpts"><?php _e( 'On Post Excerpts', 'pib' ); ?></label>
340
+ </td>
341
+ </tr>
342
+ <tr valign="top">
343
+ <td>
344
+ <?php _e( 'Currently, only the button style <strong>"image is pre-selected"</strong> will use the individual post URL when a visitor
345
+ pins on a post excerpt.', 'pib' ); ?>
346
+ </td>
347
+ </tr>
348
+ </table>
349
+ </div>
350
+
351
+ <div class="postbox pib-postbox">
352
+ <?php pib_handlediv(); ?>
353
+ <h3 class="hndle pib-hndle"><?php _e( 'Custom CSS & Styling', 'pib' ); ?></h3>
354
+
355
+ <table class="form-table inside">
356
+ <tr valign="top">
357
+ <td>
358
+ <label for="custom_css"><?php _e( 'Additional CSS to add', 'pib' ); ?>:</label>
359
+ </td>
360
+ </tr>
361
+ <tr valign="top">
362
+ <td>
363
+ <textarea id="custom_css" name="pib_options[custom_css]" rows="6"><?php echo $custom_css; ?></textarea>
364
+ </td>
365
+ </tr>
366
+ <tr valign="top">
367
+ <td>
368
+ <input id="remove_div" name="pib_options[remove_div]" type="checkbox" value="1"
369
+ <?php checked( (bool)$pib_options['remove_div'] ); ?> />
370
+ <label for="remove_div">
371
+ <?php _e( 'Remove div tag surrounding regular button', 'pib' ); ?> (<code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code>).
372
+ <?php _e( 'Already removed if other social sharing buttons enabled.', 'pib' ); ?>
373
+
374
+ <?php if ( !PIB_IS_PRO ): ?>
375
+ (<strong><a href="<?php echo PIB_UPGRADE_URL; ?>" target="_blank" class="external"><?php _e( 'Pro Feature', 'pib' ); ?></a></strong>)
376
+ <?php endif; ?>
377
+ </label>
378
+ </td>
379
+ </tr>
380
+ </table>
381
+ </div>
382
+
383
+ <div class="postbox pib-postbox">
384
+ <?php pib_handlediv(); ?>
385
+ <h3 class="hndle pib-hndle"><?php _e( 'Shortcode Instructions', 'pib' ); ?></h3>
386
+
387
+ <div class="inside">
388
+ <p>
389
+ Use the shortcode <code>[pinit]</code> to display the button within your content.
390
+ </p>
391
+ <p>
392
+ Use the function <code><?php echo htmlentities( '<?php echo do_shortcode(\'[pinit]\'); ?>' ); ?></code>
393
+ to display within template or theme files.
394
+ </p>
395
+ <p><strong>Shortcode parameters</strong></p>
396
+ <p>
397
+ - count: none (default), horizontal, vertical<br/>
398
+ - url: URL of the web page to be pinned (defaults to current post/page URL, but <em>must specify</em> if on home or index page)<br/>
399
+ - image_url: URL of the image to be pinned (defaults to first image in post)<br/>
400
+ - description: description of the pin (defaults to post title)<br/>
401
+ - float: none (default), left, right<br/>
402
+ - remove_div: false (default), true -- if true removes surrounding div tag
403
+ (<code><?php echo htmlentities( '<div class="pin-it-btn-wrapper-shortcode"></div>' ); ?></code>), which also removes float setting<br/>
404
+ - always_show_count: false (default), true -- if true will show count even if zero
405
+ </p>
406
+ <p><strong>Examples</strong></p>
407
+ <p>
408
+ <code>[pinit count="horizontal"]</code><br/>
409
+ <code>[pinit count="vertical" url="http://www.mysite.com" image_url="http://www.mysite.com/myimage.jpg"
410
+ description="My favorite image!" float="right"]</code><br/>
411
+ </p>
412
+ </div>
413
+ </div>
414
+
415
+ <div class="pib-submit-settings">
416
+ <input name="submit" type="submit" value="<?php _e( 'Save Changes', 'pib' ); ?>" class="button-primary" />
417
+ </div>
418
+
419
+ </form>
420
+ </div>
421
+ </div>
422
+ </div>
423
+ </div>
424
+
425
+ <?php echo ( PIB_IS_PRO ? pib_custom_btn_img_selector_popup() : pib_custom_btn_img_examples_popup() ); ?>
426
+
427
+ </div>
428
+
429
+ <?php
430
+ }
431
+
432
+ //Add Settings link to the left of Deactivate on plugins list page
433
+
434
+ function pib_plugin_settings_link( $links ) {
435
+ $url = admin_url( 'admin.php?page=' . PIB_BASE_NAME );
436
+ $settings_link = '<a href="' . $url . '">Settings</a>';
437
+ array_unshift( $links, $settings_link );
438
+ return $links;
439
+ }
440
+
441
+ add_filter( 'plugin_action_links_' . PIB_BASE_NAME, 'pib_plugin_settings_link' );
442
+
443
+ //Handle div tag html
444
+
445
+ function pib_handlediv() {
446
+ ?>
447
+ <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
448
+ <?php
449
+ }
450
+
451
+ //Subscribe by email admin section
452
+
453
+ function pib_newsletter_subscribe() {
454
+ ?>
455
+
456
+ <div class="postbox">
457
+ <?php pib_handlediv(); ?>
458
+ <h3 class="hndle pib-hndle"><?php _e( 'Subscribe by Email', 'tpp' ); ?></h3>
459
+
460
+ <div class="inside">
461
+ <p><?php _e( 'Subscribe to get notified of important updates and news for our Pinterest plugins.', 'pib' ); ?></p>
462
+ &raquo; <a href="http://pinterestplugin.com/newsletter-from-plugin" target="_blank" class="external">
463
+ <?php _e( 'Get Updates', 'pib' ); ?></a>
464
+ </div>
465
+ </div>
466
+
467
+ <?php
468
+ }
469
+
470
+ //Plugin news feed
471
+
472
+ function pib_plugin_news() {
473
+ ?>
474
+
475
+ <div class="postbox">
476
+ <?php pib_handlediv(); ?>
477
+ <h3 class="hndle pib-hndle"><?php _e( 'Pinterest Plugin News', 'pib' ); ?></h3>
478
+
479
+ <div class="inside">
480
+ <? echo pib_rss_news(); ?>
481
+ </div>
482
+ </div>
483
+
484
+ <?php
485
+ }
486
+
487
+ //Render rss items from pinterestplugin.com
488
+ //http://codex.wordpress.org/Function_Reference/fetch_feed
489
+
490
+ function pib_rss_news() {
491
+ // Get RSS Feed(s)
492
+ include_once( ABSPATH . WPINC . '/feed.php' );
493
+
494
+ // Get a SimplePie feed object from the specified feed source.
495
+ $rss = fetch_feed( 'http://pinterestplugin.com/feed/' );
496
+
497
+ if ( !is_wp_error( $rss ) ) {
498
+ // Checks that the object is created correctly
499
+ // Figure out how many total items there are, but limit it to 5.
500
+ $maxitems = $rss->get_item_quantity( 3 );
501
+
502
+ // Build an array of all the items, starting with element 0 (first element).
503
+ $rss_items = $rss->get_items( 0, $maxitems );
504
+ }
505
+
506
+ ?>
507
+
508
+ <ul>
509
+ <?php if ($maxitems == 0): ?>
510
+ <li><?php _e( 'No items.', 'pib' ); ?></li>
511
+ <?php else: ?>
512
+ <?php
513
+ // Loop through each feed item and display each item as a hyperlink.
514
+ foreach ( $rss_items as $item ): ?>
515
+ <li>
516
+ &raquo; <a href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank" class="external">
517
+ <?php echo esc_html( $item->get_title() ); ?></a>
518
+ </li>
519
+ <?php endforeach; ?>
520
+ <?php endif; ?>
521
+ </ul>
522
+
523
+ <?php
524
+ }
525
+
526
+ //*** Functions depending on Pro vs Lite versions ***
527
+
528
+ //Return "Pro" or blank string (no need to show "Lite")
529
+
530
+ function pib_pro_or_lite() {
531
+ return ( PIB_IS_PRO ? 'Pro' : '' );
532
+ }
533
+
534
+ //Lite version: Add disabled attribute
535
+
536
+ function pib_lite_disabled_attr() {
537
+ if ( !PIB_IS_PRO ) { echo 'disabled="disabled"'; }
538
+ }
539
+
540
+ //Lite version: Add disabled class name
541
+
542
+ function pib_lite_disabled_class() {
543
+ if ( !PIB_IS_PRO ) { echo 'disabled'; }
544
+ }
545
+
546
+ function pib_pro_label() {
547
+ if ( !PIB_IS_PRO ) {
548
+ echo '<span class="pib-pro-label">' . __( 'Pro Feature', 'pib' ) . '</span>';
549
+ }
550
+ }
inc/admin-general-functions-shared.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //*** Admin General Functions - Lite & Pro Shared ***
4
+
5
+ //Plugin installation/activation
6
+
7
+ function pib_install() {
8
+ global $pib_options;
9
+
10
+ //Deactivate plugin if WP version too low
11
+ if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
12
+ deactivate_plugins( basename( __FILE__ ) );
13
+ }
14
+
15
+ //Setup default options for values that don't exist and need to be set to 1/true/value (not 0/false/blank)
16
+ //Done this way to preseve options saved in previous versions
17
+ if ( !isset( $pib_options['button_style'] ) ) { $pib_options['button_style'] = 'user_selects_image'; }
18
+ if ( !isset( $pib_options['count_layout'] ) ) { $pib_options['count_layout'] = 'none'; }
19
+
20
+ if ( !isset( $pib_options['custom_btn_img_url'] ) ) { $pib_options['custom_btn_img_url'] = PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL; }
21
+
22
+ if ( !isset( $pib_options['share_btn_1'] ) ) { $pib_options['share_btn_1'] = 'pinterest'; }
23
+ if ( !isset( $pib_options['share_btn_2'] ) ) { $pib_options['share_btn_2'] = 'facebook'; }
24
+ if ( !isset( $pib_options['share_btn_3'] ) ) { $pib_options['share_btn_3'] = 'twitter'; }
25
+ if ( !isset( $pib_options['share_btn_4'] ) ) { $pib_options['share_btn_4'] = 'gplus'; }
26
+
27
+ if ( !isset( $pib_options['display_home_page'] ) ) { $pib_options['display_home_page'] = 1; }
28
+ if ( !isset( $pib_options['display_posts'] ) ) { $pib_options['display_posts'] = 1; }
29
+ if ( !isset( $pib_options['display_pages'] ) ) { $pib_options['display_pages'] = 1; }
30
+ if ( !isset( $pib_options['display_below_content'] ) ) { $pib_options['display_below_content'] = 1; }
31
+
32
+ //Save default option values
33
+ update_option( 'pib_options', $pib_options );
34
+ }
35
+
36
+ register_activation_hook( __FILE__, 'pib_install' );
37
+
38
+ //Register settings
39
+
40
+ function pib_register_settings() {
41
+ register_setting( 'pib_settings_group', 'pib_options' );
42
+ }
43
+
44
+ add_action( 'admin_init', 'pib_sharing_add_meta_box' );
45
+ add_action( 'admin_init', 'pib_register_settings' );
46
+
47
+ //Add settings page to admin menu
48
+ //Use $page variable to load CSS/JS ONLY for this plugin's admin page
49
+
50
+ function pib_create_menu() {
51
+ //add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
52
+ $page = add_menu_page( __( 'Pin It Button ' . pib_pro_or_lite() . ' Settings', 'pib' ), __( 'Pin It Button ' . pib_pro_or_lite(), 'pib' ), 'manage_options',
53
+ 'pib_pin_it_button', 'pib_settings_page', PIB_IMAGES_URL . 'pinterest-button-icon-small.png' );
54
+
55
+ add_action( 'admin_print_styles-' . $page, 'pib_add_admin_css_js' );
56
+ }
57
+
58
+ add_action( 'admin_menu', 'pib_create_menu' );
59
+
60
+ //Add Admin CSS/JS
61
+
62
+ function pib_add_admin_css_js() {
63
+ wp_enqueue_script( 'jquery' );
64
+
65
+ //Add thickbox JS/CSS for custom button image gallery popup (and button examples)
66
+ add_thickbox();
67
+
68
+ wp_enqueue_style( 'pinterest-pin-it-button', PIB_CSS_URL . 'pinterest-pin-it-button-admin.css' );
69
+ wp_enqueue_script( 'pinterest-pin-it-button', PIB_JS_URL . 'pinterest-pin-it-button-admin.js', array( 'jquery' ), '' );
70
+ }
inc/admin-pin-it-button-iframe.html DELETED
@@ -1,8 +0,0 @@
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>
 
 
 
 
 
 
 
 
inc/admin-settings.php DELETED
@@ -1,344 +0,0 @@
1
- <?php
2
-
3
- //Create settings page
4
-
5
- function pib_create_settings_page() {
6
- global $pib_options;
7
- $custom_css = trim( $pib_options['custom_css'] );
8
- ?>
9
-
10
- <div class="wrap">
11
- <a href="http://pinterestplugin.com/" target="_blank"><div id="pinterest-button-icon-32" class="icon32"
12
- style="background: url(<?php echo plugins_url( '/img/pinterest-button-icon-med.png', dirname( __FILE__ ) ); ?>) no-repeat;"></div></a>
13
- <h2><?php _e( 'Pinterest "Pin It" Button Settings', 'pib' ); ?></h2>
14
-
15
- <div id="poststuff" class="metabox-holder has-right-sidebar">
16
-
17
- <!-- Fixed right sidebar like WP post edit screen -->
18
- <div id="side-info-column" class="inner-sidebar">
19
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
20
- <div class="pib-admin-banner">
21
- <a href="http://pinterestplugin.com/ad-tpp-from-pib" target="_blank">
22
- <img src="http://cdn.pinterestplugin.com/img/top-pinned-posts-ad-01.jpg" alt="Top Pinned Posts Pinterest Plugin for WordPress"></img>
23
- </a>
24
- </div>
25
-
26
- <div class="postbox">
27
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
28
- <h3 class="hndle pib-hndle"><?php _e( 'Spread the Word', 'pib' ); ?></h3>
29
-
30
- <div class="inside">
31
- <p><?php _e( 'Like this plugin? A share would be awesome!', 'pib' ); ?></p>
32
-
33
- <table id="share_plugin_buttons">
34
- <tr>
35
- <td><?php echo pib_share_twitter(); ?></td>
36
- <td><?php echo pib_share_pinterest(); ?></td>
37
- <td><?php echo pib_share_facebook(); ?></td>
38
- </tr>
39
- </table>
40
-
41
- <p>
42
- &raquo; <a href="http://wordpress.org/extend/plugins/pinterest-pin-it-button/" target="_blank" class="external">
43
- <?php _e( 'Rate it on WordPress', 'pib' ); ?></a>
44
- </p>
45
- </div>
46
- </div>
47
-
48
- <div class="postbox">
49
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
50
- <h3 class="hndle pib-hndle"><?php _e( 'Plugin Support', 'tpp' ); ?></h3>
51
-
52
- <div class="inside">
53
- <p>
54
- &raquo; <a href="http://pinterestplugin.com/support-pin-it-button" target="_blank" class="external">
55
- <?php _e( 'Support & Knowledge Base', 'pib' ); ?></a>
56
- </p>
57
- <p>
58
- <?php _e( 'Email support provided to licensed users only.', 'pib' ); ?>
59
- </p>
60
- <p>
61
- &raquo; <strong><a href="http://pinterestplugin.com/buy-support-pin-it-button" target="_blank" class="external">
62
- <?php _e( 'See Support Pricing', 'pib' ); ?></a></strong>
63
- </p>
64
- </div>
65
- </div>
66
-
67
- <div class="postbox">
68
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
69
- <h3 class="hndle pib-hndle"><?php _e( 'More Pinterest Plugins', 'pib' ); ?></h3>
70
-
71
- <div class="inside">
72
- <ul>
73
- <li>&raquo; <a href="http://pinterestplugin.com/top-pinned posts" target="_blank" class="external">Top Pinned Posts</a></li>
74
- <li>&raquo; <a href="http://pinterestplugin.com/follow-button" target="_blank" class="external">"Follow" Button</a></li>
75
- <li>&raquo; <a href="http://pinterestplugin.com/pinterest-block" target="_blank" class="external">Pinterest Block</a></li>
76
- </ul>
77
- </div>
78
- </div>
79
-
80
- <div class="postbox">
81
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
82
- <h3 class="hndle pib-hndle"><?php _e( 'Pinterest Plugin News', 'pib' ); ?></h3>
83
-
84
- <div class="inside">
85
- <? echo pib_rss_news(); ?>
86
- </div>
87
- </div>
88
-
89
- <div class="postbox">
90
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
91
- <h3 class="hndle pib-hndle"><?php _e( 'Subscribe by Email', 'pib' ); ?></h3>
92
-
93
- <div class="inside">
94
- <p><?php _e( 'Want to know when new Pinterest plugins and features are released?', 'pib' ); ?></p>
95
- &raquo; <strong><a href="http://pinterestplugin.com/newsletter-from-plugin" target="_blank" class="external">
96
- <?php _e( 'Get Updates', 'pib' ); ?></a></strong>
97
- </div>
98
- </div>
99
- </div>
100
- </div>
101
-
102
- <div id="post-body">
103
- <div id="post-body-content">
104
- <div class="meta-box-sortables ui-sortable">
105
- <?php settings_errors(); //Display status messages after action ("settings saved", errors) ?>
106
-
107
- <form method="post" action="options.php">
108
- <?php settings_fields( 'pib-settings-group' ); ?>
109
-
110
- <div id="button-type" class="postbox pib-postbox">
111
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
112
- <h3 class="hndle pib-hndle"><?php _e( 'Button Style', 'pib' ); ?></h3>
113
-
114
- <table class="form-table inside">
115
- <tr valign="top">
116
- <td>
117
- <?php _e( 'What style of button would you like to use?', 'pib' ); ?>
118
- </td>
119
- </tr>
120
- <tr valign="top">
121
- <td>
122
- <input type="radio" id="user_selects_image" value="user_selects_image" name="pib_options[button_style]"
123
- <?php checked( ( $pib_options['button_style'] == 'user_selects_image' ) || empty( $pib_options['button_style'] ) ); ?> />
124
- <label for="display_pinit_button"><strong>User selects image</strong> from popup</label>
125
- </td>
126
- </tr>
127
- <tr valign="top">
128
- <td>
129
- <input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
130
- <?php checked( $pib_options['button_style'], 'image_selected' ); ?> />
131
- <label for="display_pinit_count_button">Image is <strong>pre-selected</strong></label>
132
- </td>
133
- </tr>
134
- <tr valign="top">
135
- <td class="pib-pad-cell-top">
136
- <label for="pib_pin_count" class="pib-plain-label"><?php _e( 'Pin Count:' ); ?></label>
137
- <select id="count_layout" name="pib_options[count_layout]">
138
- <option value="none" <?php selected( ( $pib_options['count_layout'] == 'none' ) || empty( $pib_options['count_layout'] ) ); ?>><?php _e( 'No Count' ); ?></option>
139
- <option value="horizontal" <?php selected( $pib_options['count_layout'], 'horizontal' ); ?>><?php _e( 'Horizontal' ); ?></option>
140
- <option value="vertical" <?php selected( $pib_options['count_layout'], 'vertical' ); ?>><?php _e('Vertical'); ?></option>
141
- </select>
142
- </td>
143
- </tr>
144
- <tr valign="top">
145
- <td>
146
- <input id="always_show_count" name="pib_options[always_show_count]" type="checkbox" <?php if ( $pib_options['always_show_count'] ) echo 'checked="checked"'; ?> />
147
- <label for="always_show_count">Always show pin count (currently works on vertical pin count only)</label>
148
- </td>
149
- </tr>
150
- <tr valign="top">
151
- <td class="pib-pad-cell-top">
152
- To specify the website address (URL) to pin, image to pin and/or pin description (other than the defaults), go to the edit screen for those posts and pages
153
- and scroll to the bottom.
154
- </td>
155
- </tr>
156
- <tr valign="top">
157
- <td>
158
- The button style setting applies to <strong>ALL</strong> "Pin It" buttons displayed on the website (widgets and shortcodes included).
159
- </td>
160
- </tr>
161
- </table>
162
-
163
- </div>
164
-
165
- <div id="pib-options" class="postbox pib-postbox">
166
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
167
- <h3 class="hndle pib-hndle"><?php _e( 'Button Visibility', 'pib' ); ?></h3>
168
-
169
- <table class="form-table inside">
170
- <tr valign="top">
171
- <td>
172
- <?php _e( 'What types of pages should the button appear on?', 'pib' ); ?>
173
- </td>
174
- </tr>
175
- <tr valign="top">
176
- <td>
177
- <input id="display_home_page" name="pib_options[display_home_page]" type="checkbox" value="1"
178
- <?php checked( (bool)$pib_options['display_home_page'] ); ?> />
179
- <label for="display_home_page">Blog Home Page (or Latest Posts Page)</label>
180
- </td>
181
- </tr>
182
- <tr valign="top">
183
- <td>
184
- <input id="display_front_page" name="pib_options[display_front_page]" type="checkbox" value="1"
185
- <?php checked( (bool)$pib_options['display_front_page'] ); ?> />
186
- <label for="display_front_page">Front Page (different from Home Page only if set in Settings > Reading)</label>
187
- </td>
188
- </tr>
189
- <tr valign="top">
190
- <td>
191
- <input id="display_posts" name="pib_options[display_posts]" type="checkbox" value="1"
192
- <?php checked( (bool)$pib_options['display_posts'] ); ?> />
193
- <label for="display_posts">Individual Posts</label>
194
- </td>
195
- </tr>
196
- <tr valign="top">
197
- <td>
198
- <input id="display_pages" name="pib_options[display_pages]" type="checkbox" value="1"
199
- <?php checked( (bool)$pib_options['display_pages'] ); ?> />
200
- <label for="display_pages">WordPress Static "Pages"</label>
201
- </td>
202
- </tr>
203
- <tr valign="top">
204
- <td>
205
- <input id="display_archives" name="pib_options[display_archives]" type="checkbox" value="1"
206
- <?php checked( (bool)$pib_options['display_archives'] ); ?> />
207
- <label for="display_archives">Archives (includes Category, Tag, Author and date-based pages)</label>
208
- </td>
209
- </tr>
210
- <tr valign="top">
211
- <td class="pib-pad-cell-top">
212
- To hide the "Pin It" button for a specific post, page or category, go to the edit screen for that post, page or category,
213
- scroll down to the bottom, and uncheck the "Show" checkbox.
214
- </td>
215
- </tr>
216
- <tr valign="top">
217
- <td>
218
- Go to Appearance &rarr; <a href="<?php echo admin_url( 'widgets.php' ); ?>">Widgets</a> to add a "Pin It" button to your sidebar.
219
- </td>
220
- </tr>
221
- </table>
222
- </div>
223
-
224
- <div id="button-show" class="postbox pib-postbox">
225
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
226
- <h3 class="hndle pib-hndle"><?php _e( 'Button Placement', 'pib' ); ?></h3>
227
-
228
- <table class="form-table inside">
229
- <tr valign="top">
230
- <td>
231
- <?php _e( 'Where on each page should the button appear?', 'pib' ); ?>
232
- </td>
233
- </tr>
234
- <tr valign="top">
235
- <td>
236
- <input id="display_above_content" name="pib_options[display_above_content]" type="checkbox" value="1"
237
- <?php checked( (bool)$pib_options['display_above_content'] ); ?> />
238
- <label for="display_above_content">Above Content</label>
239
- </td>
240
- </tr>
241
- <tr valign="top">
242
- <td>
243
- <input id="display_below_content" name="pib_options[display_below_content]" type="checkbox" value="1"
244
- <?php checked( (bool)$pib_options['display_below_content'] ); ?> />
245
- <label for="display_below_content">Below Content</label>
246
- </td>
247
- </tr>
248
- <tr valign="top">
249
- <td>
250
- <input id="display_on_post_excerpts" name="pib_options[display_on_post_excerpts]" type="checkbox" value="1"
251
- <?php checked( (bool)$pib_options['display_on_post_excerpts'] ); ?> />
252
- <label for="display_on_post_excerpts">On Post Excerpts</label>
253
- </td>
254
- </tr>
255
- <tr valign="top">
256
- <td>
257
- Currently, only the button style <strong>"image is pre-selected"</strong> will use the individual post URL when a visitor
258
- pins on a post excerpt.
259
- </td>
260
- </tr>
261
- </table>
262
- </div>
263
-
264
- <div class="submit-settings">
265
- <input name="submit" type="submit" value="Save Settings" class="button-primary" />
266
- </div>
267
-
268
- <div id="style-options" class="postbox pib-postbox">
269
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
270
- <h3 class="hndle pib-hndle"><?php _e( 'Advanced Styling & CSS', 'pib' ); ?></h3>
271
-
272
- <table class="form-table inside">
273
- <tr valign="top">
274
- <td>
275
- <label for="custom_css">Custom CSS</label>
276
- </td>
277
- </tr>
278
- <tr valign="top">
279
- <td>
280
- <textarea id="pib-custom-css" name="pib_options[custom_css]" rows="6"><?php echo $custom_css; ?></textarea>
281
- </td>
282
- </tr>
283
- <tr valign="top">
284
- <td>
285
- <input id="remove_div" name="pib_options[remove_div]" type="checkbox" value="1"
286
- <?php checked( (bool)$pib_options['remove_div'] ); ?> />
287
- <label for="remove_div">Remove div tag surrounding regular button: <code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code></label>
288
- </td>
289
- </tr>
290
-
291
- <tr valign="top">
292
- <td>
293
- <a href="http://pinterestplugin.com/pin-it-button-custom-css/" target="_blank" class="external">
294
- See custom CSS examples</a> aligning the button with other social sharing plugins.
295
- </td>
296
- </tr>
297
- </table>
298
- </div>
299
-
300
- <div class="postbox pib-postbox">
301
- <div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
302
- <h3 class="hndle pib-hndle"><?php _e( 'Shortcode Instructions', 'pib' ); ?></h3>
303
-
304
- <div class="inside">
305
- <p>
306
- Use the shortcode <code>[pinit]</code> to display the button within your content.
307
- </p>
308
- <p>
309
- Use the function <code><?php echo htmlentities('<?php echo do_shortcode(\'[pinit]\'); ?>'); ?></code>
310
- to display within template or theme files.
311
- </p>
312
- <p><strong>Shortcode parameters</strong></p>
313
- <p>
314
- - count: none (default), horizontal, vertical<br/>
315
- - url: URL of the web page to be pinned (defaults to current post/page URL, but <em>must specify</em> if on home or index page)<br/>
316
- - image_url: URL of the image to be pinned (defaults to first image in post)<br/>
317
- - description: description of the pin (defaults to post title)<br/>
318
- - float: none (default), left, right<br/>
319
- - remove_div: false (default), true -- if true removes surrounding div tag
320
- (<code><?php echo htmlentities('<div class="pin-it-btn-wrapper-shortcode"></div>'); ?></code>), which also removes float setting<br/>
321
- - always_show_count: false (default), true -- if true will show count even if zero
322
- </p>
323
- <p><strong>Examples</strong></p>
324
- <p>
325
- <code>[pinit count="horizontal"]</code><br/>
326
- <code>[pinit count="vertical" url="http://www.mysite.com" image_url="http://www.mysite.com/myimage.jpg"
327
- description="My favorite image!" float="right"]</code><br/>
328
- </p>
329
- </div>
330
- </div>
331
-
332
- <div class="submit-settings">
333
- <input name="submit" type="submit" value="Save Settings" class="button-primary" />
334
- </div>
335
-
336
- </form>
337
- </div>
338
- </div>
339
- </div>
340
- </div>
341
- </div>
342
-
343
- <?php
344
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/{category-meta-page.php → category-meta.php} RENAMED
@@ -35,7 +35,7 @@ function pib_category_fields($tag) {
35
  <?php echo $pib_category_checked; ?> />
36
  <p class="description">
37
  If checked displays the button for this category (if <strong>Archives</strong> also checked in
38
- <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>).
39
  If unchecked the button will <strong>always</strong> be hidden for this category.
40
  </p>
41
  </td>
35
  <?php echo $pib_category_checked; ?> />
36
  <p class="description">
37
  If checked displays the button for this category (if <strong>Archives</strong> also checked in
38
+ <a href="<?php echo admin_url( 'admin.php?page=' . PIB_BASE_NAME ); ?>">"Pin It" Button Settings</a>).
39
  If unchecked the button will <strong>always</strong> be hidden for this category.
40
  </p>
41
  </td>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/{post-meta-page.php → post-meta.php} RENAMED
@@ -21,7 +21,7 @@ function pib_sharing_meta_box_content( $post ) {
21
  ?>
22
 
23
  <p>
24
- <em>Button style is inherited from setting saved in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>.
25
  Current style: <strong><?php echo $pib_button_style; ?></strong></em>
26
  </p>
27
  <p>
@@ -56,7 +56,7 @@ function pib_sharing_meta_box_content( $post ) {
56
  <label for="pib_enable_post_sharing">Show "Pin It" button on this post/page.</label>
57
  <p class="description">
58
  If checked displays the button for this post/page (if <strong>Individual Posts</strong> (for posts) or <strong>WordPress Static "Pages"</strong>
59
- (for pages) is also checked in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>).
60
  If unchecked the button will <strong>always</strong> be hidden for this post/page.
61
  </p>
62
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
21
  ?>
22
 
23
  <p>
24
+ <em>Button style is inherited from setting saved in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_BASE_NAME ); ?>">"Pin It" Button Settings</a>.
25
  Current style: <strong><?php echo $pib_button_style; ?></strong></em>
26
  </p>
27
  <p>
56
  <label for="pib_enable_post_sharing">Show "Pin It" button on this post/page.</label>
57
  <p class="description">
58
  If checked displays the button for this post/page (if <strong>Individual Posts</strong> (for posts) or <strong>WordPress Static "Pages"</strong>
59
+ (for pages) is also checked in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_BASE_NAME ); ?>">"Pin It" Button Settings</a>).
60
  If unchecked the button will <strong>always</strong> be hidden for this post/page.
61
  </p>
62
  <input type="hidden" name="pib_sharing_status_hidden" value="1" />
inc/public-display-functions.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //Add Public CSS/JS
4
+
5
+ function pib_add_public_css_js() {
6
+ global $pib_options;
7
+
8
+ //Add CSS to header
9
+ wp_enqueue_style( 'pinterest-pin-it-button', PIB_CSS_URL . 'pinterest-pin-it-button.css' );
10
+
11
+ //Image pre-selected
12
+ if ( $pib_options['button_style'] == 'image_selected' ) {
13
+
14
+ //Image pre-selected AND use Custom image button
15
+ if ( (bool)$pib_options['use_custom_img_btn'] ) {
16
+ //Popup small sized window like original Pinterest create pin popup
17
+ wp_enqueue_script( 'pin-it-button-image-selected', PIB_JS_URL . 'pin-it-button-image-selected.js', array( 'jquery' ), '', true );
18
+ }
19
+
20
+ //Image pre-selected AND use Stock button (embed code from Pinterest)
21
+ else {
22
+ //Official iframe + official button image + image pre-selected (original embed code from Pinterest, output their pinit.js in footer)
23
+ wp_enqueue_script( 'pinterest-assets', 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/js/pinit.js', null, '', true );
24
+ }
25
+ }
26
+
27
+ //User selects image (default)
28
+ //$pib_options['button_style'] == 'user_selects_image' (or blank)
29
+ else {
30
+ //Fire off Pinterest's pinmarklet.js
31
+ wp_enqueue_script( 'pin-it-button-user-selects-image', PIB_JS_URL . 'pin-it-button-user-selects-image.js', array( 'jquery' ), '', true );
32
+
33
+ //User selects image AND use Custom image button
34
+ if ( (bool)$pib_options['use_custom_img_btn'] ) {
35
+ //Do nothing
36
+ }
37
+
38
+ //User selects image AND use Stock button
39
+ else {
40
+ //Do nothing
41
+ }
42
+ }
43
+
44
+ //Custom count bubble JS for non-iframe buttons (if count layout specified)
45
+ if (
46
+ ( ( $pib_options['button_style'] != 'image_selected' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
47
+ ( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
48
+ ) {
49
+ wp_enqueue_script( 'pin-it-button-custom-btn-img', PIB_JS_URL . 'pin-it-button-custom-btn-img.js', array( 'jquery' ), '', true );
50
+ }
51
+ }
52
+
53
+ add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
54
+
55
+ //Add Custom CSS
56
+
57
+ function pib_add_custom_css() {
58
+ global $pib_options;
59
+
60
+ $custom_css = trim( $pib_options['custom_css'] );
61
+
62
+ if ( !empty( $custom_css ) ) {
63
+ echo "\n" . '<style type="text/css">' . "\n" . $custom_css . "\n" . '</style>' . "\n";
64
+ }
65
+ }
66
+
67
+ add_action( 'wp_head', 'pib_add_custom_css' );
68
+
69
+ //Function for rendering "Pin It" button base html
70
+
71
+ function pib_button_base( $post_url, $image_url, $description, $count_layout, $always_show_count ) {
72
+ global $pib_options;
73
+
74
+ $btn_class = '';
75
+ $btn_img_url = '';
76
+
77
+ //Specify no-iframe class for all but Stock button
78
+ if ( ( $pib_options['button_style'] != 'image_selected' ) || (bool)$pib_options['use_custom_img_btn'] ) {
79
+ $btn_class .= 'pin-it-button-no-iframe';
80
+ }
81
+
82
+ //Set button image URL
83
+ if ( PIB_IS_PRO && (bool)$pib_options['use_custom_img_btn'] ) {
84
+ $btn_img_url = $pib_options['custom_btn_img_url'];
85
+ }
86
+ else {
87
+ //Default non-sprite button image url from Pinterest
88
+ $btn_img_url = '//assets.pinterest.com/images/PinExt.png';
89
+ }
90
+
91
+ //Image pre-selected
92
+ if ( $pib_options['button_style'] == 'image_selected' ) {
93
+
94
+ //Image pre-selected AND use Custom image button
95
+ if ( (bool)$pib_options['use_custom_img_btn'] ) {
96
+ $btn_class .= ' pin-it-button-image-selected';
97
+ }
98
+
99
+ //Image pre-selected AND use Stock button (embed code from Pinterest)
100
+ else {
101
+ //Official iframe + image pre-selected (original embed code from Pinterest, use their class name)
102
+ $btn_class .= ' pin-it-button';
103
+ }
104
+ }
105
+
106
+ //User selects image (default)
107
+ //$pib_options['button_style'] == 'user_selects_image' (or blank)
108
+ else {
109
+ $btn_class .= ' pin-it-button-user-selects-image';
110
+ }
111
+
112
+ //HTML from Pinterest Goodies 3/19/2012
113
+ //<a href="http://pinterest.com/pin/create/button/?url=[PAGE]&media=[IMG]&description=[DESC]" class="pin-it-button" count-layout="horizontal" always-show-count="true">
114
+ //<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
115
+ //rel="nobox" is to prevent lightbox popup
116
+
117
+ $inner_btn_html = '<img border="0" class="pib-count-img" src="' . $btn_img_url . '" title="Pin It" />';
118
+ $full_btn_html = '';
119
+
120
+ //Link href always needs all the parameters in it for the count bubble to work
121
+ $link_href = 'http://pinterest.com/pin/create/button/?url=' . rawurlencode( $post_url ) . '&media=' . rawurlencode( $image_url ) .
122
+ '&description='. rawurlencode( $description );
123
+
124
+ //Full link html with attributes
125
+ $link_html = '<a href="' . $link_href . '" ' .
126
+ 'count-layout="' . $count_layout . '" class="' . $btn_class . '" rel="nobox" ' .
127
+ ( $always_show_count ? 'always-show-count="true"' : '') . '>' .
128
+ $inner_btn_html . '</a>';
129
+
130
+ //Count bubble HTML for non-iframe buttons (if count layout specified)
131
+ if (
132
+ ( ( $pib_options['button_style'] == 'user_selects_image' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
133
+ ( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
134
+ ) {
135
+
136
+ if ( $pib_options['count_layout'] == 'horizontal' ) {
137
+
138
+ $full_btn_html = '<table class="pib-count-table pib-count-table-horizontal"><tbody><tr>' .
139
+ '<td>' . $link_html . '</td>' .
140
+ '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' .
141
+ '</tr></tbody></table>';
142
+ }
143
+ elseif ( $pib_options['count_layout'] == 'vertical' ) {
144
+
145
+ $full_btn_html = '<table class="pib-count-table pib-count-table-vertical"><tbody><tr>' .
146
+ '<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' .
147
+ '</tr><tr>' .
148
+ '<td>' . $link_html . '</td>' .
149
+ '</tr></tbody></table>';
150
+ }
151
+ }
152
+ else {
153
+ $full_btn_html = $link_html;
154
+ }
155
+
156
+ return $full_btn_html;
157
+ }
158
+
159
+ //Button HTML to render
160
+
161
+ function pib_button_html( $postID ) {
162
+ global $pib_options;
163
+ global $post;
164
+
165
+ //Return nothing if sharing disabled on current post
166
+ if ( get_post_meta( $postID, 'pib_sharing_disabled', 1 ) ) {
167
+ return '';
168
+ }
169
+
170
+ //Set post url, image url and description from current post meta
171
+ $post_url = get_post_meta( $postID, 'pib_url_of_webpage', true );
172
+ $image_url = get_post_meta( $postID, 'pib_url_of_img', true );
173
+ $description = get_post_meta( $postID, 'pib_description', true );
174
+
175
+ //Use featured image if specified (also not blank and Pro only)
176
+ $featured_img_array = wp_get_attachment_image_src( get_post_thumbnail_id( $postID ), 'full' );
177
+ $featured_img_url = $featured_img_array[0];
178
+ if ( PIB_IS_PRO && (bool)$pib_options['use_featured_image'] && !empty( $featured_img_url ) ) {
179
+ $image_url = $featured_img_url;
180
+ }
181
+
182
+ //Set post url to current post if still blank
183
+ if ( empty( $post_url ) ) { $post_url = get_permalink( $postID ); }
184
+
185
+ //Set image url to first image if still blank
186
+ if ( empty( $image_url ) ) {
187
+ //Get url of img and compare width and height
188
+ $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
189
+ $first_img = $matches [1] [0];
190
+ $image_url = $first_img;
191
+ }
192
+
193
+ //Set description to post title if still blank
194
+ if ( empty( $description ) ) { $description = get_the_title( $postID ); }
195
+
196
+ $count_layout = $pib_options['count_layout'];
197
+ $always_show_count = (bool)$pib_options['always_show_count'];
198
+
199
+ $base_btn = pib_button_base( $post_url, $image_url, $description, $count_layout, $always_show_count );
200
+
201
+ //Don't wrap with div if using other sharing buttons or "remove div" is checked
202
+ if ( (bool)$pib_options['use_other_sharing_buttons'] || (bool)$pib_options['remove_div'] ) {
203
+ return $base_btn;
204
+ }
205
+ else {
206
+ //Surround with div tag
207
+ return '<div class="pin-it-btn-wrapper">' . $base_btn . '</div>';
208
+ }
209
+ }
210
+
211
+ //Share Bar HTML to render (pass through button unless Pro)
212
+
213
+ function pib_sharebar_html( $postID ) {
214
+ global $pib_options;
215
+
216
+ if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
217
+ return pib_sharebar_html_pro( $postID );
218
+ } else {
219
+ return pib_button_html( $postID );
220
+ }
221
+ }
222
+
223
+ //Render share bar on pages with regular content
224
+
225
+ function pib_render_content( $content ) {
226
+ global $pib_options;
227
+ global $post;
228
+
229
+ $postID = $post->ID;
230
+
231
+ //Determine if button displayed on current page from main admin settings
232
+ if (
233
+ ( is_home() && ( (bool)$pib_options['display_home_page'] ) ) ||
234
+ ( is_front_page() && ( (bool)$pib_options['display_front_page'] ) ) ||
235
+ ( is_single() && ( (bool)$pib_options['display_posts'] ) ) ||
236
+ ( is_page() && ( (bool)$pib_options['display_pages'] ) && !is_front_page() ) ||
237
+
238
+ //archive pages besides categories (tag, author, date, search)
239
+ //http://codex.wordpress.org/Conditional_Tags
240
+ ( is_archive() && ( (bool)$pib_options['display_archives'] ) &&
241
+ ( is_tag() || is_author() || is_date() || is_search() )
242
+ )
243
+ ) {
244
+ if ( (bool)$pib_options['display_above_content'] ) {
245
+ $content = pib_sharebar_html( $postID ) . $content;
246
+ }
247
+ if ( (bool)$pib_options['display_below_content'] ) {
248
+ $content .= pib_sharebar_html( $postID );
249
+ }
250
+ }
251
+
252
+ //Determine if displayed on Category on the base of category edit Screen Option
253
+ if ( is_archive() && ( (bool)$pib_options['display_archives'] ) ) {
254
+ $tag_extra_fields = get_option( PIB_CATEGORY_FIELDS );
255
+ $category_ids = get_all_category_ids();
256
+ foreach( $category_ids as $term_id ) {
257
+ if( !$tag_extra_fields[$term_id]['checkbox'] ) {
258
+
259
+ if( is_category($term_id) ) {
260
+ if ( (bool)$pib_options['display_above_content'] ) {
261
+ $content = pib_sharebar_html( $postID ) . $content;
262
+ }
263
+ if ( (bool)$pib_options['display_below_content'] ) {
264
+ $content .= pib_sharebar_html( $postID );
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+
271
+ return $content;
272
+ }
273
+
274
+ add_filter( 'the_content', 'pib_render_content' );
275
+
276
+ //Render share bar on pages with excerpts if option checked
277
+
278
+ function pib_render_content_excerpt( $content ) {
279
+ global $pib_options;
280
+ global $post;
281
+ $postID = $post->ID;
282
+
283
+ if ( $pib_options['display_on_post_excerpts'] ) {
284
+ if (
285
+ ( is_home() && ( $pib_options['display_home_page'] ) ) ||
286
+ ( is_front_page() && ( $pib_options['display_front_page'] ) )
287
+ ) {
288
+ if ( $pib_options['display_above_content'] ) {
289
+ $content = pib_sharebar_html( $postID ) . $content;
290
+ }
291
+ if ( $pib_options['display_below_content'] ) {
292
+ $content .= pib_sharebar_html( $postID );
293
+ }
294
+ }
295
+
296
+ //Determine if displayed on Category on the base of category edit Screen Option
297
+ if( is_archive() && ( $pib_options['display_archives'] ) ) {
298
+
299
+ $tag_extra_fields = get_option( PIB_CATEGORY_FIELDS );
300
+ $category_ids = get_all_category_ids();
301
+ foreach( $category_ids as $term_id ) {
302
+ if( !$tag_extra_fields[$term_id]['checkbox'] ) {
303
+
304
+ if(is_category($term_id)) {
305
+ if ( $pib_options['display_above_content'] ) {
306
+ $content = pib_sharebar_html( $postID ) . $content;
307
+ }
308
+ if ( $pib_options['display_below_content'] ) {
309
+ $content .= pib_sharebar_html( $postID );
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+
317
+ return $content;
318
+ }
319
+
320
+ add_filter( 'the_excerpt', 'pib_render_content_excerpt' );
inc/widget.php CHANGED
@@ -4,16 +4,24 @@
4
  class Pib_Widget extends WP_Widget {
5
 
6
  function __construct() {
7
- $widget_ops = array('classname' => 'pib-clearfix', 'description' => __( 'Add a Pinterest "Pin It" button to your sidebar with this widget.') );
8
- $control_ops = array('width' => 400); //doesn't use height
9
- parent::__construct('pib_button', __('Pinterest "Pin It" Button'), $widget_ops, $control_ops);
10
  }
11
 
12
  function widget( $args, $instance ) {
 
13
  extract($args);
14
 
15
- $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
16
- $pib_url_of_webpage_widget = $instance['pib_url_of_webpage_widget'];
 
 
 
 
 
 
 
17
  $pib_url_of_img_widget = $instance['pib_url_of_img_widget'];
18
  $pib_description_widget = $instance['pib_description_widget'];
19
  $count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
@@ -51,12 +59,12 @@ class Pib_Widget extends WP_Widget {
51
 
52
  function update( $new_instance, $old_instance ) {
53
  $instance = $old_instance;
54
- $new_instance = wp_parse_args( (array) $new_instance, array( 'count_layout' => 'none', 'title' => '',
55
- 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
56
  $instance['title'] = strip_tags($new_instance['title']);
57
- $instance['pib_url_of_webpage_widget'] = strip_tags($new_instance['pib_url_of_webpage_widget']);
58
- $instance['pib_url_of_img_widget'] = strip_tags($new_instance['pib_url_of_img_widget']);
59
- $instance['pib_description_widget'] = strip_tags($new_instance['pib_description_widget']);
60
  $instance['count_layout'] = $new_instance['count_layout'];
61
  $instance['float'] = $new_instance['float'];
62
  $instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
@@ -69,54 +77,56 @@ class Pib_Widget extends WP_Widget {
69
  global $pib_options;
70
 
71
  $instance = wp_parse_args( (array) $instance, array( 'count_layout' => 'none', 'title' => '',
72
- 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
73
  $title = strip_tags($instance['title']);
74
- $pib_url_of_webpage_widget = strip_tags($instance['pib_url_of_webpage_widget']);
75
- $pib_url_of_img_widget = strip_tags($instance['pib_url_of_img_widget']);
76
- $pib_description_widget = strip_tags($instance['pib_description_widget']);
77
  $pib_button_style_widget = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
78
  ?>
79
 
80
  <p>
81
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):'); ?></label>
82
- <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); ?>" />
83
  </p>
84
  <p>
85
- <label for="<?php echo $this->get_field_id('count_layout'); ?>"><?php _e('Pin Count:'); ?></label>
86
- <select name="<?php echo $this->get_field_name('count_layout'); ?>" id="<?php echo $this->get_field_id('count_layout'); ?>">
87
- <option value="none" <?php selected( $instance['count_layout'], 'none' ); ?>><?php _e('No Count'); ?></option>
88
- <option value="horizontal" <?php selected( $instance['count_layout'], 'horizontal' ); ?>><?php _e('Horizontal'); ?></option>
89
- <option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e('Vertical'); ?></option>
90
  </select>
91
  </p>
92
  <p>
93
- <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"/>
94
- <label for="<?php echo $this->get_field_id('always_show_count'); ?>">Always show pin count (even when zero)</label>
95
  </p>
96
  <div class="pib-widget-text-fields">
97
  <p>
98
- <em>Button style is inherited from setting saved in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>.
99
- Current style: <strong><?php echo $pib_button_style_widget; ?></strong></em>
 
 
 
100
  </p>
101
  <p>
102
- <em>These 3 text fields will be used only if the button style is <strong>"Image pre-selected"</strong></em>
103
- </p>
104
- <p>
105
- <label for="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>"><?php _e('URL of the web page to be pinned (<strong>required</strong>):'); ?></label>
106
  <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); ?>" />
 
107
  </p>
108
  <p>
109
- <label for="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>"><?php _e('URL of the image to be pinned (<strong>required</strong>):'); ?></label>
110
  <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); ?>" />
 
111
  </p>
112
  <p>
113
- <label for="<?php echo $this->get_field_id('pib_description_widget'); ?>"><?php _e('Description of the pin (optional):'); ?></label>
114
  <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); ?>" />
115
  </p>
116
  </div>
117
 
118
  <p>
119
- <label for="<?php echo $this->get_field_id('float'); ?>"><?php _e('Align (float):'); ?></label>
120
  <select name="<?php echo $this->get_field_name('float'); ?>" id="<?php echo $this->get_field_id('float'); ?>">
121
  <option value="none" <?php selected( $instance['float'], 'none' ); ?>><?php _e('none (default)'); ?></option>
122
  <option value="left" <?php selected( $instance['float'], 'left' ); ?>><?php _e('left'); ?></option>
@@ -125,7 +135,7 @@ class Pib_Widget extends WP_Widget {
125
  </p>
126
  <p>
127
  <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"/>
128
- <label for="<?php echo $this->get_field_id('remove_div'); ?>">Remove div tag surrounding this widget button (also removes <strong>float</strong> setting)</label>
129
  </p>
130
  <?php
131
  }
4
  class Pib_Widget extends WP_Widget {
5
 
6
  function __construct() {
7
+ $widget_ops = array( 'classname' => 'pib-clearfix', 'description' => __( 'Add a Pinterest "Pin It" button to your sidebar with this widget.' ) );
8
+ $control_ops = array( 'width' => 400 ); //doesn't use height
9
+ parent::__construct( 'pib_button', __( 'Pinterest "Pin It" Button' ), $widget_ops, $control_ops );
10
  }
11
 
12
  function widget( $args, $instance ) {
13
+ global $pib_options;
14
  extract($args);
15
 
16
+ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
17
+
18
+ $pib_url_of_webpage_widget = $instance['pib_url_of_webpage_widget'];
19
+
20
+ //Set URL to home page if button style is "user selects image"
21
+ if ( empty( $pib_url_of_webpage_widget ) && ( $pib_options['button_style'] == 'user_selects_image' ) ) {
22
+ $pib_url_of_webpage_widget = get_home_url();
23
+ }
24
+
25
  $pib_url_of_img_widget = $instance['pib_url_of_img_widget'];
26
  $pib_description_widget = $instance['pib_description_widget'];
27
  $count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
59
 
60
  function update( $new_instance, $old_instance ) {
61
  $instance = $old_instance;
62
+ $new_instance = wp_parse_args( (array)$new_instance, array( 'count_layout' => 'none', 'title' => '',
63
+ 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none' ) );
64
  $instance['title'] = strip_tags($new_instance['title']);
65
+ $instance['pib_url_of_webpage_widget'] = strip_tags( $new_instance['pib_url_of_webpage_widget'] );
66
+ $instance['pib_url_of_img_widget'] = strip_tags( $new_instance['pib_url_of_img_widget'] );
67
+ $instance['pib_description_widget'] = strip_tags( $new_instance['pib_description_widget'] );
68
  $instance['count_layout'] = $new_instance['count_layout'];
69
  $instance['float'] = $new_instance['float'];
70
  $instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
77
  global $pib_options;
78
 
79
  $instance = wp_parse_args( (array) $instance, array( 'count_layout' => 'none', 'title' => '',
80
+ 'pib_count_button_radio' => 'user_selects_image', 'float' => 'none' ) );
81
  $title = strip_tags($instance['title']);
82
+ $pib_url_of_webpage_widget = strip_tags( $instance['pib_url_of_webpage_widget'] );
83
+ $pib_url_of_img_widget = strip_tags( $instance['pib_url_of_img_widget'] );
84
+ $pib_description_widget = strip_tags( $instance['pib_description_widget'] );
85
  $pib_button_style_widget = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
86
  ?>
87
 
88
  <p>
89
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title (optional):' ); ?></label>
90
+ <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 ); ?>" />
91
  </p>
92
  <p>
93
+ <label for="<?php echo $this->get_field_id( 'count_layout' ); ?>"><?php _e( 'Pin Count:' ); ?></label>
94
+ <select name="<?php echo $this->get_field_name( 'count_layout' ); ?>" id="<?php echo $this->get_field_id( 'count_layout' ); ?>">
95
+ <option value="none" <?php selected( $instance['count_layout'], 'none' ); ?>><?php _e( 'No Count'); ?></option>
96
+ <option value="horizontal" <?php selected( $instance['count_layout'], 'horizontal' ); ?>><?php _e( 'Horizontal' ); ?></option>
97
+ <option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e( 'Vertical' ); ?></option>
98
  </select>
99
  </p>
100
  <p>
101
+ <input class="checkbox" <?php checked( $instance['always_show_count'], true) ?> id="<?php echo $this->get_field_id( 'always_show_count' ); ?>" name="<?php echo $this->get_field_name( 'always_show_count' ); ?>" type="checkbox"/>
102
+ <label for="<?php echo $this->get_field_id( 'always_show_count' ); ?>"><?php _e( 'Always show pin count (even when zero)' ); ?></label>
103
  </p>
104
  <div class="pib-widget-text-fields">
105
  <p>
106
+ <?php _e('Button style is inherited from setting saved in'); ?>
107
+ <a href="<?php echo admin_url( 'admin.php?page=' . PIB_BASE_NAME ); ?>"><?php _e('"Pin It" Button Settings'); ?></a>
108
+ </p>
109
+ <p>
110
+ <?php _e('Current style') ?>: <strong style="color: red;"><?php echo $pib_button_style_widget; ?></strong>
111
  </p>
112
  <p>
113
+ <label for="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>"><?php _e('URL of the web page to be pinned'); ?></label>
 
 
 
114
  <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); ?>" />
115
+ <span class="description"><?php _e('Required for "image pre-selected". Defaults to home page for "user selects image".'); ?></span>
116
  </p>
117
  <p>
118
+ <label for="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>"><?php _e('URL of the image to be pinned'); ?></label>
119
  <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); ?>" />
120
+ <span class="description"><?php _e('Required for "image pre-selected". Not used for "user selects image".'); ?></span>
121
  </p>
122
  <p>
123
+ <label for="<?php echo $this->get_field_id('pib_description_widget'); ?>"><?php _e('Description of the pin (optional)'); ?></label>
124
  <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); ?>" />
125
  </p>
126
  </div>
127
 
128
  <p>
129
+ <label for="<?php echo $this->get_field_id('float'); ?>"><?php _e('Align (float)'); ?>:</label>
130
  <select name="<?php echo $this->get_field_name('float'); ?>" id="<?php echo $this->get_field_id('float'); ?>">
131
  <option value="none" <?php selected( $instance['float'], 'none' ); ?>><?php _e('none (default)'); ?></option>
132
  <option value="left" <?php selected( $instance['float'], 'left' ); ?>><?php _e('left'); ?></option>
135
  </p>
136
  <p>
137
  <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"/>
138
+ <label for="<?php echo $this->get_field_id('remove_div'); ?>"><?php _e('Remove div tag surrounding this widget button (also removes <strong>float</strong> setting)'); ?></label>
139
  </p>
140
  <?php
141
  }
js/gplus-embed.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ //Embed JS that gets rendered in footer once if using official Google +1 JS buttons
2
+ //https://developers.google.com/+/plugins/+1button/
3
+
4
+ (function() {
5
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
6
+ po.src = 'https://apis.google.com/js/plusone.js';
7
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
8
+ })();
js/pin-it-button-custom-btn-img.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //JS to create count bubble for custom image button
2
+ //Modified from original Pinterest iframe pinit.html
3
+
4
+ jQuery(document).ready(function($) {
5
+ var baseApiUrl = "//api.pinterest.com/v1/urls/count.json?callback=?";
6
+
7
+ //Loop through pin it button table that contains css/image and count bubble
8
+ $(".pib-count-table").each(function (index) {
9
+ var parentContainer = $(this);
10
+ var pinItLink = parentContainer.find(".pin-it-button-no-iframe");
11
+ var countLayout = 'horizontal';
12
+ var alwaysShowCount = false;
13
+
14
+ // Parse args
15
+ var vars = {}
16
+ var url = pinItLink.attr("href");
17
+ var pairs = url.slice(url.indexOf('?') + 1).split('&');
18
+ for (var i = 0; i < pairs.length; i++) {
19
+ var parts = pairs[i].split('=');
20
+ vars[parts[0]] = parts[1];
21
+ }
22
+
23
+ countLayout = pinItLink.attr("count-layout") || countLayout;
24
+ alwaysShowCount = pinItLink.attr("always-show-count") || alwaysShowCount;
25
+
26
+ // Request count from API
27
+ if (countLayout != 'none' || alwaysShowCount) {
28
+ var targetUrl = vars['url'] || vars['media'];
29
+
30
+ //Decode URL and convert + to space
31
+ //http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
32
+ targetUrl = decodeURIComponent(targetUrl.replace(/\+/g, " "));
33
+
34
+ $.getJSON(baseApiUrl, { url: targetUrl }, function (data) {
35
+ //Don't show count bubble if count is zero
36
+ if ((data.count < 1) && !alwaysShowCount) {
37
+ return;
38
+ }
39
+
40
+ //Transform count (from Pinterest JS)
41
+ var count = data.count;
42
+ if (count > 999 && count <= 999999)
43
+ count = Math.floor(count / 1000) + "K+";
44
+ else if (count > 999999 && count <= 999999999)
45
+ count = Math.floor(count / 1000000) + "M+";
46
+ else if (count > 999999999)
47
+ count = "++";
48
+
49
+ //If this far display the bubble and count
50
+ parentContainer.find(".pib-count-cell").show();
51
+ parentContainer.find(".pib-count-bubble").html(count);
52
+ });
53
+ }
54
+ });
55
+ });
js/pin-it-button-image-selected.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ //Add click event for image-selected/no-iframe version
2
+ jQuery(document).ready(function($) {
3
+ $("a.pin-it-button-image-selected").click(function(event) {
4
+ event.preventDefault();
5
+ var modal = window.open($(this).attr('href'),'pibModal','width=665,height=300');
6
+ if (window.focus) { modal.focus(); }
7
+ });
8
+ });
js/pin-it-button-user-selects-image-assets.js DELETED
@@ -1,91 +0,0 @@
1
- //Modified version of http://assets.pinterest.com/js/pinit.js
2
- //Pinterest last updated 4/6/2012
3
- //Points to local iFrame
4
-
5
- (function (o, q, c) {
6
- var s = function (h) {
7
- var e = c.pinit,
8
- m = "?",
9
- a, i, f, b;
10
- f = [];
11
- b = [];
12
- var j = {},
13
- g = o.createElement("IFRAME"),
14
- r = h.getAttribute(c.att.count) || false,
15
- n = h.getAttribute(c.att.layout) || "horizontal";
16
- if (q.location.protocol === "https:") e = c.pinit_secure;
17
- f = h.href.split("?")[1].split("#")[0].split("&");
18
- a = 0;
19
- for (i = f.length; a < i; a += 1) {
20
- b = f[a].split("=");
21
- j[b[0]] = b[1]
22
- }
23
- a = f = 0;
24
- for (i = c.vars.req.length; a < i; a += 1) {
25
- b = c.vars.req[a];
26
- if (j[b]) {
27
- e = e + m + b + "=" + j[b];
28
- m = "&"
29
- }
30
- f += 1
31
- }
32
- if (j.media && j.media.indexOf("http") !== 0) f = 0;
33
- if (f === i) {
34
- a = 0;
35
- for (i = c.vars.opt.length; a < i; a += 1) {
36
- b = c.vars.opt[a];
37
- if (j[b]) e = e + m + b + "=" + j[b]
38
- }
39
- e = e + "&layout=" + n;
40
- if (r !== false) e += "&count=1";
41
- g.setAttribute("src", e);
42
- g.setAttribute("scrolling", "no");
43
- g.allowTransparency = true;
44
- g.frameBorder = 0;
45
- g.style.border = "none";
46
- g.style.width = c.layout[n].width + "px";
47
- g.style.height = c.layout[n].height + "px";
48
- h.parentNode.replaceChild(g, h)
49
- } else h.parentNode.removeChild(h)
50
- },
51
- p = o.getElementsByTagName("A"),
52
- l, d, k = [];
53
- d = 0;
54
- for (l = p.length; d < l; d += 1) k.push(p[d]);
55
- d = 0;
56
- for (l = k.length; d < l; d += 1) k[d].href && k[d].href.indexOf(c.button) !== -1 && s(k[d])
57
- })
58
-
59
- (document, window, {
60
- att: {
61
- layout: "count-layout",
62
- count: "always-show-count"
63
- },
64
-
65
- //pinit:"http://pinit-cdn.pinterest.com/pinit.html",
66
- //pinit_secure:"https://assets.pinterest.com/pinit.html",
67
-
68
- //Point to local iFrame
69
- pinit: iFrameBtnUrl,
70
- pinit_secure: iFrameBtnUrl,
71
-
72
- button: "//pinterest.com/pin/create/button/?",
73
- vars: {
74
- req: ["url", "media"],
75
- opt: ["title", "description"]
76
- },
77
- layout: {
78
- none: {
79
- width: 43,
80
- height: 20
81
- },
82
- vertical: {
83
- width: 43,
84
- height: 58
85
- },
86
- horizontal: {
87
- width: 90,
88
- height: 20
89
- }
90
- }
91
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/pin-it-button-user-selects-image.js CHANGED
@@ -1,5 +1,4 @@
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');
@@ -7,3 +6,11 @@ function execPinmarklet() {
7
  e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
8
  document.body.appendChild(e);
9
  }
 
 
 
 
 
 
 
 
1
+ //Added function for firing off Pinterest's pinmarklet.js for "user selects image" button type
 
2
  function execPinmarklet() {
3
  var e=document.createElement('script');
4
  e.setAttribute('type','text/javascript');
6
  e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
7
  document.body.appendChild(e);
8
  }
9
+
10
+ //Add click event for user-selects-image/no-frame version
11
+ jQuery(document).ready(function($) {
12
+ $("a.pin-it-button-user-selects-image").click(function(event) {
13
+ event.preventDefault();
14
+ execPinmarklet();
15
+ });
16
+ });
js/pinterest-pin-it-button-admin.js CHANGED
@@ -1,9 +1,9 @@
1
-
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
  $(".pib-hndle").toggle(function() {
8
  $(this).next(".inside").slideToggle("fast");
9
  }, function () {
@@ -15,5 +15,58 @@ jQuery(document).ready(function($) {
15
  }, function() {
16
  $(this).next(".pib-hndle").next(".inside").slideToggle("fast");
17
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
 
 
 
 
 
 
 
 
 
19
  });
 
 
1
  //See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
2
+
3
  jQuery(document).ready(function($) {
4
 
5
  //Enable collapse/expand toggle of admin boxes (like WP dashboard)
6
+
7
  $(".pib-hndle").toggle(function() {
8
  $(this).next(".inside").slideToggle("fast");
9
  }, function () {
15
  }, function() {
16
  $(this).next(".pib-hndle").next(".inside").slideToggle("fast");
17
  });
18
+
19
+ /*** Custom Button Image ***/
20
+
21
+ disableCustomButtonImage();
22
+
23
+ $("#use_custom_img_btn").change(function(event) {
24
+ disableCustomButtonImage();
25
+ });
26
+
27
+ //Disable custom button image label and row elements depending on enabled checkbox
28
+ function disableCustomButtonImage() {
29
+ var customButtonEnabled = $("#use_custom_img_btn").is(":checked");
30
+
31
+ $("#custom_img_btn_select_row, #custom_btn_img, #custom_btn_img_select_link").toggleClass("disabled", !customButtonEnabled);
32
+ }
33
+
34
+ //Process custom button image selection from thickbox popup (Pro)
35
+ //Making table cell clickable instead of inside link tag
36
+ $("#custom_img_btn_selector .custom-btn-img-cell").click(function(event) {
37
+ event.preventDefault();
38
+
39
+ var img_url = $(this).data("img-url");
40
+
41
+ //Close thickbox popup right after click
42
+ tb_remove();
43
+
44
+ //Update settings screen current image under modal box
45
+ //Just fill in hidden field on parent form. No need to post via ajax.
46
+ $("img#custom_btn_img").prop("src", img_url);
47
+ $("input#custom_btn_img_url").val(img_url);
48
+ });
49
+
50
+ //Close custom button image examples thickbox popup (Lite)
51
+ $("#custom_img_btn_examples_container .upgrade-text a.close").click(function(event) {
52
+ tb_remove();
53
+ });
54
+
55
+ /*** Other Social Sharing Buttons / Share Bar ***/
56
+
57
+ disableShareBarSelection();
58
+
59
+ $("#use_other_sharing_buttons").change(function(event) {
60
+ disableShareBarSelection();
61
+ });
62
 
63
+ //Disable share bar label and drop-downs depending on enabled checkbox
64
+ function disableShareBarSelection() {
65
+ var sharingEnabled = $("#use_other_sharing_buttons").is(":checked");
66
+
67
+ //Adding disable attribute causes drop-down values to save as blank, so just add visual disable class
68
+ //$("#share_btn_1, #share_btn_2, #share_btn_3, #share_btn_4").prop("disabled", !sharingEnabled);
69
+ $("#share_btn_label, #share_btn_1, #share_btn_2, #share_btn_3, #share_btn_4").toggleClass("disabled", !sharingEnabled);
70
+ }
71
+
72
  });
js/pinterest-pin-it-button.js DELETED
@@ -1,21 +0,0 @@
1
-
2
- //jQuery doc ready
3
- //See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
4
- jQuery(document).ready(function($) {
5
- //Set pin-it button click logic
6
- $(".pin-it-btn").click(function(event) {
7
- event.preventDefault();
8
- //Use jQuery function to retrieve and execute JavaScript from Pinterest
9
- $.getScript("http://assets.pinterest.com/js/pinmarklet.js?r=" + Math.random()*99999999);
10
- });
11
- });
12
-
13
- /* Old JavaScript from Pinterest
14
- function exec_pinmarklet() {
15
- var e=document.createElement('script');
16
- e.setAttribute('type','text/javascript');
17
- e.setAttribute('charset','UTF-8');
18
- e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
19
- document.body.appendChild(e);
20
- }
21
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/twitter-embed.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ //Embed JS that gets rendered in footer once if using official Tweet JS buttons
2
+ //https://twitter.com/about/resources/buttons
3
+
4
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
license.txt ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your
13
+ freedom to share and change it. By contrast, the GNU General Public
14
+ License is intended to guarantee your freedom to share and change free
15
+ software--to make sure the software is free for all its users. This
16
+ General Public License applies to most of the Free Software
17
+ Foundation's software and to any other program whose authors commit to
18
+ using it. (Some other Free Software Foundation software is covered by
19
+ the GNU Library General Public License instead.) You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ this service if you wish), that you receive source code or can get it
26
+ if you want it, that you can change the software or use pieces of it
27
+ in new free programs; and that you know you can do these things.
28
+
29
+ To protect your rights, we need to make restrictions that forbid
30
+ anyone to deny you these rights or to ask you to surrender the rights.
31
+ These restrictions translate to certain responsibilities for you if you
32
+ distribute copies of the software, or if you modify it.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must give the recipients all the rights that
36
+ you have. You must make sure that they, too, receive or can get the
37
+ source code. And you must show them these terms so they know their
38
+ rights.
39
+
40
+ We protect your rights with two steps: (1) copyright the software, and
41
+ (2) offer you this license which gives you legal permission to copy,
42
+ distribute and/or modify the software.
43
+
44
+ Also, for each author's protection and ours, we want to make certain
45
+ that everyone understands that there is no warranty for this free
46
+ software. If the software is modified by someone else and passed on, we
47
+ want its recipients to know that what they have is not the original, so
48
+ that any problems introduced by others will not reflect on the original
49
+ authors' reputations.
50
+
51
+ Finally, any free program is threatened constantly by software
52
+ patents. We wish to avoid the danger that redistributors of a free
53
+ program will individually obtain patent licenses, in effect making the
54
+ program proprietary. To prevent this, we have made it clear that any
55
+ patent must be licensed for everyone's free use or not licensed at all.
56
+
57
+ The precise terms and conditions for copying, distribution and
58
+ modification follow.
59
+
60
+ GNU GENERAL PUBLIC LICENSE
61
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
+
63
+ 0. This License applies to any program or other work which contains
64
+ a notice placed by the copyright holder saying it may be distributed
65
+ under the terms of this General Public License. The "Program", below,
66
+ refers to any such program or work, and a "work based on the Program"
67
+ means either the Program or any derivative work under copyright law:
68
+ that is to say, a work containing the Program or a portion of it,
69
+ either verbatim or with modifications and/or translated into another
70
+ language. (Hereinafter, translation is included without limitation in
71
+ the term "modification".) Each licensee is addressed as "you".
72
+
73
+ Activities other than copying, distribution and modification are not
74
+ covered by this License; they are outside its scope. The act of
75
+ running the Program is not restricted, and the output from the Program
76
+ is covered only if its contents constitute a work based on the
77
+ Program (independent of having been made by running the Program).
78
+ Whether that is true depends on what the Program does.
79
+
80
+ 1. You may copy and distribute verbatim copies of the Program's
81
+ source code as you receive it, in any medium, provided that you
82
+ conspicuously and appropriately publish on each copy an appropriate
83
+ copyright notice and disclaimer of warranty; keep intact all the
84
+ notices that refer to this License and to the absence of any warranty;
85
+ and give any other recipients of the Program a copy of this License
86
+ along with the Program.
87
+
88
+ You may charge a fee for the physical act of transferring a copy, and
89
+ you may at your option offer warranty protection in exchange for a fee.
90
+
91
+ 2. You may modify your copy or copies of the Program or any portion
92
+ of it, thus forming a work based on the Program, and copy and
93
+ distribute such modifications or work under the terms of Section 1
94
+ above, provided that you also meet all of these conditions:
95
+
96
+ a) You must cause the modified files to carry prominent notices
97
+ stating that you changed the files and the date of any change.
98
+
99
+ b) You must cause any work that you distribute or publish, that in
100
+ whole or in part contains or is derived from the Program or any
101
+ part thereof, to be licensed as a whole at no charge to all third
102
+ parties under the terms of this License.
103
+
104
+ c) If the modified program normally reads commands interactively
105
+ when run, you must cause it, when started running for such
106
+ interactive use in the most ordinary way, to print or display an
107
+ announcement including an appropriate copyright notice and a
108
+ notice that there is no warranty (or else, saying that you provide
109
+ a warranty) and that users may redistribute the program under
110
+ these conditions, and telling the user how to view a copy of this
111
+ License. (Exception: if the Program itself is interactive but
112
+ does not normally print such an announcement, your work based on
113
+ the Program is not required to print an announcement.)
114
+
115
+ These requirements apply to the modified work as a whole. If
116
+ identifiable sections of that work are not derived from the Program,
117
+ and can be reasonably considered independent and separate works in
118
+ themselves, then this License, and its terms, do not apply to those
119
+ sections when you distribute them as separate works. But when you
120
+ distribute the same sections as part of a whole which is a work based
121
+ on the Program, the distribution of the whole must be on the terms of
122
+ this License, whose permissions for other licensees extend to the
123
+ entire whole, and thus to each and every part regardless of who wrote it.
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
pib-config.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /***************************
4
+ * Global Constants
5
+ ***************************/
6
+
7
+ define( 'PIB_BASE_NAME', plugin_basename( __FILE__ ) ); // pinterest-pin-it-button/pinterest-pin-it-button
8
+ define( 'PIB_BASE_DIR_SHORT', dirname( PIB_BASE_NAME ) ); // pinterest-pin-it-button
9
+ define( 'PIB_BASE_DIR_LONG', dirname( __FILE__ ) ); // ../wp-content/plugins/pinterest-pin-it-button (physical file path)
10
+ define( 'PIB_INC_DIR', PIB_BASE_DIR_LONG . '/inc/' ); // ../wp-content/plugins/pinterest-pin-it-button/inc/ (physical file path)
11
+ define( 'PIB_BASE_URL', plugin_dir_url( __FILE__ ) ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/
12
+ define( 'PIB_IMAGES_URL', PIB_BASE_URL . 'img/' ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/img/
13
+ define( 'PIB_CSS_URL', PIB_BASE_URL . 'css/' );
14
+ define( 'PIB_JS_URL', PIB_BASE_URL . 'js/' );
15
+ define( 'PIB_HTML_URL', PIB_BASE_URL . 'html/' );
16
+
17
+ define( 'PIB_UPGRADE_URL', 'http://pinterestplugin.com/pin-it-button-pro' );
18
+ define( 'PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL', PIB_IMAGES_URL . 'pin-it-buttons/set01/a04.png' );
19
+
20
+ $pib_options = get_option( 'pib_options' );
21
+
22
+ /***************************
23
+ * Includes
24
+ ***************************/
25
+
26
+ require_once( PIB_INC_DIR . 'admin-general-functions-shared.php' );
27
+ require_once( PIB_INC_DIR . 'admin-display-functions-shared.php' );
28
+ require_once( PIB_INC_DIR . 'public-display-functions.php' );
29
+
30
+ if ( PIB_IS_PRO ) {
31
+ require_once( PIB_INC_DIR . 'admin-display-functions-pro.php' );
32
+ require_once( PIB_INC_DIR . 'public-display-functions-pro.php' );
33
+ }
34
+ else {
35
+ require_once( PIB_INC_DIR . 'admin-display-functions-lite.php' );
36
+ }
37
+
38
+ require_once( PIB_INC_DIR . 'widget.php' );
39
+ require_once( PIB_INC_DIR . 'shortcode.php' );
40
+ require_once( PIB_INC_DIR . 'post-meta.php' );
41
+ require_once( PIB_INC_DIR . 'category-meta.php' );
42
+
43
+ /***************************
44
+ * Debug
45
+ ***************************/
46
+
47
+ function pib_debug_print( $value ) {
48
+ print_r( '<br/><br/>' );
49
+ print_r( $value );
50
+ }
pinterest-pin-it-button.php CHANGED
@@ -1,444 +1,15 @@
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. Includes shortcode and widget.
6
  Author: Phil Derksen
7
  Author URI: http://pinterestplugin.com
8
- Version: 1.3.1
9
  License: GPLv2
10
  Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
11
  */
12
 
13
- /***************************
14
- * Global Constants
15
- ***************************/
16
 
17
- define( 'PIB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
18
-
19
- $pib_options = get_option( 'pib_options' );
20
-
21
- /***************************
22
- * Includes
23
- ***************************/
24
-
25
- require_once( 'inc/admin-settings.php' );
26
- require_once( 'inc/widget.php' );
27
- require_once( 'inc/shortcode.php' );
28
- require_once( 'inc/post-meta-page.php' );
29
- require_once( 'inc/category-meta-page.php' );
30
-
31
- //Plugin install/activation
32
-
33
- function pib_install() {
34
- global $pib_options;
35
-
36
- //Deactivate plugin if WP version too low
37
- if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
38
- deactivate_plugins( basename( __FILE__ ) );
39
- }
40
-
41
- //Setup default options for values that don't exist and need to be set to 1/true/value (not 0/false/blank)
42
- //Done this way to preseve options saved in previous versions
43
- if ( !isset( $pib_options['display_home_page'] ) ) { $pib_options['display_home_page'] = 1; }
44
- if ( !isset( $pib_options['display_posts'] ) ) { $pib_options['display_posts'] = 1; }
45
- if ( !isset( $pib_options['display_pages'] ) ) { $pib_options['display_pages'] = 1; }
46
- if ( !isset( $pib_options['display_below_content'] ) ) { $pib_options['display_below_content'] = 1; }
47
- if ( !isset( $pib_options['button_style'] ) ) { $pib_options['button_style'] = 'user_selects_image'; }
48
- if ( !isset( $pib_options['count_layout'] ) ) { $pib_options['count_layout'] = 'none'; }
49
-
50
- //Save default option values
51
- update_option( 'pib_options', $pib_options );
52
- }
53
-
54
- register_activation_hook( __FILE__, 'pib_install' );
55
-
56
- //Debugging
57
-
58
- function pib_debug_print( $value ) {
59
- print_r( '<br/><br/>' );
60
- print_r( $value );
61
- }
62
-
63
- //Register settings
64
-
65
- function pib_register_settings() {
66
- register_setting( 'pib-settings-group', 'pib_options' );
67
- }
68
-
69
- // Tie into WordPress Hooks and any functions that should run on load
70
-
71
- add_action( 'admin_init', 'pib_sharing_add_meta_box' );
72
- add_action( 'admin_init', 'pib_register_settings' );
73
-
74
- //Add settings page to admin menu
75
- //Use $page variable to load CSS/JS ONLY for this plugin's admin page
76
-
77
- function pib_create_menu() {
78
- $capability = 'manage_options';
79
-
80
- //add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
81
- $page = add_menu_page( 'Pin It Button Settings', 'Pin It Button', $capability, __FILE__, 'pib_create_settings_page',
82
- plugins_url( '/img/pinterest-button-icon-small.png', __FILE__ ) );
83
-
84
- add_action( 'admin_print_styles-' . $page, 'pib_add_admin_css_js' );
85
- }
86
-
87
- add_action( 'admin_menu', 'pib_create_menu' );
88
-
89
- //Add Admin CSS/JS
90
-
91
- function pib_add_admin_css_js() {
92
- wp_enqueue_script( 'jquery' );
93
-
94
- wp_enqueue_style( 'pinterest-pin-it-button', plugins_url( '/css/pinterest-pin-it-button-admin.css' , __FILE__ ) );
95
- wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button-admin.js', __FILE__ ), array( 'jquery' ) );
96
- }
97
-
98
- //Add first-install pointer CSS/JS & functionality
99
-
100
- function pib_add_admin_css_js_pointer() {
101
- wp_enqueue_style( 'wp-pointer' );
102
- wp_enqueue_script( 'wp-pointer' );
103
-
104
- add_action( 'admin_print_footer_scripts', 'pib_admin_print_footer_scripts' );
105
- }
106
-
107
- add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js_pointer' );
108
-
109
- //Add pointer popup message when plugin first installed
110
-
111
- function pib_admin_print_footer_scripts() {
112
- //Check option to hide pointer after initial display
113
- if ( !get_option( 'pib_hide_pointer' ) ) {
114
- $pointer_content = '<h3>Ready to be Pinned?</h3>';
115
- $pointer_content .= '<p>Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. ' .
116
- 'Now just configure your settings and start getting Pinned!</p>';
117
-
118
- $url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
119
-
120
- ?>
121
-
122
- <script type="text/javascript">
123
- //<![CDATA[
124
- jQuery(document).ready( function($) {
125
- $("#menu-plugins").pointer({
126
- content: '<?php echo $pointer_content; ?>',
127
- buttons: function( event, t ) {
128
- button = $('<a id="pointer-close" class="button-secondary">Close</a>');
129
- button.bind("click.pointer", function() {
130
- t.element.pointer("close");
131
- });
132
- return button;
133
- },
134
- position: "left",
135
- close: function() { }
136
-
137
- }).pointer("open");
138
-
139
- $("#pointer-close").after('<a id="pointer-primary" class="button-primary" style="margin-right: 5px;" href="<?php echo $url; ?>">' +
140
- 'Pin It Button Settings');
141
- });
142
- //]]>
143
- </script>
144
-
145
- <?php
146
-
147
- //Update option so this pointer is never seen again
148
- update_option( 'pib_hide_pointer', 1 );
149
- }
150
- }
151
-
152
- //Render rss items from pinterestplugin.com
153
- //http://codex.wordpress.org/Function_Reference/fetch_feed
154
-
155
- function pib_rss_news() {
156
- // Get RSS Feed(s)
157
- include_once(ABSPATH . WPINC . '/feed.php');
158
-
159
- // Get a SimplePie feed object from the specified feed source.
160
- $rss = fetch_feed('http://pinterestplugin.com/feed/');
161
-
162
- if (!is_wp_error( $rss ) ) {
163
- // Checks that the object is created correctly
164
- // Figure out how many total items there are, but limit it to 5.
165
- $maxitems = $rss->get_item_quantity(3);
166
-
167
- // Build an array of all the items, starting with element 0 (first element).
168
- $rss_items = $rss->get_items(0, $maxitems);
169
- }
170
-
171
- ?>
172
-
173
- <ul>
174
- <?php if ($maxitems == 0): ?>
175
- <li><?php _e( 'No items.', 'pib' ); ?></li>
176
- <?php else: ?>
177
- <?php
178
- // Loop through each feed item and display each item as a hyperlink.
179
- foreach ( $rss_items as $item ): ?>
180
- <li>
181
- &raquo; <a href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank" class="external">
182
- <?php echo esc_html( $item->get_title() ); ?></a>
183
- </li>
184
- <?php endforeach; ?>
185
- <?php endif; ?>
186
- </ul>
187
-
188
- <?php
189
- }
190
-
191
- //Render Facebook Share button
192
- //http://developers.facebook.com/docs/share/
193
-
194
- function pib_share_facebook() {
195
- ?>
196
- <a name="fb_share" type="button" share_url="http://pinterestplugin.com/" alt="Share on Facebook"></a>
197
- <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
198
- <?php
199
- }
200
-
201
- //Render Twitter button
202
- //https://twitter.com/about/resources/buttons
203
-
204
- function pib_share_twitter() {
205
- ?>
206
- <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pinterestplugin.com" data-text="I'm using the Pinterest &quot;Pin It&quot; Button Plugin for WordPress. It rocks!" data-count="none">Tweet</a>
207
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
208
- <?php
209
- }
210
-
211
- //Render Pin It button
212
- //Render in iFrame otherwise it messes up the WP admin left menu
213
-
214
- function pib_share_pinterest() {
215
- ?>
216
- <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="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
217
- <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
218
- <?php
219
- }
220
-
221
- //Add Settings link to the left of Deactivate on plugins list page
222
-
223
- function pib_plugin_settings_link( $links ) {
224
- $url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
225
- $settings_link = '<a href="' . $url . '">Settings</a>';
226
- array_unshift( $links, $settings_link );
227
- return $links;
228
- }
229
-
230
- add_filter('plugin_action_links_' . PIB_PLUGIN_BASENAME, 'pib_plugin_settings_link' );
231
-
232
- //Add Public CSS/JS (to Header)
233
-
234
- function pib_add_public_css_js() {
235
- wp_enqueue_style( 'pinterest_pin_it_button', plugins_url( '/css/pinterest-pin-it-button.css' , __FILE__ ) );
236
- }
237
-
238
- add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
239
-
240
- //Add Public JS (to Footer)
241
-
242
- function pib_add_public_js_footer() {
243
- global $pib_options;
244
-
245
- // If option #1 selected (user selects image)
246
- if ( ( $pib_options['button_style'] == 'user_selects_image' ) || empty( $pib_options['button_style'] ) ) {
247
- //Save iFrame URL to JS variable
248
- echo '<script type="text/javascript">' .
249
- 'var iFrameBtnUrl = "' . plugins_url( '/inc/pin-it-button-user-selects-image-iframe.html', __FILE__ ) . '"; ' .
250
- '</script>' . "\n";
251
-
252
- echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image.js', __FILE__ ) . '"></script>' . "\n";
253
- echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image-assets.js', __FILE__ ) . '"></script>' . "\n";
254
- }
255
- // If option #2 selected (image pre-selected)
256
- elseif ( $pib_options['button_style'] == 'image_selected' ) {
257
- echo '<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>' . "\n";
258
- }
259
- }
260
-
261
- add_action( 'wp_footer', 'pib_add_public_js_footer' );
262
-
263
- //Add Custom CSS
264
-
265
- function pib_add_custom_css() {
266
- global $pib_options;
267
-
268
- $custom_css = trim( $pib_options['custom_css'] );
269
-
270
- if ( $custom_css != '' ) {
271
- echo "\n" . '<style type="text/css">' . "\n" . $custom_css . "\n" . '</style>' . "\n";
272
- }
273
- }
274
-
275
- add_action( 'wp_head', 'pib_add_custom_css' );
276
-
277
- //Function for rendering "Pin It" button base html
278
-
279
- function pib_button_base( $postUrl, $imageUrl, $description, $countLayout ) {
280
- global $pib_options;
281
-
282
- //Change css class for "user selects image" button style to avoid conflicts
283
- $buttonClass = 'pin-it-button';
284
-
285
- if ( $pib_options['button_style'] == 'user_selects_image' ) {
286
- $buttonClass = 'pin-it-button2';
287
- }
288
-
289
- //HTML from Pinterest Goodies 3/19/2012
290
- //<a href="http://pinterest.com/pin/create/button/?url=PAGE&media=IMG&description=DESC" class="pin-it-button" count-layout="horizontal">
291
- //<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
292
-
293
- $btn = '<a href="http://pinterest.com/pin/create/button/?url=' . urlencode( $postUrl ) .
294
- '&media=' . urlencode( $imageUrl ) . '&description='. urlencode( $description ) . '" ' .
295
- 'count-layout="' . $countLayout . '" class="' . $buttonClass . '">' .
296
- '<img border="0" style="border:0;" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>';
297
-
298
- return $btn;
299
- }
300
-
301
- //Button html to render
302
-
303
- function pib_button_html( $postID ) {
304
- global $pib_options;
305
- global $post;
306
-
307
- $pib_url_of_webpage = get_post_meta( $postID, 'pib_url_of_webpage', true );
308
- $pib_url_of_img = get_post_meta( $postID, 'pib_url_of_img', true );
309
- $pib_description = get_post_meta( $postID, 'pib_description', true );
310
-
311
- $countLayout = $pib_options['count_layout'];
312
- $permalink = get_permalink( $postID );
313
- $title = get_the_title( $postID );
314
- $first_img = '';
315
-
316
- //Get url of img and compare width and height
317
- $output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
318
- $first_img = $matches [1] [0];
319
-
320
- //Determine if button displayed on current page from single post settings
321
- if ( get_post_meta( $postID, 'pib_sharing_disabled', 1 ) ) {
322
- return "";
323
- }
324
- else {
325
- //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
326
- $pib_url_of_webpage = ( empty( $pib_url_of_webpage ) ? $permalink : $pib_url_of_webpage );
327
- $pib_url_of_img = ( empty( $pib_url_of_img ) ? $first_img : $pib_url_of_img );
328
- $pib_description = ( empty( $pib_description ) ? $title : $pib_description );
329
-
330
- $baseBtn = pib_button_base( $pib_url_of_webpage, $pib_url_of_img, $pib_description, $countLayout );
331
-
332
- if ( $pib_options['remove_div'] ) {
333
- return $baseBtn;
334
- }
335
- else {
336
- //Surround with div tag
337
- return '<div class="pin-it-btn-wrapper">' . $baseBtn . '</div>';
338
- }
339
- }
340
- }
341
-
342
- //Render button on pages with regular content
343
-
344
- function pib_render_btn( $content ) {
345
- global $pib_options;
346
- global $post;
347
-
348
- $postID = $post->ID;
349
-
350
- //Determine if button displayed on current page from main admin settings
351
- if (
352
- ( is_home() && ( $pib_options['display_home_page'] ) ) ||
353
- ( is_front_page() && ( $pib_options['display_front_page'] ) ) ||
354
- ( is_single() && ( $pib_options['display_posts'] ) ) ||
355
- ( is_page() && ( $pib_options['display_pages'] ) && !is_front_page() ) ||
356
-
357
- //archive pages besides categories (tag, author, date, search)
358
- //http://codex.wordpress.org/Conditional_Tags
359
- ( is_archive() && ( $pib_options['display_archives'] ) &&
360
- ( is_tag() || is_author() || is_date() || is_search() )
361
- )
362
- ) {
363
- if ( $pib_options['display_above_content'] ) {
364
- $content = pib_button_html( $postID ) . $content;
365
- }
366
- if ( $pib_options['display_below_content'] ) {
367
- $content .= pib_button_html( $postID );
368
- }
369
- }
370
-
371
- //Determine if displayed on Category on the base of category edit Screen Option
372
- if ( is_archive() && ( $pib_options['display_archives'] ) ) {
373
- $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
374
- $category_ids = get_all_category_ids();
375
- foreach($category_ids as $term_id) {
376
-
377
- if($tag_extra_fields[$term_id]['checkbox'] != true) {
378
-
379
- if(is_category($term_id)) {
380
- if ( $pib_options['display_above_content'] ) {
381
- $content = pib_button_html($postID) . $content;
382
- }
383
-
384
- if ( $pib_options['display_below_content'] ) {
385
- $content .= pib_button_html($postID);
386
- }
387
- }
388
- }
389
- }
390
- }
391
-
392
- return $content;
393
- }
394
-
395
- add_filter( 'the_content', 'pib_render_btn' );
396
-
397
- //Render button on pages with excerpts if option checked
398
-
399
- function pib_render_btn_excerpt( $content ) {
400
- global $pib_options;
401
- global $post;
402
- $postID = $post->ID;
403
-
404
- if ( $pib_options['display_on_post_excerpts'] ) {
405
- if (
406
- ( is_home() && ( $pib_options['display_home_page'] ) ) ||
407
- ( is_front_page() && ( $pib_options['display_front_page'] ) )
408
-
409
- ) {
410
- if ( $pib_options['display_above_content'] ) {
411
- $content = pib_button_html($postID) . $content;
412
- }
413
- if ( $pib_options['display_below_content'] ) {
414
- $content .= pib_button_html($postID);
415
- }
416
- }
417
-
418
- //Determine if displayed on Category on the base of category edit Screen Option
419
- if( is_archive() && ( $pib_options['display_archives'] ) ) {
420
-
421
- $tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
422
- $category_ids = get_all_category_ids();
423
- foreach($category_ids as $term_id) {
424
-
425
- if($tag_extra_fields[$term_id]['checkbox'] != true) {
426
-
427
-
428
- if(is_category($term_id)) {
429
- if ( $pib_options['display_above_content'] ) {
430
- $content = pib_button_html($postID) . $content;
431
- }
432
-
433
- if ( $pib_options['display_below_content'] ) {
434
- $content .= pib_button_html($postID);
435
- }
436
- }
437
- }
438
- }
439
- }
440
- }
441
- return $content;
442
- }
443
-
444
- add_filter( 'the_excerpt', 'pib_render_btn_excerpt' );
1
  <?php
2
  /*
3
+ Plugin Name: Pinterest "Pin It" Button Lite
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. Includes shortcode and widget.
6
  Author: Phil Derksen
7
  Author URI: http://pinterestplugin.com
8
+ Version: 1.4.0
9
  License: GPLv2
10
  Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
11
  */
12
 
13
+ define( 'PIB_IS_PRO', false );
 
 
14
 
15
+ require_once( 'pib-config.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,47 +1,51 @@
1
- === Pinterest "Pin It" Button ===
2
  Contributors: pderksen
3
  Tags: pinterest, pin it, social
4
- Requires at least: 3.0
5
- Tested up to: 3.3.2
6
- Stable tag: trunk
7
 
8
  Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
9
 
10
  == Description ==
11
 
12
- Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
13
 
14
- ### "Pin It" Button Features: ###
15
 
16
- * Specify image to pin or let the reader select
17
- * Add horizontal or vertical pin count
18
- * Display or hide on any post, page or category
19
- * Custom CSS for aligning just right
20
- * Includes widget and full shortcode support
 
 
21
 
22
- = Resources =
23
 
24
- * [View Live Demo &raquo;](http://bruisesandbandaids.com/2011/newborn-photography-props/)
25
- * [Pinterest Plugin Updates &raquo;](http://pinterestplugin.com)
26
- * [User Support & Feature Requests &raquo;](http://pinterestplugin.com/support)
 
27
 
28
- = More Features =
29
 
30
- * Display above and/or below content
31
- * Optionally display on post excerpts
32
- * Optionally specify URL, image and description for each button
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
-
36
- **Pinterest Drives More Traffic Than Google+, YouTube and LinkedIn Combined** - Mashable [[link]](http://mashable.com/2012/02/01/pinterest-traffic-study/)
37
 
38
- **Pinterest Rate of Referral Now Close to Twitter, Google+** - The Wall Street Journal [[link]](http://blogs.wsj.com/tech-europe/2012/02/03/pinterest-rate-of-referral-now-close-to-twitter-google/)
39
 
40
- **Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
 
 
41
 
42
  = More Pinterest Plugins =
43
 
44
- * [Top Pinned Posts](http://pinterestplugin.com/)
 
45
  * ["Follow" Button](http://pinterestplugin.com/follow-button)
46
  * [Pinterest Block](http://pinterestplugin.com/pinterest-block)
47
 
@@ -67,43 +71,7 @@ Note: If you overwrite the plugin using an FTP upload, you may lose some saved s
67
 
68
  == Frequently Asked Questions ==
69
 
70
- **The "Pin It" button is showing up, but clicking it does nothing. What can I try?**
71
-
72
- Here are some things to try. After each one re-test a couple pages on your site to see if that fixed it.
73
-
74
- * Clear your browser cache.
75
- * Log out of your WordPress admin and refresh the page with the button(s).
76
- * Test in a different browser.
77
- * If using any WordPress caching plugin, please empty/clear it (examples: W3 Total Cache, WP-Cache and WP SuperCache).
78
- * See known plugin conflicts below.
79
- * Disable other social sharing plugins being used.
80
- * Disable other plugins one by one until the issue is fixed. (Please let us know if you find and incompatible plugin.
81
- * Switch to a different theme temporarily, preferably the default WordPress TwentyEleven theme. Please let us know if you find an incompatible theme.
82
- * If you find a different solution that fixes the issue for you (or find an incompatible plugin or theme), please let us know.
83
-
84
- **Known plugin conflicts**
85
-
86
- * W3 Total Cache: Make sure Minify mode is set to Manual, not Auto.
87
- * Google Analytics for WordPress: Make sure "Track outbound clicks as pageviews" is un-checked under Advanced Settings.
88
-
89
- **How do I display the button in places other than above or below the content?**
90
-
91
- * Use the shortcode `[pinit]` to display the button within content. See shortcode instructions on settings page for attributes you can specify.
92
- * Use the function `<?php echo do_shortcode('[pinit]'); ?>` to display within template or theme files.
93
-
94
- **How do I get the "Pin It" button to line up next to my other social sharing icons?**
95
-
96
- * Add custom CSS on the settings screen and optionally remove the surrounding `<div>` tag.
97
- * See some of our [custom CSS examples](http://pinterestplugin.com/pin-it-button-custom-css/).
98
-
99
- **I had an old version of the plugin that worked and now it doesn't. Can I get it back?
100
-
101
- * Yes, you can [download previous versions here](http://wordpress.org/extend/plugins/pinterest-pin-it-button/download/).
102
- * 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.
103
-
104
- **I'd like to report a bug or submit a feature request.**
105
-
106
- * Go to the [User Support & Feature Requests Forum](http://pinterestplugin.com/support)
107
 
108
  == Screenshots ==
109
 
@@ -115,10 +83,14 @@ Here are some things to try. After each one re-test a couple pages on your site
115
 
116
  == Changelog ==
117
 
 
 
 
 
118
  = 1.3.1 =
119
  * Changed: Modified button JavaScript to be in line with Pinterest's current button embed JavaScript
120
  * Changed: Split up internal code files for easier maintenance and updates
121
- * Fixed: For the shortcode, if the attributes "url", "image_url" and/or "description" aren't specified, it will try and use the post's custom page url, image url and/or description if found. If not found it will default to the post's url, first image in post and post title.
122
  * Fixed: Changed the way defaults are set upon install so it shouldn't override previous settings
123
  * Fixed: Uninstall now removes custom post meta fields
124
 
@@ -127,8 +99,8 @@ Here are some things to try. After each one re-test a couple pages on your site
127
  * Added: Added new button style where image is pre-selected (like official Pinterest button)
128
  * Added: Added fields for specifying URL, image URL and description for new button style **image pre-selected**
129
  * Added: Added float option for alignment (none, left or right) to widget and shortcode
130
- * Added: Can now remove div tag wrapper surrounding shortcode
131
- * Added: Can now remove widget surrounding div tag wrapper
132
  * Changed: Moved "Follow" button widget to separate plugin: [Pinterest "Follow" Button](http://wordpress.org/extend/plugins/pinterest-follow-button/)
133
  * Changed: Both button styles now embed iframe (like official Pinterest button)
134
  * Changed: External JavaScript now loads in footer for better performance
1
+ === Pinterest "Pin It" Button Lite ===
2
  Contributors: pderksen
3
  Tags: pinterest, pin it, social
4
+ Requires at least: 3.1
5
+ Tested up to: 3.4.2
6
+ Stable tag: 1.4.0
7
 
8
  Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
9
 
10
  == Description ==
11
 
12
+ Add a Simple "Pin It" Button to Your Posts in 2 Minutes!
13
 
14
+ ###"Pin It" Button Lite Features:###
15
 
16
+ * Let the reader select an image from a popup (or)
17
+ * Specify image to pin on each post
18
+ * Show horizontal, vertical or no pin count
19
+ * Show or hide the button on any post, page or category
20
+ * Add custom CSS to align with other sharing buttons
21
+ * Sidebar widget and shortcode included
22
+ * Option for no iframe (fixes display issues on some web hosts)
23
 
24
+ ###Additional Features Available in "Pin It" Button Pro:###
25
 
26
+ * 30 Custom Button Designs to choose from
27
+ * Facebook, Twitter & Google +1 sharing button included
28
+ * Allow featured images to be pre-selected when pinning
29
+ * Automatic Upgrades & Priority Support
30
 
31
+ [Upgrade to "Pin It" Button Pro Now! &raquo;](http://pinterestplugin.com)
32
 
33
+ **Resources**
 
 
34
 
35
+ * [See the "Pin It" Button in Action &raquo;](http://bruisesandbandaids.com/2011/newborn-photography-props/)
36
+ * [Premium Pinterest Plugins &raquo;](http://pinterestplugin.com)
37
+ * [User Support & Feature Requests &raquo;](http://pinterestplugin.com/support)
38
 
39
+ Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
40
 
41
+ * **Pinterest Drives More Traffic Than Google+, YouTube and LinkedIn Combined** - Mashable [[link]](http://mashable.com/2012/02/01/pinterest-traffic-study/)
42
+ * **Pinterest Rate of Referral Now Close to Twitter, Google+** - The Wall Street Journal [[link]](http://blogs.wsj.com/tech-europe/2012/02/03/pinterest-rate-of-referral-now-close-to-twitter-google/)
43
+ * **Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
44
 
45
  = More Pinterest Plugins =
46
 
47
+ * ["Pin It" Button Pro](http://pinterestplugin.com/pin-it-button-pro/)
48
+ * [Top Pinned Posts](http://pinterestplugin.com/top-pinned-posts/)
49
  * ["Follow" Button](http://pinterestplugin.com/follow-button)
50
  * [Pinterest Block](http://pinterestplugin.com/pinterest-block)
51
 
71
 
72
  == Frequently Asked Questions ==
73
 
74
+ [FAQ maintained here &raquo;](http://pinterestplugin.com/pin-it-button-lite-faq)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  == Screenshots ==
77
 
83
 
84
  == Changelog ==
85
 
86
+ = 1.4.0 =
87
+ * Changed/Fixed: Iframe removed when button set to "User selects image". Fixes security issues and display errors on some web hosts.
88
+ * Added: Displays new features available if upgrading "Pin It" Button Pro
89
+
90
  = 1.3.1 =
91
  * Changed: Modified button JavaScript to be in line with Pinterest's current button embed JavaScript
92
  * Changed: Split up internal code files for easier maintenance and updates
93
+ * Fixed: Shortcode -- If the attributes "url", "image_url" and/or "description" aren't specified, it will try and use the post's custom page url, image url and/or description if found. If not found it will default to the post's url, first image in post and post title.
94
  * Fixed: Changed the way defaults are set upon install so it shouldn't override previous settings
95
  * Fixed: Uninstall now removes custom post meta fields
96
 
99
  * Added: Added new button style where image is pre-selected (like official Pinterest button)
100
  * Added: Added fields for specifying URL, image URL and description for new button style **image pre-selected**
101
  * Added: Added float option for alignment (none, left or right) to widget and shortcode
102
+ * Added: Shortcode -- Can now remove div tag wrapper
103
+ * Added: Widget -- Can now remove div tag wrapper
104
  * Changed: Moved "Follow" button widget to separate plugin: [Pinterest "Follow" Button](http://wordpress.org/extend/plugins/pinterest-follow-button/)
105
  * Changed: Both button styles now embed iframe (like official Pinterest button)
106
  * Changed: External JavaScript now loads in footer for better performance