PluginProbe
Image Source Control Lite – Show Image Credits and Captions / 3.11.0
Image Source Control Lite – Show Image Credits and Captions v3.11.0
3.12.0 3.11.0 trunk 1.1 1.1.1 1.1.2 1.1.2.1 1.1.3 1.10 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.2 1.2.0.1 1.2.0.2 1.2.0.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.4.1 1.3.5 All 110 releases
image-source-control-isc / includes / image-sources / admin / notices.php

notices.php in Image Source Control Lite – Show Image Credits and Captions 3.11.0, at includes/image-sources/admin/notices.php

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ISC\Image_Sources;
4
5 use ISC_Model;
6
7 /**
8 * Add the admin menu items für Image Sources features
9 */
10 class Admin_Notices {
11 use \ISC\Options;
12
13 /**
14 * Constructor
15 */
16 public function __construct() {
17 add_action( 'admin_notices', [ $this, 'admin_notices' ] );
18 }
19
20 /**
21 * Search for missing sources and display a warning if found some
22 *
23 * This message intentionally uses the `admin_notices` hook instead of the `isc_admin_notices` hook
24 * since it is meant to be shown in the general admin area and not on ISC pages.
25 * Someone visiting ISC pages might already be aware of the issue and does not need to be reminded there.
26 */
27 public function admin_notices() {
28
29 // only check, if check-option was enabled
30 $options = $this->get_options();
31 // skip the warning on the image sources screen since the list shows up there
32 $screen = get_current_screen();
33 if ( empty( $options['warning_onesource_missing'] )
34 || empty( $screen->id )
35 || $screen->id === 'media_page_isc-sources' ) {
36 return;
37 }
38
39 $missing_sources = (int) get_transient( 'isc-show-missing-sources-warning' );
40
41 // check for missing sources if the transient is empty and store that value
42 if ( ! $missing_sources ) {
43 $missing_sources = ISC_Model::update_missing_sources_transient();
44 }
45
46 // attachments without sources
47 if ( $missing_sources ) {
48 require_once ISCPATH . '/admin/templates/notice-missing.php';
49 }
50 }
51 }
52