Show the admin notice regarding the license status.

@return bool Should we show the notice ?
331700
function show_notice() {
		if ( ! is_admin() ) {
			return false;
		}
		$status                = $this->get_license_status();
		$no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to upgrade your plan in order to use %s on more websites. Please ask the %s Staff for more details.' );
		$no_valid_string       = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your  <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
		$expiration_string     = apply_filters( $this->product->get_key() . '_lc_expiration_string', 'Your license is about to expire for %s. You can go to %s and renew it   ' );

		// No activations left for this license.
		if ( 'valid' != $status && $this->check_activation() ) {
			?>
			<div class="error">
				<p><strong>
						<?php
						echo sprintf(
							$no_activations_string,
							$this->product->get_name(),
							$this->product->get_name(),
							'<a href="' . $this->get_api_url() . '" target="_blank">' . $this->get_distributor_name() . '</a>'
						);
						?>
					</strong>
				</p>
			</div>
			<?php
			return false;
		}
		// Invalid license key.
		if ( 'valid' != $status ) {
			?>
			<div class="error">
				<p>
					<strong><?php echo sprintf( $no_valid_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->get_api_url(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() ); ?> </strong>
				</p>
			</div>
			<?php

			return false;
		}

		// Expired and soon to expire license.
		if ( 'valid' == $status && $this->check_expiration() ) {
			?>
			<div class="update-nag">
				<p>
					<strong>
						<?php
						echo sprintf(
							$expiration_string,
							$this->product->get_name() . ' ' . $this->product->get_type(),
							'<a href="' . $this->renew_url() . '" target="_blank">' . $this->get_distributor_name() . '</a>'
						);
						?>
					</strong>
				</p>
			</div>
			<?php
			return false;
		}

		return true;
	}
362083
private function should_add_sticky_optin_notice() {
            if ( fs_is_network_admin() ) {
                if ( ! $this->_is_network_active ) {
                    return false;
                }

                if ( ! $this->is_network_activation_mode() ) {
                    return false;
                }

                return ! isset( $this->_storage->sticky_optin_added_ms );
            }

            if ( ! $this->is_activation_mode() ) {
                return false;
            }

            // If running from a blog admin and delegated the connection.
            return ! isset( $this->_storage->sticky_optin_added );
        }
855221
private static function is_active_valid_license( $license ) {
            return (
                is_object( $license ) &&
                FS_Plugin_License::is_valid_id( $license->id ) &&
                $license->is_active() &&
                $license->is_valid()
            );
        }
124147
def is_admin(self):
        """"""
        return self.role == self.roles.administrator.value and self.state == State.approved
1034458
function _add_license_action_link() {
            $this->_logger->entrance();

            if ( ! self::is_ajax() ) {
                // Inject license activation dialog UI and client side code.
                add_action( 'admin_footer', array( &$this, '_add_license_activation_dialog_box' ) );
            }

            $link_text = $this->is_free_plan() ?
                $this->get_text_inline( 'Activate License', 'activate-license' ) :
                $this->get_text_inline( 'Change License', 'change-license' );

            $this->add_plugin_action_link(
                $link_text,
                '#',
                false,
                11,
                ( 'activate-license ' . $this->get_unique_affix() )
            );
        }
479744
public function register_settings() {
		if ( ! is_admin() ) {
			return false;
		}
		add_settings_field(
			$this->product->get_key() . '_license',
			$this->product->get_name() . ' license',
			array( $this, 'license_view' ),
			'general'
		);
	}
349141
public function admin_notices() {
		$afterKeyAdded = get_option( $this->option );

		if ( empty( $afterKeyAdded ) ) {
			return;
		}

		switch( $afterKeyAdded ) {
			case 'success':
				echo '<div class="notice notice-success is-dismissible bglib-key-added"><p>' .
					esc_html( 'Your new BoldGrid Connect Key has been successfully added!', 'boldgrid-library' ) .
					'</p></div>';
				break;
			case 'fail':
				echo '<div class="notice notice-error is-dismissible bglib-key-added"><p>' .
					esc_html( 'An unknown error occurred adding your new BoldGrid Connect Key.', 'boldgrid-library' ) .
					'</p></div>';
				break;
		}

		delete_option( $this->option );
	}
505890
function has_active_license() {
            return (
                is_object( $this->_license ) &&
                is_numeric( $this->_license->id ) &&
                ! $this->_license->is_expired()
            );
        }
408171
public function product_valid() {
		if ( false !== ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) {
			return;
		}
		$license = $this->check_license();
		set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
		update_option( $this->product->get_key() . '_license_data', $license );
	}
46253
public function isAllowedToNotify()
    {
        if (!$this->node->isPublished()) {
            return false;
        }

        return $this->showNotification($this->node, $this->node->isPublished());
    }
1116395
public function emailVerification()
    {
        $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
        $this->get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
        $this->get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
    }
1065641
public function canAdministrate()
    {
        $user = $this->getUser();
        if ($user->name == 'Guest' && $user->email == 'guest@example.com') {
            return false;
        }
        if (method_exists($user, 'isAdmin')) {
            return $user->isAdmin();
        }
        if (method_exists($user, 'can')) {
            return $user->can('administrate') || $user->can('admin');
        }
        // If no method of authorizing return false;
        return false;
    }
1234366
public function isUserAdmin()
	{
		$user = $this->getUsersDatabase();
		$sr = $user->getById($this->_context->authenticatedUserId());
		return ($sr->getField($user->getUserTable()->admin) == "yes");
	}
431948
private function handle_license_deactivation_result( $license, $hmm_text = false, $show_notice = true ) {
            if ( isset( $license->error ) ) {
                $this->_admin_notices->add(
                    $this->get_text_inline( 'It looks like the license deactivation failed.', 'license-deactivation-failed-message' ) . '<br> ' .
                    $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . ' ' . var_export( $license->error, true ),
                    $hmm_text,
                    'error'
                );

                return;
            }

            // Update license cache.
            if ( is_array( $this->_licenses ) ) {
                for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
                    if ( $license->id == $this->_licenses[ $i ]->id ) {
                        $this->_licenses[ $i ] = new FS_Plugin_License( $license );
                    }
                }
            }

            // Update site plan to default.
            $this->_sync_plans();
            $this->_site->plan_id = $this->_plans[0]->id;
            // Unlink license from site.
            $this->_update_site_license( null );

            $this->_store_account();

            if ( $show_notice ) {
                $this->_admin_notices->add(
                    sprintf( $this->get_text_inline( 'Your license was successfully deactivated, you are back to the %s plan.', 'license-deactivation-message' ), $this->get_plan_title() ),
                    $this->get_text_inline( 'O.K', 'ok' )
                );
            }

            $this->_admin_notices->remove_sticky( array(
                'plan_upgraded',
                'license_activated',
            ) );
        }
186509
public function onAllAdminNotices()
    {
        if (!($notices = $this->get())) {
            return; // Nothing to do.
        }
        $time = time(); // The current time.

        foreach ($notices as $_key => &$_notice) {
            # Catch invalid/corrupted notices.

            if (!is_string($_key) || !is_array($_notice)) {
                unset($notices[$_key]);
                continue; // Ignore.
            }
            # Normalize the notice.

            $_notice = $this->normalize($_notice);

            # Initialize a few variables.

            $_markup           = '';
            $_current_user_can = false;
            $_is_applicable    = false;

            $_class = $this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
            $_class .= ' -notice';
            $_class .= ' notice';

            $_style   = $_notice['style'];
            $_dismiss = ''; // Default; n/a.

            # Check for empty markup.

            if (!($_markup = $_notice['markup'])) {
                unset($notices[$_key]);
                continue; // Ignore.
            }
            # If transient, wipe after a single pass.

            if ($_notice['is_transient']) {
                unset($notices[$_key]);
            }
            # Has notice become too old; i.e., lingering?

            if ($_notice['_insertion_time'] < $this->outdated_notice_time
                && /* Not intentially delayed. */ $_notice['delay_until_time'] < $time) {
                unset($notices[$_key]); // Ancient history after this pass.
            }
            # Check conditions; i.e., is notice applicable?

            if (!$this->currentUserCan($_notice)) {
                continue; // Do not display.
            } elseif (!$this->isApplicableContext($_notice)) {
                continue; // Do not display.
            } elseif (!$this->isApplicablePage($_notice)) {
                continue; // Do not display.
            } elseif ($_notice['delay_until_time'] > $time) {
                continue; // Do not display.
            } elseif ($_notice['recurs_every'] && $_notice['_last_recur_dismiss_time']
                && $_notice['_last_recur_dismiss_time'] + $_notice['recurs_every'] > $time) {
                continue; // Do not display; not time to recur yet, based on last time.
            }
            # If `is_applicable` is a closure, check it's return value also.

            if ($this->c::isSerialized($_notice['is_applicable'])) {
                try { // Maybe catch exceptions here.
                    $_is_applicable = $this->c::unserializeClosure($_notice['is_applicable']);
                    $_is_applicable = $_is_applicable($this->App); // Should return (bool) or `null`.
                    $_is_applicable = $_is_applicable === null ? $_is_applicable : (bool) $_is_applicable;

                    // NOTE: A special return value of `null` indicates the notice
                    // is no longer applicable (at all) and should be dequeued entirely.

                    if ($_is_applicable === null) {
                        unset($notices[$_key]);
                        continue; // Ignore.
                    } elseif (!$_is_applicable) {
                        continue; // Do not display.
                    }
                } catch (\Throwable $Throwable) {
                    unset($notices[$_key]); // Avoid repeats.

                    if ($this->App->Config->©debug['©enable']) {
                        throw $Throwable;
                    }
                    continue; // Ignore.
                }
            }
            # If `markup` is a closure, call upon the closure now.

            if ($this->c::isSerialized($_notice['markup'])) {
                try { // Maybe catch exceptions here.
                    $_markup = $this->c::unserializeClosure($_notice['markup']);
                    $_markup = (string) $_markup($this->App); // Should return a string.

                    // NOTE: A special return value (empty) indicates the notice
                    // is no longer applicable (at all) and should be dequeued entirely.

                    if (!$_markup) {
                        unset($notices[$_key]);
                        continue; // Ignore.
                    }
                } catch (\Throwable $Throwable) {
                    unset($notices[$_key]); // Avoid repeats.

                    if ($this->App->Config->©debug['©enable']) {
                        throw $Throwable;
                    }
                    continue; // Ignore.
                }
            }
            # Setup notice classes for CSS in WP core.

            switch ($_notice['type']) {
                case 'info':
                    $_class .= ' notice-info';
                    break; // Blue coloration.

                case 'success':
                    $_class .= ' notice-success';
                    break; // Green coloration.

                case 'warning':
                    $_class .= ' notice-warning';
                    break; // Orange/yellow coloration.

                case 'error':
                    $_class .= ' notice-error';
                    break; // Red coloration.

                default: // Default (info).
                    $_class .= ' notice-info';
            }
            // Create dismiss icon if applicable.

            if ($_notice['is_persistent'] && $_notice['is_dismissable']) {
                // $_class .= ' is-dismissible';
                // We use a different approach for dismissals.

                $_style .= ' padding-right:38px; position:relative;';
                $_dismiss = '<a class="notice-dismiss" style="text-decoration:none;" href="'.esc_attr($this->dismissUrl($_key)).'">'.
                                '<span class="screen-reader-text">'.__('Dismiss this notice.', 'wp-sharks-core').'</span>'.
                            '</a>';
            }
            # Make sure markup is wrapped in a block-level tag so margins will exist.

            $_markup = $this->c::mbTrim($_markup); // Before checking.
            if (!preg_match('/^\<(?:p|div|form|h[1-6]|ul|ol)[\s>]/ui', $_markup)) {
                $_markup = '<p>'.$_markup.'</p>'; // Add `<p>` tag.
            }
            # Display notice `<div>` with the markup and a possible dismiss icon.

            echo '<div class="'.esc_attr($_class).'" style="'.esc_attr($_style).'">'.
                    $_markup.$_dismiss.// Possible dismiss icon.
                 '</div>';

            # Notice seen. Handle queue state logic now.

            if ($_notice['is_persistent']) {
                continue; // Persistent; do nothing.
                // See {@link dismiss()} for recurring + persistent notice handling.
                // A recurring + persistent notice is counted/updated when it's dismissed.
                // If it's not dismissable, then it simply remains until dequeued manually.
            } elseif ($_notice['recurs_every']) {
                ++$_notice['_recurrences']; // Update counter.

                if ($_notice['_recurrences'] < $_notice['recurs_times']) {
                    $_notice['_last_recur_dismiss_time'] = $time;
                } else {
                    unset($notices[$_key]); // Dequeue.
                }
            } else {
                unset($notices[$_key]); // Dequeue.
            }
        } // unset($_key, $_notice, $_markup, $_current_user_can, $_is_applicable, $_class, $_style, $_dismiss);

        $this->update($notices);
    }
510234
public static function displayNotices()
    {
        if ($notices = get_option('staticwp_deferred_admin_notices')) {
            foreach ($notices as $notice) {
                $message = $notice;
                $type = 'updated';

                if (is_array($notice)) {
                    $message = isset($notice['message']) ? $notice['message'] : '';
                    $type = isset($notice['type']) ? $notice['type'] : $type;
                }

                echo '<div class="' . $type . '"><p>' . $message . '</p></div>';
            }
            delete_option('staticwp_deferred_admin_notices');
        }
    }
5284
public function isAPINotification()
    {
        return (bool)(isset($this->notificationObj->unique_id) && !empty($this->notificationObj->unique_id));
    }