jQuery Pin It Button for Images - Version 2.1.3

Version Description

  • Released 2017-01-12
  • Added ability to disable the plugin on certain filters and changing filters priority
  • Added strong type checking in settings to reduce errors caused by type mismatch
Download this release

Release Info

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

Code changes from version 2.1.2 to 2.1.3

Files changed (35) hide show
  1. css/admin-ad.css +2 -3
  2. css/admin.css +1 -1
  3. includes/admin/class-jpibfi-admin.php +0 -184
  4. includes/admin/includes/{class-jpibfi-ajax-result-builder.php → jpibfi-ajax-result-builder.php} +0 -0
  5. includes/admin/includes/jpibfi-nag.php +92 -0
  6. includes/admin/jpibfi-admin.php +220 -0
  7. includes/admin/settings/class-jpibfi-import-export-settings.php +0 -126
  8. includes/admin/settings/class-jpibfi-selection-settings.php +0 -188
  9. includes/admin/settings/class-jpibfi-settings-base.php +0 -117
  10. includes/admin/settings/class-jpibfi-settings-validator.php +0 -69
  11. includes/admin/settings/class-jpibfi-visual-settings.php +0 -209
  12. includes/admin/settings/jpibfi-advanced-settings.php +78 -0
  13. includes/admin/settings/jpibfi-import-export-settings.php +135 -0
  14. includes/admin/settings/jpibfi-license-settings.php +5 -0
  15. includes/admin/settings/jpibfi-selection-settings.php +183 -0
  16. includes/admin/settings/jpibfi-settings-base.php +130 -0
  17. includes/admin/settings/jpibfi-validator.php +150 -0
  18. includes/admin/settings/jpibfi-visual-settings.php +248 -0
  19. includes/includes/{class-jpibfi-edd-sl-plugin-updater.php → jpibfi-edd-sl-plugin-updater.php} +71 -27
  20. includes/includes/{class-jpibfi-includes.php → jpibfi-includes.php} +5 -4
  21. includes/includes/{class-jpibfi-option-converter.php → jpibfi-option-converter.php} +4 -5
  22. includes/includes/{class-jpibfi-updater.php → jpibfi-updater.php} +0 -0
  23. includes/includes/options/class-jpibfi-license-options.php +0 -3
  24. includes/includes/options/index.php +1 -0
  25. includes/includes/options/jpibfi-advanced-options.php +21 -0
  26. includes/{admin/settings/class-jpibfi-license-settings.php → includes/options/jpibfi-license-options.php} +0 -0
  27. includes/includes/options/{class-jpibfi-options.php → jpibfi-options.php} +2 -2
  28. includes/includes/options/{class-jpibfi-selection-options.php → jpibfi-selection-options.php} +0 -0
  29. includes/includes/options/{class-jpibfi-visual-options.php → jpibfi-visual-options.php} +0 -0
  30. includes/{class-jpibfi.php → jpibfi.php} +7 -2
  31. includes/public/class-jpibfi-client.php +23 -3
  32. jquery-pin-it-button-for-images.php +21 -21
  33. js/jpibfi.admin.js +9 -9
  34. languages/jquery-pin-it-button-for-images.pot +206 -126
  35. readme.txt +10 -2
css/admin-ad.css CHANGED
@@ -1,12 +1,11 @@
1
div.jpibfi-pro-notice {
2
overflow: hidden;
3
- margin: 5px 0;
4
}
5
6
div.jpibfi-pro-notice p {
7
display:block;
8
float:left;
9
- font-size: 1.3em;
10
font-weight: 600;
11
color: #23282d;
12
margin: 5px 0;
@@ -19,7 +18,7 @@ div.jpibfi-pro-notice a {
19
div.jpibfi-pro-notice span {
20
display:block;
21
float: right;
22
- font-size: 1.6em;
23
padding: 2px 10px;
24
margin: 0.6em 0;
25
cursor: pointer;
1
div.jpibfi-pro-notice {
2
overflow: hidden;
3
}
4
5
div.jpibfi-pro-notice p {
6
display:block;
7
float:left;
8
+ font-size: 1em;
9
font-weight: 600;
10
color: #23282d;
11
margin: 5px 0;
18
div.jpibfi-pro-notice span {
19
display:block;
20
float: right;
21
+ font-size: 1em;
22
padding: 2px 10px;
23
margin: 0.6em 0;
24
cursor: pointer;
css/admin.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";a.pinit-button.old_default,a.pinit-button.old_default span{height:41px!important;width:65px!important}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-circle,a.pinit-button.default.jpibfi-size-small .jpibfi-icon-plain{font-size:28.8px}a.pinit-button.custom,a.pinit-button.old_default{text-indent:-9999em!important}a.pinit-button.custom span,a.pinit-button.old_default span{display:block;background-color:transparent!important;background-repeat:no-repeat!important;background-position:0 0!important}a.pinit-button.old_default span{background-image:url(images/pinit-button.png)!important;background-size:65px 41px!important}a.pinit-button.default{display:block;overflow:hidden;text-decoration:none;color:#fff;background-color:#bd081c}a.pinit-button.default:hover{background-color:#a50718}a.pinit-button.default.jpibfi-size-small{height:43.2px}a.pinit-button.default.jpibfi-size-small.jpibfi-button-round,a.pinit-button.default.jpibfi-size-small.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-small.jpibfi-button-square{width:43.2px}a.pinit-button.default.jpibfi-size-small.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-small.jpibfi-button-rounded-rectangle{width:64.8px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-circle:before{margin-top:-14.4px;margin-left:-12.38px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-pushpin,a.pinit-button.default.jpibfi-size-small .jpibfi-icon-thumb-tack{font-size:17.28px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-plain:before{margin-top:-13.5px;margin-left:-10.06px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-thumb-tack:before{margin-top:-7.97px;margin-left:-5.54px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-pushpin:before{margin-top:-8.64px;margin-left:-8.64px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-pinterest2{font-size:28.8px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-circle,a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-plain{font-size:36px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-pinterest2:before{margin-top:-14.4px;margin-left:-14.4px}a.pinit-button.default.jpibfi-size-normal{height:54px}a.pinit-button.default.jpibfi-size-normal.jpibfi-button-round,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-square{width:54px}a.pinit-button.default.jpibfi-size-large.jpibfi-button-round,a.pinit-button.default.jpibfi-size-large.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-large.jpibfi-button-square,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rounded-rectangle{width:81px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-circle:before{margin-top:-18px;margin-left:-15.47px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-pushpin,a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-thumb-tack{font-size:21.6px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-plain:before{margin-top:-16.88px;margin-left:-12.58px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-thumb-tack:before{margin-top:-9.96px;margin-left:-6.92px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-pushpin:before{margin-top:-10.8px;margin-left:-10.8px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-pinterest2{font-size:36px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-circle,a.pinit-button.default.jpibfi-size-large .jpibfi-icon-plain{font-size:54px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-pinterest2:before{margin-top:-18px;margin-left:-18px}a.pinit-button.default.jpibfi-size-large{height:81px}a.pinit-button.default.jpibfi-size-large.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-large.jpibfi-button-rounded-rectangle{width:121.5px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-circle:before{margin-top:-27px;margin-left:-23.2px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-pushpin,a.pinit-button.default.jpibfi-size-large .jpibfi-icon-thumb-tack{font-size:32.4px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-plain:before{margin-top:-25.31px;margin-left:-18.86px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-thumb-tack:before{margin-top:-14.93px;margin-left:-10.38px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-pushpin:before{margin-top:-16.2px;margin-left:-16.2px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-pinterest2{font-size:54px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-pinterest2:before{margin-top:-27px;margin-left:-27px}a.pinit-button.default.jpibfi-button-rounded-rectangle,a.pinit-button.default.jpibfi-button-rounded-square{border-radius:10px}a.pinit-button.default.jpibfi-button-round{border-radius:50%}a.pinit-button.default [class*=" jpibfi-icon-"],a.pinit-button.default [class^=jpibfi-icon-]{color:#fff;display:block}a.pinit-button.default [class*=" jpibfi-icon-"]:hover,a.pinit-button.default [class^=jpibfi-icon-]:hover{color:#fff}a.pinit-button.default [class*=" jpibfi-icon-"]:before,a.pinit-button.default [class^=jpibfi-icon-]:before{display:block;position:absolute;top:50%;left:50%}@font-face{font-family:jpibfi-font;src:url(fonts/jpibfi-font.eot?ifsn2k);src:url(fonts/jpibfi-font.eot?ifsn2k#iefix) format("embedded-opentype"),url(fonts/jpibfi-font.ttf?ifsn2k) format("truetype"),url(fonts/jpibfi-font.woff?ifsn2k) format("woff"),url(fonts/jpibfi-font.svg?ifsn2k#jpibfi-font) format("svg");font-weight:400;font-style:normal}[class*=" jpibfi-icon-"],[class^=jpibfi-icon-]{font-family:jpibfi-font!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.jpibfi-icon-circle:before{content:""}.jpibfi-icon-plain:before{content:""}.jpibfi-icon-thumb-tack:before{content:""}.jpibfi-icon-pushpin:before{content:""}.jpibfi-icon-pinterest2:before{content:""}.frizzly-sortable li{cursor:move}input[type=checkbox]~label{padding-left:5px}input#custom_image_url{width:100%}div.checkbox-indented{margin-left:20px}table.jpibfi-inner-table td,table.jpibfi-inner-table th{max-width:350px}table.jpibfi-inner-table th{padding:5px;width:auto}table.jpibfi-inner-table td{vertical-align:top;padding:0 15px 0 10px}a.pinit-button{display:block;position:relative}
1
+ @charset "UTF-8";a.pinit-button.old_default,a.pinit-button.old_default span{height:41px!important;width:65px!important}a.pinit-button.custom,a.pinit-button.old_default{text-indent:-9999em!important}a.pinit-button.custom span,a.pinit-button.old_default span{display:block;background-color:transparent!important;background-repeat:no-repeat!important;background-position:0 0!important}a.pinit-button.old_default span{background-image:url(images/pinit-button.png)!important;background-size:65px 41px!important}a.pinit-button.default{display:block;overflow:hidden;text-decoration:none;color:#fff;background-color:#bd081c}a.pinit-button.default:hover{background-color:#a50718}a.pinit-button.default.jpibfi-size-small{height:43.2px}a.pinit-button.default.jpibfi-size-small.jpibfi-button-round,a.pinit-button.default.jpibfi-size-small.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-small.jpibfi-button-square{width:43.2px}a.pinit-button.default.jpibfi-size-small.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-small.jpibfi-button-rounded-rectangle{width:64.8px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-circle{font-size:28.8px}a.pinit-button.default.jpibfi-size-small .jpibfi-icon-circle:before{margin-top:-14.4px;margin-left:-12.38px}a.pinit-button.default.jpibfi-size-normal{height:54px}a.pinit-button.default.jpibfi-size-normal.jpibfi-button-round,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-square{width:54px}a.pinit-button.default.jpibfi-size-large.jpibfi-button-round,a.pinit-button.default.jpibfi-size-large.jpibfi-button-rounded-square,a.pinit-button.default.jpibfi-size-large.jpibfi-button-square,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-normal.jpibfi-button-rounded-rectangle{width:81px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-circle{font-size:36px}a.pinit-button.default.jpibfi-size-normal .jpibfi-icon-circle:before{margin-top:-18px;margin-left:-15.47px}a.pinit-button.default.jpibfi-size-large{height:81px}a.pinit-button.default.jpibfi-size-large.jpibfi-button-rectangle,a.pinit-button.default.jpibfi-size-large.jpibfi-button-rounded-rectangle{width:121.5px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-circle{font-size:54px}a.pinit-button.default.jpibfi-size-large .jpibfi-icon-circle:before{margin-top:-27px;margin-left:-23.2px}a.pinit-button.default.jpibfi-button-rounded-rectangle,a.pinit-button.default.jpibfi-button-rounded-square{border-radius:10px}a.pinit-button.default.jpibfi-button-round{border-radius:50%}a.pinit-button.default [class*=" jpibfi-icon-"],a.pinit-button.default [class^=jpibfi-icon-]{color:#fff;display:block}a.pinit-button.default [class*=" jpibfi-icon-"]:hover,a.pinit-button.default [class^=jpibfi-icon-]:hover{color:#fff}a.pinit-button.default [class*=" jpibfi-icon-"]:before,a.pinit-button.default [class^=jpibfi-icon-]:before{display:block;position:absolute;top:50%;left:50%}@font-face{font-family:jpibfi-font;src:url(fonts/jpibfi-font.eot?ifsn2k);src:url(fonts/jpibfi-font.eot?ifsn2k#iefix) format("embedded-opentype"),url(fonts/jpibfi-font.ttf?ifsn2k) format("truetype"),url(fonts/jpibfi-font.woff?ifsn2k) format("woff"),url(fonts/jpibfi-font.svg?ifsn2k#jpibfi-font) format("svg");font-weight:400;font-style:normal}[class*=" jpibfi-icon-"],[class^=jpibfi-icon-]{font-family:jpibfi-font!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.jpibfi-icon-circle:before{content:""}.frizzly-sortable li{cursor:move}input[type=checkbox]~label{padding-left:5px}input#custom_image_url{width:100%}div.checkbox-indented{margin-left:20px}table.jpibfi-inner-table td,table.jpibfi-inner-table th{max-width:350px}table.jpibfi-inner-table th{padding:5px;width:auto}table.jpibfi-inner-table td{vertical-align:top;padding:0 15px 0 10px}a.pinit-button{display:block;position:relative}
includes/admin/class-jpibfi-admin.php DELETED
@@ -1,184 +0,0 @@
1
- <?php
2
-
3
- class JPIBFI_Admin {
4
-
5
- private $file;
6
- private $version;
7
-
8
- private $admin_screen_hook = '';
9
- private $import_export_settings;
10
- private $selection_settings;
11
- private $visual_settings;
12
-
13
- function __construct($file, $version) {
14
- $this->file = $file;
15
- $this->version = $version;
16
-
17
- $this->load_dependencies();
18
- $this->init_settings();
19
-
20
- add_action( 'admin_menu', array( $this, 'print_admin_page_action') );
21
- add_action( 'admin_enqueue_scripts', array($this, 'add_admin_scripts') );
22
-
23
- $jpibfi_plugin = plugin_basename( $this->file );
24
- add_filter( "plugin_action_links_$jpibfi_plugin", array( $this, 'add_settings_link' ) );
25
- add_action( 'admin_notices', array( $this, 'show_lightbox_ad' ), 11 );
26
- add_action( 'admin_notices', array( $this, 'show_pro_ad') );
27
- add_filter( 'plugin_row_meta', array($this, 'plugin_meta_links'), 10, 2 );
28
- add_action( 'wp_ajax_jpibfi_remove_pro_ad', array($this, 'remove_pro_ad') );
29
- }
30
-
31
- function add_settings_link( $links ) {
32
- $settings_link = '<a href="options-general.php?page=jpibfi_settings">' . __( 'Settings', 'jquery-pin-it-button-for-images' ) . '</a>';
33
- array_unshift( $links, $settings_link );
34
- return $links;
35
- }
36
-
37
- private function load_dependencies(){
38
- $deps = array(
39
- 'includes/class-jpibfi-ajax-result-builder.php',
40
- 'settings/class-jpibfi-settings-base.php',
41
- 'settings/class-jpibfi-settings-validator.php',
42
- 'settings/class-jpibfi-import-export-settings.php',
43
- 'settings/class-jpibfi-selection-settings.php',
44
- 'settings/class-jpibfi-visual-settings.php',
45
- );
46
- foreach ($deps as $dep)
47
- require_once $dep;
48
- }
49
-
50
- private function init_settings(){
51
- $this->import_export_settings = new JPIBFI_Import_Export_Settings();
52
- $this->selection_settings = new JPIBFI_Selection_Settings();
53
- $this->visual_settings = new JPIBFI_Visual_Settings();
54
- }
55
-
56
- public function print_admin_page_action() {
57
-
58
- $name = 'jQuery Pin It Button For Images Lite';
59
-
60
- $this->admin_screen_hook = add_options_page(
61
- $name,
62
- $name,
63
- 'manage_options',
64
- 'jpibfi_settings',
65
- array( $this, 'print_admin_page' )
66
- );
67
- }
68
-
69
- public function add_admin_scripts($hook) {
70
- if ($this->admin_screen_hook === $hook) {
71
- $this->add_settings_scripts();
72
- }
73
-
74
- if ('plugins.php' === $hook) {
75
- $this->add_remove_ad_scripts();
76
- }
77
- }
78
-
79
- private function add_settings_scripts() {
80
- $plugin_dir_url = plugin_dir_url($this->file);
81
-
82
- wp_enqueue_style( 'jquery-pin-it-button-admin-style', $plugin_dir_url . 'css/admin.css', array(), $this->version, 'all' );
83
- wp_enqueue_style( 'jpibfi-ad', $plugin_dir_url . 'css/admin-ad.css', array(), $this->version, 'all' );
84
-
85
- $slug = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'select';
86
- $settings = array (
87
- 'ajax' => apply_filters('jpibfi_settings_ajax', array (
88
- 'url' => admin_url( 'admin-ajax.php' ),
89
- 'tab' => $slug,
90
- )),
91
- 'tabs' => $this->get_sorted_tabs(),
92
- 'currentTab' => $slug,
93
- 'page' => 'jpibfi_settings',
94
- 'settings' => apply_filters( 'jpibfi_settings_configuration_' . $slug, array()),
95
- 'i18n' => array (
96
- 'editor' => apply_filters( 'jpibfi_settings_i18n_' . $slug, array (
97
- 'submit' => __('Save Changes', 'jquery-pin-it-button-for-images'),
98
- 'pro_feature_error' => sprintf(__('This feature is available in <a target="_blank" href="%s">the PRO version</a>.', 'jquery-pin-it-button-for-images'), 'https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/')
99
- )),
100
- 'status' => array (
101
- 'pending' => __('Saving changes ...', 'jquery-pin-it-button-for-images'),
102
- ),
103
- ),
104
- );
105
- $settings['version'] = 'lite';
106
- wp_enqueue_script( 'jpibfi', $plugin_dir_url . 'js/jpibfi.admin.js', array( 'jquery' ), $this->version, false );
107
- wp_localize_script('jpibfi', 'jpibfi_settings', $settings);
108
-
109
- if ( function_exists( "wp_enqueue_media") ) {
110
- wp_enqueue_media();
111
- }
112
- }
113
-
114
- private function get_sorted_tabs(){
115
- $settings_tabs = apply_filters('jpibfi_settings_tabs', array());
116
-
117
- /* order tabs by priority */
118
- $priority = array();
119
- foreach ($settings_tabs as $key => $tab){
120
- $priority[$key] = $tab['priority'];
121
- }
122
- array_multisort($priority, SORT_ASC, $settings_tabs);
123
- return $settings_tabs;
124
- }
125
-
126
- public function print_admin_page() {
127
- ?>
128
- <div ng-app="app" class="wrap">
129
- <h2><?php _e( 'jQuery Pin It Button For Images Options', 'jquery-pin-it-button-for-images' ); ?></h2>
130
- <div id="icon-plugins" class="icon32"></div>
131
- <app settings-name="jpibfi_settings"></app>
132
- </div>
133
- <?php
134
- }
135
-
136
- public function show_lightbox_ad() {
137
- global $hook_suffix;
138
- if ( $hook_suffix === $this->admin_screen_hook ) {
139
- ?>
140
- <div class="updated jpibfi-pro-notice">
141
- <p><?php echo sprintf(__('Lightbox feature has been transferred to another plugin. Click <a target="_blank" href="%s">here</a> to learn more.', 'jquery-pin-it-button-for-images'), 'http://bit.ly/2cXnS2D'); ?></p>
142
- </div>
143
- <?php
144
- }
145
- }
146
-
147
- private function add_remove_ad_scripts() {
148
- $plugin_dir_url = plugin_dir_url($this->file);
149
- wp_enqueue_style( 'jpibfi-ad', $plugin_dir_url . 'css/admin-ad.css', array(), $this->version, 'all' );
150
- wp_enqueue_script( 'jpibfi-ad', $plugin_dir_url . 'js/jpibfi-ad.admin.js', array( 'jquery' ), $this->version, false );
151
- }
152
-
153
- function show_pro_ad() {
154
- global $hook_suffix;
155
- $hooks = array();
156
- $hooks[] = $this->admin_screen_hook;
157
- if (get_option('jpibfi_pro_ad')) {
158
- $hooks[] = 'plugins.php';
159
- }
160
-
161
- if (in_array($hook_suffix, $hooks)) {
162
- $show_close = 'plugins.php' == $hook_suffix;
163
- ?>
164
- <div class="updated jpibfi-pro-notice">
165
- <p><?php echo sprintf(__('jQuery Pin It Button for Images Pro is available. Click <a target="_blank" href="%s">here</a> to learn more.', 'jquery-pin-it-button-for-images'), 'https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/'); ?></p>
166
- <?php if ($show_close): ?><span id="jpibfi_remove_ad" class="dashicons dashicons-no"></span><?php endif; ?>
167
- </div>
168
- <?php
169
- }
170
- }
171
-
172
- function plugin_meta_links( $links, $file ) {
173
- $plugin = plugin_basename($this->file);
174
- if ( $file == $plugin ) {
175
- return array_merge($links, array( '<a href="https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/">jQuery Pin It Button for Images Pro</a>' ));
176
- }
177
- return $links;
178
- }
179
-
180
- function remove_pro_ad(){
181
- delete_option('jpibfi_pro_ad');
182
- wp_die();
183
- }
184
- }
includes/admin/includes/{class-jpibfi-ajax-result-builder.php → jpibfi-ajax-result-builder.php} RENAMED
File without changes
includes/admin/includes/jpibfi-nag.php ADDED
@@ -0,0 +1,92 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class JPIBFI_Nag
5
+ *
6
+ * Heavily influenced by What The File Plugin
7
+ * https://wordpress.org/plugins/what-the-file/
8
+ */
9
+ class JPIBFI_Nag {
10
+
11
+ private $notice_key;
12
+ private $notice_text;
13
+ private $notice_period;
14
+ private $install_date_key;
15
+
16
+ function __construct($plugin_prefix, $plugin_name, $review_link, $period = '-10 days') {
17
+ $this->notice_key = $plugin_prefix . '_review_notice';
18
+ $this->install_date_key = $plugin_prefix . '_install_date';
19
+
20
+ $this->notice_text = sprintf(
21
+ __( "You've been using <b>%s</b> for some time now, could you please give it a review at wordpress.org? <br /><br /> <a href='%s' target='_blank'>Yes, take me there!</a> - <a href='%s'>I've already done this!</a>" ),
22
+ $plugin_name,
23
+ $review_link,
24
+ '%s'
25
+ );
26
+ $this->notice_period = $period;
27
+
28
+ $this->setup();
29
+ }
30
+
31
+ public function setup() {
32
+ if ( current_user_can( 'install_plugins' ) ) {
33
+ $this->catch_hide_notice();
34
+ $this->add_notice();
35
+ }
36
+ }
37
+
38
+ private function catch_hide_notice() {
39
+ if ( ! isset( $_GET[ $this->notice_key ] ) ) {
40
+ return;
41
+ }
42
+ global $current_user;
43
+ add_user_meta( $current_user->ID, $this->notice_key, '1', true );
44
+ wp_redirect( remove_query_arg( $this->notice_key ) );
45
+ exit;
46
+ }
47
+
48
+ private function add_notice() {
49
+ $current_user = wp_get_current_user();
50
+ $hide_notice = get_user_meta( $current_user->ID, $this->notice_key, true );
51
+
52
+ if ( '' != $hide_notice ) {
53
+ return;
54
+ }
55
+
56
+ // Get installation date
57
+ $datetime_install = $this->get_install_date();
58
+ $datetime_past = new DateTime( $this->notice_period );
59
+
60
+ if ( $datetime_past >= $datetime_install ) {
61
+ add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
62
+ }
63
+ }
64
+
65
+ private function get_install_date() {
66
+ $date_string = get_site_option( $this->install_date_key, '' );
67
+ if ( $date_string == '' ) {
68
+ $date_string = $this->insert_install_date();
69
+ }
70
+
71
+ return new DateTime( $date_string );
72
+ }
73
+
74
+ public function insert_install_date() {
75
+ $datetime_now = new DateTime();
76
+ $date_string = $datetime_now->format( 'Y-m-d' );
77
+ add_site_option( $this->install_date_key, $date_string );
78
+
79
+ return $date_string;
80
+ }
81
+
82
+ /**
83
+ * Display the admin notice
84
+ */
85
+ public function display_admin_notice() {
86
+ ?>
87
+ <div class="updated">
88
+ <p><?php printf( $this->notice_text, add_query_arg( $this->notice_key, '1' ) ); ?></p>
89
+ </div>
90
+ <?php
91
+ }
92
+ }
includes/admin/jpibfi-admin.php ADDED
@@ -0,0 +1,220 @@
1
+ <?php
2
+
3
+ class JPIBFI_Admin {
4
+
5
+ private $file;
6
+ private $version;
7
+
8
+ private $admin_screen_hook = '';
9
+
10
+ /**
11
+ * @var JPIBFI_Settings_Tab[]
12
+ */
13
+ private $tab_modules;
14
+
15
+ function __construct( $file, $version ) {
16
+ $this->file = $file;
17
+ $this->version = $version;
18
+
19
+ $this->tab_modules = array();
20
+
21
+ $this->load_dependencies();
22
+ $this->init();
23
+
24
+ add_action( 'admin_menu', array( $this, 'print_admin_page_action' ) );
25
+ add_action( 'admin_enqueue_scripts', array( $this, 'add_admin_scripts' ) );
26
+
27
+ $jpibfi_plugin = plugin_basename( $this->file );
28
+ add_filter( "plugin_action_links_$jpibfi_plugin", array( $this, 'add_settings_link' ) );
29
+ add_action( 'admin_notices', array( $this, 'show_ad' ), 11 );
30
+ add_action( 'admin_init', array( $this, 'show_nag' ) );
31
+ add_action( 'admin_notices', array( $this, 'show_pro_ad' ) );
32
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 2 );
33
+ add_action( 'wp_ajax_jpibfi_remove_pro_ad', array( $this, 'remove_pro_ad' ) );
34
+ }
35
+
36
+ function add_settings_link( $links ) {
37
+ $settings_link = '<a href="options-general.php?page=jpibfi_settings">' . __( 'Settings', 'jquery-pin-it-button-for-images' ) . '</a>';
38
+ array_unshift( $links, $settings_link );
39
+
40
+ return $links;
41
+ }
42
+
43
+ /**
44
+ * @param $tab_module JPIBFI_Settings_Tab
45
+ */
46
+ private function add_tab_module( $tab_module ) {
47
+ $this->tab_modules[ $tab_module->get_slug() ] = $tab_module;
48
+ }
49
+
50
+ private function load_dependencies() {
51
+ $deps = array(
52
+ 'includes/jpibfi-ajax-result-builder.php',
53
+ 'settings/jpibfi-settings-base.php',
54
+ 'settings/jpibfi-validator.php',
55
+ 'settings/jpibfi-import-export-settings.php',
56
+ 'settings/jpibfi-selection-settings.php',
57
+ 'settings/jpibfi-visual-settings.php',
58
+ 'settings/jpibfi-advanced-settings.php',
59
+ );
60
+ foreach ( $deps as $dep ) {
61
+ require_once $dep;
62
+ }
63
+ }
64
+
65
+ private function init() {
66
+ $this->add_tab_module( new JPIBFI_Selection_Settings() );
67
+ $this->add_tab_module( new JPIBFI_Visual_Settings() );
68
+ $this->add_tab_module( new JPIBFI_Advanced_Settings() );
69
+ $this->add_tab_module( new JPIBFI_Import_Export_Settings() );
70
+ }
71
+
72
+ public function print_admin_page_action() {
73
+
74
+ $name = 'jQuery Pin It Button For Images Lite';
75
+
76
+ $this->admin_screen_hook = add_options_page(
77
+ $name,
78
+ $name,
79
+ 'manage_options',
80
+ 'jpibfi_settings',
81
+ array( $this, 'print_admin_page' )
82
+ );
83
+ }
84
+
85
+ public function add_admin_scripts( $hook ) {
86
+ if ( $this->admin_screen_hook === $hook ) {
87
+ $this->add_settings_scripts();
88
+ }
89
+
90
+ if ( 'plugins.php' === $hook ) {
91
+ $this->add_remove_ad_scripts();
92
+ }
93
+ }
94
+
95
+ private function add_settings_scripts() {
96
+ $plugin_dir_url = plugin_dir_url( $this->file );
97
+
98
+ wp_enqueue_style( 'jquery-pin-it-button-admin-style', $plugin_dir_url . 'css/admin.css', array(), $this->version, 'all' );
99
+ wp_enqueue_style( 'jpibfi-ad', $plugin_dir_url . 'css/admin-ad.css', array(), $this->version, 'all' );
100
+
101
+ $slug = isset( $_GET['tab'] ) ? $_GET['tab'] : 'select';
102
+ $tab_mod = $this->get_tab( $slug );
103
+ $settings = array(
104
+ 'ajax' => $tab_mod->get_settings_ajax(),
105
+ 'tabs' => $this->get_tabs(),
106
+ 'currentTab' => $slug,
107
+ 'page' => 'jpibfi_settings',
108
+ 'links' => array(
109
+ array(
110
+ 'url' => 'https://highfiveplugins.com/jpibfi/jquery-pin-it-button-for-images-documentation/',
111
+ 'label' => __( 'Documentation', 'jquery-pin-it-button-for-images' )
112
+ ),
113
+ array(
114
+ 'url' => 'https://wordpress.org/support/plugin/jquery-pin-it-button-for-images',
115
+ 'label' => __( 'Support', 'jquery-pin-it-button-for-images' )
116
+ )
117
+ ),
118
+ 'settings' => $tab_mod->get_settings_configuration(),
119
+ 'i18n' => array(
120
+ 'editor' => $tab_mod->get_settings_i18n(),
121
+ 'status' => array( 'pending' => __( 'Saving changes ...', 'jquery-pin-it-button-for-images' ) ),
122
+ ),
123
+ );
124
+ $settings['version'] = 'lite';
125
+ wp_enqueue_script( 'jpibfi', $plugin_dir_url . 'js/jpibfi.admin.js', array( 'jquery' ), $this->version, false );
126
+ wp_localize_script( 'jpibfi', 'jpibfi_settings', $settings );
127
+
128
+ if ( function_exists( "wp_enqueue_media" ) ) {
129
+ wp_enqueue_media();
130
+ }
131
+ }
132
+
133
+ private function get_tab( $tab_slug ) {
134
+ return $this->tab_modules[ $tab_slug ];
135
+ }
136
+
137
+ private function get_tabs() {
138
+ $res = array();
139
+ foreach ( $this->tab_modules as $slug => $tab_module ) {
140
+ $res[] = $tab_module->get_module_settings();
141
+ }
142
+
143
+ return $res;
144
+ }
145
+
146
+ public function print_admin_page() {
147
+ ?>
148
+ <div ng-app="app" class="wrap">
149
+ <h2><?php _e( 'jQuery Pin It Button For Images Options', 'jquery-pin-it-button-for-images' ); ?></h2>
150
+ <div id="icon-plugins" class="icon32"></div>
151
+ <app settings-name="jpibfi_settings"></app>
152
+ </div>
153
+ <?php
154
+ }
155
+
156
+ public function show_ad() {
157
+ global $hook_suffix;
158
+ if ( $hook_suffix === $this->admin_screen_hook ) {
159
+ ?>
160
+ <div class="updated jpibfi-pro-notice">
161
+ <p>
162
+ <?php echo
163
+ wp_kses(
164
+ sprintf(
165
+ __( 'Check out <a href="%1$s" target="_blank">Frizzly</a> - share buttons for images and post content.', 'jquery-pin-it-button-for-images' ),
166
+ 'https://wordpress.org/plugins/frizzly/'
167
+ ),
168
+ array( 'a' => array( 'href' => array(), 'target' => array() ) )
169
+ ); ?>
170
+ </p>
171
+ </div>
172
+ <?php
173
+ }
174
+ }
175
+
176
+ private function add_remove_ad_scripts() {
177
+ $plugin_dir_url = plugin_dir_url( $this->file );
178
+ wp_enqueue_style( 'jpibfi-ad', $plugin_dir_url . 'css/admin-ad.css', array(), $this->version, 'all' );
179
+ wp_enqueue_script( 'jpibfi-ad', $plugin_dir_url . 'js/jpibfi-ad.admin.js', array( 'jquery' ), $this->version, false );
180
+ }
181
+
182
+ function show_nag() {
183
+ require_once 'includes/jpibfi-nag.php';
184
+ new JPIBFI_Nag('jpibfi', 'jQuery Pin It Button For Images', 'http://wordpress.org/support/view/plugin-reviews/jquery-pin-it-button-for-images', '-10 days');
185
+ }
186
+
187
+ function show_pro_ad() {
188
+ global $hook_suffix;
189
+ $hooks = array();
190
+ $hooks[] = $this->admin_screen_hook;
191
+ if ( get_option( 'jpibfi_pro_ad' ) ) {
192
+ $hooks[] = 'plugins.php';
193
+ }
194
+
195
+ if ( in_array( $hook_suffix, $hooks ) ) {
196
+ $show_close = 'plugins.php' == $hook_suffix;
197
+ ?>
198
+ <div class="updated jpibfi-pro-notice">
199
+ <p><?php echo sprintf( __( 'jQuery Pin It Button for Images Pro is available. Click <a target="_blank" href="%s">here</a> to learn more.', 'jquery-pin-it-button-for-images' ), 'https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/' ); ?></p>
200
+ <?php if ( $show_close ): ?><span id="jpibfi_remove_ad"
201
+ class="dashicons dashicons-no"></span><?php endif; ?>
202
+ </div>
203
+ <?php
204
+ }
205
+ }
206
+
207
+ function plugin_meta_links( $links, $file ) {
208
+ $plugin = plugin_basename( $this->file );
209
+ if ( $file == $plugin ) {
210
+ return array_merge( $links, array( '<a href="https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/">jQuery Pin It Button for Images Pro</a>' ) );
211
+ }
212
+
213
+ return $links;
214
+ }
215
+
216
+ function remove_pro_ad() {
217
+ delete_option( 'jpibfi_pro_ad' );
218
+ wp_die();
219
+ }
220
+ }
includes/admin/settings/class-jpibfi-import-export-settings.php DELETED
@@ -1,126 +0,0 @@
1
- <?php
2
-
3
- class JPIBFI_Import_Export_Settings extends JPIBFI_Settings_Tab {
4
-
5
- private $ajax_import_action;
6
-
7
- function __construct() {
8
- parent::__construct();
9
- $this->ajax_import_action = '_import';
10
- add_filter( 'export_args', array( $this, 'export_args' ) );
11
- add_action( 'export_wp', array( $this, 'export_wp' ) );
12
- add_filter($this->ajax_custom_action . $this->ajax_import_action, array($this, 'ajax_import'));
13
- }
14
-
15
- function ajax_import() {
16
- $result = new JPIBFI_Ajax_Result_Builder();
17
- $file = wp_import_handle_upload();
18
-
19
- if ( isset( $file['error'] ) ) {
20
- return $result
21
- ->set_error(esc_html( $file['error'] ))
22
- ->build();
23
- }
24
-
25
- if ( ! isset( $file['file'], $file['id'] ) ) {
26
- return $result
27
- ->set_error(__( 'The file did not upload properly. Please try again.', 'jquery-pin-it-button-for-images' ))
28
- ->build();
29
- }
30
-
31
- if ( ! file_exists( $file['file'] ) ) {
32
- wp_import_cleanup( $file['id'] );
33
- return $result
34
- ->set_error(sprintf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'jquery-pin-it-button-for-images' ), esc_html( $file['file'] ) ))
35
- ->build();
36
- }
37
-
38
- if ( ! is_file( $file['file'] ) ) {
39
- wp_import_cleanup( $file['id'] );
40
- return $result
41
- ->set_error(__( 'The path is not a file, please try again.', 'jquery-pin-it-button-for-images' ))
42
- ->build();
43
- }
44
-
45
- $file_contents = file_get_contents( $file['file'] );
46
- $data = json_decode( $file_contents, true );
47
- wp_import_cleanup( $file['id']);
48
-
49
- $options_to_import = $data['options'];
50
- foreach ( (array)$options_to_import as $option_name => $option_value ) {
51
- $options_to_import[$option_name] = maybe_unserialize( $option_value );
52
- }
53
-
54
- $converter = new JPIBFI_Option_Converter();
55
- $converter->save_and_convert_if_needed($options_to_import);
56
-
57
- return $result
58
- ->set_model($input)
59
- ->set_message(__('Import Successful', 'jquery_pin_it_button_for_images'))
60
- ->build();
61
- }
62
-
63
- function filter_settings_i18n($i18n) {
64
- $i18n['export_title'] = __( 'Export', 'jquery-pin-it-button-for-images' );
65
- $i18n['export_url'] = admin_url('export.php?download=true&content=jpibfi');
66
- $i18n['export_button_text'] = __('Download Export File', 'jquery-pin-it-button-for-images');
67
-
68
- $i18n['import_title'] = __( 'Import', 'jquery-pin-it-button-for-images' );
69
- $i18n['import_button_text'] = __('Import Settings', 'jquery-pin-it-button-for-images');
70
- $i18n['import_action_name'] = $this->ajax_import_action;
71
- return $i18n;
72
- }
73
-
74
- function get_module_settings() {
75
- return array (
76
- 'slug' => 'import',
77
- 'name' => __( 'Import/Export Settings', 'jquery-pin-it-button-for-images' ),
78
- 'priority' => 10,
79
- 'setting_name' => ''
80
- );
81
- }
82
-
83
- /**
84
- * @param array $args The export args being filtered.
85
- * @return array The (possibly modified) export args.
86
- */
87
- public function export_args( $args ) {
88
- if ( ! empty( $_GET['content'] ) && 'jpibfi' == $_GET['content'] ) {
89
- return array( 'jpibfi' => true );
90
- }
91
- return $args;
92
- }
93
-
94
-
95
- /**
96
- * Export options as a JSON file if that's what the user wants to do.
97
- *
98
- * @param array $args The export arguments.
99
- * @return void
100
- */
101
- public function export_wp( $args ) {
102
- if (empty($args['jpibfi']))
103
- return;
104
-
105
- $filename = 'jpibfi_settings_' . date( 'Y-m-d' ) . '.json';
106
-
107
- header( 'Content-Description: File Transfer' );
108
- header( 'Content-Disposition: attachment; filename=' . $filename );
109
- header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
110
-
111
- $option_names = apply_filters('jpibfi_option_names', array ('jpibfi_options_version'));
112
-
113
- $export_options = array();
114
-
115
- foreach ( $option_names as $option_name ) {
116
-
117
- $option_value = get_option( $option_name );
118
- if ( $option_value !== false ) {
119
- $export_options[ $option_name ] = maybe_serialize( $option_value );
120
- }
121
- }
122
- $JSON_PRETTY_PRINT = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
123
- echo json_encode( array( 'options' => $export_options ), $JSON_PRETTY_PRINT );
124
- exit;
125
- }
126
- }
includes/admin/settings/class-jpibfi-selection-settings.php DELETED
@@ -1,188 +0,0 @@
1
- <?php
2
-
3
- class JPIBFI_Selection_Settings extends JPIBFI_Settings_Base {
4
-
5
- function __construct() {
6
- parent::__construct();
7
- add_action( 'add_meta_boxes', array( $this, 'add_post_selection_meta_box' ), 10, 2 );
8
- add_action( 'save_post', array( $this, 'save_post_selection_meta' ), 10, 3);
9
- }
10
-
11
- function add_post_selection_meta_box( $post_type, $post ) {
12
- add_meta_box(
13
- 'jpibfi-disable-plugin_meta',
14
- __( 'jQuery Pin It Button for Images Settings', 'jquery-pin-it-button-for-images' ),
15
- array( $this, 'render_post_selection_meta_box' ),
16
- array( 'post', 'page' ),
17
- 'side'
18
- );
19
- }
20
-
21
- function filter_settings_i18n($i18n) {
22
- $i18n['title'] = __('Selection settings', 'jquery-pin-it-button-for-images');
23
- $i18n['image_resolution_label'] = __( 'Minimum image resolution', 'jquery-pin-it-button-for-images' );
24
- $i18n['image_resolution_desc'] = __( 'Use this settings to hide the "Pin it" button on small images (e.g. social media icons).', 'jquery-pin-it-button-for-images' );
25
- $i18n['image_resolution_desc_2'] = __( '* - screen that is less than 768 pixels wide', 'jquery-pin-it-button-for-images' );
26
- $i18n['min_resolution_template_small'] = __('For small screens* the "Pin it" button will show up if the image is at least %height% pixels high and %width% pixels wide.', 'jquery-pin-it-button-for-images');
27
- $i18n['min_resolution_template'] = __('Otherwise, the "Pin it" button will show up if the image is at least %height% pixels high and %width% pixels wide.', 'jquery-pin-it-button-for-images');
28
-
29
- $i18n['show_on_field_label'] = __( 'On which pages the "Pin it" button should be shown', 'jquery-pin-it-button-for-images' );
30
- $i18n['show_on_field_desc'] = __('Separate settings using commas. For the button to show up on a certain page, the page must be included in the "Show on" section and not included in the "Disable on" section. You can use the following settings:')
31
- . '<p>'
32
- . __( 'number (e.g. 588) - the ID of a certain page or post') . '<br/>'
33
- . __( '[front] - front page') . '<br/>'
34
- . __( '[single] - single posts') . '<br/>'
35
- . __( '[page] - single pages') . '<br/>'
36
- . __( '[archive] - archive pages') . '<br/>'
37
- . __( '[search] - search pages') . '<br/>'
38
- . __( '[category] - category pages') . '<br/>'
39
- . __( '[home] - blog page') . '</p>';
40
- return $i18n;
41
- }
42
-
43
- function get_module_settings() {
44
- return array (
45
- 'slug' => 'select',
46
- 'name' => __('Selection', 'jquery-pin-it-button-for-images'),
47
- 'priority' => 0,
48
- 'setting_name' => $this->get_options()->get_option_name()
49
- );
50
- }
51
-
52
- function get_options() {
53
- return new JPIBFI_Selection_Options();
54
- }
55
-
56
- function get_settings_configuration($params) {
57
-
58
- $option_value = $this->options->get();
59
- $res = array();
60
-
61
- $res['image_selector'] = array (
62
- 'key' => 'image_selector',
63
- 'label' => __( 'Image selector', 'jquery-pin-it-button-for-images' ),
64
- 'desc' => sprintf ( __( '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.', 'jquery-pin-it-button-for-images' ),
65
- '<strong>.jpibfi_container img</strong>',
66
- '<strong>img</strong>',
67
- '<a href="http://api.jquery.com/category/selectors/" target="_blank">',
68
- '</a>'
69
- )
70
- );
71
-
72
- $res['disabled_classes'] = array (
73
- 'key' => 'disabled_classes',
74
- 'label' => __( 'Disabled classes', 'jquery-pin-it-button-for-images' ),
75
- 'desc' => __( 'Pictures with these CSS classes won\'t show the "Pin it" button. Please separate multiple classes with semicolons. Spaces are not accepted.', 'jquery-pin-it-button-for-images' )
76
- );
77
-
78
- $res['enabled_classes'] = array (
79
- 'key' => 'enabled_classes',
80
- 'label' => __( 'Enabled classes', 'jquery-pin-it-button-for-images' ),
81
- 'desc' => __( 'Only pictures 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.', 'jquery-pin-it-button-for-images' ),
82
- );
83
-
84
- $local_args = array('min' => '0', 'step' => '1');
85
- $res['min_image_height'] = array_merge($local_args, array('key' => 'min_image_height', 'label' => __('Height', 'jquery-pin-it-button-for-images')));
86
- $res['min_image_width'] = array_merge($local_args, array('key' => 'min_image_width', 'label' => __('Width', 'jquery-pin-it-button-for-images')));
87
-
88
- $res['min_image_height_small'] = array_merge($local_args, array('key' => 'min_image_height_small', 'label' => __('Height', 'jquery-pin-it-button-for-images')));
89
- $res['min_image_width_small'] = array_merge($local_args, array('key' => 'min_image_width_small', 'label' => __('Width', 'jquery-pin-it-button-for-images')));
90
-
91
- $res['show_on'] = array (
92
- 'key' => 'show_on',
93
- 'label' => __( 'Show on', 'jquery-pin-it-button-for-images' ),
94
- );
95
-
96
- $res['disable_on'] = array (
97
- 'key' => 'disable_on',
98
- 'label' => __( 'Disable on', 'jquery-pin-it-button-for-images' ),
99
- );
100
-
101
- foreach($res as $key => $setting) {
102
- $res[$key]['value'] = $option_value[$key];
103
- }
104
-
105
- return $res;
106
- }
107
-
108
- function render_post_selection_meta_box() {
109
- global $post;
110
- $id = $post->ID;
111
- $options = $this->options->get();
112
- $disabled_list = $options['disable_on'];
113
- $disabled_array = explode(',', $disabled_list);
114
- $result = in_array((string)$id, $disabled_array);
115
- wp_nonce_field('jpibfi-post-selection', "jpibfi-post-selection");
116
- ?>
117
- <div>
118
- <label>
119
- <input name="jpibfi-disable-post" type="checkbox" <?php checked( true, $result, true); ?> value="1" />
120
- <?php _e('Disable plugin on this post', 'jquery-pin-it-button-for-images'); ?>
121
- </label>
122
- </div>
123
- <?php
124
- }
125
-
126
- public function sanitize_selection_options( $input ) {
127
-
128
- $this->sanitize_input($input);
129
- $output = $this->options->get();
130
-
131
- $validator = new JPIBFI_Settings_Validator($input, $output);
132
-
133
- foreach( $input as $key => $value ) {
134
- switch($key) {
135
- case 'disabled_classes':
136
- case 'enabled_classes':
137
- $field = 'disabled_classes' == $key
138
- ? __( 'Disabled classes', 'jquery-pin-it-button-for-images' )
139
- : __( 'Enabled classes', 'jquery-pin-it-button-for-images' );
140
- $error_message = $field . ' - ' . __('the given value doesn\'t meet the requirements. Please correct it and try again.', 'jquery-pin-it-button-for-images');
141
- $validator->validate_css_class_list($key, $error_message, array());
142
- break;
143
- case 'min_image_height':
144
- case 'min_image_width':
145
- $field = 'min_image_height' == $key
146
- ? __( 'Minimum image height', 'jquery-pin-it-button-for-images' )
147
- : __( 'Minimum image width', 'jquery-pin-it-button-for-images' );
148
- $error_message = $field . ' - ' . sprintf ( __('value must be a number greater or equal to %d.', 'jquery-pin-it-button-for-images'), '0' );
149
- $validator->validate_number($key, $error_message, array( 'min' => 0));
150
- break;
151
- default:
152
- $output[$key] = $value;
153
- break;
154
- }
155
- }
156
- return $output;
157
- }
158
-
159
- function save_post_selection_meta($post_id, $post, $update) {
160
- if ( !isset($_POST["jpibfi-post-selection"]) || !wp_verify_nonce($_POST["jpibfi-post-selection"], 'jpibfi-post-selection') )
161
- return $post_id;
162
-
163
- if ( !current_user_can("edit_post", $post_id) )
164
- return $post_id;
165
-
166
- if ( defined("DOING_AUTOSAVE") && DOING_AUTOSAVE )
167
- return $post_id;
168
-
169
- $should_be_in_array = isset($_POST["jpibfi-disable-post"]);
170
-
171
- $options = $this->options->get();
172
- $disabled_str = $options['disable_on'];
173
- $disabled_array = explode(',', $disabled_str);
174
- $is_in_array = in_array((string)$post_id, $disabled_array);
175
-
176
- if ($should_be_in_array === $is_in_array)
177
- return $post_id;
178
-
179
- if ($should_be_in_array)
180
- $disabled_array[] = (string)$post_id;
181
- else
182
- $disabled_array = array_diff( $disabled_array, array( (string)$post_id ) );
183
-
184
- $disabled_str = implode( ',', $disabled_array );
185
- $options['disable_on'] = $disabled_str;
186
- $this->options->update( $options );
187
- }
188
- }
includes/admin/settings/class-jpibfi-settings-base.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
-
3
- abstract class JPIBFI_Settings_Tab {
4
-
5
- protected abstract function get_module_settings();
6
-
7
- protected $ajax_custom_action;
8
-
9
- function __construct() {
10
- $this->ajax_custom_action = 'jpibfi_settings_custom';
11
- add_action( 'wp_ajax_' . $this->ajax_custom_action, array($this, 'ajax_custom') );
12
- add_filter( 'jpibfi_settings_ajax', array($this, 'filter_settings_ajax_custom'));
13
- add_filter( 'jpibfi_settings_tabs', array($this, 'filter_settings_tab'));
14
-
15
- $module_settings = $this->get_module_settings();
16
- $slug = $module_settings['slug'];
17
- add_filter('jpibfi_settings_i18n_' . $slug, array($this, 'filter_settings_i18n'));
18
- }
19
-
20
- function ajax_custom() {
21
- check_ajax_referer( $this->ajax_custom_action, 'nonce' );
22
- if (!current_user_can( 'manage_options' ))
23
- wp_die();
24
-
25
- $action = $_REQUEST['name'];
26
- $settings = json_decode(stripslashes($_REQUEST['settings']), true);
27
- $result = apply_filters($this->ajax_custom_action . $action, array(), $settings);
28
- wp_send_json( $result );
29
- }
30
-
31
- function filter_settings_ajax_custom($ajax) {
32
- $ajax['customAction'] = $this->ajax_custom_action;
33
- $ajax['customActionNonce'] = wp_create_nonce( $this->ajax_custom_action );
34
- return $ajax;
35
- }
36
-
37
- function filter_settings_i18n($i18n){
38
- return $i18n;
39
- }
40
-
41
- function filter_settings_tab($tabs) {
42
- $module_settings = $this->get_module_settings();
43
- $tabs[] = $module_settings;
44
- return $tabs;
45
- }
46
- }
47
-
48
- abstract class JPIBFI_Settings_Base extends JPIBFI_Settings_Tab {
49
-
50
- protected $ajax_save_action;
51
- protected $options;
52
- public $settings_name;
53
-
54
- function __construct() {
55
- parent::__construct();
56
- $this->ajax_save_action = 'jpibfi_settings_save_';
57
- $this->options = $this->get_options();
58
- $this->settings_name = $this->options->get_option_name();
59
-
60
- $module_settings = $this->get_module_settings();
61
- $slug = $module_settings['slug'];
62
-
63
- add_action( 'wp_ajax_' . $this->ajax_save_action . $slug, array($this, 'ajax_save_settings') );
64
- add_filter( 'jpibfi_settings_ajax', array($this, 'filter_settings_ajax_settings'));
65
- add_filter( 'jpibfi_option_names', array($this, 'add_option_name') );
66
- add_filter( 'jpibfi_settings_configuration_' . $slug, array($this, 'filter_settings_configuration'));
67
- add_filter( 'jpibfi_settings_i18n_' . $slug, array($this, 'filter_settings_i18n'));
68
- }
69
-
70
- public function add_option_name($arr) {
71
- $arr[] = $this->settings_name;
72
- return $arr;
73
- }
74
-
75
- function ajax_save_settings() {
76
- check_ajax_referer( $this->ajax_save_action, 'nonce' );
77
- if (!current_user_can( 'manage_options' ))
78
- wp_die();
79
-
80
- $settings = json_decode(stripslashes($_REQUEST['settings']), true);
81
- $update_result = $this->save_settings($settings);
82
- wp_send_json( $update_result );
83
- }
84
-
85
- protected function get_checkbox_settings() {
86
- return array();
87
- }
88
-
89
- protected abstract function get_options();
90
-
91
- function filter_settings_ajax_settings($ajax) {
92
- $ajax['saveSettingsAction'] = $this->ajax_save_action;
93
- $ajax['saveSettingsNonce'] = wp_create_nonce( $this->ajax_save_action );
94
- return $ajax;
95
- }
96
-
97
- function filter_settings_tab($tabs) {
98
- $module_settings = $this->get_module_settings();
99
- $tabs[] = $module_settings;
100
- return $tabs;
101
- }
102
-
103
- function filter_settings_configuration($result){
104
- return $this->get_settings_configuration($result);
105
- }
106
-
107
- function save_settings($settings){
108
- $settings = $this->options->sanitize( $settings );
109
- $this->options->update( $settings );
110
-
111
- $result = new JPIBFI_Ajax_Result_Builder();
112
- return $result
113
- ->set_model($settings)
114
- ->set_message(__('Settings saved.', 'jquery-pin-it-button-for-images'))
115
- ->build();
116
- }
117
- }
includes/admin/settings/class-jpibfi-settings-validator.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- class JPIBFI_Settings_Validator {
4
-
5
- private $input = null;
6
- private $output = null;
7
-
8
- function __construct($input_arr, &$output_arr){
9
- $this->input = $input_arr;
10
- $this->output = &$output_arr;
11
- }
12
-
13
- public function add_error($key, $error_text){
14
- add_settings_error(
15
- $key,
16
- esc_attr( 'settings_updated' ),
17
- $error_text
18
- );
19
- }
20
-
21
- public function validate_number($key, $error_message, $validator_settings){
22
- $this->validate($key, $error_message, 'v_number', $validator_settings);
23
- }
24
-
25
- public function validate_css_class_list($key, $error_message, $validation_settings){
26
- $this->validate($key, $error_message, 'v_css_class_names', $validator_settings);
27
- }
28
-
29
- private function validate($key, $error_message, $validator_name, $validator_settings){
30
- $value = $this->input[ $key ];
31
- $valid = call_user_func( array($this, $validator_name), $value, $validator_settings);
32
- $this->handle_validation_result($valid, $key, $error_message);
33
- }
34
-
35
- private function handle_validation_result($validation_result, $key, $error_message){
36
- if ( $validation_result ){
37
- $this->output[ $key ] = $this->input[ $key ];
38
- } else {
39
- $this->add_error($key, $error_message);
40
- }
41
- }
42
-
43
- /* V FUNCTIONS */
44
-
45
- /* Checks if given string contains class names separated by semicolons or is empty */
46
- private function v_css_class_names( $str, $settings ) {
47
- if ( 0 == strlen( $str ) )
48
- return true;
49
-
50
- $names = explode( ';', $str );
51
- $only_class_names = true;
52
-
53
- for( $i = 0; $i < count( $names ) && $only_class_names; $i++ )
54
- $only_class_names = 1 == preg_match( "/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*#x2F;", $names [ $i ] );
55
-
56
- return $only_class_names;
57
- }
58
-
59
- private function v_number($value, $settings){
60
- if (isset($settings['required']) && false == $settings['required'] && '' == $value)
61
- return true;
62
-
63
- return is_numeric($value)
64
- && (!isset($settings[ 'min' ]) || $value >= $settings['min'])
65
- && (!isset($settings[ 'max' ]) || $value <= $settings['max']);
66
- }
67
-
68
- /* END V FUNCTIONS */
69
- }
includes/admin/settings/class-jpibfi-visual-settings.php DELETED
@@ -1,209 +0,0 @@
1
- <?php
2
-
3
- class JPIBFI_Visual_Settings extends JPIBFI_Settings_Base {
4
-
5
- function __construct() {
6
- parent::__construct();
7
- }
8
-
9
- function filter_settings_i18n($i18n) {
10
- $i18n['margins_label'] = __( '"Pin it" button margins', 'jquery-pin-it-button-for-images' );
11
- $i18n['margins_desc'] = sprintf( __( 'Margins are used to adjust the position of the "Pin it" button, but not all margins are used on all button positions. Here is an example. If you\'re using the "%s" position, the button\'s position will be affected only by top and left margins. Bottom and right margins affect "%s" position, etc. The "%s" position does not use any margins at all.', 'jquery-pin-it-button-for-images' ),
12
- __( 'Top left', 'jquery-pin-it-button-for-images' ),
13
- __( 'Bottom right', 'jquery-pin-it-button-for-images' ),
14
- __( 'Middle', 'jquery-pin-it-button-for-images' )
15
- );
16
- $i18n['preview'] = __( 'Preview', 'jquery-pin-it-button-for-images' );
17
- $i18n['mode'] = __('Mode', 'jquery-pin-it-button-for-images');
18
- $i18n['settings'] = __('Settings', 'jquery-pin-it-button-for-images');
19
- $i18n['custom_button_desc'] = __( 'Click the button to choose an image from your WordPress media library. Height and width should fill automatically.', 'jquery-pin-it-button-for-images' );
20
- $i18n['custom_button_no_image_to_preview'] = __( 'No image to preview', 'jquery-pin-it-button-for-images' );
21
- $i18n['custom_button_upload'] = __( 'Upload an image using media library','jquery-pin-it-button-for-images');
22
- $i18n['custom_button_frame_title'] = __('Select your custom "Pin It" button', 'jquery-pin-it-button-for-images');
23
- $i18n['custom_button_frame_button_text'] = __('Use as "Pin It" button', 'jquery-pin-it-button-for-images');
24
-
25
- $i18n['attribution'] = sprintf( __('Available icons come from the following icon packs: %s and %s.', 'jquery-pin-it-button-for-images'),
26
- '<a href="http://fontawesome.io/" target="_blank">Font Awesome</a>',
27
- '<a href="https://icomoon.io/icons-icomoon.html" target="_blank">Icomoon</a>'
28
- );
29
-
30
- return $i18n;
31
- }
32
-
33
- function get_module_settings() {
34
- return array (
35
- 'slug' => 'visual',
36
- 'name' => __( 'Visual', 'jquery-pin-it-button-for-images' ),
37
- 'priority' => 1,
38
- 'setting_name' => $this->get_options()->get_option_name()
39
- );
40
- }
41
-
42
- function get_options() {
43
- return new JPIBFI_Visual_Options();
44
- }
45
-
46
- function get_settings_configuration($params) {
47
-
48
- $option_value = $this->options->get();
49
- $res = array();
50
-
51
- $res['show_button'] = array (
52
- 'key' => 'show_button',
53
- 'label' => __( 'Show button', 'jquery-pin-it-button-for-images' ),
54
- 'options' => array (
55
- 'hover' => __( 'On hover', 'jquery-pin-it-button-for-images' ),
56
- 'always_touch' => __( 'Always on touch devices', 'jquery-pin-it-button-for-images' ),
57
- 'always' => __( 'Always', 'jquery-pin-it-button-for-images' )
58
- ),
59
- 'desc' => __( 'When the "Pin it" button should be visible.', 'jquery-pin-it-button-for-images' )
60
- );
61
-
62
- $margin_args = array ('min' => '0', 'step' => '1', 'unit' => 'px');
63
- $res['button_margin_bottom'] = array_merge($margin_args, array('key' => 'button_margin_bottom', 'label' => __('Bottom', 'jquery-pin-it-button-for-images')));
64
- $res['button_margin_top'] = array_merge($margin_args, array('key' => 'button_margin_top', 'label' => __('Top', 'jquery-pin-it-button-for-images')));
65
- $res['button_margin_left'] = array_merge($margin_args, array('key' => 'button_margin_left', 'label' => __('Left', 'jquery-pin-it-button-for-images')));
66
- $res['button_margin_right'] = array_merge($margin_args, array('key' => 'button_margin_right', 'label' => __('Right', 'jquery-pin-it-button-for-images')));
67
-
68
- $res['button_position'] = array (
69
- 'key' => 'button_position',
70
- 'label' => __( '"Pin it" button position', 'jquery-pin-it-button-for-images' ),
71
- 'options' => array (
72
- 'top-left' => __( 'Top left', 'jquery-pin-it-button-for-images' ),
73
- 'top-right' => __( 'Top right', 'jquery-pin-it-button-for-images' ),
74
- 'bottom-left' => __( 'Bottom left', 'jquery-pin-it-button-for-images' ),
75
- 'bottom-right' => __( 'Bottom right', 'jquery-pin-it-button-for-images' ),
76
- 'middle' => __( 'Middle', 'jquery-pin-it-button-for-images' )
77
- ),
78
- 'desc' => __( 'Where the "Pin it" button should appear on the image.', 'jquery-pin-it-button-for-images' )
79
- );
80
-
81
- $res['description_option'] = array (
82
- 'key' => 'description_option',
83
- 'label' => __( 'Description source', 'jquery-pin-it-button-for-images' ),
84
- 'options' => array (
85
- "post_title" => __( 'Post title', 'jquery-pin-it-button-for-images' ),
86
- "post_excerpt" => __( 'Post description (excerpt)', 'jquery-pin-it-button-for-images' ),
87
- "img_title" => __( 'Image title attribute', 'jquery-pin-it-button-for-images' ),
88
- "site_title" => __( 'Site title (Settings->General)', 'jquery-pin-it-button-for-images' ),
89
- "img_description" => __( 'Image description', 'jquery-pin-it-button-for-images' ),
90
- "img_caption" => __('Image caption', 'jquery-pin-it-button-for-images' ),
91
- "img_alt" => __( 'Image alt attribute', 'jquery-pin-it-button-for-images' )
92
- ),
93
- 'desc' => __( 'From where the Pinterest message should be taken. Check which sources should be considered and prioritize them by dragging and dropping. The description will come from the top source that has data. Please note that "Image description" and "Image caption" work properly only for images that were added to your Media Library.', 'jquery-pin-it-button-for-images' )
94
- );
95
-
96
- $res['pinLinkedImages'] = array (
97
- 'key' => 'pinLinkedImages',
98
- 'label' => __('Pin linked images', 'jquery-pin-it-button-for-images'),
99
- 'text' => __('Active', 'jquery-pin-it-button-for-images'),
100
- 'desc' => __('When checked, pins full-sized images instead of thumbnails (works only if you link thumbnails to their full versions).', 'jquery-pin-it-button-for-images')
101
- );
102
-
103
- $res['transparency_value'] = array (
104
- 'key' => 'transparency_value',
105
- 'label' => __('Transparency value', 'jquery-pin-it-button-for-images'),
106
- 'desc' => sprintf ( __('Choose transparency (between %.02f and %.02f)', 'jquery-pin-it-button-for-images'), '0.00', '1.00' ),
107
- 'min' => '0',
108
- 'max' => '1',
109
- 'step' => '0.01'
110
- );
111
-
112
- $res['pin_image'] = array (
113
- 'key' => 'pin_image',
114
- 'label' => __('Pin image', 'jquery-pin-it-button-for-images'),
115
- 'options' => array (
116
- 'old_default' => __('Old default', 'jquery-pin-it-button-for-images'),
117
- 'default' => __('Default', 'jquery-pin-it-button-for-images'),
118
- 'custom' => __('Custom', 'jquery-pin-it-button-for-images')
119
- )
120
- );
121
-
122
- $res['pin_image_button'] = array (
123
- 'key' => 'pin_image_button',
124
- 'label' => __('Button', 'jquery-pin-it-button-for-images'),
125
- 'options' => array (
126
- 'square' => __('Square', 'jquery-pin-it-button-for-images'),
127
- 'rounded-square' => __('Rounded square', 'jquery-pin-it-button-for-images'),
128
- 'round' => __('Round', 'jquery-pin-it-button-for-images'),
129
- 'rectangle' => __('Rectangle', 'jquery-pin-it-button-for-images'),
130
- 'rounded-rectangle' => __('Rounded rectangle', 'jquery-pin-it-button-for-images')
131
- )
132
- );
133
-
134
- $pin_icon_options = array (
135
- 'circle' => __('Circle', 'jquery-pin-it-button-for-images'),
136
- 'plain' => __('Plain', 'jquery-pin-it-button-for-images'),
137
- 'thumb-tack' => __('Thumbtack', 'jquery-pin-it-button-for-images'),
138
- 'pushpin' => __('Thumbtack #2', 'jquery-pin-it-button-for-images'),
139
- 'pinterest2' => __('Classic', 'jquery-pin-it-button-for-images'),
140
- );
141
-
142
- $res['pin_image_icon'] = array (
143
- 'key' => 'pin_image_icon',
144
- 'label' => __('Icon', 'jquery-pin-it-button-for-images'),
145
- 'options' => $pin_icon_options
146
- );
147
-
148
- $res['pin_image_size'] = array (
149
- 'key' => 'pin_image_size',
150
- 'label' => __('Size', 'jquery-pin-it-button-for-images'),
151
- 'options' => array (
152
- 'small' => __('Small', 'jquery-pin-it-button-for-images'),
153
- 'normal' => __('Normal', 'jquery-pin-it-button-for-images'),
154
- 'large' => __('Large', 'jquery-pin-it-button-for-images'),
155
- )
156
- );
157
-
158
- $res['custom_image_url'] = array (
159
- 'key' => 'custom_image_url',
160
- 'label' => __( 'URL address of the image', 'jquery-pin-it-button-for-images' )
161
- );
162
-
163
- $image_size = array ('min' => '0', 'step' => '1', 'unit' => 'px');
164
- $res['custom_image_height'] = array_merge($margin_args, array('key' => 'custom_image_height', 'label' => __( 'Height', 'jquery-pin-it-button-for-images' )));
165
- $res['custom_image_width'] = array_merge($margin_args, array('key' => 'custom_image_width', 'label' => __('Width', 'jquery-pin-it-button-for-images')));
166
-
167
- foreach($res as $key => $setting) {
168
- $res[$key]['value'] = $option_value[$key];
169
- }
170
-
171
- return $res;
172
- }
173
-
174
- public function visual_options_callback() {
175
- echo '<p>' . __('How it should look like', 'jquery-pin-it-button-for-images') . '</p>';
176
- }
177
-
178
- public function sanitize_visual_options( $input ) {
179
-
180
- $this->sanitize_input( $input );
181
- $output = $this->options->get();
182
-
183
- $validator = new JPIBFI_Settings_Validator($input, $output);
184
-
185
- foreach( $input as $key => $value ) {
186
-
187
- switch($key) {
188
- case 'custom_image_height':
189
- case 'custom_image_width':
190
- $name = "";
191
- if ( 'custom_image_height' == $key )
192
- $name = __('Custom image height', 'jquery-pin-it-button-for-images' );
193
- else if ( 'custom_image_width' == $key )
194
- $name = __('Custom image width', 'jquery-pin-it-button-for-images' );
195
- $error_message = $name . ' - ' . sprintf ( __('value must be empty or a number greater or equal to %d.', 'jquery-pin-it-button-for-images'), '0' );
196
- $validator->validate_number($key, $error_message, array( 'min' => 0, 'required' => false));
197
- break;
198
- case 'transparency_value':
199
- $error_message = sprintf( __('Transparency value must be a number between %.02d and %.02f.', 'jquery-pin-it-button-for-images'), '0.00', '1.00' );
200
- $validator->validate_number($key, $error_message, array( 'min' => 0.0, 'max' => 1.0));
201
- break;
202
- default:
203
- $output[ $key ] = $value;
204
- break;
205
- }
206
- }
207
- return $this->options->sanitize($output);
208
- }
209
- }
includes/admin/settings/jpibfi-advanced-settings.php ADDED
@@ -0,0 +1,78 @@
1
+ <?php
2
+
3
+ class JPIBFI_Advanced_Settings extends JPIBFI_Settings_Base {
4
+
5
+ function __construct() {
6
+ parent::__construct( 'advanced', new JPIBFI_Advanced_Options() );
7
+ }
8
+
9
+ function get_settings_i18n() {
10
+ $parent = parent::get_settings_i18n();
11
+ $i18n = array();
12
+ $i18n['title'] = __('Advanced settings', 'jquery-pin-it-button-for-images');
13
+ $i18n['filters_label'] = __( 'Filters', 'jquery-pin-it-button-for-images' );
14
+ $i18n['filters_description'] =
15
+ sprintf(
16
+ __( 'You can enabled or disable if the plugin should use a certain filter and change the priority setting. Read more about filters <a href="%s" target="_blank">here</a>. By default all 3 filters are active with the priority of 10.', 'jquery-pin-it-button-for-images' ),
17
+ 'https://codex.wordpress.org/Plugin_API'
18
+ );
19
+ $i18n['filter_template'] = __( '%name% <label>with priority of</label> %priority%', 'jquery-pin-it-button-for-images' );
20
+
21
+ return array_merge( $parent, $i18n );
22
+ }
23
+
24
+ function get_module_settings() {
25
+ return array(
26
+ 'slug' => 'advanced',
27
+ 'name' => __( 'Advanced', 'jquery-pin-it-button-for-images' ),
28
+ );
29
+ }
30
+
31
+ function get_settings_configuration() {
32
+
33
+ $option_value = $this->options->get();
34
+ $res = array();
35
+
36
+ $res['filter_the_content_on'] = array(
37
+ 'key' => 'filter_the_content_on',
38
+ 'text' => 'the_content',
39
+ 'type' => 'boolean'
40
+ );
41
+
42
+ $res['filter_the_content_priority'] = array(
43
+ 'key' => 'filter_the_content_priority',
44
+ 'type' => 'int',
45
+ 'error_label' => __( 'the_content priority', 'jquery-pin-it-button-for-images' )
46
+ );
47
+
48
+ $res['filter_the_excerpt_on'] = array(
49
+ 'key' => 'filter_the_excerpt_on',
50
+ 'text' => 'the_excerpt',
51
+ 'type' => 'boolean'
52
+ );
53
+
54
+ $res['filter_the_excerpt_priority'] = array(
55
+ 'key' => 'filter_the_excerpt_priority',
56
+ 'type' => 'int',
57
+ 'error_label' => __( 'the_excerpt priority', 'jquery-pin-it-button-for-images' )
58
+ );
59
+
60
+ $res['filter_post_thumbnail_html_on'] = array(
61
+ 'key' => 'filter_post_thumbnail_html_on',
62
+ 'text' => 'post_thumbnail_html',
63
+ 'type' => 'boolean'
64
+ );
65
+
66
+ $res['filter_post_thumbnail_html_priority'] = array(
67
+ 'key' => 'filter_post_thumbnail_html_priority',
68
+ 'type' => 'int',
69
+ 'error_label' => __( 'post_thumbnail_html priority', 'jquery-pin-it-button-for-images' )
70
+ );
71
+
72
+ foreach ( $res as $key => $setting ) {
73
+ $res[ $key ]['value'] = $option_value[ $key ];
74
+ }
75
+
76
+ return $res;
77
+ }
78
+ }
includes/admin/settings/jpibfi-import-export-settings.php ADDED
@@ -0,0 +1,135 @@
1
+ <?php
2
+
3
+ class JPIBFI_Import_Export_Settings extends JPIBFI_Settings_Tab {
4
+
5
+ private $ajax_import_action;
6
+
7
+ function __construct() {
8
+ parent::__construct( 'import' );
9
+ $this->ajax_import_action = 'import';
10
+ add_filter( 'export_args', array( $this, 'export_args' ) );
11
+ add_action( 'export_wp', array( $this, 'export_wp' ) );
12
+ }
13
+
14
+ function import() {
15
+ $result = new JPIBFI_Ajax_Result_Builder();
16
+ $file = wp_import_handle_upload();
17
+
18
+ if ( isset( $file['error'] ) ) {
19
+ return $result
20
+ ->set_error( esc_html( $file['error'] ) )
21
+ ->build();
22
+ }
23
+
24
+ if ( ! isset( $file['file'], $file['id'] ) ) {
25
+ return $result
26
+ ->set_error( __( 'The file did not upload properly. Please try again.', 'jquery-pin-it-button-for-images' ) )
27
+ ->build();
28
+ }
29
+
30
+ if ( ! file_exists( $file['file'] ) ) {
31
+ wp_import_cleanup( $file['id'] );
32
+
33
+ return $result
34
+ ->set_error( sprintf( __( 'The export file could not be found at <code>%s</code>. It is likely that this was caused by a permissions problem.', 'jquery-pin-it-button-for-images' ), esc_html( $file['file'] ) ) )
35
+ ->build();
36
+ }
37
+
38
+ if ( ! is_file( $file['file'] ) ) {
39
+ wp_import_cleanup( $file['id'] );
40
+
41
+ return $result
42
+ ->set_error( __( 'The path is not a file, please try again.', 'jquery-pin-it-button-for-images' ) )
43
+ ->build();
44
+ }
45
+
46
+ $file_contents = file_get_contents( $file['file'] );
47
+ $data = json_decode( $file_contents, true );
48
+ wp_import_cleanup( $file['id'] );
49
+
50
+ $options_to_import = $data['options'];
51
+ foreach ( (array) $options_to_import as $option_name => $option_value ) {
52
+ $options_to_import[ $option_name ] = maybe_unserialize( $option_value );
53
+ }
54
+
55
+ $converter = new JPIBFI_Option_Converter();
56
+ $converter->save_and_convert_if_needed( $options_to_import );
57
+
58
+ return $result
59
+ ->set_message( __( 'Import Successful', 'jquery_pin_it_button_for_images' ) )
60
+ ->build();
61
+ }
62
+
63
+ function get_settings_i18n() {
64
+ $parent = parent::get_settings_i18n();
65
+ $i18n = array();
66
+ $i18n['export_title'] = __( 'Export', 'jquery-pin-it-button-for-images' );
67
+ $i18n['export_url'] = admin_url( 'export.php?download=true&content=jpibfi' );
68
+ $i18n['export_button_text'] = __( 'Download Export File', 'jquery-pin-it-button-for-images' );
69
+
70
+ $i18n['import_title'] = __( 'Import', 'jquery-pin-it-button-for-images' );
71
+ $i18n['import_button_text'] = __( 'Import Settings', 'jquery-pin-it-button-for-images' );
72
+ $i18n['import_action_name'] = $this->ajax_import_action;
73
+
74
+ return array_merge( $parent, $i18n );
75
+ }
76
+
77
+ function get_module_settings() {
78
+ return array(
79
+ 'slug' => 'import',
80
+ 'name' => __( 'Import/Export Settings', 'jquery-pin-it-button-for-images' ),
81
+ );
82
+ }
83
+
84
+ /**
85
+ * @param array $args The export args being filtered.
86
+ *
87
+ * @return array The (possibly modified) export args.
88
+ */
89
+ public function export_args( $args ) {
90
+ if ( ! empty( $_GET['content'] ) && 'jpibfi' == $_GET['content'] ) {
91
+ return array( 'jpibfi' => true );
92
+ }
93
+
94
+ return $args;
95
+ }
96
+
97
+
98
+ /**
99
+ * Export options as a JSON file if that's what the user wants to do.
100
+ *
101
+ * @param array $args The export arguments.
102
+ *
103
+ * @return void
104
+ */
105
+ public function export_wp( $args ) {
106
+ if ( empty( $args['jpibfi'] ) ) {
107
+ return;
108
+ }
109
+
110
+ $filename = 'jpibfi_settings_' . date( 'Y-m-d' ) . '.json';
111
+
112
+ header( 'Content-Description: File Transfer' );
113
+ header( 'Content-Disposition: attachment; filename=' . $filename );
114
+ header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
115
+
116
+ $option_names = array(
117
+ 'jpibfi_selection_options',
118
+ 'jpibfi_visual_options',
119
+ 'jpibfi_options_version'
120
+ );
121
+
122
+ $export_options = array();
123
+
124
+ foreach ( $option_names as $option_name ) {
125
+
126
+ $option_value = get_option( $option_name );
127
+ if ( $option_value !== false ) {
128
+ $export_options[ $option_name ] = maybe_serialize( $option_value );
129
+ }
130
+ }
131
+ $JSON_PRETTY_PRINT = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
132
+ echo json_encode( array( 'options' => $export_options ), $JSON_PRETTY_PRINT );
133
+ exit;
134
+ }
135
+ }
includes/admin/settings/jpibfi-license-settings.php ADDED
@@ -0,0 +1,5 @@
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
includes/admin/settings/jpibfi-selection-settings.php ADDED
@@ -0,0 +1,183 @@
1
+ <?php
2
+
3
+ class JPIBFI_Selection_Settings extends JPIBFI_Settings_Base {
4
+
5
+ function __construct() {
6
+ parent::__construct( 'select', new JPIBFI_Selection_Options() );
7
+ add_action( 'add_meta_boxes', array( $this, 'add_post_selection_meta_box' ), 10, 2 );
8
+ add_action( 'save_post', array( $this, 'save_post_selection_meta' ), 10, 3 );
9
+ }
10
+
11
+ function add_post_selection_meta_box( $post_type, $post ) {
12
+ add_meta_box(
13
+ 'jpibfi-disable-plugin_meta',
14
+ __( 'jQuery Pin It Button for Images Settings', 'jquery-pin-it-button-for-images' ),
15
+ array( $this, 'render_post_selection_meta_box' ),
16
+ array( 'post', 'page' ),
17
+ 'side'
18
+ );
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' );
25
+ $i18n['image_resolution_label'] = __( 'Minimum image resolution', 'jquery-pin-it-button-for-images' );
26
+ $i18n['image_resolution_desc'] = __( 'Use this settings to hide the "Pin it" button on small images (e.g. social media icons).', 'jquery-pin-it-button-for-images' );
27
+ $i18n['image_resolution_desc_2'] = __( '* - screen that is less than 768 pixels wide', 'jquery-pin-it-button-for-images' );
28
+ $i18n['min_resolution_template_small'] = __( 'For small screens* the "Pin it" button will show up if the image is at least %height% pixels high and %width% pixels wide.', 'jquery-pin-it-button-for-images' );
29
+ $i18n['min_resolution_template'] = __( 'Otherwise, the "Pin it" button will show up if the image is at least %height% pixels high and %width% pixels wide.', 'jquery-pin-it-button-for-images' );
30
+
31
+ $i18n['show_on_field_label'] = __( 'On which pages the "Pin it" button should be shown', 'jquery-pin-it-button-for-images' );
32
+ $i18n['show_on_field_desc'] = __( 'Separate settings using commas. For the button to show up on a certain page, the page must be included in the "Show on" section and not included in the "Disable on" section. You can use the following settings:' )
33
+ . '<p>'
34
+ . __( 'number (e.g. 588) - the ID of a certain page or post' ) . '<br/>'
35
+ . __( '[front] - front page' ) . '<br/>'
36
+ . __( '[single] - single posts' ) . '<br/>'
37
+ . __( '[page] - single pages' ) . '<br/>'
38
+ . sprintf( __( '[archive] - <a href="%s" target="_blank">archive pages</a>' ) . '<br/>', 'https://codex.wordpress.org/Function_Reference/is_archive' )
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
+ }
46
+
47
+ function get_module_settings() {
48
+ return array(
49
+ 'slug' => 'select',
50
+ 'name' => __( 'Selection', 'jquery-pin-it-button-for-images' ),
51
+ );
52
+ }
53
+
54
+ function get_settings_configuration() {
55
+
56
+ $option_value = $this->options->get();
57
+ $res = array();
58
+
59
+ $res['image_selector'] = array(
60
+ 'key' => 'image_selector',
61
+ 'label' => __( 'Image selector', 'jquery-pin-it-button-for-images' ),
62
+ 'desc' => sprintf( __( '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.', 'jquery-pin-it-button-for-images' ),
63
+ '<strong>.jpibfi_container img</strong>',
64
+ '<strong>img</strong>',
65
+ '<a href="http://api.jquery.com/category/selectors/" target="_blank">',
66
+ '</a>'
67
+ ),
68
+ 'type' => 'string'
69
+ );
70
+
71
+ $res['disabled_classes'] = array(
72
+ 'key' => 'disabled_classes',
73
+ 'label' => __( 'Disabled classes', 'jquery-pin-it-button-for-images' ),
74
+ 'desc' => __( 'Images with these CSS classes won\'t show the "Pin it" button. Please separate multiple classes with semicolons. Spaces are not accepted.', 'jquery-pin-it-button-for-images' ),
75
+ 'type' => 'string'
76
+ );
77
+
78
+ $res['enabled_classes'] = array(
79
+ 'key' => 'enabled_classes',
80
+ 'label' => __( 'Enabled classes', 'jquery-pin-it-button-for-images' ),
81
+ 'desc' => __( '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.', 'jquery-pin-it-button-for-images' ),
82
+ 'type' => 'string'
83
+ );
84
+
85
+ $local_args = array(
86
+ 'min' => '0',
87
+ 'step' => '1',
88
+ 'type' => 'int'
89
+ );
90
+ $res['min_image_height'] = array_merge( $local_args, array(
91
+ 'key' => 'min_image_height',
92
+ 'label' => __( 'Height', 'jquery-pin-it-button-for-images' ),
93
+ 'error_label' => __( 'Minimum image height', 'jquery-pin-it-button-for-images' )
94
+ ) );
95
+ $res['min_image_width'] = array_merge( $local_args, array(
96
+ 'key' => 'min_image_width',
97
+ 'label' => __( 'Width', 'jquery-pin-it-button-for-images' ),
98
+ 'error_label' => __( 'Minimum image width', 'jquery-pin-it-button-for-images' )
99
+ ) );
100
+
101
+ $res['min_image_height_small'] = array_merge( $local_args, array(
102
+ 'key' => 'min_image_height_small',
103
+ 'label' => __( 'Height', 'jquery-pin-it-button-for-images' ),
104
+ 'error_label' => __( 'Minimum image height for mobile', 'jquery-pin-it-button-for-images' )
105
+ ) );
106
+ $res['min_image_width_small'] = array_merge( $local_args, array(
107
+ 'key' => 'min_image_width_small',
108
+ 'label' => __( 'Width', 'jquery-pin-it-button-for-images' ),
109
+ 'error_label' => __( 'Minimum image width for mobile', 'jquery-pin-it-button-for-images' )
110
+ ) );
111
+
112
+ $res['show_on'] = array(
113
+ 'key' => 'show_on',
114
+ 'label' => __( 'Show on', 'jquery-pin-it-button-for-images' ),
115
+ 'type' => 'string'
116
+ );
117
+
118
+ $res['disable_on'] = array(
119
+ 'key' => 'disable_on',
120
+ 'label' => __( 'Disable on', 'jquery-pin-it-button-for-images' ),
121
+ 'type' => 'string'
122
+ );
123
+
124
+ foreach ( $res as $key => $setting ) {
125
+ $res[ $key ]['value'] = $option_value[ $key ];
126
+ }
127
+
128
+ return $res;
129
+ }
130
+
131
+ function render_post_selection_meta_box() {
132
+ global $post;
133
+ $id = $post->ID;
134
+ $options = $this->options->get();
135
+ $disabled_list = $options['disable_on'];
136
+ $disabled_array = explode( ',', $disabled_list );
137
+ $result = in_array( (string) $id, $disabled_array );
138
+ wp_nonce_field( 'jpibfi-post-selection', "jpibfi-post-selection" );
139
+ ?>
140
+ <div>
141
+ <label>
142
+ <input name="jpibfi-disable-post" type="checkbox" <?php checked( true, $result, true ); ?> value="1"/>
143
+ <?php _e( 'Disable plugin on this post', 'jquery-pin-it-button-for-images' ); ?>
144
+ </label>
145
+ </div>
146
+ <?php
147
+ }
148
+
149
+ function save_post_selection_meta( $post_id, $post, $update ) {
150
+ if ( ! isset( $_POST["jpibfi-post-selection"] ) || ! wp_verify_nonce( $_POST["jpibfi-post-selection"], 'jpibfi-post-selection' ) ) {
151
+ return $post_id;
152
+ }
153
+
154
+ if ( ! current_user_can( "edit_post", $post_id ) ) {
155
+ return $post_id;
156
+ }
157
+
158
+ if ( defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE ) {
159
+ return $post_id;
160
+ }
161
+
162
+ $should_be_in_array = isset( $_POST["jpibfi-disable-post"] );
163
+
164
+ $options = $this->options->get();
165
+ $disabled_str = $options['disable_on'];
166
+ $disabled_array = explode( ',', $disabled_str );
167
+ $is_in_array = in_array( (string) $post_id, $disabled_array );
168
+
169
+ if ( $should_be_in_array === $is_in_array ) {
170
+ return $post_id;
171
+ }
172
+
173
+ if ( $should_be_in_array ) {
174
+ $disabled_array[] = (string) $post_id;
175
+ } else {
176
+ $disabled_array = array_diff( $disabled_array, array( (string) $post_id ) );
177
+ }
178
+
179
+ $disabled_str = implode( ',', $disabled_array );
180
+ $options['disable_on'] = $disabled_str;
181
+ $this->options->update( $options );
182
+ }
183
+ }
includes/admin/settings/jpibfi-settings-base.php ADDED
@@ -0,0 +1,130 @@
1
+ <?php
2
+
3
+ abstract class JPIBFI_Settings_Tab {
4
+
5
+ abstract function get_module_settings();
6
+
7
+ /**
8
+ * @var string
9
+ */
10
+ private $slug;
11
+
12
+ function __construct( $slug ) {
13
+ $this->slug = $slug;
14
+ add_action( 'wp_ajax_' . $this->get_ajax_custom_action_name(), array( $this, 'ajax_custom' ) );
15
+ }
16
+
17
+ function ajax_custom() {
18
+ check_ajax_referer( $this->get_ajax_custom_action_name(), 'nonce' );
19
+ if ( ! current_user_can( 'manage_options' ) ) {
20
+ wp_die();
21
+ }
22
+
23
+ $action = $_REQUEST['name'];
24
+ if ( ! is_callable( array( $this, $action ) ) ) {
25
+ $builder = new JPIBFI_Ajax_Result_Builder();
26
+ wp_send_json(
27
+ $builder
28
+ ->set_error( __( 'Error', 'jquery-pin-it-button-for-images' ) )
29
+ ->build()
30
+ );
31
+ } else {
32
+ $result = call_user_func( array( $this, $action ) );
33
+ wp_send_json( $result );
34
+ }
35
+ }
36
+
37
+ private function get_ajax_custom_action_name() {
38
+ return 'jpibfi_settings_custom_' . $this->get_slug();
39
+ }
40
+
41
+ function get_settings_ajax() {
42
+ return array(
43
+ 'url' => admin_url( 'admin-ajax.php' ),
44
+ 'customAction' => $this->get_ajax_custom_action_name(),
45
+ 'customActionNonce' => wp_create_nonce( $this->get_ajax_custom_action_name() )
46
+ );
47
+ }
48
+
49
+ function get_settings_configuration() {
50
+ return array();
51
+ }
52
+
53
+ function get_settings_i18n() {
54
+ return array(
55
+ 'submit' => __( 'Save Changes', 'jquery-pin-it-button-for-images' ),
56
+ 'pro_feature_error' => sprintf(
57
+ __( 'This feature is available in <a target="_blank" href="%s">the PRO version</a>.', 'jquery-pin-it-button-for-images' ),
58
+ 'https://highfiveplugins.com/downloads/jquery-pin-it-button-for-images-pro/'
59
+ )
60
+ );
61
+ }
62
+
63
+ function get_slug() {
64
+ return $this->slug;
65
+ }
66
+ }
67
+
68
+ abstract class JPIBFI_Settings_Base extends JPIBFI_Settings_Tab {
69
+
70
+ /**
71
+ * @var JPIBFI_Options
72
+ */
73
+ protected $options;
74
+
75
+ function __construct( $slug, $options ) {
76
+ parent::__construct( $slug );
77
+ $this->options = $options;
78
+
79
+ add_action( 'wp_ajax_' . $this->get_ajax_save_action_name(), array( $this, 'ajax_save_settings' ) );
80
+ }
81
+
82
+ function ajax_save_settings() {
83
+ check_ajax_referer( $this->get_ajax_save_action_name(), 'nonce' );
84
+ if ( ! current_user_can( 'manage_options' ) ) {
85
+ wp_die();
86
+ }
87
+
88
+ $settings = json_decode( stripslashes( $_REQUEST['settings'] ), true );
89
+ $update_result = $this->save_settings( $settings );
90
+ wp_send_json( $update_result );
91
+ }
92
+
93
+ private function get_ajax_save_action_name() {
94
+ return 'jpibfi_settings_save_' . $this->get_slug();
95
+ }
96
+
97
+ function get_settings_ajax() {
98
+ $result = parent::get_settings_ajax();
99
+ $result['saveSettingsAction'] = $this->get_ajax_save_action_name();
100
+ $result['saveSettingsNonce'] = wp_create_nonce( $this->get_ajax_save_action_name() );
101
+
102
+ return $result;
103
+ }
104
+
105
+ function save_settings( $settings ) {
106
+ $settings = $this->options->sanitize( $settings );
107
+
108
+ $validator = new JPIBFI_Validator( $settings, $this->options->get_default_options(), $this->get_settings_configuration() );
109
+ $errors = $validator->get_errors();
110
+
111
+ $result = new JPIBFI_Ajax_Result_Builder();
112
+
113
+ if ( count( $errors ) > 0 ) {
114
+ return $result
115
+ ->set_errors( array_merge(
116
+ array( 'header' => __( 'Settings not saved.', 'jquery-pin-it-button-for-images' ) ),
117
+ $errors
118
+ ) )
119
+ ->build();
120
+ }
121
+
122
+ $sanitized = $validator->get_result();
123
+ $this->options->update( $sanitized );
124
+
125
+ return $result
126
+ ->set_model( $sanitized )
127
+ ->set_message( __( 'Settings saved.', 'jquery-pin-it-button-for-images' ) )
128
+ ->build();
129
+ }
130
+ }
includes/admin/settings/jpibfi-validator.php ADDED
@@ -0,0 +1,150 @@
1
+ <?php
2
+
3
+ class JPIBFI_Validator {
4
+
5
+ private $current;
6
+ private $default;
7
+ private $settings;
8
+
9
+ private $result;
10
+ private $errors;
11
+
12
+ function __construct( $current, $default, $settings ) {
13
+ $this->current = $current;
14
+ $this->default = $default;
15
+ $this->settings = $settings;
16
+
17
+ $this->process();
18
+ }
19
+
20
+ private function process() {
21
+ $this->errors = array();
22
+ $this->result = array();
23
+
24
+ foreach ( $this->default as $key => $def_value ) {
25
+ if ( ! isset( $this->current[ $key ] ) ) {
26
+ $this->result[ $key ] = $def_value;
27
+ continue;
28
+ }
29
+ if ( ! isset( $this->settings[ $key ] ) ) {
30
+ continue;
31
+ }
32
+ $value = $this->current[ $key ];
33
+ $value = $this->try_sanitize_field( $value, $this->settings[ $key ] );
34
+ $validation_result = $this->validate_field( $value, $this->settings[ $key ] );
35
+ if ( true !== $validation_result ) {
36
+ $this->errors[ $key ] = $validation_result;
37
+ }
38
+ $this->result[ $key ] = $value;
39
+ }
40
+ }
41
+
42
+ function get_errors() {
43
+ return $this->errors;
44
+ }
45
+
46
+ function get_result() {
47
+ return $this->result;
48
+ }
49
+
50
+ private function get_error_label( $setting ) {
51
+ return isset( $setting['error_label'] ) ? $setting['error_label'] : $setting['label'];
52
+ }
53
+
54
+ private function validate_field( $value, $setting ) {
55
+ if ( ! isset( $setting['type'] ) ) {
56
+ return true;
57
+ }
58
+ $func_name = 'validate_' . $setting['type'];
59
+
60
+ if ( is_callable( array( $this, $func_name ) ) ) {
61
+ return call_user_func( array( $this, $func_name ), $value, $setting );
62
+ }
63
+ return true;
64
+ }
65
+
66
+ private function validate_float( $value, $setting ) {
67
+ if ( ! is_float( $value ) ) {
68
+ return sprintf(
69
+ __( '%1$s value is not a number.', 'jquery-pin-it-button-for-images' ),
70
+ $this->get_error_label( $setting )
71
+ );
72
+ }
73
+
74
+ return $this->validate_mix_max( $value, $setting );
75
+ }
76
+
77
+ private function validate_int( $value, $setting ) {
78
+ if ( ! is_int( $value ) ) {
79
+ return sprintf(
80
+ __( '%1$s value is not a number.', 'jquery-pin-it-button-for-images' ),
81
+ $this->get_error_label( $setting )
82
+ );
83
+ }
84
+
85
+ return $this->validate_mix_max( $value, $setting );
86
+ }
87
+
88
+ private function validate_mix_max( $value, $setting ) {
89
+ if ( isset( $setting['min'] ) && $value < $setting['min'] ) {
90
+ return sprintf(
91
+ __( '%1$s value is less than the minimum value of %2$s.', 'jquery-pin-it-button-for-images' ),
92
+ $this->get_error_label( $setting ),
93
+ $setting['min']
94
+ );
95
+ }
96
+ if ( isset( $setting['max'] ) && $value > $setting['max'] ) {
97
+ return sprintf(
98
+ __( '%1$s value is greater than the minimum value of %2$s.', 'jquery-pin-it-button-for-images' ),
99
+ $this->get_error_label( $setting ),
100
+ $setting['max']
101
+ );
102
+ }
103
+
104
+ return true;
105