Media Library Categories - Version 1.5.2

Version Description

  • Support for GlotPress (to translate WordPress plugins). You can help to translate on https://translate.wordpress.org/projects/wp-plugins/wp-media-library-categories/
  • Fixed notice "Undefined index: ids" which in some rare cases would appear.
Download this release

Release Info

Developer jeffrey-wp
Plugin Icon 128x128 Media Library Categories
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

Files changed (2) hide show
  1. index.php +19 -17
  2. readme.txt +6 -2
index.php CHANGED
@@ -3,8 +3,9 @@
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: http://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
- * Version: 1.5.1
7
  * Author: Jeffrey-WP
 
8
  * Author URI: http://codecanyon.net/user/jeffrey-wp/?ref=jeffrey-wp
9
  */
10
 
@@ -164,8 +165,9 @@ function wpmediacategory_gallery_atts( $result, $defaults, $atts ) {
164
  }
165
 
166
  }
167
-
168
- $result['include'] = implode( ',', $atts['ids'] );
 
169
  $result['category'] = $atts['category'];
170
 
171
  }
@@ -245,7 +247,7 @@ if ( is_admin() ) {
245
  $dropdown_options = array(
246
  'taxonomy' => $taxonomy,
247
  'name' => $taxonomy,
248
- 'show_option_all' => __( 'View all categories' ),
249
  'hide_empty' => false,
250
  'hierarchical' => true,
251
  'orderby' => 'name',
@@ -256,7 +258,7 @@ if ( is_admin() ) {
256
  } else {
257
  $dropdown_options = array(
258
  'taxonomy' => $taxonomy,
259
- 'show_option_all' => __( 'View all categories' ),
260
  'hide_empty' => false,
261
  'hierarchical' => true,
262
  'orderby' => 'name',
@@ -282,24 +284,24 @@ if ( is_admin() ) {
282
 
283
  echo '<script type="text/javascript">';
284
  echo 'jQuery(window).load(function() {';
285
- echo 'jQuery(\'<optgroup id="wpmediacategory_optgroup1" label="' . html_entity_decode( __( 'Categories' ), ENT_QUOTES, 'UTF-8' ) . '">\').appendTo("select[name=\'action\']");';
286
- echo 'jQuery(\'<optgroup id="wpmediacategory_optgroup2" label="' . html_entity_decode( __( 'Categories' ), ENT_QUOTES, 'UTF-8' ) . '">\').appendTo("select[name=\'action2\']");';
287
 
288
  // add categories
289
  foreach ( $terms as $term ) {
290
- $sTxtAdd = esc_js( __( 'Add' ) . ': ' . $term->name );
291
  echo "jQuery('<option>').val('wpmediacategory_add_" . $term->term_taxonomy_id . "').text('" . $sTxtAdd . "').appendTo('#wpmediacategory_optgroup1');";
292
  echo "jQuery('<option>').val('wpmediacategory_add_" . $term->term_taxonomy_id . "').text('" . $sTxtAdd . "').appendTo('#wpmediacategory_optgroup2');";
293
  }
294
  // remove categories
295
  foreach ( $terms as $term ) {
296
- $sTxtRemove = esc_js( __( 'Remove' ) . ': ' . $term->name );
297
  echo "jQuery('<option>').val('wpmediacategory_remove_" . $term->term_taxonomy_id . "').text('" . $sTxtRemove . "').appendTo('#wpmediacategory_optgroup1');";
298
  echo "jQuery('<option>').val('wpmediacategory_remove_" . $term->term_taxonomy_id . "').text('" . $sTxtRemove . "').appendTo('#wpmediacategory_optgroup2');";
299
  }
300
  // remove all categories
301
- echo "jQuery('<option>').val('wpmediacategory_remove_0').text('" . esc_js( __( 'Delete all' ) ) . "').appendTo('#wpmediacategory_optgroup1');";
302
- echo "jQuery('<option>').val('wpmediacategory_remove_0').text('" . esc_js( __( 'Delete all' ) ) . "').appendTo('#wpmediacategory_optgroup2');";
303
  echo "});";
304
  echo "</script>";
305
 
@@ -416,7 +418,7 @@ if ( is_admin() ) {
416
  global $post_type, $pagenow;
417
 
418
  if ( $pagenow == 'upload.php' && $post_type == 'attachment' && isset( $_GET['editCategory'] ) ) {
419
- echo '<div class="updated"><p>' . __( 'Settings saved.' ) . '</p></div>';
420
  }
421
  }
422
  add_action( 'admin_notices', 'wpmediacategory_custom_bulk_admin_notices' );
@@ -430,8 +432,8 @@ if ( is_admin() ) {
430
  $taxonomy = apply_filters( 'wpmediacategory_taxonomy', $taxonomy );
431
  return array_merge(
432
  array(
433
- 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/edit-tags.php?taxonomy=' . $taxonomy . '&amp;post_type=attachment">' . __( 'Categories' ) . '</a>',
434
- 'premium' => '<a href="http://codecanyon.net/item/media-library-categories-premium/6691290?ref=jeffrey-wp">' . __( 'Get Premium Version' ) . '</a>'
435
  ),
436
  $links
437
  );
@@ -524,13 +526,13 @@ if ( is_admin() ) {
524
 
525
  echo '<script type="text/javascript">';
526
  echo '/* <![CDATA[ */';
527
- echo 'var wpmediacategory_taxonomies = {"' . $taxonomy . '":{"list_title":"' . html_entity_decode( __( 'View all categories' ), ENT_QUOTES, 'UTF-8' ) . '","term_list":[' . substr( $attachment_terms, 2 ) . ']}};';
528
  echo '/* ]]> */';
529
  echo '</script>';
530
 
531
- wp_enqueue_script( 'wpmediacategory-media-views', plugins_url( 'js/wpmediacategory-media-views.min.js', __FILE__ ), array( 'media-views' ), '1.5.1', true );
532
  }
533
- wp_enqueue_style( 'wpmediacategory', plugins_url( 'css/wpmediacategory.min.css', __FILE__ ), array(), '1.5.1' );
534
  }
535
  add_action( 'admin_enqueue_scripts', 'wpmediacategory_enqueue_media_action' );
536
 
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: http://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
+ * Version: 1.5.2
7
  * Author: Jeffrey-WP
8
+ * Text Domain: wp-media-library-categories
9
  * Author URI: http://codecanyon.net/user/jeffrey-wp/?ref=jeffrey-wp
10
  */
11
 
165
  }
166
 
167
  }
168
+ if ( isset( $atts['ids'] ) ) {
169
+ $result['include'] = implode( ',', $atts['ids'] );
170
+ }
171
  $result['category'] = $atts['category'];
172
 
173
  }
247
  $dropdown_options = array(
248
  'taxonomy' => $taxonomy,
249
  'name' => $taxonomy,
250
+ 'show_option_all' => __( 'View all categories', 'wp-media-library-categories' ),
251
  'hide_empty' => false,
252
  'hierarchical' => true,
253
  'orderby' => 'name',
258
  } else {
259
  $dropdown_options = array(
260
  'taxonomy' => $taxonomy,
261
+ 'show_option_all' => __( 'View all categories', 'wp-media-library-categories' ),
262
  'hide_empty' => false,
263
  'hierarchical' => true,
264
  'orderby' => 'name',
284
 
285
  echo '<script type="text/javascript">';
286
  echo 'jQuery(window).load(function() {';
287
+ echo 'jQuery(\'<optgroup id="wpmediacategory_optgroup1" label="' . html_entity_decode( __( 'Categories', 'wp-media-library-categories' ), ENT_QUOTES, 'UTF-8' ) . '">\').appendTo("select[name=\'action\']");';
288
+ echo 'jQuery(\'<optgroup id="wpmediacategory_optgroup2" label="' . html_entity_decode( __( 'Categories', 'wp-media-library-categories' ), ENT_QUOTES, 'UTF-8' ) . '">\').appendTo("select[name=\'action2\']");';
289
 
290
  // add categories
291
  foreach ( $terms as $term ) {
292
+ $sTxtAdd = esc_js( __( 'Add', 'wp-media-library-categories' ) . ': ' . $term->name );
293
  echo "jQuery('<option>').val('wpmediacategory_add_" . $term->term_taxonomy_id . "').text('" . $sTxtAdd . "').appendTo('#wpmediacategory_optgroup1');";
294
  echo "jQuery('<option>').val('wpmediacategory_add_" . $term->term_taxonomy_id . "').text('" . $sTxtAdd . "').appendTo('#wpmediacategory_optgroup2');";
295
  }
296
  // remove categories
297
  foreach ( $terms as $term ) {
298
+ $sTxtRemove = esc_js( __( 'Remove', 'wp-media-library-categories' ) . ': ' . $term->name );
299
  echo "jQuery('<option>').val('wpmediacategory_remove_" . $term->term_taxonomy_id . "').text('" . $sTxtRemove . "').appendTo('#wpmediacategory_optgroup1');";
300
  echo "jQuery('<option>').val('wpmediacategory_remove_" . $term->term_taxonomy_id . "').text('" . $sTxtRemove . "').appendTo('#wpmediacategory_optgroup2');";
301
  }
302
  // remove all categories
303
+ echo "jQuery('<option>').val('wpmediacategory_remove_0').text('" . esc_js( __( 'Remove all categories', 'wp-media-library-categories' ) ) . "').appendTo('#wpmediacategory_optgroup1');";
304
+ echo "jQuery('<option>').val('wpmediacategory_remove_0').text('" . esc_js( __( 'Remove all categories', 'wp-media-library-categories' ) ) . "').appendTo('#wpmediacategory_optgroup2');";
305
  echo "});";
306
  echo "</script>";
307
 
418
  global $post_type, $pagenow;
419
 
420
  if ( $pagenow == 'upload.php' && $post_type == 'attachment' && isset( $_GET['editCategory'] ) ) {
421
+ echo '<div class="updated"><p>' . __( 'Category changes are saved.', 'wp-media-library-categories' ) . '</p></div>';
422
  }
423
  }
424
  add_action( 'admin_notices', 'wpmediacategory_custom_bulk_admin_notices' );
432
  $taxonomy = apply_filters( 'wpmediacategory_taxonomy', $taxonomy );
433
  return array_merge(
434
  array(
435
+ 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/edit-tags.php?taxonomy=' . $taxonomy . '&amp;post_type=attachment">' . __( 'Categories', 'wp-media-library-categories' ) . '</a>',
436
+ 'premium' => '<a href="http://codecanyon.net/item/media-library-categories-premium/6691290?ref=jeffrey-wp">' . __( 'Get Premium Version', 'wp-media-library-categories' ) . '</a>'
437
  ),
438
  $links
439
  );
526
 
527
  echo '<script type="text/javascript">';
528
  echo '/* <![CDATA[ */';
529
+ echo 'var wpmediacategory_taxonomies = {"' . $taxonomy . '":{"list_title":"' . html_entity_decode( __( 'View all categories', 'wp-media-library-categories' ), ENT_QUOTES, 'UTF-8' ) . '","term_list":[' . substr( $attachment_terms, 2 ) . ']}};';
530
  echo '/* ]]> */';
531
  echo '</script>';
532
 
533
+ wp_enqueue_script( 'wpmediacategory-media-views', plugins_url( 'js/wpmediacategory-media-views.min.js', __FILE__ ), array( 'media-views' ), '1.5.2', true );
534
  }
535
+ wp_enqueue_style( 'wpmediacategory', plugins_url( 'css/wpmediacategory.min.css', __FILE__ ), array(), '1.5.2' );
536
  }
537
  add_action( 'admin_enqueue_scripts', 'wpmediacategory_enqueue_media_action' );
538
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jeffrey-wp
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SSNQMST6R28Q2
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 3.1
6
- Tested up to: 4.3
7
- Stable tag: 1.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -78,6 +78,10 @@ Maintaining a plugin and keeping it up to date is hard work. Please support me b
78
 
79
  == Changelog ==
80
 
 
 
 
 
81
  = 1.5.1 =
82
  * Support for WordPress 4.2
83
  * Security enhancement for add_query_arg
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SSNQMST6R28Q2
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 3.1
6
+ Tested up to: 4.5.1
7
+ Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
78
 
79
  == Changelog ==
80
 
81
+ = 1.5.2 =
82
+ * Support for GlotPress (to translate WordPress plugins). You can help to translate on [https://translate.wordpress.org/projects/wp-plugins/wp-media-library-categories/](https://translate.wordpress.org/projects/wp-plugins/wp-media-library-categories/)
83
+ * Fixed notice "Undefined index: ids" which in some rare cases would appear.
84
+
85
  = 1.5.1 =
86
  * Support for WordPress 4.2
87
  * Security enhancement for add_query_arg