Version Description
- Added options for colors, sizes and shapes based on Pinterest's official widget builder.
- Added an option to show count bubble even for zero count pins.
- Minor bug fixes.
- Tested up to WordPress 3.8.
Download this release
Release Info
Developer | pderksen |
Plugin | Pinterest "Pin It" Button |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- class-pinterest-pin-it-button.php +71 -60
- css/admin.css +9 -1
- includes/misc-functions.php +22 -0
- includes/register-settings.php +58 -12
- includes/shortcodes.php +12 -8
- includes/widgets.php +36 -2
- js/index.php +0 -1
- pinterest-pin-it-button.php +12 -7
- readme.txt +11 -3
- views/admin-help.php +25 -1
- views/admin-sidebar.php +44 -18
- views/post-meta-display.php +13 -12
- views/public.php +34 -4
class-pinterest-pin-it-button.php
CHANGED
@@ -20,7 +20,14 @@ class Pinterest_Pin_It_Button {
|
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
* Unique identifier for your plugin.
|
@@ -57,16 +64,16 @@ class Pinterest_Pin_It_Button {
|
|
57 |
*
|
58 |
* @since 2.0.0
|
59 |
*/
|
60 |
-
|
61 |
/**
|
62 |
* Presstrends API authorization
|
63 |
*
|
64 |
-
* @since
|
65 |
*
|
66 |
* @var string
|
67 |
*/
|
68 |
protected $presstrends_auth = '0ebdi3uscgaztp99nnbam6rl6i2186qwo';
|
69 |
-
|
70 |
private function __construct() {
|
71 |
// Setup constants.
|
72 |
$this->setup_constants();
|
@@ -80,10 +87,9 @@ class Pinterest_Pin_It_Button {
|
|
80 |
|
81 |
// Add the options page and menu item.
|
82 |
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 );
|
83 |
-
|
84 |
// Enqueue admin styles and scripts.
|
85 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
86 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
87 |
|
88 |
// Enqueue public style and scripts.
|
89 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
@@ -98,7 +104,7 @@ class Pinterest_Pin_It_Button {
|
|
98 |
|
99 |
// Add plugin listing "Settings" action link.
|
100 |
add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . $this->plugin_slug . '.php' ), array( $this, 'settings_link' ) );
|
101 |
-
|
102 |
// Finally, call presstrends tracking code.
|
103 |
add_action( 'admin_init', array( $this, 'use_presstrends_tracking' ) );
|
104 |
}
|
@@ -146,11 +152,8 @@ class Pinterest_Pin_It_Button {
|
|
146 |
* Fired when the plugin is activated.
|
147 |
*
|
148 |
* @since 2.0.0
|
149 |
-
*
|
150 |
-
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
|
151 |
*/
|
152 |
-
public static function activate(
|
153 |
-
// Add value to indicate that we should show admin install notice.
|
154 |
update_option( 'pib_show_admin_install_notice', 1 );
|
155 |
}
|
156 |
|
@@ -226,23 +229,6 @@ class Pinterest_Pin_It_Button {
|
|
226 |
}
|
227 |
}
|
228 |
|
229 |
-
/**
|
230 |
-
* Enqueue admin-specific JavaScript.
|
231 |
-
*
|
232 |
-
* @since 2.0.0
|
233 |
-
*
|
234 |
-
* @return null Return early if no settings page is registered.
|
235 |
-
*/
|
236 |
-
public function enqueue_admin_scripts() {
|
237 |
-
|
238 |
-
// No admin.js needed yet so commented out.
|
239 |
-
|
240 |
-
if ( $this->viewing_this_plugin() ) {
|
241 |
-
// Main plugin admin JS. Tackon plugin version.
|
242 |
-
//wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), $this->version );
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
/**
|
247 |
* Enqueue public-facing style sheets.
|
248 |
*
|
@@ -264,13 +250,38 @@ class Pinterest_Pin_It_Button {
|
|
264 |
*/
|
265 |
public function enqueue_scripts() {
|
266 |
global $pib_options;
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
|
|
|
|
|
|
|
|
|
|
273 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
/**
|
276 |
* Register the administration menu for this plugin into the WordPress Dashboard menu.
|
@@ -287,7 +298,7 @@ class Pinterest_Pin_It_Button {
|
|
287 |
array( $this, 'display_plugin_admin_page' ),
|
288 |
plugins_url( 'assets/pinterest-icon-16.png', __FILE__ )
|
289 |
);
|
290 |
-
|
291 |
// Add Help submenu page
|
292 |
$this->plugin_screen_hook_suffix[] = add_submenu_page(
|
293 |
$this->plugin_slug,
|
@@ -307,7 +318,7 @@ class Pinterest_Pin_It_Button {
|
|
307 |
public function display_plugin_admin_page() {
|
308 |
include_once( 'views/admin.php' );
|
309 |
}
|
310 |
-
|
311 |
public function display_admin_help_page() {
|
312 |
include_once( 'views/admin-help.php' );
|
313 |
}
|
@@ -321,16 +332,16 @@ class Pinterest_Pin_It_Button {
|
|
321 |
// Add the meta boxes for both posts and pages
|
322 |
add_meta_box('pib-meta', '"Pin It" Button Settings', 'add_meta_form', 'post', 'advanced', 'high');
|
323 |
add_meta_box('pib-meta', '"Pin It" Button Settings', 'add_meta_form', 'page', 'advanced', 'high');
|
324 |
-
|
325 |
// function to output the HTML for meta box
|
326 |
function add_meta_form( $post ) {
|
327 |
-
|
328 |
wp_nonce_field( basename( __FILE__ ), 'pib_meta_nonce' );
|
329 |
-
|
330 |
include_once( 'views/post-meta-display.php' );
|
331 |
}
|
332 |
}
|
333 |
-
|
334 |
/**
|
335 |
* Save the post meta for this plugin.
|
336 |
*
|
@@ -342,7 +353,7 @@ class Pinterest_Pin_It_Button {
|
|
342 |
public function save_meta_data( $post_id ) {
|
343 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
344 |
return $post_id;
|
345 |
-
|
346 |
// An array to hold all of our post meta ids so we can run them through a loop
|
347 |
$post_meta_fields = array(
|
348 |
'pib_url_of_webpage',
|
@@ -351,27 +362,27 @@ class Pinterest_Pin_It_Button {
|
|
351 |
);
|
352 |
|
353 |
// Record sharing disable
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
}
|
371 |
}
|
372 |
}
|
373 |
}
|
374 |
-
|
|
|
375 |
|
376 |
return $post_id;
|
377 |
}
|
@@ -432,7 +443,7 @@ class Pinterest_Pin_It_Button {
|
|
432 |
if( get_current_screen()->id == 'plugins' )
|
433 |
include_once( 'views/admin-install-notice.php' );
|
434 |
}
|
435 |
-
|
436 |
public function use_presstrends_tracking() {
|
437 |
global $pib_options;
|
438 |
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
|
24 |
+
/**************************************
|
25 |
+
* UPDATE VERSION HERE
|
26 |
+
* and main plugin file header comments
|
27 |
+
* and README.txt changelog
|
28 |
+
**************************************/
|
29 |
+
|
30 |
+
protected $version = '2.0.2';
|
31 |
|
32 |
/**
|
33 |
* Unique identifier for your plugin.
|
64 |
*
|
65 |
* @since 2.0.0
|
66 |
*/
|
67 |
+
|
68 |
/**
|
69 |
* Presstrends API authorization
|
70 |
*
|
71 |
+
* @since 2.0.0
|
72 |
*
|
73 |
* @var string
|
74 |
*/
|
75 |
protected $presstrends_auth = '0ebdi3uscgaztp99nnbam6rl6i2186qwo';
|
76 |
+
|
77 |
private function __construct() {
|
78 |
// Setup constants.
|
79 |
$this->setup_constants();
|
87 |
|
88 |
// Add the options page and menu item.
|
89 |
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ), 2 );
|
90 |
+
|
91 |
// Enqueue admin styles and scripts.
|
92 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
|
|
93 |
|
94 |
// Enqueue public style and scripts.
|
95 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
104 |
|
105 |
// Add plugin listing "Settings" action link.
|
106 |
add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . $this->plugin_slug . '.php' ), array( $this, 'settings_link' ) );
|
107 |
+
|
108 |
// Finally, call presstrends tracking code.
|
109 |
add_action( 'admin_init', array( $this, 'use_presstrends_tracking' ) );
|
110 |
}
|
152 |
* Fired when the plugin is activated.
|
153 |
*
|
154 |
* @since 2.0.0
|
|
|
|
|
155 |
*/
|
156 |
+
public static function activate() {
|
|
|
157 |
update_option( 'pib_show_admin_install_notice', 1 );
|
158 |
}
|
159 |
|
229 |
}
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
/**
|
233 |
* Enqueue public-facing style sheets.
|
234 |
*
|
250 |
*/
|
251 |
public function enqueue_scripts() {
|
252 |
global $pib_options;
|
253 |
+
|
254 |
+
/*if( ! empty( $pib_options['use_async'] ) ) {
|
255 |
+
//wp_enqueue_script( $this->plugin_slug . '-pinterest-pinit', plugins_url( 'js/pinit-async.js', __FILE__ ), array(), null, true );
|
256 |
+
add_action( 'wp_head', array( $this, 'use_async_pinit' ) );
|
257 |
+
} else {*/
|
258 |
+
// If this option is empty then it means we can load the pinit.js, otherwise do not load it
|
259 |
+
if( empty( $pib_options['no_pinit_js'] ) ) {
|
260 |
+
// Enqueue Pinterest JS plugin boilerplate style. Don't tack on plugin version.
|
261 |
+
wp_enqueue_script( $this->plugin_slug . '-pinterest-pinit', '//assets.pinterest.com/js/pinit.js', array(), null, true );
|
262 |
+
}
|
263 |
+
//}
|
264 |
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Use async version of pinit.js
|
268 |
+
*
|
269 |
+
* @since
|
270 |
+
*/
|
271 |
+
|
272 |
+
/*public function use_async_pinit() {
|
273 |
+
$script = "<script type='text/javascript'>\n";
|
274 |
+
$script .= "(function(d){\n";
|
275 |
+
$script .= "var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');\n";
|
276 |
+
$script .= "p.type = 'text/javascript';\n";
|
277 |
+
$script .= "p.async = true;\n";
|
278 |
+
$script .= "p.src = '//assets.pinterest.com/js/pinit.js';\n";
|
279 |
+
$script .= "f.parentNode.insertBefore(p, f);\n";
|
280 |
+
$script .= "}(document));\n";
|
281 |
+
$script .= "</script>\n";
|
282 |
+
|
283 |
+
echo $script;
|
284 |
+
}*/
|
285 |
|
286 |
/**
|
287 |
* Register the administration menu for this plugin into the WordPress Dashboard menu.
|
298 |
array( $this, 'display_plugin_admin_page' ),
|
299 |
plugins_url( 'assets/pinterest-icon-16.png', __FILE__ )
|
300 |
);
|
301 |
+
|
302 |
// Add Help submenu page
|
303 |
$this->plugin_screen_hook_suffix[] = add_submenu_page(
|
304 |
$this->plugin_slug,
|
318 |
public function display_plugin_admin_page() {
|
319 |
include_once( 'views/admin.php' );
|
320 |
}
|
321 |
+
|
322 |
public function display_admin_help_page() {
|
323 |
include_once( 'views/admin-help.php' );
|
324 |
}
|
332 |
// Add the meta boxes for both posts and pages
|
333 |
add_meta_box('pib-meta', '"Pin It" Button Settings', 'add_meta_form', 'post', 'advanced', 'high');
|
334 |
add_meta_box('pib-meta', '"Pin It" Button Settings', 'add_meta_form', 'page', 'advanced', 'high');
|
335 |
+
|
336 |
// function to output the HTML for meta box
|
337 |
function add_meta_form( $post ) {
|
338 |
+
|
339 |
wp_nonce_field( basename( __FILE__ ), 'pib_meta_nonce' );
|
340 |
+
|
341 |
include_once( 'views/post-meta-display.php' );
|
342 |
}
|
343 |
}
|
344 |
+
|
345 |
/**
|
346 |
* Save the post meta for this plugin.
|
347 |
*
|
353 |
public function save_meta_data( $post_id ) {
|
354 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
355 |
return $post_id;
|
356 |
+
|
357 |
// An array to hold all of our post meta ids so we can run them through a loop
|
358 |
$post_meta_fields = array(
|
359 |
'pib_url_of_webpage',
|
362 |
);
|
363 |
|
364 |
// Record sharing disable
|
365 |
+
|
366 |
+
if ( current_user_can( 'edit_post', $post_id ) ) {
|
367 |
+
if ( isset( $_POST['pib_sharing_status_hidden'] ) ) {
|
368 |
+
if ( !isset( $_POST['pib_enable_post_sharing'] ) ) {
|
369 |
+
update_post_meta( $post_id, 'pib_sharing_disabled', 1 );
|
370 |
+
}
|
371 |
+
else {
|
372 |
+
delete_post_meta( $post_id, 'pib_sharing_disabled' );
|
373 |
+
}
|
374 |
+
|
375 |
+
// Loop through our array and make sure it is posted and not empty in order to update it, otherwise we delete it
|
376 |
+
foreach ( $post_meta_fields as $pmf ) {
|
377 |
+
if ( isset( $_POST[$pmf] ) && !empty( $_POST[$pmf] ) ) {
|
378 |
+
update_post_meta( $post_id, $pmf, sanitize_text_field( stripslashes( $_POST[$pmf] ) ) );
|
379 |
+
} else {
|
380 |
+
delete_post_meta( $post_id, $pmf );
|
|
|
381 |
}
|
382 |
}
|
383 |
}
|
384 |
+
}
|
385 |
+
|
386 |
|
387 |
return $post_id;
|
388 |
}
|
443 |
if( get_current_screen()->id == 'plugins' )
|
444 |
include_once( 'views/admin-install-notice.php' );
|
445 |
}
|
446 |
+
|
447 |
public function use_presstrends_tracking() {
|
448 |
global $pib_options;
|
449 |
|
css/admin.css
CHANGED
@@ -38,7 +38,8 @@ a.pib-external-link {
|
|
38 |
/* Sidebar container. Taken from Flat UI .tile & popover classes. */
|
39 |
|
40 |
#pib-settings-sidebar .sidebar-container {
|
41 |
-
background-color: #
|
|
|
42 |
border-radius: 6px;
|
43 |
font-size: 15px;
|
44 |
margin-bottom: 18px;
|
@@ -110,3 +111,10 @@ a.pib-external-link {
|
|
110 |
#pib-settings-sidebar .sidebar-content.pib-rss-news ul {
|
111 |
font-size: 14px;
|
112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/* Sidebar container. Taken from Flat UI .tile & popover classes. */
|
39 |
|
40 |
#pib-settings-sidebar .sidebar-container {
|
41 |
+
background-color: #fff;
|
42 |
+
border: 1px solid #ccc;
|
43 |
border-radius: 6px;
|
44 |
font-size: 15px;
|
45 |
margin-bottom: 18px;
|
111 |
#pib-settings-sidebar .sidebar-content.pib-rss-news ul {
|
112 |
font-size: 14px;
|
113 |
}
|
114 |
+
|
115 |
+
/* Admin pages styles */
|
116 |
+
.pib-checkbox-label, .pib-radio-label {
|
117 |
+
line-height: 1.4em;
|
118 |
+
margin: .25em 0 .5em!important;
|
119 |
+
display: block;
|
120 |
+
}
|
includes/misc-functions.php
CHANGED
@@ -106,3 +106,25 @@ function pib_is_woo_commerce_active() {
|
|
106 |
* http://pippinsplugins.com/checking-dependent-plugin-active/
|
107 |
*/
|
108 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
* http://pippinsplugins.com/checking-dependent-plugin-active/
|
107 |
*/
|
108 |
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Check if the Article Rich Pins plugin is active.
|
112 |
+
*
|
113 |
+
* @since 2.0.2
|
114 |
+
*
|
115 |
+
* @return boolean
|
116 |
+
*/
|
117 |
+
function pib_is_article_rich_pins_active() {
|
118 |
+
return class_exists( 'Article_Rich_Pins' );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Check if the WooCommerce Rich Pins plugin is active.
|
123 |
+
*
|
124 |
+
* @since 2.0.2
|
125 |
+
*
|
126 |
+
* @return boolean
|
127 |
+
*/
|
128 |
+
function pib_is_wc_rich_pins_active() {
|
129 |
+
return class_exists( 'WooCommerce_Rich_Pins' );
|
130 |
+
}
|
includes/register-settings.php
CHANGED
@@ -39,6 +39,43 @@ function pib_register_settings() {
|
|
39 |
'vertical' => __( 'Above the Button', 'pib' )
|
40 |
)
|
41 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
'uninstall_save_settings' => array(
|
43 |
'id' => 'uninstall_save_settings',
|
44 |
'name' => __( 'Save Settings', 'pib' ),
|
@@ -49,8 +86,7 @@ function pib_register_settings() {
|
|
49 |
'id' => 'presstrends_tracking',
|
50 |
'name' => __( 'Allow Anonymous Usage Tracking', 'pib' ),
|
51 |
'desc' => __( 'If checked, this option will enable PressTrends, which is a simple usage tracker that allows us to see how our customers are using our plugins.', 'pib' ) . '<br/>' .
|
52 |
-
__( 'This anonymous data gives us insight on how we can improve our plugins for you. It will not track any user details, so your security and privacy are safe with us.', 'pib' )
|
53 |
-
'<p class="description">' . __( 'If you feel comfortable enabling this option we\'d appreciate your participation. Thanks!', 'pib' ) . '</p>',
|
54 |
'type' => 'checkbox'
|
55 |
)
|
56 |
),
|
@@ -111,12 +147,18 @@ function pib_register_settings() {
|
|
111 |
'advanced' => array(
|
112 |
'no_pinit_js' => array(
|
113 |
'id' => 'no_pinit_js',
|
114 |
-
'name' => __( 'Disable pinit.js', 'pib' ),
|
115 |
'desc' => __( 'Disable output of <code>pinit.js</code>, the JavaScript file for all widgets from Pinterest.', 'pib' ) .
|
116 |
'<p class="description">' . __( 'Check this option if you have <code>pinit.js</code> referenced in another plugin, widget or your theme. ' .
|
117 |
-
|
118 |
'type' => 'checkbox'
|
119 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
)
|
121 |
);
|
122 |
|
@@ -132,7 +174,7 @@ function pib_register_settings() {
|
|
132 |
if ( false == get_option( 'pib_settings_styles' ) ) {
|
133 |
add_option( 'pib_settings_styles' );
|
134 |
}
|
135 |
-
|
136 |
if( false == get_option( 'pib_settings_advanced' ) ){
|
137 |
add_option( 'pib_settings_advanced' );
|
138 |
}
|
@@ -193,7 +235,7 @@ function pib_register_settings() {
|
|
193 |
pib_get_settings_field_args( $option, 'styles' )
|
194 |
);
|
195 |
}
|
196 |
-
|
197 |
/* Add the Advanced Settings section */
|
198 |
add_settings_section(
|
199 |
'pib_settings_advanced',
|
@@ -273,9 +315,10 @@ function pib_radio_callback( $args ) {
|
|
273 |
$checked = true;
|
274 |
elseif ( isset( $args['std'] ) && $args['std'] == $key && ! isset( $pib_options[ $args['id'] ] ) )
|
275 |
$checked = true;
|
276 |
-
|
|
|
277 |
$html .= '<input name="pib_settings_' . $args['section'] . '[' . $args['id'] . ']" id="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" type="radio" value="' . $key . '" ' . checked( true, $checked, false ) . '/>' . "\n";
|
278 |
-
$html .=
|
279 |
}
|
280 |
|
281 |
// Render and style description text underneath if it exists.
|
@@ -318,8 +361,9 @@ function pib_multicheck_callback( $args ) {
|
|
318 |
|
319 |
foreach ( $args['options'] as $key => $option ) {
|
320 |
if ( isset( $pib_options[$args['id']][$key] ) ) { $enabled = $option; } else { $enabled = NULL; }
|
|
|
321 |
$html .= '<input name="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" id="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" type="checkbox" value="' . $option . '" ' . checked($option, $enabled, false) . '/>' . "\n";
|
322 |
-
$html .=
|
323 |
}
|
324 |
|
325 |
// Render and style description text underneath if it exists.
|
@@ -401,6 +445,8 @@ function pib_number_callback( $args ) {
|
|
401 |
|
402 |
/**
|
403 |
* Textbox callback function
|
|
|
|
|
404 |
*/
|
405 |
function pib_text_callback( $args ) {
|
406 |
global $pib_options;
|
@@ -410,8 +456,8 @@ function pib_text_callback( $args ) {
|
|
410 |
else
|
411 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
412 |
|
413 |
-
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : '
|
414 |
-
$html = "\n" . '<input type="text" class="' . $size . '
|
415 |
|
416 |
// Render and style description text underneath if it exists.
|
417 |
if ( ! empty( $args['desc'] ) )
|
39 |
'vertical' => __( 'Above the Button', 'pib' )
|
40 |
)
|
41 |
),
|
42 |
+
'show_zero_count' => array(
|
43 |
+
'id' => 'show_zero_count',
|
44 |
+
'name' => '',
|
45 |
+
'desc' => __( 'Show count bubble when there are zero pins.', 'pib' ),
|
46 |
+
'type' => 'checkbox'
|
47 |
+
),
|
48 |
+
'data_pin_size' => array(
|
49 |
+
'id' => 'data_pin_size',
|
50 |
+
'name' => __( 'Button Size', 'pib' ),
|
51 |
+
'desc' => '',
|
52 |
+
'type' => 'select',
|
53 |
+
'options' => array(
|
54 |
+
'small' => __( 'Small', 'pib' ),
|
55 |
+
'large' => __( 'Large', 'pib' )
|
56 |
+
)
|
57 |
+
),
|
58 |
+
'data_pin_shape' => array(
|
59 |
+
'id' => 'data_pin_shape',
|
60 |
+
'name' => __( 'Button Shape', 'pib' ),
|
61 |
+
'desc' => '',
|
62 |
+
'type' => 'select',
|
63 |
+
'options' => array(
|
64 |
+
'rectangular' => __( 'Rectangular', 'pib' ),
|
65 |
+
'circular' => __( 'Circular', 'pib' )
|
66 |
+
)
|
67 |
+
),
|
68 |
+
'data_pin_color' => array(
|
69 |
+
'id' => 'data_pin_color',
|
70 |
+
'name' => __( 'Button Color', 'pib' ),
|
71 |
+
'desc' => __( 'Color ignored if button shape is <strong>Circular</strong>.', 'pib' ),
|
72 |
+
'type' => 'select',
|
73 |
+
'options' => array(
|
74 |
+
'gray' => __( 'Gray', 'pib' ),
|
75 |
+
'red' => __( 'Red', 'pib' ),
|
76 |
+
'white' => __( 'White', 'pib' )
|
77 |
+
)
|
78 |
+
),
|
79 |
'uninstall_save_settings' => array(
|
80 |
'id' => 'uninstall_save_settings',
|
81 |
'name' => __( 'Save Settings', 'pib' ),
|
86 |
'id' => 'presstrends_tracking',
|
87 |
'name' => __( 'Allow Anonymous Usage Tracking', 'pib' ),
|
88 |
'desc' => __( 'If checked, this option will enable PressTrends, which is a simple usage tracker that allows us to see how our customers are using our plugins.', 'pib' ) . '<br/>' .
|
89 |
+
__( 'This anonymous data gives us insight on how we can improve our plugins for you. It will not track any user details, so your security and privacy are safe with us.', 'pib' ),
|
|
|
90 |
'type' => 'checkbox'
|
91 |
)
|
92 |
),
|
147 |
'advanced' => array(
|
148 |
'no_pinit_js' => array(
|
149 |
'id' => 'no_pinit_js',
|
150 |
+
'name' => __( 'Disable <code>pinit.js</code>', 'pib' ),
|
151 |
'desc' => __( 'Disable output of <code>pinit.js</code>, the JavaScript file for all widgets from Pinterest.', 'pib' ) .
|
152 |
'<p class="description">' . __( 'Check this option if you have <code>pinit.js</code> referenced in another plugin, widget or your theme. ' .
|
153 |
+
'Ouputting <code>pinit.js</code> more than once on a page can cause conflicts.', 'pib' ) . '</p>',
|
154 |
'type' => 'checkbox'
|
155 |
+
)/*,
|
156 |
+
- 'use_async' => array(
|
157 |
+
- 'id' => 'use_async',
|
158 |
+
- 'name' => __( 'Load <code>pinit.js</code> asynchronously', 'pib' ),
|
159 |
+
- 'desc' => __( 'This may improve page load time by loading <code>pinit.js</code> independent of the rest of the page.', 'pib' ) . '</p>',
|
160 |
+
- 'type' => 'checkbox'
|
161 |
+
)*/
|
162 |
)
|
163 |
);
|
164 |
|
174 |
if ( false == get_option( 'pib_settings_styles' ) ) {
|
175 |
add_option( 'pib_settings_styles' );
|
176 |
}
|
177 |
+
|
178 |
if( false == get_option( 'pib_settings_advanced' ) ){
|
179 |
add_option( 'pib_settings_advanced' );
|
180 |
}
|
235 |
pib_get_settings_field_args( $option, 'styles' )
|
236 |
);
|
237 |
}
|
238 |
+
|
239 |
/* Add the Advanced Settings section */
|
240 |
add_settings_section(
|
241 |
'pib_settings_advanced',
|
315 |
$checked = true;
|
316 |
elseif ( isset( $args['std'] ) && $args['std'] == $key && ! isset( $pib_options[ $args['id'] ] ) )
|
317 |
$checked = true;
|
318 |
+
|
319 |
+
$html .= '<label for="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" class="pib-radio-label">';
|
320 |
$html .= '<input name="pib_settings_' . $args['section'] . '[' . $args['id'] . ']" id="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" type="radio" value="' . $key . '" ' . checked( true, $checked, false ) . '/>' . "\n";
|
321 |
+
$html .= $option . '</label>';
|
322 |
}
|
323 |
|
324 |
// Render and style description text underneath if it exists.
|
361 |
|
362 |
foreach ( $args['options'] as $key => $option ) {
|
363 |
if ( isset( $pib_options[$args['id']][$key] ) ) { $enabled = $option; } else { $enabled = NULL; }
|
364 |
+
$html .= '<label for="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" class="pib-checkbox-label">';
|
365 |
$html .= '<input name="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" id="pib_settings_' . $args['section'] . '[' . $args['id'] . '][' . $key . ']" type="checkbox" value="' . $option . '" ' . checked($option, $enabled, false) . '/>' . "\n";
|
366 |
+
$html .= $option . '</label>';
|
367 |
}
|
368 |
|
369 |
// Render and style description text underneath if it exists.
|
445 |
|
446 |
/**
|
447 |
* Textbox callback function
|
448 |
+
* Valid built-in size CSS class values:
|
449 |
+
* small-text, regular-text, large-text
|
450 |
*/
|
451 |
function pib_text_callback( $args ) {
|
452 |
global $pib_options;
|
456 |
else
|
457 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
458 |
|
459 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : '';
|
460 |
+
$html = "\n" . '<input type="text" class="' . $size . '" id="pib_settings_' . $args['section'] . '[' . $args['id'] . ']" name="pib_settings_' . $args['section'] . '[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>' . "\n";
|
461 |
|
462 |
// Render and style description text underneath if it exists.
|
463 |
if ( ! empty( $args['desc'] ) )
|
includes/shortcodes.php
CHANGED
@@ -25,13 +25,17 @@ function pib_pinit_shortcode( $attr ) {
|
|
25 |
*/
|
26 |
|
27 |
extract( shortcode_atts( array(
|
28 |
-
'count'
|
29 |
-
'url'
|
30 |
-
'image_url'
|
31 |
-
'description'
|
32 |
-
'align'
|
33 |
-
'remove_div'
|
34 |
-
'button_type'
|
|
|
|
|
|
|
|
|
35 |
), $attr ) );
|
36 |
|
37 |
if ( empty( $url ) ) {
|
@@ -68,7 +72,7 @@ function pib_pinit_shortcode( $attr ) {
|
|
68 |
// set button_type to a correct parameter to be passed
|
69 |
$button_type = ( $button_type == 'one' ? 'image_selected' : 'user_selects_image' );
|
70 |
|
71 |
-
$base_btn = pib_button_base( $button_type, $url, $image_url, $description, $count );
|
72 |
|
73 |
//Don't wrap with div or set float class if "remove div" is checked
|
74 |
if ( $remove_div ) {
|
25 |
*/
|
26 |
|
27 |
extract( shortcode_atts( array(
|
28 |
+
'count' => 'none',
|
29 |
+
'url' => '',
|
30 |
+
'image_url' => '',
|
31 |
+
'description' => '',
|
32 |
+
'align' => 'none',
|
33 |
+
'remove_div' => false,
|
34 |
+
'button_type' => 'any',
|
35 |
+
'size' => 'small',
|
36 |
+
'color' => 'gray',
|
37 |
+
'shape' => 'rectangular',
|
38 |
+
'always_show_count' => 'false'
|
39 |
), $attr ) );
|
40 |
|
41 |
if ( empty( $url ) ) {
|
72 |
// set button_type to a correct parameter to be passed
|
73 |
$button_type = ( $button_type == 'one' ? 'image_selected' : 'user_selects_image' );
|
74 |
|
75 |
+
$base_btn = pib_button_base( $button_type, $url, $image_url, $description, $count, $size, $color, $shape, $always_show_count );
|
76 |
|
77 |
//Don't wrap with div or set float class if "remove div" is checked
|
78 |
if ( $remove_div ) {
|
includes/widgets.php
CHANGED
@@ -46,6 +46,9 @@ class PIB_Widget extends WP_Widget {
|
|
46 |
$align = empty( $instance['button_align'] ) ? 'none' : $instance['button_align'];
|
47 |
$pib_remove_div = (bool) $instance['remove_div'];
|
48 |
$button_type = empty ( $instance['button_type'] ) ? 'user_selects_image' : $instance['button_type'];
|
|
|
|
|
|
|
49 |
|
50 |
// If the button type is set for users to select image then we need to overwrite any values from the widget that are used
|
51 |
// for displaying a a pre-selected image. These are not erased from the widget, but are just overwritten here.
|
@@ -55,7 +58,7 @@ class PIB_Widget extends WP_Widget {
|
|
55 |
$pib_description_widget = '';
|
56 |
}
|
57 |
|
58 |
-
$base_btn = pib_button_base( $button_type, $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout );
|
59 |
|
60 |
echo $before_widget;
|
61 |
|
@@ -98,6 +101,9 @@ class PIB_Widget extends WP_Widget {
|
|
98 |
$instance['button_align'] = $new_instance['align'];
|
99 |
$instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
|
100 |
$instance['button_type'] = $new_instance['button_type'];
|
|
|
|
|
|
|
101 |
|
102 |
return $instance;
|
103 |
}
|
@@ -113,7 +119,10 @@ class PIB_Widget extends WP_Widget {
|
|
113 |
'pib_url_of_img_widget' => '',
|
114 |
'pib_description_widget' => '',
|
115 |
'button_align' => 'none',
|
116 |
-
'remove_div' => 0
|
|
|
|
|
|
|
117 |
);
|
118 |
|
119 |
$instance = wp_parse_args( (array) $instance, $default );
|
@@ -137,6 +146,31 @@ class PIB_Widget extends WP_Widget {
|
|
137 |
<option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e( 'Above the Button', 'pib' ); ?></option>
|
138 |
</select>
|
139 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
<p>
|
142 |
Button Type:
|
46 |
$align = empty( $instance['button_align'] ) ? 'none' : $instance['button_align'];
|
47 |
$pib_remove_div = (bool) $instance['remove_div'];
|
48 |
$button_type = empty ( $instance['button_type'] ) ? 'user_selects_image' : $instance['button_type'];
|
49 |
+
$size = ( ! empty( $instance['size'] ) ? $instance['size'] : 'small' );
|
50 |
+
$color = ( ! empty( $instance['color'] ) ? $instance['color'] : 'gray' );
|
51 |
+
$shape = ( ! empty( $instance['shape'] ) ? $instance['shape'] : 'rectangular' );
|
52 |
|
53 |
// If the button type is set for users to select image then we need to overwrite any values from the widget that are used
|
54 |
// for displaying a a pre-selected image. These are not erased from the widget, but are just overwritten here.
|
58 |
$pib_description_widget = '';
|
59 |
}
|
60 |
|
61 |
+
$base_btn = pib_button_base( $button_type, $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout, $size, $color, $shape );
|
62 |
|
63 |
echo $before_widget;
|
64 |
|
101 |
$instance['button_align'] = $new_instance['align'];
|
102 |
$instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
|
103 |
$instance['button_type'] = $new_instance['button_type'];
|
104 |
+
$instance['size'] = $new_instance['size'];
|
105 |
+
$instance['color'] = $new_instance['color'];
|
106 |
+
$instance['shape'] = $new_instance['shape'];
|
107 |
|
108 |
return $instance;
|
109 |
}
|
119 |
'pib_url_of_img_widget' => '',
|
120 |
'pib_description_widget' => '',
|
121 |
'button_align' => 'none',
|
122 |
+
'remove_div' => 0,
|
123 |
+
'size' => 'small',
|
124 |
+
'color' => 'gray',
|
125 |
+
'shape' => 'rectangular'
|
126 |
);
|
127 |
|
128 |
$instance = wp_parse_args( (array) $instance, $default );
|
146 |
<option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e( 'Above the Button', 'pib' ); ?></option>
|
147 |
</select>
|
148 |
</p>
|
149 |
+
|
150 |
+
<p>
|
151 |
+
<label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Size:', 'pib' ); ?></label>
|
152 |
+
<select name="<?php echo $this->get_field_name( 'size' ); ?>" id="<?php echo $this->get_field_id( 'size' ); ?>">
|
153 |
+
<option value="small" <?php selected( $instance['size'], 'small' ); ?>><?php _e( 'Small', 'pib' ); ?></option>
|
154 |
+
<option value="large" <?php selected( $instance['size'], 'large' ); ?>><?php _e( 'Large', 'pib' ); ?></option>
|
155 |
+
</select>
|
156 |
+
</p>
|
157 |
+
|
158 |
+
<p>
|
159 |
+
<label for="<?php echo $this->get_field_id( 'shape' ); ?>"><?php _e( 'Shape:', 'pib' ); ?></label>
|
160 |
+
<select name="<?php echo $this->get_field_name( 'shape' ); ?>" id="<?php echo $this->get_field_id( 'shape' ); ?>">
|
161 |
+
<option value="rectangular" <?php selected( $instance['shape'], 'rectangular' ); ?>><?php _e( 'Rectangular', 'pib' ); ?></option>
|
162 |
+
<option value="circular" <?php selected( $instance['shape'], 'circular' ); ?>><?php _e( 'Circular', 'pib' ); ?></option>
|
163 |
+
</select>
|
164 |
+
</p>
|
165 |
+
|
166 |
+
<p>
|
167 |
+
<label for="<?php echo $this->get_field_id( 'color' ); ?>"><?php _e( 'Color:', 'pib' ); ?></label>
|
168 |
+
<select name="<?php echo $this->get_field_name( 'color' ); ?>" id="<?php echo $this->get_field_id( 'color' ); ?>">
|
169 |
+
<option value="gray" <?php selected( $instance['color'], 'gray' ); ?>><?php _e( 'Gray', 'pib' ); ?></option>
|
170 |
+
<option value="red" <?php selected( $instance['color'], 'red' ); ?>><?php _e( 'Red', 'pib' ); ?></option>
|
171 |
+
<option value="white" <?php selected( $instance['color'], 'white' ); ?>><?php _e( 'White', 'pib' ); ?></option>
|
172 |
+
</select>
|
173 |
+
</p>
|
174 |
|
175 |
<p>
|
176 |
Button Type:
|
js/index.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php // Silence is golden ?>
|
|
pinterest-pin-it-button.php
CHANGED
@@ -10,9 +10,9 @@
|
|
10 |
*
|
11 |
* @wordpress-plugin
|
12 |
* Plugin Name: Pinterest "Pin It" Button Lite
|
13 |
-
* Plugin URI: http://pinterestplugin.com
|
14 |
* Description: Add a Pinterest "Pin It" Button to your site and get your visitors to start pinning your awesome content!
|
15 |
-
* Version: 2.0.
|
16 |
* Author: Phil Derksen
|
17 |
* Author URI: http://philderksen.com
|
18 |
* License: GPL-2.0+
|
@@ -23,10 +23,15 @@
|
|
23 |
if ( ! defined( 'ABSPATH' ) )
|
24 |
exit;
|
25 |
|
26 |
-
if( ! class_exists( '
|
27 |
-
|
|
|
28 |
|
29 |
-
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
|
30 |
-
register_activation_hook( __FILE__, array( 'Pinterest_Pin_It_Button', 'activate' ) );
|
31 |
|
32 |
-
Pinterest_Pin_It_Button::get_instance();
|
|
|
|
|
|
|
|
10 |
*
|
11 |
* @wordpress-plugin
|
12 |
* Plugin Name: Pinterest "Pin It" Button Lite
|
13 |
+
* Plugin URI: http://pinterestplugin.com/pin-it-button-pro/
|
14 |
* Description: Add a Pinterest "Pin It" Button to your site and get your visitors to start pinning your awesome content!
|
15 |
+
* Version: 2.0.2
|
16 |
* Author: Phil Derksen
|
17 |
* Author URI: http://philderksen.com
|
18 |
* License: GPL-2.0+
|
23 |
if ( ! defined( 'ABSPATH' ) )
|
24 |
exit;
|
25 |
|
26 |
+
if( ! class_exists( 'Pinterest_Pin_It_Button_Pro' ) ) {
|
27 |
+
if( ! class_exists( 'Pinterest_Pin_It_Button' ) )
|
28 |
+
require_once( plugin_dir_path( __FILE__ ) . 'class-pinterest-pin-it-button.php' );
|
29 |
|
30 |
+
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
|
31 |
+
register_activation_hook( __FILE__, array( 'Pinterest_Pin_It_Button', 'activate' ) );
|
32 |
|
33 |
+
Pinterest_Pin_It_Button::get_instance();
|
34 |
+
} else {
|
35 |
+
echo "You already have Pinterest Pin It Button Pro installed. To downgrade please deactivate and delete the Pro plugin first.";
|
36 |
+
die();
|
37 |
+
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: pderksen, nickyoung87
|
3 |
Tags: pinterest, pinterest, pin it button, social, social media, image, images, photo, photos, pinterest pin it button, pin it, social button
|
4 |
Requires at least: 3.5.2
|
5 |
-
Tested up to: 3.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -21,6 +21,7 @@ No need to copy and paste code throughout your WordPress site.
|
|
21 |
* Pre-select an image for the reader to pin.
|
22 |
* Default to the first image in the post.
|
23 |
* Specify a specific image to pin per post.
|
|
|
24 |
* Hide the "Pin It" button on specific posts and pages.
|
25 |
* Add a "Pin It" button to your sidebar or footer as a widget.
|
26 |
* Place "Pin It" buttons anywhere using shortcodes.
|
@@ -34,8 +35,8 @@ No need to copy and paste code throughout your WordPress site.
|
|
34 |
* Twitter, Facebook, Google+ & LinkedIn sharing buttons included.
|
35 |
* Option to pin featured images.
|
36 |
* Show or hide on custom post types.
|
37 |
-
* WooCommerce compatibility
|
38 |
-
* Customer support and automatic updates
|
39 |
|
40 |
[Start Getting Pinned Like Crazy with "Pin It" Button Pro!](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
|
41 |
|
@@ -121,6 +122,13 @@ CSS styling and shortcode help available within the plugin admin.
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
= 2.0.1 =
|
125 |
|
126 |
* Added an option to disable Pinterest's pinit.js JavaScript to avoid conflicts with other Pinterest plugins, themes and custom code (on new "Advanced" tab).
|
2 |
Contributors: pderksen, nickyoung87
|
3 |
Tags: pinterest, pinterest, pin it button, social, social media, image, images, photo, photos, pinterest pin it button, pin it, social button
|
4 |
Requires at least: 3.5.2
|
5 |
+
Tested up to: 3.8
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
21 |
* Pre-select an image for the reader to pin.
|
22 |
* Default to the first image in the post.
|
23 |
* Specify a specific image to pin per post.
|
24 |
+
* Pick from official "Pin It" button colors and sizes.
|
25 |
* Hide the "Pin It" button on specific posts and pages.
|
26 |
* Add a "Pin It" button to your sidebar or footer as a widget.
|
27 |
* Place "Pin It" buttons anywhere using shortcodes.
|
35 |
* Twitter, Facebook, Google+ & LinkedIn sharing buttons included.
|
36 |
* Option to pin featured images.
|
37 |
* Show or hide on custom post types.
|
38 |
+
* WooCommerce compatibility.
|
39 |
+
* Customer support and automatic updates.
|
40 |
|
41 |
[Start Getting Pinned Like Crazy with "Pin It" Button Pro!](http://pinterestplugin.com/pin-it-button-pro/?utm_source=wordpress_org&utm_medium=link&utm_campaign=pin_it_button_lite)
|
42 |
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
+
= 2.0.2 =
|
126 |
+
|
127 |
+
* Added options for colors, sizes and shapes based on Pinterest's official widget builder.
|
128 |
+
* Added an option to show count bubble even for zero count pins.
|
129 |
+
* Minor bug fixes.
|
130 |
+
* Tested up to WordPress 3.8.
|
131 |
+
|
132 |
= 2.0.1 =
|
133 |
|
134 |
* Added an option to disable Pinterest's pinit.js JavaScript to avoid conflicts with other Pinterest plugins, themes and custom code (on new "Advanced" tab).
|
views/admin-help.php
CHANGED
@@ -81,10 +81,28 @@ if ( ! defined( 'ABSPATH' ) )
|
|
81 |
</tr>
|
82 |
<tr>
|
83 |
<td>description</td>
|
84 |
-
<td><?php _e( 'Description of the pin', 'pib' ); ?></td>
|
85 |
<td><?php _e( 'Any string of text', 'pib' ); ?></td>
|
86 |
<td>Post/page title</td>
|
87 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<tr>
|
89 |
<td>align</td>
|
90 |
<td><?php _e( 'Adds CSS to align button', 'pib' ); ?></td>
|
@@ -97,6 +115,12 @@ if ( ! defined( 'ABSPATH' ) )
|
|
97 |
<td>true, false</td>
|
98 |
<td>false</td>
|
99 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
</tbody>
|
101 |
</table>
|
102 |
|
81 |
</tr>
|
82 |
<tr>
|
83 |
<td>description</td>
|
84 |
+
<td><?php _e( 'Description of the pin. Ignored if button_type="any"', 'pib' ); ?></td>
|
85 |
<td><?php _e( 'Any string of text', 'pib' ); ?></td>
|
86 |
<td>Post/page title</td>
|
87 |
</tr>
|
88 |
+
<tr>
|
89 |
+
<td>size</td>
|
90 |
+
<td><?php _e( '"Pin It" button size', 'pib' ); ?></td>
|
91 |
+
<td>small, large</td>
|
92 |
+
<td>small</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<td>shape</td>
|
96 |
+
<td><?php _e( '"Pin It" button shape', 'pib' ); ?></td>
|
97 |
+
<td>rectangular, circular</td>
|
98 |
+
<td>rectangular</td>
|
99 |
+
</tr>
|
100 |
+
<tr>
|
101 |
+
<td>color</td>
|
102 |
+
<td><?php _e( '"Pin It" button color', 'pib' ); ?></td>
|
103 |
+
<td>gray, red, white</td>
|
104 |
+
<td>gray</td>
|
105 |
+
</tr>
|
106 |
<tr>
|
107 |
<td>align</td>
|
108 |
<td><?php _e( 'Adds CSS to align button', 'pib' ); ?></td>
|
115 |
<td>true, false</td>
|
116 |
<td>false</td>
|
117 |
</tr>
|
118 |
+
<tr>
|
119 |
+
<td>always_show_count</td>
|
120 |
+
<td><?php _e( 'Will always show the count bubble, even for pages with zero pins', 'pib' ); ?></td>
|
121 |
+
<td>true, false</td>
|
122 |
+
<td>false</td>
|
123 |
+
</tr>
|
124 |
</tbody>
|
125 |
</table>
|
126 |
|
views/admin-sidebar.php
CHANGED
@@ -42,28 +42,54 @@ if ( ! defined( 'ABSPATH' ) )
|
|
42 |
<?php _e( 'Upgrade to Pro Now', 'pib' ); ?></a>
|
43 |
<br/>
|
44 |
<p style="text-align: center;">
|
45 |
-
<?php _e( 'Enter discount code <strong>
|
46 |
</p>
|
47 |
</div>
|
48 |
</div>
|
49 |
|
50 |
-
<?php if ( pib_is_woo_commerce_active() ): ?>
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
</
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
<div class="sidebar-container">
|
69 |
<div class="sidebar-content">
|
42 |
<?php _e( 'Upgrade to Pro Now', 'pib' ); ?></a>
|
43 |
<br/>
|
44 |
<p style="text-align: center;">
|
45 |
+
<?php _e( 'Enter discount code <strong>HOLIDAY2013</strong> to get a <strong>10% discount</strong> until Dec 31, 2013!', 'pib' ); ?>
|
46 |
</p>
|
47 |
</div>
|
48 |
</div>
|
49 |
|
50 |
+
<?php if ( pib_is_woo_commerce_active() ): // Check if WooCommerce is active to show WC Rich Pins promo. ?>
|
51 |
+
|
52 |
+
<?php if ( ! pib_is_wc_rich_pins_active() ): // If WooCommerce Rich Pins is already active don't show. ?>
|
53 |
+
|
54 |
+
<div class="sidebar-container">
|
55 |
+
<h4 class="sidebar-title-medium"><?php _e( 'WooCommerce Rich Pins', 'pib' ); ?></h4>
|
56 |
+
<div class="sidebar-content">
|
57 |
+
<p>
|
58 |
+
<?php _e( 'Running a WooCommerce store and want to give your product pins a boost? There\'s a plugin for that.', 'pib' ); ?>
|
59 |
+
</p>
|
60 |
+
<p>
|
61 |
+
<a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/plugins/product-rich-pins-for-woocommerce/', 'pib_lite_2', 'sidebar_link', 'wc_rich_pins' ); ?>"
|
62 |
+
class="btn btn-small btn-block btn-inverse" target="_blank">
|
63 |
+
<?php _e( 'Check out Rich Pins for WooCommerce', 'pib' ); ?>
|
64 |
+
</a>
|
65 |
+
</p>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
|
69 |
+
<?php endif; // End WooCommerce Rich Pins check ?>
|
70 |
+
|
71 |
+
<?php else: // If not running WooCommerce show Article Rich Pins promo. ?>
|
72 |
+
|
73 |
+
<?php if ( ! pib_is_article_rich_pins_active() ): // Unless of course Article Rich Pins is already active. ?>
|
74 |
+
|
75 |
+
<div class="sidebar-container">
|
76 |
+
<h4 class="sidebar-title-medium"><?php _e( 'Article Rich Pins', 'pib' ); ?></h4>
|
77 |
+
<div class="sidebar-content">
|
78 |
+
<p>
|
79 |
+
<?php _e( 'Want give your pins a boost with <strong>Article Rich Pins</strong>? There\'s a plugin for that.', 'pib' ); ?>
|
80 |
+
</p>
|
81 |
+
<p>
|
82 |
+
<a href="<?php echo pib_ga_campaign_url( 'http://pinterestplugin.com/plugins/article-rich-pins/', 'pib_lite_2', 'sidebar_link', 'article_rich_pins' ); ?>"
|
83 |
+
class="btn btn-small btn-block btn-inverse" target="_blank">
|
84 |
+
<?php _e( 'Check out Article Rich Pins', 'pib' ); ?>
|
85 |
+
</a>
|
86 |
+
</p>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<?php endif; // End Article Rich Pins check ?>
|
91 |
+
|
92 |
+
<?php endif; // End WooCommerce check ?>
|
93 |
|
94 |
<div class="sidebar-container">
|
95 |
<div class="sidebar-content">
|
views/post-meta-display.php
CHANGED
@@ -12,14 +12,14 @@
|
|
12 |
if ( ! defined( 'ABSPATH' ) )
|
13 |
exit;
|
14 |
|
15 |
-
global $pib_options;
|
16 |
|
17 |
$button_type_display = ( $pib_options['button_type'] == 'user_selects_image' ) ? __( 'User selects image', 'pib' ) : __( 'Image pre-selected', 'pib' );
|
18 |
|
19 |
-
$pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled',
|
20 |
-
$pib_url_of_webpage
|
21 |
-
$pib_url_of_img
|
22 |
-
$pib_description
|
23 |
?>
|
24 |
|
25 |
<p>
|
@@ -36,27 +36,28 @@ $pib_description = get_post_meta( $post->ID, 'pib_description', true);
|
|
36 |
<?php endif; ?>
|
37 |
<p>
|
38 |
<label for="pib_url_of_webpage"><?php _e( 'URL of the web page to be pinned', 'pib' ); ?>:</label><br />
|
39 |
-
<input type="text" class="widefat" name="pib_url_of_webpage" id="pib_url_of_webpage" value="<?php echo $pib_url_of_webpage; ?>" />
|
40 |
<span class="description"><?php _e( 'Defaults to current post/page URL if left blank.', 'pib' ); ?></span>
|
41 |
</p>
|
42 |
<p>
|
43 |
<label for="pib_url_of_img"><?php _e( 'URL of the image to be pinned', 'pib' ); ?>:</label><br />
|
44 |
-
<input type="text" class="widefat" name="pib_url_of_img" id="pib_url_of_img" value="<?php echo $pib_url_of_img; ?>" />
|
45 |
<span class="description"><?php _e( 'Defaults to first image in post if left blank.', 'pib' ); ?></span>
|
46 |
</p>
|
47 |
<p>
|
48 |
<label for="pib_description"><?php _e( 'Description of the pin', 'pib' ); ?>:</label><br />
|
49 |
-
<input type="text" class="widefat" name="pib_description" id="pib_description" value="<?php echo $pib_description; ?>" />
|
50 |
<span class="description"><?php _e( 'Defaults to post title if left blank.', 'pib' ); ?></span>
|
51 |
</p>
|
52 |
<p>
|
53 |
<input type="checkbox" name="pib_enable_post_sharing" id="pib_enable_post_sharing" <?php checked( empty( $pib_sharing_checked ) || ($pib_sharing_checked === false) ); ?> />
|
54 |
<label for="pib_enable_post_sharing"><?php _e( 'Show "Pin It" button on this post/page', 'pib' ); ?></label>
|
55 |
</p>
|
56 |
-
<p>
|
57 |
-
|
58 |
</p>
|
59 |
-
<p>
|
60 |
-
|
61 |
</p>
|
|
|
62 |
<input type="hidden" name="pib_sharing_status_hidden" value="1" />
|
12 |
if ( ! defined( 'ABSPATH' ) )
|
13 |
exit;
|
14 |
|
15 |
+
global $pib_options, $post;
|
16 |
|
17 |
$button_type_display = ( $pib_options['button_type'] == 'user_selects_image' ) ? __( 'User selects image', 'pib' ) : __( 'Image pre-selected', 'pib' );
|
18 |
|
19 |
+
$pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled', true );
|
20 |
+
$pib_url_of_webpage = get_post_meta( $post->ID, 'pib_url_of_webpage', true);
|
21 |
+
$pib_url_of_img = get_post_meta( $post->ID, 'pib_url_of_img', true);
|
22 |
+
$pib_description = get_post_meta( $post->ID, 'pib_description', true);
|
23 |
?>
|
24 |
|
25 |
<p>
|
36 |
<?php endif; ?>
|
37 |
<p>
|
38 |
<label for="pib_url_of_webpage"><?php _e( 'URL of the web page to be pinned', 'pib' ); ?>:</label><br />
|
39 |
+
<input type="text" class="widefat" name="pib_url_of_webpage" id="pib_url_of_webpage" value="<?php echo esc_attr( $pib_url_of_webpage ); ?>" /><br/>
|
40 |
<span class="description"><?php _e( 'Defaults to current post/page URL if left blank.', 'pib' ); ?></span>
|
41 |
</p>
|
42 |
<p>
|
43 |
<label for="pib_url_of_img"><?php _e( 'URL of the image to be pinned', 'pib' ); ?>:</label><br />
|
44 |
+
<input type="text" class="widefat" name="pib_url_of_img" id="pib_url_of_img" value="<?php echo esc_attr( $pib_url_of_img ); ?>" /><br/>
|
45 |
<span class="description"><?php _e( 'Defaults to first image in post if left blank.', 'pib' ); ?></span>
|
46 |
</p>
|
47 |
<p>
|
48 |
<label for="pib_description"><?php _e( 'Description of the pin', 'pib' ); ?>:</label><br />
|
49 |
+
<input type="text" class="widefat" name="pib_description" id="pib_description" value="<?php echo esc_attr( $pib_description ); ?>" /><br/>
|
50 |
<span class="description"><?php _e( 'Defaults to post title if left blank.', 'pib' ); ?></span>
|
51 |
</p>
|
52 |
<p>
|
53 |
<input type="checkbox" name="pib_enable_post_sharing" id="pib_enable_post_sharing" <?php checked( empty( $pib_sharing_checked ) || ($pib_sharing_checked === false) ); ?> />
|
54 |
<label for="pib_enable_post_sharing"><?php _e( 'Show "Pin It" button on this post/page', 'pib' ); ?></label>
|
55 |
</p>
|
56 |
+
<p class="description">
|
57 |
+
<?php _e( 'If checked displays the button for this post (if Individual Posts selected) or this page (if Individual Pages selected) in the main "Pin It" button settings.', 'pib' ); ?>
|
58 |
</p>
|
59 |
+
<p class="description">
|
60 |
+
<?php _e( 'If unchecked the button will always be hidden for this post/page.', 'pib' ); ?>
|
61 |
</p>
|
62 |
+
|
63 |
<input type="hidden" name="pib_sharing_status_hidden" value="1" />
|
views/public.php
CHANGED
@@ -37,7 +37,7 @@ add_action( 'wp_head', 'pib_add_custom_css' );
|
|
37 |
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
|
38 |
</a>
|
39 |
*/
|
40 |
-
function pib_button_base( $button_type, $post_url, $image_url, $description, $count_layout ) {
|
41 |
global $pib_options;
|
42 |
global $post;
|
43 |
$postID = $post->ID;
|
@@ -87,13 +87,39 @@ function pib_button_base( $button_type, $post_url, $image_url, $description, $co
|
|
87 |
$link_href = '//www.pinterest.com/pin/create/button/' .
|
88 |
'?url=' . rawurlencode( $post_url ) .
|
89 |
'&media=' . rawurlencode( $image_url ) .
|
90 |
-
'&description=' . rawurlencode( $description );
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
// Full link html with data attributes.
|
93 |
// Add rel="nobox" to prevent lightbox popup.
|
94 |
$link_html = '<a href="' . $link_href . '" ' .
|
95 |
'data-pin-do="' . $data_pin_do . '" ' .
|
96 |
'data-pin-config="' . $data_pin_config . '" ' .
|
|
|
|
|
|
|
|
|
97 |
'rel="nobox">' .
|
98 |
$inner_btn_html . '</a>';
|
99 |
|
@@ -119,8 +145,12 @@ function pib_button_html( $image_url = '' ) {
|
|
119 |
$image_url = get_post_meta( $postID, 'pib_url_of_img', true );
|
120 |
|
121 |
$count_layout = $pib_options['count_layout'];
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
$base_btn = pib_button_base( $pib_options['button_type'], $post_url, $image_url, $description, $count_layout );
|
124 |
|
125 |
// Don't wrap with div if using other sharing buttons or "remove div" is checked.
|
126 |
if ( ! empty( $pib_options['remove_div'] ) )
|
37 |
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
|
38 |
</a>
|
39 |
*/
|
40 |
+
function pib_button_base( $button_type, $post_url, $image_url, $description, $count_layout, $size, $color, $shape, $show_zero_count = null ) {
|
41 |
global $pib_options;
|
42 |
global $post;
|
43 |
$postID = $post->ID;
|
87 |
$link_href = '//www.pinterest.com/pin/create/button/' .
|
88 |
'?url=' . rawurlencode( $post_url ) .
|
89 |
'&media=' . rawurlencode( $image_url ) .
|
90 |
+
'&description=' . rawurlencode( wp_strip_all_tags( $description ) );
|
91 |
+
|
92 |
+
// New options that were added to the widget builder on Pinterest
|
93 |
+
// the size is different depending on the shape of the button, so first we determine the shape and then set the size
|
94 |
+
if( $size == 'large' && $shape == 'circular' ) {
|
95 |
+
$data_pin_size = 'data-pin-height="32" ';
|
96 |
+
} else {
|
97 |
+
$data_pin_size = ( $size == 'large' ? 'data-pin-height="28" ' : ' ' );
|
98 |
+
}
|
99 |
+
|
100 |
+
$data_pin_color = ( ! empty( $color ) ? 'data-pin-color="' . $color . '" ' : ' ' );
|
101 |
+
$data_pin_shape = ( $shape == 'circular' ? 'data-pin-shape="round" ' : ' ' );
|
102 |
+
|
103 |
+
// Use new data-pin-zero option to show count bubbles even on pages that have 0 pins
|
104 |
+
// check if show_zero_count parameter is set and turn on the zero count if it is true
|
105 |
+
if( $show_zero_count !== null ) {
|
106 |
+
$display_zero = ( ( $show_zero_count == 'true' ) ? 'data-pin-zero="true" ' : ' ' );
|
107 |
+
} else {
|
108 |
+
// Check main settings option and set accordingly
|
109 |
+
$display_zero = ( ! empty( $pib_options['show_zero_count'] ) ? 'data-pin-zero="true" ' : ' ' );
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
// Full link html with data attributes.
|
115 |
// Add rel="nobox" to prevent lightbox popup.
|
116 |
$link_html = '<a href="' . $link_href . '" ' .
|
117 |
'data-pin-do="' . $data_pin_do . '" ' .
|
118 |
'data-pin-config="' . $data_pin_config . '" ' .
|
119 |
+
$data_pin_size .
|
120 |
+
$data_pin_color .
|
121 |
+
$display_zero .
|
122 |
+
$data_pin_shape .
|
123 |
'rel="nobox">' .
|
124 |
$inner_btn_html . '</a>';
|
125 |
|
145 |
$image_url = get_post_meta( $postID, 'pib_url_of_img', true );
|
146 |
|
147 |
$count_layout = $pib_options['count_layout'];
|
148 |
+
|
149 |
+
$size = ( ! empty( $pib_options['data_pin_size'] ) ? $pib_options['data_pin_size'] : '' );
|
150 |
+
$color = ( ! empty( $pib_options['data_pin_color'] ) ? $pib_options['data_pin_color'] : '' );
|
151 |
+
$shape = ( ! empty( $pib_options['data_pin_shape'] ) ? $pib_options['data_pin_shape'] : '' );
|
152 |
|
153 |
+
$base_btn = pib_button_base( $pib_options['button_type'], $post_url, $image_url, $description, $count_layout, $size, $color, $shape );
|
154 |
|
155 |
// Don't wrap with div if using other sharing buttons or "remove div" is checked.
|
156 |
if ( ! empty( $pib_options['remove_div'] ) )
|