Version Description
- Fixed: Various shortcode fixes.
- Fixed: Moved some JavaScript files that were loaded in the footer to now load in the header to improve compatibility with themes not implementing wp_footer().
- Fixed: Updated button CSS/styles to improve compatibility with more themes.
Download this release
Release Info
Developer | pderksen |
Plugin | Pinterest "Pin It" Button |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- css/pinterest-pin-it-button.css +47 -33
- inc/admin-display-functions-shared.php +17 -14
- inc/public-display-functions.php +30 -19
- inc/shortcode.php +35 -20
- inc/widget.php +3 -3
- pib-config.php +3 -3
- pinterest-pin-it-button.php +1 -1
- readme.txt +6 -1
css/pinterest-pin-it-button.css
CHANGED
@@ -54,35 +54,48 @@
|
|
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 {
|
@@ -90,11 +103,12 @@ img.pib-count-img {
|
|
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 {
|
@@ -106,31 +120,31 @@ table.pib-count-table-vertical td.pib-count-cell {
|
|
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,
|
54 |
display: block;
|
55 |
}
|
56 |
|
57 |
+
.pib-sharebar li:before {
|
58 |
+
content: none !important;
|
59 |
+
}
|
60 |
+
|
61 |
.pib-sharebar li.pib-share-pinterest {
|
62 |
margin-right: 30px !important;
|
63 |
}
|
64 |
|
65 |
/*** BEGIN Count Bubble CSS ***/
|
66 |
+
/* Need to override theme styles as much as possible */
|
67 |
|
68 |
table.pib-count-table {
|
69 |
+
border: 0 !important;
|
70 |
+
border-collapse: collapse !important;
|
71 |
+
border-spacing: 0 !important;
|
72 |
+
margin: 0 !important;
|
73 |
+
padding: 0 !important;
|
74 |
+
vertical-align: top !important;
|
75 |
+
width: auto !important;
|
76 |
}
|
77 |
|
78 |
table.pib-count-table td {
|
79 |
+
border: 0 !important;
|
80 |
+
margin: 0 !important;
|
81 |
+
padding: 0 !important;
|
82 |
+
vertical-align: top !important;
|
83 |
}
|
84 |
|
85 |
table.pib-count-table-horizontal td {
|
86 |
+
text-align: left !important;
|
87 |
}
|
88 |
|
89 |
table.pib-count-table-vertical td {
|
90 |
+
text-align: center !important;
|
91 |
+
}
|
92 |
+
|
93 |
+
a.pin-it-button-no-iframe,
|
94 |
+
a.pin-it-button-no-iframe:hover {
|
95 |
+
background: none !important;
|
96 |
+
border: 0 !important;
|
97 |
+
text-decoration: none !important;
|
98 |
+
width: auto !important;
|
99 |
}
|
100 |
|
101 |
img.pib-count-img {
|
103 |
margin: 0 !important;
|
104 |
max-width: none !important;
|
105 |
padding: 0 !important;
|
106 |
+
width: auto !important;
|
107 |
}
|
108 |
|
109 |
.pib-count-cell {
|
110 |
display: none; /* Initially hidden */
|
111 |
+
position: relative !important;
|
112 |
}
|
113 |
|
114 |
table.pib-count-table-horizontal td.pib-count-cell {
|
120 |
}
|
121 |
|
122 |
.pib-count-bubble {
|
123 |
+
background-color: #FCF9F9 !important;
|
124 |
+
border: 1px solid #C9C5C5 !important;
|
125 |
+
border-radius: 1px !important;
|
126 |
+
color: #777 !important;
|
127 |
+
display: inline-block !important;
|
128 |
+
position: relative !important;
|
129 |
+
vertical-align: top !important;
|
130 |
}
|
131 |
|
132 |
table.pib-count-table-horizontal .pib-count-bubble {
|
133 |
+
height: 10px !important;
|
134 |
+
font: 10px/10px Arial, Helvetica, sans-serif !important;
|
135 |
+
margin: 0 !important;
|
136 |
+
padding: 3px 5px 4px 5px !important;
|
137 |
+
text-align: left !important;
|
138 |
+
width: auto !important;
|
139 |
}
|
140 |
|
141 |
table.pib-count-table-vertical .pib-count-bubble {
|
142 |
+
font: 12px/12px Arial, Helvetica, sans-serif !important;
|
143 |
+
height: 21px !important;
|
144 |
+
margin: 0 !important;
|
145 |
+
padding: 9px 0 0 0 !important;
|
146 |
+
text-align: center !important;
|
147 |
+
width: 39px !important;
|
148 |
}
|
149 |
|
150 |
.pib-count-bubble:after,
|
inc/admin-display-functions-shared.php
CHANGED
@@ -43,14 +43,14 @@ function pib_settings_page() {
|
|
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
|
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>
|
54 |
</td>
|
55 |
</tr>
|
56 |
<tr valign="top">
|
@@ -386,24 +386,27 @@ function pib_settings_page() {
|
|
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
|
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)
|
399 |
-
- image_url: URL of the image to be pinned (defaults to first image in post)
|
400 |
-
- description: description of the pin (defaults to post title)
|
401 |
-
- float: none (default), left, right
|
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>),
|
404 |
-
|
|
|
|
|
|
|
405 |
</p>
|
406 |
-
<p><strong
|
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"
|
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', '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>', 'pib' ); ?></label>
|
54 |
</td>
|
55 |
</tr>
|
56 |
<tr valign="top">
|
386 |
|
387 |
<div class="inside">
|
388 |
<p>
|
389 |
+
<?php _e( 'Use the shortcode', 'pib' ); ?> <code>[pinit]</code> <?php _e( 'to display the button within your content.', 'pib' ); ?>
|
390 |
</p>
|
391 |
<p>
|
392 |
+
<?php _e( 'Use the function', 'pib' ); ?> <code><?php echo htmlentities( '<?php echo do_shortcode(\'[pinit]\'); ?>' ); ?></code>
|
393 |
+
<?php _e( 'to display within template or theme files.', 'pib' ); ?>
|
394 |
</p>
|
395 |
<p><strong>Shortcode parameters</strong></p>
|
396 |
<p>
|
397 |
+
- <?php _e( 'count: none (default), horizontal, vertical', 'pib' ); ?><br/>
|
398 |
+
- <?php _e( '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)', 'pib' ); ?><br/>
|
399 |
+
- <?php _e( 'image_url: URL of the image to be pinned (defaults to first image in post)', 'pib' ); ?><br/>
|
400 |
+
- <?php _e( 'description: description of the pin (defaults to post title)', 'pib' ); ?><br/>
|
401 |
+
- <?php _e( 'float: none (default), left, right', 'pib' ); ?><br/>
|
402 |
+
- <?php _e( 'remove_div: false (default), true -- if true removes surrounding div tag ', 'pib' ); ?>
|
403 |
+
(<code><?php echo htmlentities( '<div class="pin-it-btn-wrapper-shortcode"></div>' ); ?></code>),
|
404 |
+
<?php _e( 'which also removes float setting', 'pib' ); ?><br/>
|
405 |
+
- <?php _e( 'always_show_count: false (default), true -- if true will show count even if zero', 'pib' ); ?><br/>
|
406 |
+
- <?php _e( 'social_buttons: false (default), true -- if true and enabled above, will show Facebook, Twitter & Google +1 buttons', 'pib' ); ?>
|
407 |
+
<?php pib_pro_label(); ?>
|
408 |
</p>
|
409 |
+
<p><strong><?php _e( 'Examples', 'pib' ); ?></strong></p>
|
410 |
<p>
|
411 |
<code>[pinit count="horizontal"]</code><br/>
|
412 |
<code>[pinit count="vertical" url="http://www.mysite.com" image_url="http://www.mysite.com/myimage.jpg"
|
inc/public-display-functions.php
CHANGED
@@ -14,12 +14,15 @@ function pib_add_public_css_js() {
|
|
14 |
//Image pre-selected AND use Custom image button
|
15 |
if ( (bool)$pib_options['use_custom_img_btn'] ) {
|
16 |
//Popup small sized window like original Pinterest create pin popup
|
17 |
-
|
|
|
|
|
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 |
}
|
@@ -28,7 +31,7 @@ function pib_add_public_css_js() {
|
|
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' )
|
32 |
|
33 |
//User selects image AND use Custom image button
|
34 |
if ( (bool)$pib_options['use_custom_img_btn'] ) {
|
@@ -46,8 +49,14 @@ function pib_add_public_css_js() {
|
|
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' )
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
|
@@ -135,18 +144,18 @@ function pib_button_base( $post_url, $image_url, $description, $count_layout, $a
|
|
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 {
|
@@ -158,9 +167,10 @@ function pib_button_base( $post_url, $image_url, $description, $count_layout, $a
|
|
158 |
|
159 |
//Button HTML to render
|
160 |
|
161 |
-
function pib_button_html(
|
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 ) ) {
|
@@ -210,13 +220,15 @@ function pib_button_html( $postID ) {
|
|
210 |
|
211 |
//Share Bar HTML to render (pass through button unless Pro)
|
212 |
|
213 |
-
function pib_sharebar_html(
|
214 |
global $pib_options;
|
|
|
|
|
215 |
|
216 |
if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
|
217 |
-
return pib_sharebar_html_pro(
|
218 |
} else {
|
219 |
-
return pib_button_html(
|
220 |
}
|
221 |
}
|
222 |
|
@@ -224,8 +236,7 @@ function pib_sharebar_html( $postID ) {
|
|
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
|
14 |
//Image pre-selected AND use Custom image button
|
15 |
if ( (bool)$pib_options['use_custom_img_btn'] ) {
|
16 |
//Popup small sized window like original Pinterest create pin popup
|
17 |
+
//***This JS file and others moved back to header (was output in footer previously) because of some theme incompatibilities
|
18 |
+
//(for starters: Portfolium by WP Shower)
|
19 |
+
wp_enqueue_script( 'pin-it-button-image-selected', PIB_JS_URL . 'pin-it-button-image-selected.js', array( 'jquery' ) );
|
20 |
}
|
21 |
|
22 |
//Image pre-selected AND use Stock button (embed code from Pinterest)
|
23 |
else {
|
24 |
//Official iframe + official button image + image pre-selected (original embed code from Pinterest, output their pinit.js in footer)
|
25 |
+
//This won't work properly if theme doesn't implement wp_footer() hook
|
26 |
wp_enqueue_script( 'pinterest-assets', 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/js/pinit.js', null, '', true );
|
27 |
}
|
28 |
}
|
31 |
//$pib_options['button_style'] == 'user_selects_image' (or blank)
|
32 |
else {
|
33 |
//Fire off Pinterest's pinmarklet.js
|
34 |
+
wp_enqueue_script( 'pin-it-button-user-selects-image', PIB_JS_URL . 'pin-it-button-user-selects-image.js', array( 'jquery' ) );
|
35 |
|
36 |
//User selects image AND use Custom image button
|
37 |
if ( (bool)$pib_options['use_custom_img_btn'] ) {
|
49 |
( ( $pib_options['button_style'] != 'image_selected' ) || (bool)$pib_options['use_custom_img_btn'] ) &&
|
50 |
( isset( $pib_options['count_layout'] ) && ( $pib_options['count_layout'] != 'none' ) )
|
51 |
) {
|
52 |
+
wp_enqueue_script( 'pin-it-button-custom-btn-img', PIB_JS_URL . 'pin-it-button-custom-btn-img.js', array( 'jquery' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
//Load other sharing button JS in head (for compatibility with themes not implementing wp_footer() hook)
|
56 |
+
if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
|
57 |
+
wp_enqueue_script( 'twitter-embed', PIB_JS_URL . 'twitter-embed.js' );
|
58 |
+
wp_enqueue_script( 'gplus-embed', PIB_JS_URL . 'gplus-embed.js' );
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
|
144 |
|
145 |
if ( $pib_options['count_layout'] == 'horizontal' ) {
|
146 |
|
147 |
+
$full_btn_html = '<table class="pib-count-table pib-count-table-horizontal"><tbody><tr>' . "\n" .
|
148 |
+
'<td>' . $link_html . '</td>' . "\n" .
|
149 |
+
'<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
|
150 |
+
'</tr></tbody></table>' . "\n";
|
151 |
}
|
152 |
elseif ( $pib_options['count_layout'] == 'vertical' ) {
|
153 |
|
154 |
+
$full_btn_html = '<table class="pib-count-table pib-count-table-vertical"><tbody><tr>' . "\n" .
|
155 |
+
'<td class="pib-count-cell"><div class="pib-count-bubble"></div></td>' . "\n" .
|
156 |
+
'</tr><tr>' . "\n" .
|
157 |
+
'<td>' . $link_html . '</td>' . "\n" .
|
158 |
+
'</tr></tbody></table>' . "\n";
|
159 |
}
|
160 |
}
|
161 |
else {
|
167 |
|
168 |
//Button HTML to render
|
169 |
|
170 |
+
function pib_button_html() {
|
171 |
global $pib_options;
|
172 |
global $post;
|
173 |
+
$postID = $post->ID;
|
174 |
|
175 |
//Return nothing if sharing disabled on current post
|
176 |
if ( get_post_meta( $postID, 'pib_sharing_disabled', 1 ) ) {
|
220 |
|
221 |
//Share Bar HTML to render (pass through button unless Pro)
|
222 |
|
223 |
+
function pib_sharebar_html() {
|
224 |
global $pib_options;
|
225 |
+
global $post;
|
226 |
+
$postID = $post->ID;
|
227 |
|
228 |
if ( PIB_IS_PRO && (bool)$pib_options['use_other_sharing_buttons'] ) {
|
229 |
+
return pib_sharebar_html_pro();
|
230 |
} else {
|
231 |
+
return pib_button_html();
|
232 |
}
|
233 |
}
|
234 |
|
236 |
|
237 |
function pib_render_content( $content ) {
|
238 |
global $pib_options;
|
239 |
+
global $post;
|
|
|
240 |
$postID = $post->ID;
|
241 |
|
242 |
//Determine if button displayed on current page from main admin settings
|
inc/shortcode.php
CHANGED
@@ -5,7 +5,8 @@
|
|
5 |
function pib_button_shortcode_html( $attr ) {
|
6 |
global $pib_options;
|
7 |
global $post;
|
8 |
-
|
|
|
9 |
/*
|
10 |
For URL, image URL and Description, use in order:
|
11 |
1) attribute value
|
@@ -16,17 +17,16 @@ function pib_button_shortcode_html( $attr ) {
|
|
16 |
$url = $attr['url'];
|
17 |
|
18 |
if ( empty( $url ) ) {
|
19 |
-
$url = get_post_meta( $
|
20 |
if ( empty( $url ) ) {
|
21 |
-
$url = get_permalink( $
|
22 |
}
|
23 |
}
|
24 |
-
|
25 |
-
|
26 |
$image_url = $attr['image_url'];
|
27 |
|
28 |
if ( empty( $image_url ) ) {
|
29 |
-
$image_url = get_post_meta( $
|
30 |
if ( empty( $image_url ) ) {
|
31 |
//Get url of img and compare width and height
|
32 |
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
|
@@ -34,26 +34,26 @@ function pib_button_shortcode_html( $attr ) {
|
|
34 |
$image_url = $first_img;
|
35 |
}
|
36 |
}
|
37 |
-
$attr['image_url'] = $image_url;
|
38 |
|
39 |
$description = $attr['description'];
|
40 |
|
41 |
if ( empty( $description ) ) {
|
42 |
-
$description = get_post_meta( $
|
43 |
if ( empty( $description ) ) {
|
44 |
-
$description = get_the_title( $
|
45 |
}
|
46 |
}
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
$
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
if ( $remove_div_bool ) {
|
56 |
-
return $baseBtn;
|
57 |
}
|
58 |
else {
|
59 |
//Surround with div tag
|
@@ -66,8 +66,23 @@ function pib_button_shortcode_html( $attr ) {
|
|
66 |
$float_class = 'pib-float-right';
|
67 |
}
|
68 |
|
69 |
-
return '<div class="pin-it-btn-wrapper-shortcode ' . $float_class . '">' . $
|
70 |
}
|
71 |
}
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
function pib_button_shortcode_html( $attr ) {
|
6 |
global $pib_options;
|
7 |
global $post;
|
8 |
+
$postID = $post->ID;
|
9 |
+
|
10 |
/*
|
11 |
For URL, image URL and Description, use in order:
|
12 |
1) attribute value
|
17 |
$url = $attr['url'];
|
18 |
|
19 |
if ( empty( $url ) ) {
|
20 |
+
$url = get_post_meta( $postID, 'pib_url_of_webpage', true);
|
21 |
if ( empty( $url ) ) {
|
22 |
+
$url = get_permalink( $postID );
|
23 |
}
|
24 |
}
|
25 |
+
|
|
|
26 |
$image_url = $attr['image_url'];
|
27 |
|
28 |
if ( empty( $image_url ) ) {
|
29 |
+
$image_url = get_post_meta( $postID, 'pib_url_of_img', true);
|
30 |
if ( empty( $image_url ) ) {
|
31 |
//Get url of img and compare width and height
|
32 |
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
|
34 |
$image_url = $first_img;
|
35 |
}
|
36 |
}
|
|
|
37 |
|
38 |
$description = $attr['description'];
|
39 |
|
40 |
if ( empty( $description ) ) {
|
41 |
+
$description = get_post_meta( $postID, 'pib_description', true);
|
42 |
if ( empty( $description ) ) {
|
43 |
+
$description = get_the_title( $postID );
|
44 |
}
|
45 |
}
|
46 |
+
|
47 |
+
$count = ( empty( $attr['count'] ) ? 'none' : $attr['count'] );
|
48 |
+
$remove_div = ( $attr['remove_div'] == 'true' );
|
49 |
+
$always_show_count = ( $attr['always_show_count'] == 'true' );
|
50 |
+
$social_buttons = ( $attr['social_buttons'] == 'true' );
|
51 |
|
52 |
+
$base_btn = pib_button_base( $url, $image_url, $description, $count, $always_show_count );
|
53 |
+
|
54 |
+
//Don't wrap with div or use float left/right if using other sharing buttons or "remove div" is checked
|
55 |
+
if ( $remove_div || $social_buttons ) {
|
56 |
+
return $base_btn;
|
|
|
|
|
|
|
57 |
}
|
58 |
else {
|
59 |
//Surround with div tag
|
66 |
$float_class = 'pib-float-right';
|
67 |
}
|
68 |
|
69 |
+
return '<div class="pin-it-btn-wrapper-shortcode ' . $float_class . '">' . $base_btn . '</div>';
|
70 |
}
|
71 |
}
|
72 |
|
73 |
+
//Share Bar HTML to render (pass through button unless Pro)
|
74 |
+
|
75 |
+
function pib_sharebar_shortcode_html( $attr ) {
|
76 |
+
global $pib_options;
|
77 |
+
global $post;
|
78 |
+
|
79 |
+
$social_buttons = ( $attr['social_buttons'] == 'true' );
|
80 |
+
|
81 |
+
if ( PIB_IS_PRO && $social_buttons && (bool)$pib_options['use_other_sharing_buttons'] ) {
|
82 |
+
return pib_sharebar_shortcode_html_pro( $attr, $post->ID );
|
83 |
+
} else {
|
84 |
+
return pib_button_shortcode_html( $attr );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
add_shortcode( 'pinit', 'pib_sharebar_shortcode_html' );
|
inc/widget.php
CHANGED
@@ -29,7 +29,7 @@ class Pib_Widget extends WP_Widget {
|
|
29 |
$pib_remove_div = (bool)$instance['remove_div'];
|
30 |
$pib_always_show_count = (bool)$instance['always_show_count'];
|
31 |
|
32 |
-
$
|
33 |
|
34 |
echo $before_widget;
|
35 |
|
@@ -38,7 +38,7 @@ class Pib_Widget extends WP_Widget {
|
|
38 |
}
|
39 |
|
40 |
if ( $pib_remove_div ) {
|
41 |
-
echo $
|
42 |
}
|
43 |
else {
|
44 |
//Surround with div tag
|
@@ -51,7 +51,7 @@ class Pib_Widget extends WP_Widget {
|
|
51 |
$float_class = 'pib-float-right';
|
52 |
}
|
53 |
|
54 |
-
echo '<div class="pin-it-btn-wrapper-widget ' . $float_class . '">' . $
|
55 |
}
|
56 |
|
57 |
echo $after_widget;
|
29 |
$pib_remove_div = (bool)$instance['remove_div'];
|
30 |
$pib_always_show_count = (bool)$instance['always_show_count'];
|
31 |
|
32 |
+
$base_btn = pib_button_base( $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout, $pib_always_show_count );
|
33 |
|
34 |
echo $before_widget;
|
35 |
|
38 |
}
|
39 |
|
40 |
if ( $pib_remove_div ) {
|
41 |
+
echo $base_btn;
|
42 |
}
|
43 |
else {
|
44 |
//Surround with div tag
|
51 |
$float_class = 'pib-float-right';
|
52 |
}
|
53 |
|
54 |
+
echo '<div class="pin-it-btn-wrapper-widget ' . $float_class . '">' . $base_btn . '</div>';
|
55 |
}
|
56 |
|
57 |
echo $after_widget;
|
pib-config.php
CHANGED
@@ -12,9 +12,8 @@ define( 'PIB_BASE_URL', plugin_dir_url( __FILE__ ) ); // http://mysite.com/wp-c
|
|
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' );
|
@@ -28,6 +27,7 @@ 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 |
}
|
@@ -45,6 +45,6 @@ require_once( PIB_INC_DIR . 'category-meta.php' );
|
|
45 |
***************************/
|
46 |
|
47 |
function pib_debug_print( $value ) {
|
48 |
-
|
49 |
print_r( $value );
|
50 |
}
|
12 |
define( 'PIB_IMAGES_URL', PIB_BASE_URL . 'img/' ); // http://mysite.com/wp-content/plugins/pinterest-pin-it-button/img/
|
13 |
define( 'PIB_CSS_URL', PIB_BASE_URL . 'css/' );
|
14 |
define( 'PIB_JS_URL', PIB_BASE_URL . 'js/' );
|
|
|
15 |
|
16 |
+
define( 'PIB_UPGRADE_URL', 'http://pinterestplugin.com/pin-it-button-pro/' );
|
17 |
define( 'PIB_DEFAULT_CUSTOM_BUTTON_IMAGE_URL', PIB_IMAGES_URL . 'pin-it-buttons/set01/a04.png' );
|
18 |
|
19 |
$pib_options = get_option( 'pib_options' );
|
27 |
require_once( PIB_INC_DIR . 'public-display-functions.php' );
|
28 |
|
29 |
if ( PIB_IS_PRO ) {
|
30 |
+
require_once( PIB_INC_DIR . 'admin-general-functions-pro.php' );
|
31 |
require_once( PIB_INC_DIR . 'admin-display-functions-pro.php' );
|
32 |
require_once( PIB_INC_DIR . 'public-display-functions-pro.php' );
|
33 |
}
|
45 |
***************************/
|
46 |
|
47 |
function pib_debug_print( $value ) {
|
48 |
+
echo '<br/><br/>';
|
49 |
print_r( $value );
|
50 |
}
|
pinterest-pin-it-button.php
CHANGED
@@ -5,7 +5,7 @@
|
|
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.
|
9 |
License: GPLv2
|
10 |
Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
|
11 |
*/
|
5 |
Description: Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Includes shortcode and widget.
|
6 |
Author: Phil Derksen
|
7 |
Author URI: http://pinterestplugin.com
|
8 |
+
Version: 1.4.1
|
9 |
License: GPLv2
|
10 |
Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
|
11 |
*/
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.
|
7 |
|
8 |
Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
|
9 |
|
@@ -83,6 +83,11 @@ Note: If you overwrite the plugin using an FTP upload, you may lose some saved s
|
|
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
|
3 |
Tags: pinterest, pin it, social
|
4 |
Requires at least: 3.1
|
5 |
Tested up to: 3.4.2
|
6 |
+
Stable tag: 1.4.1
|
7 |
|
8 |
Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
|
9 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 1.4.1 =
|
87 |
+
* Fixed: Various shortcode fixes.
|
88 |
+
* Fixed: Moved some JavaScript files that were loaded in the footer to now load in the header to improve compatibility with themes not implementing wp_footer().
|
89 |
+
* Fixed: Updated button CSS/styles to improve compatibility with more themes.
|
90 |
+
|
91 |
= 1.4.0 =
|
92 |
* Changed/Fixed: Iframe removed when button set to "User selects image". Fixes security issues and display errors on some web hosts.
|
93 |
* Added: Displays new features available if upgrading "Pin It" Button Pro
|