Catch IDs - Version 2.0

Version Description

(Released: March 10, 2020) = * Compatibility check up to version 5.4

Download this release

Release Info

Developer catchthemes
Plugin Icon 128x128 Catch IDs
Version 2.0
Comparing to
See all releases

Code changes from version 1.9 to 2.0

Files changed (3) hide show
  1. catch-ids.php +222 -221
  2. languages/catch-ids.pot +7 -7
  3. readme.txt +4 -1
catch-ids.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Catch IDs
16
  * Plugin URI: https://catchplugins.com/plugins/catch-ids/
17
  * Description: Catch IDs is a simple and light weight plugin to show the Post ID, Page ID, Media ID, Links ID, Category ID, Tag ID and User ID in the Admin Section Table. This plugin was initially develop to support our themes features slider. Then we thought that this will be helpful to all the WordPress Admin Users. Just activate and catch IDs in your page, post, category, tag and media pages.
18
- * Version: 1.9
19
  * Author: Catch Plugins
20
  * Author URI: catchplugins.com
21
  * License: GPL-3.0+
@@ -47,26 +47,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
47
  * Translations can be filed in the /languages/ directory
48
  */
49
 
50
- if ( !defined( 'ABSPATH' ) ) exit;
 
 
51
 
52
 
53
  // Define Version
54
- define( 'CATCH_IDS_VERSION', '1.9' );
55
 
56
  // The URL of the directory that contains the plugin
57
- if ( !defined( 'CATCH_IDS_URL' ) ) {
58
  define( 'CATCH_IDS_URL', plugin_dir_url( __FILE__ ) );
59
  }
60
 
61
 
62
  // The absolute path of the directory that contains the file
63
- if ( !defined( 'CATCH_IDS_PATH' ) ) {
64
  define( 'CATCH_IDS_PATH', plugin_dir_path( __FILE__ ) );
65
  }
66
 
67
 
68
  // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
69
- if ( !defined( 'CATCH_IDS_BASENAME' ) ) {
70
  define( 'CATCH_IDS_BASENAME', plugin_basename( __FILE__ ) );
71
  }
72
 
@@ -82,313 +84,312 @@ add_action( 'plugins_loaded', 'catchids_load_textdomain' );
82
  * @since Catch IDs 1.0
83
  */
84
 
85
- if ( ! function_exists( 'catchids_column' ) ):
86
- /**
87
- * Prepend the new column to the columns array
88
- */
89
- function catchids_column( $cols ) {
90
- $column_id = array( 'catchids' => __( 'ID', 'catch-ids' ) );
91
- $cols = array_slice( $cols, 0, 1, true ) + $column_id + array_slice( $cols, 1, NULL, true );
92
- return $cols;
93
- }
94
 
95
  endif; // catchids_column
96
 
97
  if ( ! function_exists( 'catchids_value' ) ) :
98
- /**
99
- * Echo the ID for the new column
100
- */
101
- function catchids_value( $column_name, $id ) {
102
- if ( 'catchids' == $column_name ) {
103
- echo $id;
 
104
  }
105
- }
106
  endif; // catchids_value
107
 
108
 
109
  if ( ! function_exists( 'catchids_return_value' ) ) :
110
- function catchids_return_value( $value, $column_name, $id ) {
111
- if ( 'catchids' == $column_name ) {
112
- $value .= $id;
 
 
113
  }
114
- return $value;
115
- }
116
  endif; // catchids_return_value
117
 
118
 
119
  if ( ! function_exists( 'catchids_css' ) ) :
120
- /**
121
- * Output CSS for width of new column
122
- */
123
- function catchids_css() {
124
- ?>
125
  <style type="text/css">
126
- #catchids { width: 80px; }
127
- @media screen and (max-width: 782px) {
128
- .wp-list-table #catchids, .wp-list-table #the-list .catchids { display: none; }
129
- .wp-list-table #the-list .is-expanded .catchids {
130
- padding-left: 30px;
131
- }
132
- }
133
  </style>
134
- <?php
135
- }
136
  endif; // catchids_css
137
- add_action( 'admin_head', 'catchids_css');
138
 
139
 
140
  if ( ! function_exists( 'catchids_add' ) ) :
141
- /**
142
- * Actions/Filters for various tables and the css output
143
- */
144
- function catchids_add() {
145
- $options = catchids_get_options();
146
- // For Media Management
147
- if( is_array( $options ) && array_key_exists( 'media', $options ) && ( 1 == $options['media'] ) ) {
148
- add_action( "manage_media_columns" , 'catchids_column' );
149
- add_filter( "manage_media_custom_column" , 'catchids_value' , 10 , 3 );
150
- }
151
 
152
- // For Link Management
153
- add_action( 'manage_link_custom_column', 'catchids_value', 10, 2 );
154
- add_filter( 'manage_link-manager_columns', 'catchids_column' );
155
-
156
- // For Category Management
157
- add_action( 'manage_edit-link-categories_columns', 'catchids_column' );
158
- add_filter( 'manage_link_categories_custom_column', 'catchids_return_value', 10, 3 );
159
-
160
- // For Category, Tags and other custom taxonomies Management
161
- foreach( get_taxonomies() as $taxonomy ) {
162
- if( is_array( $options ) && array_key_exists ( 'category', $options ) && ( 1 == $options['category'] ) ) {
163
- add_action( "manage_edit-${taxonomy}_columns" , 'catchids_column' );
164
- add_filter( "manage_${taxonomy}_custom_column" , 'catchids_return_value' , 10 , 3 );
165
- if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) {
166
- add_filter( "manage_edit-${taxonomy}_sortable_columns" , 'catchids_column' );
 
167
  }
168
  }
169
- }
170
 
171
- foreach( get_post_types() as $ptype ) {
172
- if( is_array( $options ) && array_key_exists ( $ptype, $options ) && ( 1 == $options[$ptype] ) ){
173
- add_action( "manage_edit-${ptype}_columns" , 'catchids_column' );
174
- add_filter( "manage_${ptype}_posts_custom_column" , 'catchids_value' , 10 , 3 );
175
- if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) {
176
- add_filter( "manage_edit-${ptype}_sortable_columns" , 'catchids_column' );
 
177
  }
178
  }
179
- }
180
 
181
- // For User Management
182
- if( is_array( $options ) && array_key_exists ( 'user', $options ) && ( 1 == $options['user'] ) ){
183
- add_action( 'manage_users_columns', 'catchids_column' );
184
- add_filter( 'manage_users_custom_column', 'catchids_return_value', 10, 3 );
185
- if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) {
186
- add_filter( "manage_users_sortable_columns" , 'catchids_column' );
 
187
  }
188
- }
189
 
190
- // For Comment Management
191
- if( is_array( $options ) && array_key_exists ( 'comment', $options ) && ( 1 == $options['comment'] ) ){
192
- add_action( 'manage_edit-comments_columns', 'catchids_column' );
193
- add_action( 'manage_comments_custom_column', 'catchids_value', 10, 2 );
194
- if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) {
195
- add_filter( "manage_edit-comments_sortable_columns" , 'catchids_column' );
 
196
  }
197
  }
198
- }
199
  endif; // catchids_add
200
  add_action( 'admin_init', 'catchids_add' );
201
 
202
 
203
  if ( ! function_exists( 'catchids_get_all_post_types' ) ) :
204
- function catchids_get_all_post_types() {
205
- $post_types = get_post_types( array( 'public' => true ) );
206
- $post_type_list = array();
207
- foreach ( $post_types as $key => $value ) {
208
- if( 'attachment' != $key ) {
209
- $data = str_replace('-', ' ', $value);
210
- $data = str_replace('_', ' ', $data);
211
- $post_type_list[$key] = ucwords( $data );
212
- }
213
- }
214
- return $post_type_list;
215
- }
216
  endif; // catchids_get_all_post_types
217
 
218
 
219
  if ( ! function_exists( 'catchids_get_options' ) ) :
220
- function catchids_get_options() {
221
- $defaults = catchids_default_options();
222
- $options = get_option( 'catchids_options', $defaults );
223
 
224
- return wp_parse_args( $options, $defaults ) ;
225
- }
226
  endif; // catchids_get_options
227
 
228
 
229
  if ( ! function_exists( 'catchids_default_options' ) ) :
230
- /**
231
- * Return array of default options
232
- *
233
- * @since 1.0
234
- * @return array default options.
235
- */
236
- function catchids_default_options( $option = null ) {
237
- $types = catchids_get_all_post_types();
238
- foreach( $types as $key => $value ) {
239
- $default_options[$key] = 1;
240
- }
241
- $default_options['category'] = 1;
242
- $default_options['media'] = 1;
243
- $default_options['user'] = 1;
244
- $default_options['comment'] = 1;
245
- $default_options['theme_plugin_tabs'] = 1;
246
-
247
- if ( null == $option ) {
248
- return apply_filters( 'catchids_options', $default_options );
249
- }
250
- else {
251
- return $default_options[ $option ];
252
  }
253
- }
254
  endif; // catchids_default_options
255
 
256
 
257
  if ( ! function_exists( 'catchids_add_plugin_settings_menu' ) ) :
258
- function catchids_add_plugin_settings_menu() {
259
- add_menu_page(
260
- esc_html__( 'Catch IDs', 'catch-ids' ), //page title
261
- esc_html__( 'Catch IDs', 'catch-ids' ), //menu title
262
- 'edit_posts', //capability needed
263
- 'catch-ids', //menu slug (and page query url)
264
- 'catchids_settings',
265
- 'dashicons-editor-ol',
266
- '99.01564'
267
- );
268
- }
269
  endif; // catchids_add_plugin_settings_menu
270
  add_action( 'admin_menu', 'catchids_add_plugin_settings_menu' );
271
 
272
 
273
  if ( ! function_exists( 'catchids_settings' ) ) :
274
- function catchids_settings() {
275
- $child_theme = false;
276
- if ( ! current_user_can( 'edit_posts' ) ) {
277
- wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'catch-ids' ) );
278
- }
279
 
280
- require_once plugin_dir_path( __FILE__ ) . 'partials/catch-ids-display.php';
281
- }
282
  endif; // catchids_settings
283
 
284
 
285
  if ( ! function_exists( 'catchids_register_settings' ) ) :
286
- /**
287
- * Catch IDs: register_settings
288
- * Catch IDs Register Settings
289
- */
290
- function catchids_register_settings() {
291
- register_setting(
292
- 'catchids-group',
293
- 'catchids_options',
294
- 'catchids_sanitize_callback'
295
- );
296
- }
297
  endif; // catchids_register_settings
298
  add_action( 'admin_init', 'catchids_register_settings' );
299
 
300
 
301
  if ( ! function_exists( 'catchids_action_links' ) ) :
302
- /**
303
- * Catch_IDs: catchids_action_links
304
- * Catch_IDs Settings Link function callback
305
- *
306
- * @param arrray $links Link url.
307
- *
308
- * @param arrray $file File name.
309
- */
310
- function catchids_action_links( $links, $file ) {
311
- if ( $file === 'catch-ids/catch-ids.php' ) {
312
- $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=catch-ids' ) ) . '">' . esc_html__( 'Settings', 'catch-ids' ) . '</a>';
313
-
314
- array_unshift( $links, $settings_link );
 
 
315
  }
316
- return $links;
317
- }
318
  endif; // catchids_action_links
319
  add_filter( 'plugin_action_links', 'catchids_action_links', 10, 2 );
320
 
321
 
322
  if ( ! function_exists( 'catchids_enqueue_styles' ) ) :
323
- function catchids_enqueue_styles() {
324
- if( isset( $_GET['page'] ) && 'catch-ids' == $_GET['page'] ) {
325
- wp_enqueue_style( 'catchids-styles', plugin_dir_url( __FILE__ ) . 'css/catch-ids.css', array(), '1.0', 'all' );
326
- wp_enqueue_style( 'catch-ids-dashboard-tabs', plugin_dir_url( __FILE__ ) . 'css/admin-dashboard.css', array(), '1.0', 'all' );
 
327
  }
328
- }
329
  endif; // catchids_enqueue_styles
330
  add_action( 'admin_enqueue_scripts', 'catchids_enqueue_styles' );
331
 
332
 
333
  if ( ! function_exists( 'catchids_enqueue_scripts' ) ) :
334
- function catchids_enqueue_scripts() {
335
- if( isset( $_GET['page'] ) && 'catch-ids' == $_GET['page'] ) {
336
- wp_enqueue_script( 'catch-ids-match-height', plugin_dir_url( __FILE__ ) . 'js/jquery.matchHeight.min.js', array( 'jquery' ), '1.0', false );
337
- wp_enqueue_script( 'catchids-scripts', plugin_dir_url( __FILE__ ) . 'js/catch-ids.js', array( 'jquery', 'catch-ids-match-height' ), '1.0', false );
338
- }
339
 
340
- }
341
  endif; // catchids_enqueue_scripts
342
  add_action( 'admin_enqueue_scripts', 'catchids_enqueue_scripts' );
343
 
344
 
345
  add_action( 'wp_ajax_catchids_switch', 'catchids_switch' );
346
  if ( ! function_exists( 'catchids_switch' ) ) :
347
- function catchids_switch() {
348
- $value = ( 'true' == $_POST['value'] ) ? 1 : 0;
349
 
350
- $option_name = $_POST['option_name'];
351
 
352
- $option_value = catchids_get_options( 'catchids_options' );
353
 
354
- $option_value[$option_name] = $value;
355
 
356
- if( update_option( 'catchids_options', $option_value ) ) {
357
- echo $value;
358
- } else {
359
- esc_html_e( 'Connection Error. Please try again.', 'catch-ids' );
360
- }
361
 
362
- wp_die(); // this is required to terminate immediately and return a proper response
363
- }
364
  endif; // catchids_switch
365
 
366
  add_action( 'wp_ajax_ctp_switch', 'ctp_switch' );
367
  if ( ! function_exists( 'ctp_switch' ) ) :
368
- function ctp_switch() {
369
- $value = ( 'true' == $_POST['value'] ) ? 1 : 0;
370
 
371
- $option_name = $_POST['option_name'];
372
 
373
- $option_value = catchids_get_options( 'catchids_options' );
374
 
375
- $option_value[$option_name] = $value;
376
 
377
- if( update_option( 'catchids_options', $option_value ) ) {
378
- echo $value;
379
- } else {
380
- esc_html_e( 'Connection Error. Please try again.', 'catch-ids' );
381
- }
382
 
383
- wp_die(); // this is required to terminate immediately and return a proper response
384
- }
385
  endif; // catchids_switch
386
 
387
  $options = catchids_get_options();
388
  //print_r($options); die();
389
- if( 1 == $options['theme_plugin_tabs'] ) {
390
  /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
391
- if( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) {
392
  require plugin_dir_path( __FILE__ ) . 'includes/CatchThemesThemePlugin.php';
393
  }
394
  }
@@ -396,8 +397,8 @@ if( 1 == $options['theme_plugin_tabs'] ) {
396
  /* Adds support link and review link in plugin page */
397
  // Only visible if the plugin is active
398
  add_filter( 'plugin_row_meta', 'catchids_add_plugin_meta_links', 10, 2 );
399
- function catchids_add_plugin_meta_links( $meta_fields, $file ){
400
- if( $file == plugin_basename( __FILE__ ) ) {
401
 
402
  $meta_fields[] = "<a href='https://catchplugins.com/support-forum/forum/catch-ids/' target='_blank'>Support Forum</a>";
403
  $meta_fields[] = "<a href='https://wordpress.org/support/plugin/catch-ids/reviews#new-post' target='_blank' title='Rate'>
@@ -407,17 +408,17 @@ function catchids_add_plugin_meta_links( $meta_fields, $file ){
407
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
408
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
409
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
410
- . "</i></a>";
411
 
412
- $stars_color = "#ffb900";
413
 
414
- echo "<style>"
415
- . ".ct-rate-stars{display:inline-block;color:" . $stars_color . ";position:relative;top:3px;}"
416
- . ".ct-rate-stars svg{fill:" . $stars_color . ";}"
417
- . ".ct-rate-stars svg:hover{fill:" . $stars_color . "}"
418
- . ".ct-rate-stars svg:hover ~ svg{fill:none;}"
419
- . "</style>";
420
  }
421
 
422
  return $meta_fields;
423
- }
15
  * Plugin Name: Catch IDs
16
  * Plugin URI: https://catchplugins.com/plugins/catch-ids/
17
  * Description: Catch IDs is a simple and light weight plugin to show the Post ID, Page ID, Media ID, Links ID, Category ID, Tag ID and User ID in the Admin Section Table. This plugin was initially develop to support our themes features slider. Then we thought that this will be helpful to all the WordPress Admin Users. Just activate and catch IDs in your page, post, category, tag and media pages.
18
+ * Version: 2.0
19
  * Author: Catch Plugins
20
  * Author URI: catchplugins.com
21
  * License: GPL-3.0+
47
  * Translations can be filed in the /languages/ directory
48
  */
49
 
50
+ if ( ! defined( 'ABSPATH' ) ) {
51
+ exit;
52
+ }
53
 
54
 
55
  // Define Version
56
+ define( 'CATCH_IDS_VERSION', '2.0' );
57
 
58
  // The URL of the directory that contains the plugin
59
+ if ( ! defined( 'CATCH_IDS_URL' ) ) {
60
  define( 'CATCH_IDS_URL', plugin_dir_url( __FILE__ ) );
61
  }
62
 
63
 
64
  // The absolute path of the directory that contains the file
65
+ if ( ! defined( 'CATCH_IDS_PATH' ) ) {
66
  define( 'CATCH_IDS_PATH', plugin_dir_path( __FILE__ ) );
67
  }
68
 
69
 
70
  // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
71
+ if ( ! defined( 'CATCH_IDS_BASENAME' ) ) {
72
  define( 'CATCH_IDS_BASENAME', plugin_basename( __FILE__ ) );
73
  }
74
 
84
  * @since Catch IDs 1.0
85
  */
86
 
87
+ if ( ! function_exists( 'catchids_column' ) ) :
88
+ /**
89
+ * Prepend the new column to the columns array
90
+ */
91
+ function catchids_column( $cols ) {
92
+ $column_id = array( 'catchids' => __( 'ID', 'catch-ids' ) );
93
+ $cols = array_slice( $cols, 0, 1, true ) + $column_id + array_slice( $cols, 1, null, true );
94
+ return $cols;
95
+ }
96
 
97
  endif; // catchids_column
98
 
99
  if ( ! function_exists( 'catchids_value' ) ) :
100
+ /**
101
+ * Echo the ID for the new column
102
+ */
103
+ function catchids_value( $column_name, $id ) {
104
+ if ( 'catchids' == $column_name ) {
105
+ echo $id;
106
+ }
107
  }
 
108
  endif; // catchids_value
109
 
110
 
111
  if ( ! function_exists( 'catchids_return_value' ) ) :
112
+ function catchids_return_value( $value, $column_name, $id ) {
113
+ if ( 'catchids' == $column_name ) {
114
+ $value .= $id;
115
+ }
116
+ return $value;
117
  }
 
 
118
  endif; // catchids_return_value
119
 
120
 
121
  if ( ! function_exists( 'catchids_css' ) ) :
122
+ /**
123
+ * Output CSS for width of new column
124
+ */
125
+ function catchids_css() {
126
+ ?>
127
  <style type="text/css">
128
+ #catchids { width: 80px; }
129
+ @media screen and (max-width: 782px) {
130
+ .wp-list-table #catchids, .wp-list-table #the-list .catchids { display: none; }
131
+ .wp-list-table #the-list .is-expanded .catchids {
132
+ padding-left: 30px;
133
+ }
134
+ }
135
  </style>
136
+ <?php
137
+ }
138
  endif; // catchids_css
139
+ add_action( 'admin_head', 'catchids_css' );
140
 
141
 
142
  if ( ! function_exists( 'catchids_add' ) ) :
143
+ /**
144
+ * Actions/Filters for various tables and the css output
145
+ */
146
+ function catchids_add() {
147
+ $options = catchids_get_options();
148
+ // For Media Management
149
+ if ( is_array( $options ) && array_key_exists( 'media', $options ) && ( 1 == $options['media'] ) ) {
150
+ add_action( 'manage_media_columns', 'catchids_column' );
151
+ add_filter( 'manage_media_custom_column', 'catchids_value', 10, 3 );
152
+ }
153
 
154
+ // For Link Management
155
+ add_action( 'manage_link_custom_column', 'catchids_value', 10, 2 );
156
+ add_filter( 'manage_link-manager_columns', 'catchids_column' );
157
+
158
+ // For Category Management
159
+ add_action( 'manage_edit-link-categories_columns', 'catchids_column' );
160
+ add_filter( 'manage_link_categories_custom_column', 'catchids_return_value', 10, 3 );
161
+
162
+ // For Category, Tags and other custom taxonomies Management
163
+ foreach ( get_taxonomies() as $taxonomy ) {
164
+ if ( is_array( $options ) && array_key_exists( 'category', $options ) && ( 1 == $options['category'] ) ) {
165
+ add_action( "manage_edit-${taxonomy}_columns", 'catchids_column' );
166
+ add_filter( "manage_${taxonomy}_custom_column", 'catchids_return_value', 10, 3 );
167
+ if ( version_compare( $GLOBALS['wp_version'], '3.0.999', '>' ) ) {
168
+ add_filter( "manage_edit-${taxonomy}_sortable_columns", 'catchids_column' );
169
+ }
170
  }
171
  }
 
172
 
173
+ foreach ( get_post_types() as $ptype ) {
174
+ if ( is_array( $options ) && array_key_exists( $ptype, $options ) && ( 1 == $options[ $ptype ] ) ) {
175
+ add_action( "manage_edit-${ptype}_columns", 'catchids_column' );
176
+ add_filter( "manage_${ptype}_posts_custom_column", 'catchids_value', 10, 3 );
177
+ if ( version_compare( $GLOBALS['wp_version'], '3.0.999', '>' ) ) {
178
+ add_filter( "manage_edit-${ptype}_sortable_columns", 'catchids_column' );
179
+ }
180
  }
181
  }
 
182
 
183
+ // For User Management
184
+ if ( is_array( $options ) && array_key_exists( 'user', $options ) && ( 1 == $options['user'] ) ) {
185
+ add_action( 'manage_users_columns', 'catchids_column' );
186
+ add_filter( 'manage_users_custom_column', 'catchids_return_value', 10, 3 );
187
+ if ( version_compare( $GLOBALS['wp_version'], '3.0.999', '>' ) ) {
188
+ add_filter( 'manage_users_sortable_columns', 'catchids_column' );
189
+ }
190
  }
 
191
 
192
+ // For Comment Management
193
+ if ( is_array( $options ) && array_key_exists( 'comment', $options ) && ( 1 == $options['comment'] ) ) {
194
+ add_action( 'manage_edit-comments_columns', 'catchids_column' );
195
+ add_action( 'manage_comments_custom_column', 'catchids_value', 10, 2 );
196
+ if ( version_compare( $GLOBALS['wp_version'], '3.0.999', '>' ) ) {
197
+ add_filter( 'manage_edit-comments_sortable_columns', 'catchids_column' );
198
+ }
199
  }
200
  }
 
201
  endif; // catchids_add
202
  add_action( 'admin_init', 'catchids_add' );
203
 
204
 
205
  if ( ! function_exists( 'catchids_get_all_post_types' ) ) :
206
+ function catchids_get_all_post_types() {
207
+ $post_types = get_post_types( array( 'public' => true ) );
208
+ $post_type_list = array();
209
+ foreach ( $post_types as $key => $value ) {
210
+ if ( 'attachment' != $key ) {
211
+ $data = str_replace( '-', ' ', $value );
212
+ $data = str_replace( '_', ' ', $data );
213
+ $post_type_list[ $key ] = ucwords( $data );
214
+ }
215
+ }
216
+ return $post_type_list;
217
+ }
218
  endif; // catchids_get_all_post_types
219
 
220
 
221
  if ( ! function_exists( 'catchids_get_options' ) ) :
222
+ function catchids_get_options() {
223
+ $defaults = catchids_default_options();
224
+ $options = get_option( 'catchids_options', $defaults );
225
 
226
+ return wp_parse_args( $options, $defaults );
227
+ }
228
  endif; // catchids_get_options
229
 
230
 
231
  if ( ! function_exists( 'catchids_default_options' ) ) :
232
+ /**
233
+ * Return array of default options
234
+ *
235
+ * @since 1.0
236
+ * @return array default options.
237
+ */
238
+ function catchids_default_options( $option = null ) {
239
+ $types = catchids_get_all_post_types();
240
+ foreach ( $types as $key => $value ) {
241
+ $default_options[ $key ] = 1;
242
+ }
243
+ $default_options['category'] = 1;
244
+ $default_options['media'] = 1;
245
+ $default_options['user'] = 1;
246
+ $default_options['comment'] = 1;
247
+ $default_options['theme_plugin_tabs'] = 1;
248
+
249
+ if ( null == $option ) {
250
+ return apply_filters( 'catchids_options', $default_options );
251
+ } else {
252
+ return $default_options[ $option ];
253
+ }
254
  }
 
255
  endif; // catchids_default_options
256
 
257
 
258
  if ( ! function_exists( 'catchids_add_plugin_settings_menu' ) ) :
259
+ function catchids_add_plugin_settings_menu() {
260
+ add_menu_page(
261
+ esc_html__( 'Catch IDs', 'catch-ids' ), //page title
262
+ esc_html__( 'Catch IDs', 'catch-ids' ), //menu title
263
+ 'edit_posts', //capability needed
264
+ 'catch-ids', //menu slug (and page query url)
265
+ 'catchids_settings',
266
+ 'dashicons-editor-ol',
267
+ '99.01564'
268
+ );
269
+ }
270
  endif; // catchids_add_plugin_settings_menu
271
  add_action( 'admin_menu', 'catchids_add_plugin_settings_menu' );
272
 
273
 
274
  if ( ! function_exists( 'catchids_settings' ) ) :
275
+ function catchids_settings() {
276
+ $child_theme = false;
277
+ if ( ! current_user_can( 'edit_posts' ) ) {
278
+ wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'catch-ids' ) );
279
+ }
280
 
281
+ require_once plugin_dir_path( __FILE__ ) . 'partials/catch-ids-display.php';
282
+ }
283
  endif; // catchids_settings
284
 
285
 
286
  if ( ! function_exists( 'catchids_register_settings' ) ) :
287
+ /**
288
+ * Catch IDs: register_settings
289
+ * Catch IDs Register Settings
290
+ */
291
+ function catchids_register_settings() {
292
+ register_setting(
293
+ 'catchids-group',
294
+ 'catchids_options',
295
+ 'catchids_sanitize_callback'
296
+ );
297
+ }
298
  endif; // catchids_register_settings
299
  add_action( 'admin_init', 'catchids_register_settings' );
300
 
301
 
302
  if ( ! function_exists( 'catchids_action_links' ) ) :
303
+ /**
304
+ * Catch_IDs: catchids_action_links
305
+ * Catch_IDs Settings Link function callback
306
+ *
307
+ * @param arrray $links Link url.
308
+ *
309
+ * @param arrray $file File name.
310
+ */
311
+ function catchids_action_links( $links, $file ) {
312
+ if ( $file === 'catch-ids/catch-ids.php' ) {
313
+ $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=catch-ids' ) ) . '">' . esc_html__( 'Settings', 'catch-ids' ) . '</a>';
314
+
315
+ array_unshift( $links, $settings_link );
316
+ }
317
+ return $links;
318
  }
 
 
319
  endif; // catchids_action_links
320
  add_filter( 'plugin_action_links', 'catchids_action_links', 10, 2 );
321
 
322
 
323
  if ( ! function_exists( 'catchids_enqueue_styles' ) ) :
324
+ function catchids_enqueue_styles() {
325
+ if ( isset( $_GET['page'] ) && 'catch-ids' == $_GET['page'] ) {
326
+ wp_enqueue_style( 'catchids-styles', plugin_dir_url( __FILE__ ) . 'css/catch-ids.css', array(), '1.0', 'all' );
327
+ wp_enqueue_style( 'catch-ids-dashboard-tabs', plugin_dir_url( __FILE__ ) . 'css/admin-dashboard.css', array(), '1.0', 'all' );
328
+ }
329
  }
 
330
  endif; // catchids_enqueue_styles
331
  add_action( 'admin_enqueue_scripts', 'catchids_enqueue_styles' );
332
 
333
 
334
  if ( ! function_exists( 'catchids_enqueue_scripts' ) ) :
335
+ function catchids_enqueue_scripts() {
336
+ if ( isset( $_GET['page'] ) && 'catch-ids' == $_GET['page'] ) {
337
+ wp_enqueue_script( 'catch-ids-match-height', plugin_dir_url( __FILE__ ) . 'js/jquery.matchHeight.min.js', array( 'jquery' ), '1.0', false );
338
+ wp_enqueue_script( 'catchids-scripts', plugin_dir_url( __FILE__ ) . 'js/catch-ids.js', array( 'jquery', 'catch-ids-match-height' ), '1.0', false );
339
+ }
340
 
341
+ }
342
  endif; // catchids_enqueue_scripts
343
  add_action( 'admin_enqueue_scripts', 'catchids_enqueue_scripts' );
344
 
345
 
346
  add_action( 'wp_ajax_catchids_switch', 'catchids_switch' );
347
  if ( ! function_exists( 'catchids_switch' ) ) :
348
+ function catchids_switch() {
349
+ $value = ( 'true' == $_POST['value'] ) ? 1 : 0;
350
 
351
+ $option_name = $_POST['option_name'];
352
 
353
+ $option_value = catchids_get_options( 'catchids_options' );
354
 
355
+ $option_value[ $option_name ] = $value;
356
 
357
+ if ( update_option( 'catchids_options', $option_value ) ) {
358
+ echo $value;
359
+ } else {
360
+ esc_html_e( 'Connection Error. Please try again.', 'catch-ids' );
361
+ }
362
 
363
+ wp_die(); // this is required to terminate immediately and return a proper response
364
+ }
365
  endif; // catchids_switch
366
 
367
  add_action( 'wp_ajax_ctp_switch', 'ctp_switch' );
368
  if ( ! function_exists( 'ctp_switch' ) ) :
369
+ function ctp_switch() {
370
+ $value = ( 'true' == $_POST['value'] ) ? 1 : 0;
371
 
372
+ $option_name = $_POST['option_name'];
373
 
374
+ $option_value = catchids_get_options( 'catchids_options' );
375
 
376
+ $option_value[ $option_name ] = $value;
377
 
378
+ if ( update_option( 'catchids_options', $option_value ) ) {
379
+ echo $value;
380
+ } else {
381
+ esc_html_e( 'Connection Error. Please try again.', 'catch-ids' );
382
+ }
383
 
384
+ wp_die(); // this is required to terminate immediately and return a proper response
385
+ }
386
  endif; // catchids_switch
387
 
388
  $options = catchids_get_options();
389
  //print_r($options); die();
390
+ if ( 1 == $options['theme_plugin_tabs'] ) {
391
  /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
392
+ if ( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) {
393
  require plugin_dir_path( __FILE__ ) . 'includes/CatchThemesThemePlugin.php';
394
  }
395
  }
397
  /* Adds support link and review link in plugin page */
398
  // Only visible if the plugin is active
399
  add_filter( 'plugin_row_meta', 'catchids_add_plugin_meta_links', 10, 2 );
400
+ function catchids_add_plugin_meta_links( $meta_fields, $file ) {
401
+ if ( $file == plugin_basename( __FILE__ ) ) {
402
 
403
  $meta_fields[] = "<a href='https://catchplugins.com/support-forum/forum/catch-ids/' target='_blank'>Support Forum</a>";
404
  $meta_fields[] = "<a href='https://wordpress.org/support/plugin/catch-ids/reviews#new-post' target='_blank' title='Rate'>
408
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
409
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
410
  . "<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-star'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>"
411
+ . '</i></a>';
412
 
413
+ $stars_color = '#ffb900';
414
 
415
+ echo '<style>'
416
+ . '.ct-rate-stars{display:inline-block;color:' . $stars_color . ';position:relative;top:3px;}'
417
+ . '.ct-rate-stars svg{fill:' . $stars_color . ';}'
418
+ . '.ct-rate-stars svg:hover{fill:' . $stars_color . '}'
419
+ . '.ct-rate-stars svg:hover ~ svg{fill:none;}'
420
+ . '</style>';
421
  }
422
 
423
  return $meta_fields;
424
+ }
languages/catch-ids.pot CHANGED
@@ -1,11 +1,11 @@
1
- # Copyright (C) 2018 Catch Plugins
2
  # This file is distributed under the GNU General Public License v3 or later.
3
  #, fuzzy
4
  msgid ""
5
  msgstr ""
6
  "Project-Id-Version: Catch Ids\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/catch-ids\n"
8
- "POT-Creation-Date: 2019-11-12 00:26-0800\n"
9
  "PO-Revision-Date: 2016-12-07 22:52-0500\n"
10
  "Last-Translator: Pratik Shrestha <pratik@catchplugins.com>\n"
11
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
@@ -14,25 +14,25 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Generator: Poedit 2.2.4\n"
18
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;"
19
  "esc_html__\n"
20
  "X-Poedit-Basepath: .\n"
21
  "X-Poedit-SearchPath-0: ..\n"
22
 
23
- #: ../catch-ids.php:90
24
  msgid "ID"
25
  msgstr ""
26
 
27
- #: ../catch-ids.php:260 ../catch-ids.php:261
28
  msgid "Catch IDs"
29
  msgstr ""
30
 
31
- #: ../catch-ids.php:277
32
  msgid "You do not have sufficient permissions to access this page."
33
  msgstr ""
34
 
35
- #: ../catch-ids.php:312
36
  msgid "Settings"
37
  msgstr ""
38
 
1
+ # Copyright (C) 2018-2020 Catch Plugins
2
  # This file is distributed under the GNU General Public License v3 or later.
3
  #, fuzzy
4
  msgid ""
5
  msgstr ""
6
  "Project-Id-Version: Catch Ids\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/catch-ids\n"
8
+ "POT-Creation-Date: 2020-03-10 23:15-0700\n"
9
  "PO-Revision-Date: 2016-12-07 22:52-0500\n"
10
  "Last-Translator: Pratik Shrestha <pratik@catchplugins.com>\n"
11
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Poedit 2.3\n"
18
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;"
19
  "esc_html__\n"
20
  "X-Poedit-Basepath: .\n"
21
  "X-Poedit-SearchPath-0: ..\n"
22
 
23
+ #: ../catch-ids.php:92
24
  msgid "ID"
25
  msgstr ""
26
 
27
+ #: ../catch-ids.php:261 ../catch-ids.php:262
28
  msgid "Catch IDs"
29
  msgstr ""
30
 
31
+ #: ../catch-ids.php:278
32
  msgid "You do not have sufficient permissions to access this page."
33
  msgstr ""
34
 
35
+ #: ../catch-ids.php:313
36
  msgid "Settings"
37
  msgstr ""
38
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: catchplugins, catchthemes, sakinshrestha, pratikshrestha, maheshma
3
  Donate link: https://catchplugins.com/plugins/catch-ids/
4
  Tags: catch-ids, simple, admin, wp-admin, show, ids, post, page, category, media, links, tag, user, id, post id, page id, category id, tag id, media id
5
  Requires at least: 4.5
6
- Tested up to: 5.3
7
  Stable tag: trunk
8
  License: GNU General Public License, version 3 (GPLv3)
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -50,6 +50,9 @@ Not so easy way (via FTP) :
50
 
51
 
52
  == Changelog ==
 
 
 
53
  = 1.9 (Released: November 12, 2019) =
54
  * Compatibility check up to version 5.3
55
 
3
  Donate link: https://catchplugins.com/plugins/catch-ids/
4
  Tags: catch-ids, simple, admin, wp-admin, show, ids, post, page, category, media, links, tag, user, id, post id, page id, category id, tag id, media id
5
  Requires at least: 4.5
6
+ Tested up to: 5.4
7
  Stable tag: trunk
8
  License: GNU General Public License, version 3 (GPLv3)
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.txt
50
 
51
 
52
  == Changelog ==
53
+ = 2.0 (Released: March 10, 2020) =
54
+ * Compatibility check up to version 5.4
55
+
56
  = 1.9 (Released: November 12, 2019) =
57
  * Compatibility check up to version 5.3
58