| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Parsely wp-admin warning | |
| 3 | + * UI: Parse.ly wp-admin warning class | |
| 4 | 4 | * |
| 5 | 5 | * @package Parsely |
| 6 | - * @since 3.0.0 | |
| 6 | + * @since 3.0.0 | |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | declare(strict_types=1); |
| 10 | 10 | |
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | |
| 13 | 13 | use Parsely\Parsely; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Conditionally render a warning message on wp-admin | |
| 16 | + * Conditionally renders a warning message on wp-admin. | |
| 17 | 17 | * |
| 18 | 18 | * @since 3.0.0 |
| 19 | 19 | */ |
| 20 | 20 | final class Admin_Warning { |
| @@ -34,13 +34,11 @@ | ||
| 34 | 34 | $this->parsely = $parsely; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Register admin warning. | |
| 38 | + * Registers admin warning. | |
| 39 | 39 | * |
| 40 | 40 | * @since 3.0.0 |
| 41 | - * | |
| 42 | - * @return void | |
| 43 | 41 | */ |
| 44 | 42 | public function run(): void { |
| 45 | 43 | add_action( 'admin_notices', array( $this, 'display_admin_warning' ) ); |
| 46 | 44 | } |
| @@ -45,11 +43,9 @@ | ||
| 45 | 43 | add_action( 'admin_notices', array( $this, 'display_admin_warning' ) ); |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | 46 | /** |
| 49 | - * Display the admin warning if needed. | |
| 50 | - * | |
| 51 | - * @return void | |
| 47 | + * Displays the admin warning if needed. | |
| 52 | 48 | */ |
| 53 | 49 | public function display_admin_warning(): void { |
| 54 | 50 | if ( ! $this->should_display_admin_warning() ) { |
| 55 | 51 | return; |
| @@ -60,18 +56,18 @@ | ||
| 60 | 56 | __( '<strong>The Parse.ly plugin is not active.</strong> You need to <a href="%s">provide your Parse.ly Dash Site ID</a> before things get cooking.', 'wp-parsely' ), |
| 61 | 57 | esc_url( Parsely::get_settings_url() ) |
| 62 | 58 | ); |
| 63 | 59 | ?> |
| 64 | - <div id="wp-parsely-apikey-error-notice" class="notice notice-error"><p><?php echo wp_kses_post( $message ); ?></p></div> | |
| 60 | + <div id="wp-parsely-site-id-error-notice" class="notice notice-error"><p><?php echo wp_kses_post( $message ); ?></p></div> | |
| 65 | 61 | <?php |
| 66 | 62 | } |
| 67 | 63 | |
| 68 | 64 | /** |
| 69 | - * Decide whether the admin display warning should be displayed | |
| 65 | + * Returns whether the admin display warning should be displayed. | |
| 70 | 66 | * |
| 71 | 67 | * @since 2.6.0 |
| 72 | 68 | * |
| 73 | - * @return bool True if the admin warning should be displayed | |
| 69 | + * @return bool True if the admin warning should be displayed. | |
| 74 | 70 | */ |
| 75 | 71 | private function should_display_admin_warning(): bool { |
| 76 | 72 | if ( is_network_admin() ) { |
| 77 | 73 | return false; |
| @@ -76,7 +72,11 @@ | ||
| 76 | 72 | if ( is_network_admin() ) { |
| 77 | 73 | return false; |
| 78 | 74 | } |
| 79 | 75 | |
| 80 | - return $this->parsely->api_key_is_missing(); | |
| 76 | + if ( $this->parsely->are_credentials_managed ) { | |
| 77 | + return false; | |
| 78 | + } | |
| 79 | + | |
| 80 | + return $this->parsely->site_id_is_missing(); | |
| 81 | 81 | } |
| 82 | 82 | } |