8 惎u书 ( 隘u书 鄌u书 皉u书 雞书 H pu书 H pu书 H pu书 H 0pu书 H @pu书 ` Ppu书 ` ppu书 ` 恜u书 ` 皃u书 ` 衟u书 H 餻u书 H qu书 H qu书 H qu书 H 0qu书 *v书 嘀k书 雷k书 餼u书 ru书 ru书 P莐书 `莐书 硄书 犌k书 0ru书 Pru书 pru书 X 恟u书 P ~u书 @ 皉u书 0 惎u书 , 恟u书 ( 恟u书 惎u书 皉u书 瘃u书 ` 衦u书 ` 鄏u书 ` 餽u书 ` su书 ` su书 ` su书 ` 0su书 ` @su书 ` Psu书 ` `su书 ` su书 ` 爏u书 ` 纒u书 ` 鄐u书 ` tu书 ` tu书 ` @tu书 ` `tu书 ` tu书 ` 恡u书 ` 爐u书 ` 皌u书 ` 纓u书 ` 衪u书 ` 鄑u书 ` 餿u书 ` uu书 `*v书 痂u书 硄书 @vu书 Pvu书 `vu书 vu书 爒u书 皏u书 *v书 wu书 鹦k书 裬书 wu书 0wu书 剥u书 v书 0 pwu书 0 wu书 恮u书 皐u书 0 衱u书 0 鄔u书 *v书 愸u书 硄书 皔u书 @xu书 Pxu书 `xu书 pxu书 恱u书 皒u书 衳u书 鄕u书 饃u书 *v书 @譳书 @豮书 pyu书 恲u书 爕u书 皔u书 饒u书 痂u书 0 衴u书 0 鄖u书 饄u书 蟢书 愊k书 饒u书 ( 爩u书 @zu书 硄书 p駏书 硄书 `zu书 *v书 0 zu书 0 恴u书 0 爖u书 0 皕u书 0 纙u书 饊u书 0 饅u书 {u书 {u书 @{u书 `{u书 {u书 衚书 衚书 爗u书 跋k书 老k书 鷘书 p衚书 衚书 纚u书 0 鄘u书 0 饆u书 0 |u书 0 |u书 0 |u书 0|u书 P|u书 p|u书 @衚书 0}u书 邢k书 P}u书 愋k书 p}u书 +v书 恾u书 皚u书 衹u书 0 饈u书 P ~u书 @ 惎u书 8 ~u书 0 @~u书 `~u书 X ~u书 X 悀u书 X 爚u书 X 皛u书 X 纞u书 衺u书 饉u书 u书 0u书 Pu书 X pu书 X u书 everal database options when the indexing process is finished. * * @return void */ public function complete() { $this->set_reason( '' ); $this->set_started( null ); } /** * Sets appropriate flags when the indexing process fails. * * @return void */ public function indexing_failed() { $this->set_reason( Indexing_Reasons::REASON_INDEXING_FAILED ); $this->set_started( null ); } /** * Sets the indexing reason. * * @param string $reason The indexing reason. * * @return void */ public function set_reason( $reason ) { $this->options_helper->set( 'indexing_reason', $reason ); $this->remove_indexing_notification(); } /** * Removes any pre-existing notification, so that a new notification (with a possible new reason) can be added. */ protected function remove_indexing_notification() { $this->notification_center->remove_notification_by_id( Indexing_Notification_Integration::NOTIFICATION_ID ); } /** * Determines whether an indexing reason has been set in the options. * * @return bool Whether an indexing reason has been set in the options. */ public function has_reason() { $reason = $this->get_reason(); return ! empty( $reason ); } /** * Returns the indexing reason. The reason why the site-wide indexing process should be run. * * @return string The indexing reason, defaults to the empty string if no reason has been set. */ public function get_reason() { return $this->options_helper->get( 'indexing_reason', '' ); } /** * Sets the start time when the indexing process has started but not completed. * * @param int|bool $timestamp The start time when the indexing process has started but not completed, false otherwise. * * @return void */ public function set_started( $timestamp ) { $this->options_helper->set( 'indexing_started', $timestamp ); } /** * Gets the start time when the indexing process has started but not completed. * * @return int|bool The start time when the indexing process has started but not completed, false otherwise. */ public function get_started() { return $this->options_helper->get( 'indexing_started' ); } /** * Sets a boolean that indicates whether or not a site still has to be indexed for the first time. * * @param bool $is_first_time_indexing Whether or not a site still has to be indexed for the first time. * * @return void */ public function set_first_time( $is_first_time_indexing ) { $this->options_helper->set( 'indexing_first_time', $is_first_time_indexing ); } /** * Gets a boolean that indicates whether or not the site still has to be indexed for the first time. * * @return bool Whether the site still has to be indexed for the first time. */ public function is_initial_indexing() { return $this->options_helper->get( 'indexing_first_time', true ); } /** * Gets a boolean that indicates whether or not the indexing of the indexables has completed. * * @return bool Whether the indexing of the indexables has completed. */ public function is_finished_indexables_indexing() { return $this->options_helper->get( 'indexables_indexing_completed', false ); } /** * Returns the total number of unindexed objects. * * @return int The total number of unindexed objects. */ public function get_unindexed_count() { $unindexed_count = 0; foreach ( $this->indexing_actions as $indexing_action ) { $unindexed_count += $indexing_action->get_total_unindexed(); } return $unindexed_count; } /** * Returns the amount of un-indexed posts expressed in percentage, which will be needed to set a threshold. * * @param int $unindexed_count The number of unindexed objects. * * @return int The amount of unindexed posts expressed in percentage. */ public function get_unindexed_percentage( $unindexed_count ) { // Gets the amount of indexed objects in the site. $indexed_count = $this->indexable_repository->get_total_number_of_indexables(); // The total amount of objects in the site. $total_objects_count = ( $indexed_count + $unindexed_count ); return ( ( $unindexed_count / $total_objects_count ) * 100 ); } /** * Returns whether the SEO optimization button should show. * * @return bool Whether the SEO optimization button should show. */ public function should_show_optimization_button() { // Gets the amount of unindexed objects in the site. $unindexed_count = $this->get_filtered_unindexed_count(); // If the amount of unidexed posts is <10 don't show configuration button. if ( $unindexed_count <= 10 ) { return false; } // If the amount of unidexed posts is >10, but the total amount of unidexed posts is 鈮4% of the total amount of objects in the site, don't show configuration button. if ( $this->get_unindexed_percentage( $unindexed_count ) <= 4 ) { return false; } return true; } /** * Returns the total number of unindexed objects and applies a filter for third party integrations. * * @return int The total number of unindexed objects. */ public function get_filtered_unindexed_count() { $unindexed_count = $this->get_unindexed_count(); /** * Filter: 'wpseo_indexing_get_unindexed_count' - Allow changing the amount of unindexed objects. * * @param int $unindexed_count The amount of unindexed objects. */ return \apply_filters( 'wpseo_indexing_get_unindexed_count', $unindexed_count ); } /** * Returns a limited number of unindexed objects. * * @param int $limit Limit the number of unindexed objects that are counted. * * @return int The total number of unindexed objects. */ public function get_limited_unindexed_count( $limit ) { $unindexed_count = 0; foreach ( $this->indexing_actions as $indexing_action ) { $unindexed_count += $indexing_action->get_limited_unindexed_count( $limit - $unindexed_count + 1 ); if ( $unindexed_count > $limit ) { return $unindexed_count; } } return $unindexed_count; } /** * Returns the total number of unindexed objects and applies a filter for third party integrations. * * @param int $limit Limit the number of unindexed objects that are counted. * * @return int The total number of unindexed objects. */ public function get_limited_filtered_unindexed_count( $limit ) { $unindexed_count = $this->get_limited_unindexed_count( $limit ); if ( $unindexed_count > $limit ) { return $unindexed_count; } /** * Filter: 'wpseo_indexing_get_limited_unindexed_count' - Allow changing the amount of unindexed objects, * and allow for a maximum number of items counted to improve performance. * * @param int $unindexed_count The amount of unindexed objects. * @param int|false $limit Limit the number of unindexed objects that need to be counted. * False if it doesn't need to be limited. */ return \apply_filters( 'wpseo_indexing_get_limited_unindexed_count', $unindexed_count, $limit ); } }