PATH:
home
/
letacommog
/
adelcya
/
wp-content
/
plugins
/
wordpress-seo-premium
/
premium
/
classes
<?php /** * WPSEO Premium plugin file. * * @package WPSEO\Premium */ /** * Handles adding site wide analysis UI to the WordPress admin. */ class WPSEO_Premium_Prominent_Words_Recalculation_Notifier implements WPSEO_WordPress_Integration { const NOTIFICATION_ID = 'wpseo-premium-prominent-words-recalculate'; const UNINDEXED_THRESHOLD = 10; /** * Registers all hooks to WordPress */ public function register_hooks() { if ( filter_input( INPUT_GET, 'page' ) === 'wpseo_dashboard' ) { add_action( 'admin_init', array( $this, 'cleanup_notification' ) ); } if ( ! wp_next_scheduled( self::NOTIFICATION_ID ) ) { wp_schedule_event( time(), 'daily', self::NOTIFICATION_ID ); } add_action( self::NOTIFICATION_ID, array( $this, 'manage_notification' ) ); add_action( 'update_option_wpseo', array( $this, 'handle_option_change' ), 10, 2 ); } /** * Removes the notification when it is set and the amount of unindexed items is lower than the threshold. */ public function cleanup_notification() { if ( ! $this->has_notification() || $this->requires_notification() ) { return; } $this->remove_notification( $this->get_notification() ); } /** * Adds the notification when it isn't set already and the amount of unindexed items is greater than the set. * threshold. */ public function manage_notification() { if ( $this->has_notification() || ! $this->requires_notification() ) { return; } $this->add_notification( $this->get_notification() ); } /** * Handles the option change to make sure the notification will be removed when link suggestions are disabled. * * @param mixed $old_value The old value. * @param mixed $new_value The new value. */ public function handle_option_change( $old_value, $new_value ) { if ( ! empty( $old_value['enable_link_suggestions'] ) && empty( $new_value['enable_link_suggestions'] ) ) { $this->remove_notification( $this->get_notification() ); } } /** * Checks if the notification has been set already. * * @return bool True when there is a notification. */ public function has_notification() { $notification = Yoast_Notification_Center::get()->get_notification_by_id( self::NOTIFICATION_ID ); return $notification instanceof Yoast_Notification; } /** * Adds a notication to the notification center. * * @param Yoast_Notification $notification The notification to add. */ protected function add_notification( Yoast_Notification $notification ) { if ( ! $this->has_enabled_link_suggestions() ) { return; } Yoast_Notification_Center::get()->add_notification( $notification ); } /** * Removes the notification from the notification center. * * @param Yoast_Notification $notification The notification to remove. */ protected function remove_notification( Yoast_Notification $notification ) { Yoast_Notification_Center::get()->remove_notification( $notification ); } /** * Returns an instance of the notification. * * @return Yoast_Notification The notification to show. */ protected function get_notification() { return new Yoast_Notification( sprintf( /* translators: 1: link to yoast.com post about internal linking suggestion. 2: is anchor closing. 3: button to the recalculation option. 4: closing button */ __( 'You need to analyze your posts and/or pages in order to receive the best %1$slink suggestions%2$s. %3$sAnalyze the content%4$s to generate the missing link suggestions.', 'wordpress-seo-premium' ), '<a href="https://yoa.st/notification-internal-link">', '</a>', sprintf( '<a href="%s" class="button">', esc_url( admin_url( 'admin.php?page=wpseo_tools#open-internal-links-calculation' ) ) ), '</a>' ), array( 'type' => Yoast_Notification::WARNING, 'id' => self::NOTIFICATION_ID, 'capabilities' => 'wpseo_manage_options', 'priority' => 0.8, ) ); } /** * Checks if the unindexed threshold is exceeded. * * @return bool True when the threshold is exceeded. */ protected function requires_notification() { $post_query = new WPSEO_Premium_Prominent_Words_Unindexed_Post_Query(); return $post_query->exceeds_limit( self::UNINDEXED_THRESHOLD ); } /** * Determines whether the user has enabled the links suggestions or not. * * @return bool True when link suggestions are enabled. */ protected function has_enabled_link_suggestions() { return WPSEO_Options::get( 'enable_link_suggestions', false ); } }
[+]
..
[-] premium-prominent-words-registration.php
[edit]
[-] upgrade-manager.php
[edit]
[-] premium-post-data-endpoint.php
[edit]
[-] premium-assets.php
[edit]
[-] premium-prominent-words-unindexed-post-query.php
[edit]
[-] premium-gsc.php
[edit]
[-] premium-import-manager.php
[edit]
[-] premium-prominent-words-recalculation-notifier.php
[edit]
[+]
export
[-] premium-post-data-service.php
[edit]
[-] premium-orphaned-post-filter.php
[edit]
[-] premium-prominent-words-link-endpoint.php
[edit]
[-] premium-prominent-words-recalculation.php
[edit]
[-] premium-orphaned-content-support.php
[edit]
[-] custom-fields-plugin.php
[edit]
[-] multi-keyword.php
[edit]
[-] premium-redirect-service.php
[edit]
[-] post-watcher.php
[edit]
[-] product-premium.php
[edit]
[-] premium-redirect-endpoint.php
[edit]
[-] validation-warning.php
[edit]
[-] premium-asset-js-l10n.php
[edit]
[-] premium-stale-cornerstone-content-filter.php
[edit]
[-] premium-prominent-words-support.php
[edit]
[-] term-watcher.php
[edit]
[-] premium-link-suggestions-endpoint.php
[edit]
[-] premium-prominent-words-versioning.php
[edit]
[-] premium-orphaned-post-notifier.php
[edit]
[+]
redirect
[-] premium-free-translations.php
[edit]
[-] premium-link-suggestions-service.php
[edit]
[-] premium-prominent-words-service.php
[edit]
[-] validation-error.php
[edit]
[-] premium-prominent-words-link-service.php
[edit]
[-] premium-prominent-words-recalculation-endpoint.php
[edit]
[-] watcher.php
[edit]
[-] premium-redirect-export-manager.php
[edit]
[-] premium-keyword-export-manager.php
[edit]
[-] premium-prominent-words-endpoint.php
[edit]
[-] premium-expose-shortlinks.php
[edit]
[+]
views
[-] premium-orphaned-content-utils.php
[edit]
[-] premium-gsc-modal.php
[edit]
[-] premium-prominent-words-language-support.php
[edit]
[-] premium-orphaned-post-query.php
[edit]
[-] premium-register-capabilities.php
[edit]
[-] facebook-profile.php
[edit]
[-] metabox-link-suggestions.php
[edit]
[-] premium-stale-cornerstone-content-notification.php
[edit]
[-] validation-result.php
[edit]
[-] premium-metabox.php
[edit]
[-] premium-javascript-strings.php
[edit]
[-] social-previews.php
[edit]
[-] premium-autoloader.php
[edit]
[-] premium-beacon-setting.php
[edit]
[-] premium-prominent-words-recalculation-service.php
[edit]