jQuery Pin It Button for Images - Version 2.4.0

Version Description

  • Released 2017-02-26
  • Added support for custom showing and disabling the plugin on custom post types
Download this release

Release Info

Developer mrsztuczkens
Plugin Icon wp plugin jQuery Pin It Button for Images
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.4 to 2.4.0

includes/admin/settings/jpibfi-selection-settings.php CHANGED
@@ -19,6 +19,8 @@ class JPIBFI_Selection_Settings extends JPIBFI_Settings_Base {
19
  }
20
 
21
  function get_settings_i18n() {
 
 
22
  $parent = parent::get_settings_i18n();
23
  $i18n = array();
24
  $i18n['title'] = __( 'Selection settings', 'jquery-pin-it-button-for-images' );
@@ -39,7 +41,8 @@ class JPIBFI_Selection_Settings extends JPIBFI_Settings_Base {
39
  . __( '[search] - search pages' ) . '<br/>'
40
  . __( '[category] - category pages' ) . '<br/>'
41
  . __( '[tag] - tag pages' ) . '<br/>'
42
- . __( '[home] - blog page' ) . '</p>';
 
43
 
44
  return array_merge( $parent, $i18n );
45
  }
19
  }
20
 
21
  function get_settings_i18n() {
22
+ $existing_post_types = get_post_types( array( 'public' => true ) );
23
+
24
  $parent = parent::get_settings_i18n();
25
  $i18n = array();
26
  $i18n['title'] = __( 'Selection settings', 'jquery-pin-it-button-for-images' );
41
  . __( '[search] - search pages' ) . '<br/>'
42
  . __( '[category] - category pages' ) . '<br/>'
43
  . __( '[tag] - tag pages' ) . '<br/>'
44
+ . __( '[home] - blog page' ) . '<br/>'
45
+ . __( '[post_type] where post_type is one of the following: ') . join(', ', $existing_post_types) . '.</p>';
46
 
47
  return array_merge( $parent, $i18n );
48
  }
includes/public/class-jpibfi-client.php CHANGED
@@ -258,13 +258,14 @@ class JPIBFI_Client {
258
  if ( is_feed() ) {
259
  return false;
260
  }
 
261
  $add_jpibfi = false;
262
  $jpibfi_selection_options = $this->selection_options->get();
263
  $show_on = $jpibfi_selection_options['show_on'];
264
  $show_array = explode( ',', $show_on );
265
 
266
  foreach ( $show_array as $show_tag ) {
267
- if ( $this->is_tag( $show_tag ) ) {
268
  $add_jpibfi = true;
269
  break;
270
  }
@@ -277,7 +278,7 @@ class JPIBFI_Client {
277
  $disable_array = explode( ',', $disable_on );
278
 
279
  foreach ( $disable_array as $disable_tag ) {
280
- if ( $this->is_tag( $disable_tag ) ) {
281
  return false;
282
  }
283
  }
@@ -285,20 +286,24 @@ class JPIBFI_Client {
285
  return true;
286
  }
287
 
288
- function is_tag( $tag ) {
289
  $tag = trim( $tag );
290
  if ( is_numeric( $tag ) ) {
291
  $int = intval( $tag );
292
 
293
  return get_the_ID() === $int;
294
  }
 
 
 
 
 
 
295
  switch ( strtolower( $tag ) ) {
296
  case '[front]':
297
  return is_front_page();
298
  case '[single]':
299
  return is_single();
300
- case '[page]':
301
- return is_page();
302
  case '[archive]':
303
  return is_archive();
304
  case '[search]':
258
  if ( is_feed() ) {
259
  return false;
260
  }
261
+ $existing_post_types = get_post_types();
262
  $add_jpibfi = false;
263
  $jpibfi_selection_options = $this->selection_options->get();
264
  $show_on = $jpibfi_selection_options['show_on'];
265
  $show_array = explode( ',', $show_on );
266
 
267
  foreach ( $show_array as $show_tag ) {
268
+ if ( $this->is_tag( $show_tag, $existing_post_types ) ) {
269
  $add_jpibfi = true;
270
  break;
271
  }
278
  $disable_array = explode( ',', $disable_on );
279
 
280
  foreach ( $disable_array as $disable_tag ) {
281
+ if ( $this->is_tag( $disable_tag, $existing_post_types ) ) {
282
  return false;
283
  }
284
  }
286
  return true;
287
  }
288
 
289
+ function is_tag( $tag, $existing_post_types ) {
290
  $tag = trim( $tag );
291
  if ( is_numeric( $tag ) ) {
292
  $int = intval( $tag );
293
 
294
  return get_the_ID() === $int;
295
  }
296
+ $tag_without = str_replace(']', '', str_replace('[', '', $tag));
297
+
298
+ if ( in_array( $tag_without, $existing_post_types ) ) {
299
+ return is_singular( $tag_without ) || is_post_type_archive( $tag_without );
300
+ }
301
+
302
  switch ( strtolower( $tag ) ) {
303
  case '[front]':
304
  return is_front_page();
305
  case '[single]':
306
  return is_single();
 
 
307
  case '[archive]':
308
  return is_archive();
309
  case '[search]':
jquery-pin-it-button-for-images.php CHANGED
@@ -6,7 +6,7 @@ Description: Highlights images on hover and adds a "Pin It" button over them for
6
  Text Domain: jquery-pin-it-button-for-images
7
  Domain Path: /languages
8
  Author: Marcin Skrzypiec
9
- Version:2.3.4
10
  Author URI: https://highfiveplugins.com/
11
  */
12
 
@@ -18,7 +18,7 @@ if ( !class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) {
18
  final class jQuery_Pin_It_Button_For_Images {
19
 
20
  function __construct() {
21
- $version = '2.3.4';
22
  require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
  new JPIBFI(__FILE__, $version);
24
  }
6
  Text Domain: jquery-pin-it-button-for-images
7
  Domain Path: /languages
8
  Author: Marcin Skrzypiec
9
+ Version:2.4.0
10
  Author URI: https://highfiveplugins.com/
11
  */
12
 
18
  final class jQuery_Pin_It_Button_For_Images {
19
 
20
  function __construct() {
21
+ $version = '2.4.0';
22
  require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
  new JPIBFI(__FILE__, $version);
24
  }
languages/jquery-pin-it-button-for-images.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2017 jquery-pin-it-button-for-images
2
  # This file is distributed under the same license as the jquery-pin-it-button-for-images package.
3
  msgid ""
4
  msgstr ""
@@ -6,7 +6,7 @@ msgstr ""
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
10
  "Language-Team: Marcin Skrzypiec\n"
11
  "X-Poedit-Basepath: ..\n"
12
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -59,7 +59,7 @@ msgstr ""
59
  msgid "Settings tabs"
60
  msgstr ""
61
 
62
- #: includes/admin/JPIBFI_Welcome_Screen.php:145, includes/admin/settings/jpibfi-selection-settings.php:47
63
  msgid "Selection settings"
64
  msgstr ""
65
 
@@ -231,91 +231,91 @@ msgstr ""
231
  msgid "jQuery Pin It Button for Images Settings"
232
  msgstr ""
233
 
234
- #: includes/admin/settings/jpibfi-selection-settings.php:49
235
  msgid "Minimum image resolution"
236
  msgstr ""
237
 
238
- #: includes/admin/settings/jpibfi-selection-settings.php:51
239
  msgid "Use this settings to hide the \"Pin it\" button on small images (e.g. social media icons)."
240
  msgstr ""
241
 
242
- #: includes/admin/settings/jpibfi-selection-settings.php:53
243
  msgid "* - screen that is less than 768 pixels wide"
244
  msgstr ""
245
 
246
- #: includes/admin/settings/jpibfi-selection-settings.php:55
247
  msgid "For small screens* the \"Pin it\" button will show up if the image is at least %height% pixels high and %width% pixels wide."
248
  msgstr ""
249
 
250
- #: includes/admin/settings/jpibfi-selection-settings.php:57
251
  msgid "Otherwise, the \"Pin it\" button will show up if the image is at least %height% pixels high and %width% pixels wide."
252
  msgstr ""
253
 
254
- #: includes/admin/settings/jpibfi-selection-settings.php:61
255
  msgid "On which pages the \"Pin it\" button should be shown"
256
  msgstr ""
257
 
258
- #: includes/admin/settings/jpibfi-selection-settings.php:99
259
  msgid "Selection"
260
  msgstr ""
261
 
262
- #: includes/admin/settings/jpibfi-selection-settings.php:121
263
  msgid "Image selector"
264
  msgstr ""
265
 
266
- #: includes/admin/settings/jpibfi-selection-settings.php:123
267
  msgid "jQuery selector for all the images that should have the \"Pin it\" button. Set the value to %s if you want the \"Pin it\" button to appear only on images in content or %s to appear on all images on site (including sidebar, header and footer). If you know a thing or two about jQuery, you might use your own selector. %sClick here%s to read about jQuery selectors."
268
  msgstr ""
269
 
270
- #: includes/admin/settings/jpibfi-selection-settings.php:147
271
  msgid "Disabled classes"
272
  msgstr ""
273
 
274
- #: includes/admin/settings/jpibfi-selection-settings.php:149
275
  msgid "Images with these CSS classes won't show the \"Pin it\" button. Please separate multiple classes with semicolons. Spaces are not accepted."
276
  msgstr ""
277
 
278
- #: includes/admin/settings/jpibfi-selection-settings.php:161
279
  msgid "Enabled classes"
280
  msgstr ""
281
 
282
- #: includes/admin/settings/jpibfi-selection-settings.php:163
283
  msgid "Only images with these CSS classes will show the \"Pin it\" button. Please separate multiple classes with semicolons. If this field is empty, images with any (besides disabled ones) classes will show the Pin It button."
284
  msgstr ""
285
 
286
- #: includes/admin/settings/jpibfi-selection-settings.php:185, includes/admin/settings/jpibfi-selection-settings.php:207, includes/admin/settings/jpibfi-visual-settings.php:389
287
  msgid "Height"
288
  msgstr ""
289
 
290
- #: includes/admin/settings/jpibfi-selection-settings.php:187
291
  msgid "Minimum image height"
292
  msgstr ""
293
 
294
- #: includes/admin/settings/jpibfi-selection-settings.php:195, includes/admin/settings/jpibfi-selection-settings.php:217, includes/admin/settings/jpibfi-visual-settings.php:399
295
  msgid "Width"
296
  msgstr ""
297
 
298
- #: includes/admin/settings/jpibfi-selection-settings.php:197
299
  msgid "Minimum image width"
300
  msgstr ""
301
 
302
- #: includes/admin/settings/jpibfi-selection-settings.php:209
303
  msgid "Minimum image height for mobile"
304
  msgstr ""
305
 
306
- #: includes/admin/settings/jpibfi-selection-settings.php:219
307
  msgid "Minimum image width for mobile"
308
  msgstr ""
309
 
310
- #: includes/admin/settings/jpibfi-selection-settings.php:229
311
  msgid "Show on"
312
  msgstr ""
313
 
314
- #: includes/admin/settings/jpibfi-selection-settings.php:241
315
  msgid "Disable on"
316
  msgstr ""
317
 
318
- #: includes/admin/settings/jpibfi-selection-settings.php:287
319
  msgid "Disable plugin on this post"
320
  msgstr ""
321
 
1
+ # Copyright (C) 2018 jquery-pin-it-button-for-images
2
  # This file is distributed under the same license as the jquery-pin-it-button-for-images package.
3
  msgid ""
4
  msgstr ""
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
10
  "Language-Team: Marcin Skrzypiec\n"
11
  "X-Poedit-Basepath: ..\n"
12
  "X-Poedit-SourceCharset: UTF-8\n"
59
  msgid "Settings tabs"
60
  msgstr ""
61
 
62
+ #: includes/admin/JPIBFI_Welcome_Screen.php:145, includes/admin/settings/jpibfi-selection-settings.php:51
63
  msgid "Selection settings"
64
  msgstr ""
65
 
231
  msgid "jQuery Pin It Button for Images Settings"
232
  msgstr ""
233
 
234
+ #: includes/admin/settings/jpibfi-selection-settings.php:53
235
  msgid "Minimum image resolution"
236
  msgstr ""
237
 
238
+ #: includes/admin/settings/jpibfi-selection-settings.php:55
239
  msgid "Use this settings to hide the \"Pin it\" button on small images (e.g. social media icons)."
240
  msgstr ""
241
 
242
+ #: includes/admin/settings/jpibfi-selection-settings.php:57
243
  msgid "* - screen that is less than 768 pixels wide"
244
  msgstr ""
245
 
246
+ #: includes/admin/settings/jpibfi-selection-settings.php:59
247
  msgid "For small screens* the \"Pin it\" button will show up if the image is at least %height% pixels high and %width% pixels wide."
248
  msgstr ""
249
 
250
+ #: includes/admin/settings/jpibfi-selection-settings.php:61
251
  msgid "Otherwise, the \"Pin it\" button will show up if the image is at least %height% pixels high and %width% pixels wide."
252
  msgstr ""
253
 
254
+ #: includes/admin/settings/jpibfi-selection-settings.php:65
255
  msgid "On which pages the \"Pin it\" button should be shown"
256
  msgstr ""
257
 
258
+ #: includes/admin/settings/jpibfi-selection-settings.php:105
259
  msgid "Selection"
260
  msgstr ""
261
 
262
+ #: includes/admin/settings/jpibfi-selection-settings.php:127
263
  msgid "Image selector"
264
  msgstr ""
265
 
266
+ #: includes/admin/settings/jpibfi-selection-settings.php:129
267
  msgid "jQuery selector for all the images that should have the \"Pin it\" button. Set the value to %s if you want the \"Pin it\" button to appear only on images in content or %s to appear on all images on site (including sidebar, header and footer). If you know a thing or two about jQuery, you might use your own selector. %sClick here%s to read about jQuery selectors."
268
  msgstr ""
269
 
270
+ #: includes/admin/settings/jpibfi-selection-settings.php:153
271
  msgid "Disabled classes"
272
  msgstr ""
273
 
274
+ #: includes/admin/settings/jpibfi-selection-settings.php:155
275
  msgid "Images with these CSS classes won't show the \"Pin it\" button. Please separate multiple classes with semicolons. Spaces are not accepted."
276
  msgstr ""
277
 
278
+ #: includes/admin/settings/jpibfi-selection-settings.php:167
279
  msgid "Enabled classes"
280
  msgstr ""
281
 
282
+ #: includes/admin/settings/jpibfi-selection-settings.php:169
283
  msgid "Only images with these CSS classes will show the \"Pin it\" button. Please separate multiple classes with semicolons. If this field is empty, images with any (besides disabled ones) classes will show the Pin It button."
284
  msgstr ""
285
 
286
+ #: includes/admin/settings/jpibfi-selection-settings.php:191, includes/admin/settings/jpibfi-selection-settings.php:213, includes/admin/settings/jpibfi-visual-settings.php:389
287
  msgid "Height"
288
  msgstr ""
289
 
290
+ #: includes/admin/settings/jpibfi-selection-settings.php:193
291
  msgid "Minimum image height"
292
  msgstr ""
293
 
294
+ #: includes/admin/settings/jpibfi-selection-settings.php:201, includes/admin/settings/jpibfi-selection-settings.php:223, includes/admin/settings/jpibfi-visual-settings.php:399
295
  msgid "Width"
296
  msgstr ""
297
 
298
+ #: includes/admin/settings/jpibfi-selection-settings.php:203
299
  msgid "Minimum image width"
300
  msgstr ""
301
 
302
+ #: includes/admin/settings/jpibfi-selection-settings.php:215
303
  msgid "Minimum image height for mobile"
304
  msgstr ""
305
 
306
+ #: includes/admin/settings/jpibfi-selection-settings.php:225
307
  msgid "Minimum image width for mobile"
308
  msgstr ""
309
 
310
+ #: includes/admin/settings/jpibfi-selection-settings.php:235
311
  msgid "Show on"
312
  msgstr ""
313
 
314
+ #: includes/admin/settings/jpibfi-selection-settings.php:247
315
  msgid "Disable on"
316
  msgstr ""
317
 
318
+ #: includes/admin/settings/jpibfi-selection-settings.php:293
319
  msgid "Disable plugin on this post"
320
  msgstr ""
321
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mrsztuczkens, redearthdesign, brocheafoin, robertark
3
  Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
4
  Requires at least: 3.3.0
5
  Tested up to: 4.9.1
6
- Stable tag: 2.3.4
7
  License: GPLv2 or later
8
 
9
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
@@ -68,6 +68,10 @@ Please report them in the plugin's support forum on Wordpress.org.
68
 
69
  == Changelog ==
70
 
 
 
 
 
71
  = 2.3.4 =
72
  * Released 2017-12-13
73
  * Minor bug fix related to getting image source
@@ -347,6 +351,9 @@ Please report them in the plugin's support forum on Wordpress.org.
347
 
348
  == Upgrade Notice ==
349
 
 
 
 
350
  = 2.3.4 =
351
  * Minor bug fix related to getting image source
352
 
3
  Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
4
  Requires at least: 3.3.0
5
  Tested up to: 4.9.1
6
+ Stable tag: 2.4.0
7
  License: GPLv2 or later
8
 
9
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
68
 
69
  == Changelog ==
70
 
71
+ = 2.4.0 =
72
+ * Released 2017-02-26
73
+ * Added support for custom showing and disabling the plugin on custom post types
74
+
75
  = 2.3.4 =
76
  * Released 2017-12-13
77
  * Minor bug fix related to getting image source
351
 
352
  == Upgrade Notice ==
353
 
354
+ = 2.4.0 =
355
+ * Added support for custom showing and disabling the plugin on custom post types
356
+
357
  = 2.3.4 =
358
  * Minor bug fix related to getting image source
359