Quick Featured Images - Version 13.4.0

Version Description

  • Added new column in the media library to list at each image for which posts it is set as featured image
  • Refactored user query for 'Default Images'
  • Tested successfully with WordPress 5.3.2
Download this release

Release Info

Developer Hinjiriyo
Plugin Icon 128x128 Quick Featured Images
Version 13.4.0
Comparing to
See all releases

Code changes from version 13.3.6 to 13.4.0

README.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: featured image,featured images,bulk set,automatic,thumbnails
5
  Requires at least: 3.8
6
  Requires PHP: 5.2
7
- Tested up to: 5.3
8
- Stable tag: 13.3.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -29,11 +29,10 @@ The plugin 'Quick Featured Images' helps you bulk managing featured images, sett
29
  You get the free version here. If you want to include **audios, videos and custom post types** and get more options then take a look the **Pro version** [Quick Featured Images Pro](https://www.quickfeaturedimages.com/).
30
 
31
  = What users said =
 
32
  * **“Doing the job perfect”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/doing-the-job-perfect/) by stigbarrett on February 14, 2019
33
  * **“Must be part of wordpress core”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/mag-ni-fi-cient-must-be-part-of-wordpress-core/) by Marc73 on November 2, 2018
34
- * **“Working great, just as expected, has lost of options. must-have!”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/working-great-has-lost-of-options/) by Yury on September 17, 2018
35
  * **“Simply the best for bulk featured image”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/simply-the-best-324/) by Syamsul Alam on January 21, 2018
36
- * **“Easy, fast and superb!”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/easy-fast-and-superb/) by alexeyvorobyov1994 on August 29, 2017
37
  * **“Made adding 10,000 featured images a breeze.”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/super-helpful-30/) by synchronista on July 28, 2017
38
  * **Number 7** in [8 Plugins to Help Supercharge Your WordPress Media Library](https://www.elegantthemes.com/blog/tips-tricks/8-plugins-to-help-supercharge-your-wordpress-media-library) by John Hughes on April 6, 2017
39
  * Mentioned in a comment of [What are must-have WordPress plugins for developer?](https://www.quora.com/What-are-must-have-WordPress-plugins-for-developer/answer/Joel-Rivera-2) by Joel Rivera on February 7, 2017
@@ -157,11 +156,13 @@ The latter setting is the default. The option is used every time a post is saved
157
 
158
  = Easy managing in a sortable image column in posts lists =
159
 
160
- Quick Featured Images Pro adds a new column called 'Featured Image' in posts lists. The additional column is sortable by the image ID. It shows the currently assigned **featured image of each post** and **action links to set, replace, edit and remove the featured image at each post**.
161
 
162
  With that column you can get a **quick overview about all used images** and a **change featured images at every single post quickly**. You can also see posts with no featured image at a glance.
163
 
164
- Under **'Featured Images' > 'Settings'** you can switch on and off the additional image column for every single post type, even custom post types if they support thumbnails.
 
 
165
 
166
  = Languages =
167
 
@@ -289,6 +290,11 @@ If you want to contribute a translation of the plugin in your language it would
289
 
290
  == Changelog ==
291
 
 
 
 
 
 
292
  = 13.3.6 =
293
  * Tested successfully with WordPress 5.3
294
 
@@ -511,7 +517,10 @@ Added spanish translation for the main texts of the plugin
511
 
512
  == Upgrade Notice ==
513
 
514
- = 13.3.6 =
 
 
 
515
  Tested successfully with WordPress 5.3
516
 
517
  = 13.3.5 =
4
  Tags: featured image,featured images,bulk set,automatic,thumbnails
5
  Requires at least: 3.8
6
  Requires PHP: 5.2
7
+ Tested up to: 5.3.2
8
+ Stable tag: 13.4.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
29
  You get the free version here. If you want to include **audios, videos and custom post types** and get more options then take a look the **Pro version** [Quick Featured Images Pro](https://www.quickfeaturedimages.com/).
30
 
31
  = What users said =
32
+ * **“I'm confused about it. It's very very very useful!”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/cool-928/) by yueli on December 19, 2019
33
  * **“Doing the job perfect”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/doing-the-job-perfect/) by stigbarrett on February 14, 2019
34
  * **“Must be part of wordpress core”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/mag-ni-fi-cient-must-be-part-of-wordpress-core/) by Marc73 on November 2, 2018
 
35
  * **“Simply the best for bulk featured image”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/simply-the-best-324/) by Syamsul Alam on January 21, 2018
 
36
  * **“Made adding 10,000 featured images a breeze.”** in [Reviews at wordpress.org](https://wordpress.org/support/topic/super-helpful-30/) by synchronista on July 28, 2017
37
  * **Number 7** in [8 Plugins to Help Supercharge Your WordPress Media Library](https://www.elegantthemes.com/blog/tips-tricks/8-plugins-to-help-supercharge-your-wordpress-media-library) by John Hughes on April 6, 2017
38
  * Mentioned in a comment of [What are must-have WordPress plugins for developer?](https://www.quora.com/What-are-must-have-WordPress-plugins-for-developer/answer/Joel-Rivera-2) by Joel Rivera on February 7, 2017
156
 
157
  = Easy managing in a sortable image column in posts lists =
158
 
159
+ Quick Featured Images adds a new column 'Featured Image' in posts lists. The additional column is sortable by the image ID. It shows the currently assigned **featured image of each post** and **action links to set, replace, edit and remove the featured image at each post**.
160
 
161
  With that column you can get a **quick overview about all used images** and a **change featured images at every single post quickly**. You can also see posts with no featured image at a glance.
162
 
163
+ Quick Featured Images also adds a new column in the media library. It lists the titles of all posts for which the corresponding image is set as featured images. The post titles are links to the respective post edit page.
164
+
165
+ Under **'Featured Images' > 'Settings'** you can switch on and off the additional columns for every single post type, even custom post types if they support thumbnails.
166
 
167
  = Languages =
168
 
290
 
291
  == Changelog ==
292
 
293
+ = 13.4.0 =
294
+ * Added new column in the media library to list at each image for which posts it is set as featured image
295
+ * Refactored user query for 'Default Images'
296
+ * Tested successfully with WordPress 5.3.2
297
+
298
  = 13.3.6 =
299
  * Tested successfully with WordPress 5.3
300
 
517
 
518
  == Upgrade Notice ==
519
 
520
+ = 13.4.0 =
521
+ Added new column in the media library to list at each image for which posts it is set as featured image, tested with WordPress 5.3.2
522
+
523
+ ^= 13.3.6 =
524
  Tested successfully with WordPress 5.3
525
 
526
  = 13.3.5 =
admin/assets/images/post_list_in_library_column.gif ADDED
Binary file
admin/class-quick-featured-images-admin.php CHANGED
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
21
  *
22
  * @var string
23
  */
24
- protected $plugin_version = '13.3.6';
25
 
26
  /**
27
  * Instance of this class.
21
  *
22
  * @var string
23
  */
24
+ protected $plugin_version = '13.4.0';
25
 
26
  /**
27
  * Instance of this class.
admin/class-quick-featured-images-columns.php CHANGED
@@ -77,13 +77,22 @@ class Quick_Featured_Images_Columns {
77
  protected $stored_settings = array();
78
 
79
  /**
80
- * Name of the additional column.
81
  *
82
  * @since 7.0
83
  *
84
  * @var string
85
  */
86
- protected $column_name = 'qfi-thumbnail';
 
 
 
 
 
 
 
 
 
87
 
88
  /**
89
  * Required user capability to use this plugin
@@ -157,7 +166,14 @@ class Quick_Featured_Images_Columns {
157
  // add Featured Image column in desired posts lists
158
  foreach ( $this->stored_settings as $key => $value ) {
159
  if ( '1' == $value ) {
160
- if ( preg_match('/^column_thumb_([a-z0-9_\-]+)$/', $key, $matches ) ) {
 
 
 
 
 
 
 
161
  // make the following lines more readable
162
  $post_type = $matches[ 1 ];
163
 
@@ -184,8 +200,7 @@ class Quick_Featured_Images_Columns {
184
  if ( ! has_action( $hook, $display_column_function ) ) {
185
  add_action( $hook, $display_column_function, 10, 2 );
186
  }
187
-
188
- } // if ( preg_match() )
189
  } // if ( value == 1 )
190
  } // foreach( stored_settings )
191
 
@@ -320,6 +335,13 @@ class Quick_Featured_Images_Columns {
320
  }
321
  }
322
 
 
 
 
 
 
 
 
323
  /**
324
  * Add a column with the title 'Featured Image' in the post lists
325
  *
@@ -329,7 +351,7 @@ class Quick_Featured_Images_Columns {
329
  */
330
  public function add_thumbnail_column( $cols ) {
331
  $text = 'Featured Image';
332
- $cols[ $this->column_name ] = _x( $text, 'post' );
333
  return $cols;
334
  }
335
 
@@ -341,7 +363,7 @@ class Quick_Featured_Images_Columns {
341
  * @return array extended list of sortable columns
342
  */
343
  public function add_sortable_column( $cols ) {
344
- $cols[ $this->column_name ] = $this->column_name;
345
 
346
  return $cols;
347
  }
@@ -354,8 +376,45 @@ class Quick_Featured_Images_Columns {
354
  * @return array extended list of columns
355
  */
356
  public function display_thumbnail_in_column( $column_name, $post_id ) {
 
 
 
357
  $width = $height = $this->used_thumbnail_width;
358
- if ( $this->column_name == $column_name ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  $thumbnail_id = get_post_thumbnail_id( $post_id );
360
  // check if image file exists, omit filters in get_attached_file() ('true')
361
  if ( $thumbnail_id ) {
@@ -447,7 +506,7 @@ class Quick_Featured_Images_Columns {
447
  echo "\n";
448
  echo "/* Quick Featured Images plugin styles */\n";
449
  echo "/* Fit thumbnails in posts list column */\n";
450
- printf( '.column-%s img {', $this->column_name );
451
  echo 'width:100%;height:auto;';
452
  printf( 'max-width:%dpx;', $this->used_thumbnail_width );
453
  printf( 'max-height:%dpx;', $this->used_thumbnail_width );
@@ -456,7 +515,7 @@ class Quick_Featured_Images_Columns {
456
  if ( version_compare( get_bloginfo( 'version' ), '4.3', '<' ) ) {
457
  echo "/* Auto-hiding of the thumbnail column in posts lists */\n";
458
  echo '@media screen and (max-width:782px) {';
459
- printf( '.column-%s {', $this->column_name );
460
  echo "display:none;}}\n";
461
  } // if WP < 4.3
462
  echo '</style>';
@@ -472,7 +531,7 @@ class Quick_Featured_Images_Columns {
472
  public function sort_column_by_image_id( $query ) {
473
 
474
  // if user wants to get rows sorted by featured image
475
- if ( $query->get( 'orderby' ) === $this->column_name ) {
476
  // set thumbnail id as sort value
477
  $query->set( 'meta_key', '_thumbnail_id' );
478
  // change sorting from alphabetical to numeric
@@ -606,4 +665,82 @@ class Quick_Featured_Images_Columns {
606
  );
607
  }
608
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  }
77
  protected $stored_settings = array();
78
 
79
  /**
80
+ * Name of the additional thumbnail column.
81
  *
82
  * @since 7.0
83
  *
84
  * @var string
85
  */
86
+ protected $thumbnail_column_name = 'qfi-thumbnail';
87
+
88
+ /**
89
+ * Name of the additional post list column.
90
+ *
91
+ * @since 13.4.0
92
+ *
93
+ * @var string
94
+ */
95
+ protected $post_list_column_name = 'qfi-post-list';
96
 
97
  /**
98
  * Required user capability to use this plugin
166
  // add Featured Image column in desired posts lists
167
  foreach ( $this->stored_settings as $key => $value ) {
168
  if ( '1' == $value ) {
169
+ if ( 'column_post_list' == $key ) {
170
+ // print post list column in media library
171
+ add_action( 'manage_media_columns', array( $this, 'add_post_list_column' ) );
172
+ // show content of post list column
173
+ add_action( 'manage_media_custom_column', array( $this, 'display_post_list_column' ), 10, 2 );
174
+ // print style for post list column
175
+ add_action( 'admin_head', array( $this, 'display_post_list_column_style' ) );
176
+ } elseif ( preg_match('/^column_thumb_([a-z0-9_\-]+)$/', $key, $matches ) ) {
177
  // make the following lines more readable
178
  $post_type = $matches[ 1 ];
179
 
200
  if ( ! has_action( $hook, $display_column_function ) ) {
201
  add_action( $hook, $display_column_function, 10, 2 );
202
  }
203
+ } // if ()
 
204
  } // if ( value == 1 )
205
  } // foreach( stored_settings )
206
 
335
  }
336
  }
337
 
338
+ /*
339
+ * ======================================================
340
+ * Methods for the thumbnail column
341
+ * on post overview pages
342
+ * ======================================================
343
+ */
344
+
345
  /**
346
  * Add a column with the title 'Featured Image' in the post lists
347
  *
351
  */
352
  public function add_thumbnail_column( $cols ) {
353
  $text = 'Featured Image';
354
+ $cols[ $this->thumbnail_column_name ] = _x( $text, 'post' );
355
  return $cols;
356
  }
357
 
363
  * @return array extended list of sortable columns
364
  */
365
  public function add_sortable_column( $cols ) {
366
+ $cols[ $this->thumbnail_column_name ] = $this->thumbnail_column_name;
367
 
368
  return $cols;
369
  }
376
  * @return array extended list of columns
377
  */
378
  public function display_thumbnail_in_column( $column_name, $post_id ) {
379
+ if ( $this->thumbnail_column_name !== $column_name ) {
380
+ return;
381
+ }
382
  $width = $height = $this->used_thumbnail_width;
383
+ // check if any plugin for external featured images exists and use it, else use the WP standard featured image
384
+ $thumbnail_url = '';
385
+ $thumbnail_alt = '';
386
+ if ( $this->is_knawatfibu ) {
387
+ $thumbnail_url = get_post_meta( $post_id, '_knawatfibu_url', true );
388
+ $thumbnail_alt = get_post_meta( $post_id, '_knawatfibu_alt', true );
389
+ } elseif( $this->is_fifu ) {
390
+ $thumbnail_url = fifu_main_image_url( $post_id );
391
+ /*if ( empty( $url ) ) {
392
+ $thumbnail_url = get_the_guid( get_post_thumbnail_id( $post_id ) );
393
+ }*/
394
+ }
395
+ if ( $thumbnail_url ) {
396
+ $sanitized_url = esc_url( $thumbnail_url , array( 'http', 'https' ) );
397
+ // if not yet cached, create thumbnail HTML code and store it in the cache
398
+ if ( empty( $this->thumbnail_cache[ $sanitized_url ] ) ) {
399
+ // get thumbnail HTML for the external image
400
+ $thumbnail_size = false;
401
+ // get the image dimensions; returns false if no such file, else an array
402
+ $thumbnail_size = @getimagesize( $sanitized_url );
403
+ if ( $thumbnail_size ) {
404
+ // finally all data are available; store HTML code in the cache
405
+ $this->thumbnail_cache[ $sanitized_url ] = $this->get_html_external_thumbnail(
406
+ $sanitized_url,
407
+ esc_attr( $thumbnail_alt ),
408
+ $thumbnail_size
409
+ );
410
+ } else {
411
+ // use error symbol
412
+ $this->thumbnail_cache[ $sanitized_url ] = $this->thumbnail_cache[ 'Invalid image URL' ];
413
+ } // if ( $thumbnail_size )
414
+ } // if ( empty( $this->thumbnail_cache[ $sanitized_url ] ) )
415
+ // print thumbnail HTML code
416
+ echo $this->thumbnail_cache[ $sanitized_url ];
417
+ } else {
418
  $thumbnail_id = get_post_thumbnail_id( $post_id );
419
  // check if image file exists, omit filters in get_attached_file() ('true')
420
  if ( $thumbnail_id ) {
506
  echo "\n";
507
  echo "/* Quick Featured Images plugin styles */\n";
508
  echo "/* Fit thumbnails in posts list column */\n";
509
+ printf( '.column-%s img {', $this->thumbnail_column_name );
510
  echo 'width:100%;height:auto;';
511
  printf( 'max-width:%dpx;', $this->used_thumbnail_width );
512
  printf( 'max-height:%dpx;', $this->used_thumbnail_width );
515
  if ( version_compare( get_bloginfo( 'version' ), '4.3', '<' ) ) {
516
  echo "/* Auto-hiding of the thumbnail column in posts lists */\n";
517
  echo '@media screen and (max-width:782px) {';
518
+ printf( '.column-%s {', $this->thumbnail_column_name );
519
  echo "display:none;}}\n";
520
  } // if WP < 4.3
521
  echo '</style>';
531
  public function sort_column_by_image_id( $query ) {
532
 
533
  // if user wants to get rows sorted by featured image
534
+ if ( $query->get( 'orderby' ) === $this->thumbnail_column_name ) {
535
  // set thumbnail id as sort value
536
  $query->set( 'meta_key', '_thumbnail_id' );
537
  // change sorting from alphabetical to numeric
665
  );
666
  }
667
 
668
+ /*
669
+ * ======================================================
670
+ * Methods for the post list column
671
+ * on the media library pages
672
+ * ======================================================
673
+ */
674
+
675
+ /**
676
+ * Add a column with the title 'Featured Image' in the post lists
677
+ *
678
+ * @since 13.4.0
679
+ *
680
+ * @return array list of columns
681
+ */
682
+ public function add_post_list_column( $cols ) {
683
+ $cols[ $this->post_list_column_name ] = __( 'Featured image for', 'quick-featured-images' );
684
+ return $cols;
685
+ }
686
+
687
+ /**
688
+ * Print the post titles which has the current image as featured image
689
+ *
690
+ * @since 13.4.0
691
+ *
692
+ * @return array extended list of columns
693
+ */
694
+ public function display_post_list_column( $column_name, $attachment_id ) {
695
+ // quit if not the desired column
696
+ if ( $this->post_list_column_name !== $column_name ) {
697
+ return;
698
+ }
699
+
700
+ // look up the posts for which the attachment was set as featured image
701
+ // returns an array of post IDs if any, else an empty array
702
+ global $wpdb;
703
+ $post_ids = $wpdb->get_col( $wpdb->prepare( "
704
+ SELECT `post_id`
705
+ FROM $wpdb->postmeta
706
+ WHERE `meta_key` LIKE '_thumbnail_id'
707
+ AND `meta_value` = %d", $attachment_id
708
+ ) );
709
+
710
+ // if posts were found
711
+ if ( $post_ids ) {
712
+ // if there is more than one post
713
+ if ( 1 < sizeof( $post_ids ) ) {
714
+ // print a list
715
+ echo '<ul>';
716
+ foreach ( $post_ids as $id ) {
717
+ echo '<li>';
718
+ // print the link to the edit page of the post
719
+ edit_post_link( get_the_title( $id ), '', '', $id );
720
+ echo '</li>';
721
+ }
722
+ echo '</ul>';
723
+ } else {
724
+ // print in a single line the link to the edit page of the found post
725
+ edit_post_link( get_the_title( $post_ids[ 0 ] ), '', '', $post_ids[ 0 ] );
726
+ }
727
+ }
728
+ }
729
+
730
+ /**
731
+ * Print CSS for post list column
732
+ *
733
+ * @since 13.4.0
734
+ *
735
+ * @return null
736
+ */
737
+ public function display_post_list_column_style(){
738
+ echo '<style type="text/css">';
739
+ echo "\n";
740
+ echo "/* Quick Featured Images plugin styles */\n";
741
+ echo ".widefat td.column-qfi-post-list ul { margin: 0; }\n";
742
+ echo "</style>\n";
743
+ }
744
+
745
+
746
  }
admin/class-quick-featured-images-settings.php CHANGED
@@ -326,8 +326,9 @@ class Quick_Featured_Images_Settings {
326
  add_option(
327
  'quick-featured-images-settings',
328
  array(
329
- 'column_thumb_post' => '1',
330
- 'column_thumb_page' => '1',
 
331
  'minimum_role_all_pages' => 'editor',
332
  )
333
  );
@@ -392,7 +393,7 @@ class Quick_Featured_Images_Settings {
392
  // form field name for use in the 'id' attribute of tags
393
  'column_toggles',
394
  // title of the form field
395
- $title . sprintf( '<br />&nbsp;<br /><img src="%s" alt="%s" width="200" height="104" />', plugins_url( 'assets/images/posts_list_w_image_column.gif' , __FILE__ ), esc_attr__( 'Posts list with image column', 'quick-featured-images' ) ),
396
  // callback function to print the form field
397
  array( $this, 'print_columns_options' ),
398
  // menu page on which to display this field for do_settings_section()
@@ -403,6 +404,42 @@ class Quick_Featured_Images_Settings {
403
  array( $title )
404
  ); // end add_settings_field()
405
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  /*
407
  *
408
  * 2nd section: menu display options
@@ -469,13 +506,14 @@ class Quick_Featured_Images_Settings {
469
  return array(
470
  'column_thumb_post' => '1',
471
  'column_thumb_page' => '1',
 
472
  'minimum_role_all_pages' => 'editor',
473
  );
474
  }
475
  $sanitized_input = array();
476
  foreach ( $input as $key => $value ) {
477
  // checkboxes
478
- if ( preg_match( '/^column_thumb_[a-z0-9_\-]+$/', $key ) ) {
479
  $sanitized_input[ $key ] = isset( $input[ $key ] ) ? '1' : '0' ;
480
  }
481
  // selections
@@ -559,6 +597,28 @@ class Quick_Featured_Images_Settings {
559
  echo $html;
560
  }
561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  /**
563
  * Print the option to set allowed roles displaying the menu items
564
  *
@@ -567,7 +627,7 @@ class Quick_Featured_Images_Settings {
567
  */
568
  public function print_role_control ( $args ) {
569
  // get translations
570
- $label = __( 'Minimum user role to see the plugin in the backend', 'quick-featured-images' );
571
 
572
  // get WP core translations; little hack: put strings into variables to avoid PO editors to find them
573
  $label_administrator = 'Administrator';
@@ -585,18 +645,18 @@ class Quick_Featured_Images_Settings {
585
  foreach ( $role_names as $role_slug => $role_label ) {
586
  $options .= sprintf(
587
  '<option value="%s"%s>%s</option>',
588
- $role_slug,
589
  selected( $stored_value, $role_slug, false ),
590
  esc_html( $role_label )
591
  );
592
  }
593
 
594
  // define the form sections, order by appereance, with headlines, and options
595
- $html = sprintf( '<fieldset><legend class="screen-reader-text"><span>%s</span></legend>', $args[ 0 ] );
596
  $html .= sprintf( '<div>' );
597
  $html .= sprintf(
598
  '<label>%s<br /><select name="%s[%s]">%s</select></label>',
599
- esc_html( $label ),
600
  $this->settings_db_slug,
601
  'minimum_role_all_pages',
602
  $options
@@ -608,10 +668,10 @@ class Quick_Featured_Images_Settings {
608
  $html .= sprintf(
609
  '<p class="description">%s</p>',
610
  sprintf(
611
- esc_html__( 'The rules as set in &#8220;%s&#8221; work on posts independently of this setting.', 'quick-featured-images' ),
612
  //esc_html__( 'Preset Featured Images', 'quick-featured-images' )
613
  esc_html__( $text )
614
- )
615
  );
616
  $html .= sprintf( '<p class="description">%s</p>', esc_html__( 'This setting controls as well whether a user will see in an image column the thumbnails with action links or the thumbnails only. To switch image columns on and off use the section above.', 'quick-featured-images' ) );
617
  $html .= sprintf( '<p class="description">%s</p>', esc_html__( 'This page is accessible for administrators only.', 'quick-featured-images' ) );
@@ -636,4 +696,12 @@ class Quick_Featured_Images_Settings {
636
  printf( "<div class=\"qfi_page_description\"><p>%s</p></div>\n", esc_html__( 'Controls which minimum user role can see the plugin.', 'quick-featured-images' ) );
637
  }
638
 
 
 
 
 
 
 
 
 
639
  }
326
  add_option(
327
  'quick-featured-images-settings',
328
  array(
329
+ 'column_thumb_post' => '1',
330
+ 'column_thumb_page' => '1',
331
+ 'column_post_list' => '1',
332
  'minimum_role_all_pages' => 'editor',
333
  )
334
  );
393
  // form field name for use in the 'id' attribute of tags
394
  'column_toggles',
395
  // title of the form field
396
+ $title . sprintf( '<br />&nbsp;<br /><img src="%s" alt="%s" width="200" height="104" />', plugins_url( 'assets/images/posts_list_w_image_column.gif' , __FILE__ ), __( 'Posts list with image column', 'quick-featured-images' ) ),
397
  // callback function to print the form field
398
  array( $this, 'print_columns_options' ),
399
  // menu page on which to display this field for do_settings_section()
404
  array( $title )
405
  ); // end add_settings_field()
406
 
407
+ /*
408
+ *
409
+ * 4th section: post lists column
410
+ *
411
+ */
412
+
413
+ $section_key = '4th_section';
414
+ // register the section
415
+ add_settings_section(
416
+ // 'id' attribute of tags
417
+ $section_key,
418
+ // title of the section.
419
+ __( 'Column in the library for posts with assigned featured image', 'quick-featured-images' ),
420
+ // callback function that fills the section with the desired content
421
+ array( $this, 'print_section_' . $section_key ),
422
+ // menu page on which to display this section
423
+ $this->main_options_page_slug
424
+ ); // end add_settings_section()
425
+
426
+ // register the options for the section
427
+ $title = __( 'Show additional column in the library for posts with featured images', 'quick-featured-images' );
428
+ add_settings_field(
429
+ // form field name for use in the 'id' attribute of tags
430
+ 'column_post_list',
431
+ // title of the form field
432
+ $title . sprintf( '<br />&nbsp;<br /><img src="%s" alt="%s" width="200" height="124" />', plugins_url( 'assets/images/post_list_in_library_column.gif' , __FILE__ ), __( 'Post list column in the library', 'quick-featured-images' ) ),
433
+ // callback function to print the form field
434
+ array( $this, 'print_column_post_list_option' ),
435
+ // menu page on which to display this field for do_settings_section()
436
+ $this->main_options_page_slug,
437
+ // section where the form field appears
438
+ $section_key,
439
+ // arguments passed to the callback function
440
+ array( $title )
441
+ ); // end add_settings_field()
442
+
443
  /*
444
  *
445
  * 2nd section: menu display options
506
  return array(
507
  'column_thumb_post' => '1',
508
  'column_thumb_page' => '1',
509
+ 'column_post_list' => '1',
510
  'minimum_role_all_pages' => 'editor',
511
  );
512
  }
513
  $sanitized_input = array();
514
  foreach ( $input as $key => $value ) {
515
  // checkboxes
516
+ if ( $key == 'column_post_list' || preg_match( '/^column_thumb_[a-z0-9_\-]+$/', $key ) ) {
517
  $sanitized_input[ $key ] = isset( $input[ $key ] ) ? '1' : '0' ;
518
  }
519
  // selections
597
  echo $html;
598
  }
599
 
600
+ /**
601
+ * Print the column for image-posts assignments
602
+ *
603
+ * @since 13.4.0
604
+ *
605
+ */
606
+ public function print_column_post_list_option ( $args ) {
607
+ $html = sprintf( '<fieldset><legend class="screen-reader-text"><span>%s</span></legend>', $args[ 0 ] );
608
+ $stored_value = isset( $this->stored_settings[ 'column_post_list' ] ) ? esc_attr( $this->stored_settings[ 'column_post_list' ] ) : '0';
609
+ $checked = $stored_value ? checked( '1', $stored_value, false ) : '0';
610
+ $html .= sprintf(
611
+ '<label><input name="%s[%s]" type="checkbox" value="1"%s /> %s</label><br />',
612
+ $this->settings_db_slug,
613
+ esc_attr( 'column_post_list' ),
614
+ $checked,
615
+ esc_html__( 'Display a new column in the media library with the titles of the posts for which the corresponding image is set as featured image', 'quick-featured-images' )
616
+ );
617
+ $html .= '</fieldset>';
618
+ $html .= sprintf( '<p class="description">%s</p>', esc_html__( 'Activate the checkbox to show the extra column in the media library. If you would not see the new column in the library switch the appereance of the library to List mode. The post titles are links to the respective post edit page.', 'quick-featured-images' ) );
619
+ echo $html;
620
+ }
621
+
622
  /**
623
  * Print the option to set allowed roles displaying the menu items
624
  *
627
  */
628
  public function print_role_control ( $args ) {
629
  // get translations
630
+ $label = esc_html__( 'Minimum user role to see the plugin in the backend', 'quick-featured-images');
631
 
632
  // get WP core translations; little hack: put strings into variables to avoid PO editors to find them
633
  $label_administrator = 'Administrator';
645
  foreach ( $role_names as $role_slug => $role_label ) {
646
  $options .= sprintf(
647
  '<option value="%s"%s>%s</option>',
648
+ esc_attr( $role_slug ),
649
  selected( $stored_value, $role_slug, false ),
650
  esc_html( $role_label )
651
  );
652
  }
653
 
654
  // define the form sections, order by appereance, with headlines, and options
655
+ $html = sprintf( '<fieldset><legend class="screen-reader-text"><span>%s</span></legend>', esc_html( $args[ 0 ] ) );
656
  $html .= sprintf( '<div>' );
657
  $html .= sprintf(
658
  '<label>%s<br /><select name="%s[%s]">%s</select></label>',
659
+ $label,
660
  $this->settings_db_slug,
661
  'minimum_role_all_pages',
662
  $options
668
  $html .= sprintf(
669
  '<p class="description">%s</p>',
670
  sprintf(
671
+ esc_html__( 'The rules as set in &#8220;%s&#8221; work on posts independently of this setting.', 'quick-featured-images' ),
672
  //esc_html__( 'Preset Featured Images', 'quick-featured-images' )
673
  esc_html__( $text )
674
+ )
675
  );
676
  $html .= sprintf( '<p class="description">%s</p>', esc_html__( 'This setting controls as well whether a user will see in an image column the thumbnails with action links or the thumbnails only. To switch image columns on and off use the section above.', 'quick-featured-images' ) );
677
  $html .= sprintf( '<p class="description">%s</p>', esc_html__( 'This page is accessible for administrators only.', 'quick-featured-images' ) );
696
  printf( "<div class=\"qfi_page_description\"><p>%s</p></div>\n", esc_html__( 'Controls which minimum user role can see the plugin.', 'quick-featured-images' ) );
697
  }
698
 
699
+ /**
700
+ * Print the explanation for section 4
701
+ *
702
+ * @since 13.4.0
703
+ */
704
+ public function print_section_4th_section () {
705
+ printf( "<div class=\"qfi_page_description\"><p>%s</p></div>\n", esc_html__( 'The additional column in the media library lists all posts for which the image is set as featured.', 'quick-featured-images' ) );
706
+ }
707
  }
admin/views/section_defaults.php CHANGED
@@ -68,14 +68,18 @@ $tags = get_tags( $args );
68
  // get stored categories
69
  $categories = get_categories( $args );
70
 
71
- // get authors: Return List all blog editors, return limited fields in resulting row objects:
72
- $user_query = new WP_User_Query( array(
73
- 'who' => 'authors',
 
74
  'fields' => array( 'ID', 'user_nicename', 'display_name' ),
75
  'order' => 'ASC',
76
  'orderby' => 'display_name'
77
- ) );
 
78
  $user_data = $user_query->get_results();
 
 
79
  // make selection box entries
80
  $users = array();
81
  if ( 0 < count( $user_data ) ) {
68
  // get stored categories
69
  $categories = get_categories( $args );
70
 
71
+ // get users: return list of all blog writers with specified fields in row objects
72
+ $user_args = array(
73
+ //'who' => 'authors'; old, use role__in instead
74
+ 'role__in' => array( 'administrator', 'editor', 'author' ),
75
  'fields' => array( 'ID', 'user_nicename', 'display_name' ),
76
  'order' => 'ASC',
77
  'orderby' => 'display_name'
78
+ );
79
+ $user_query = new WP_User_Query( $user_args );
80
  $user_data = $user_query->get_results();
81
+ // free memory
82
+ unset( $user_query, $user_args );
83
  // make selection box entries
84
  $users = array();
85
  if ( 0 < count( $user_data ) ) {
quick-featured-images.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Quick Featured Images
11
  * Plugin URI: http://wordpress.org/plugins/quick-featured-images
12
  * Description: Your time-saving Swiss Army Knife for featured images: Set, replace and delete them in bulk, in posts lists and set default images for future posts.
13
- * Version: 13.3.6
14
  * Author: Martin Stehle
15
  * Author URI: http://stehle-internet.de
16
  * Text Domain: quick-featured-images
10
  * Plugin Name: Quick Featured Images
11
  * Plugin URI: http://wordpress.org/plugins/quick-featured-images
12
  * Description: Your time-saving Swiss Army Knife for featured images: Set, replace and delete them in bulk, in posts lists and set default images for future posts.
13
+ * Version: 13.4.0
14
  * Author: Martin Stehle
15
  * Author URI: http://stehle-internet.de
16
  * Text Domain: quick-featured-images