@return int|false The total number of indexables without prominent words. False if the query fails. */ public function get_limited_unindexed_count( $limit ) { return $this->get_total_unindexed(); } /** * Retrieves a batch of indexables, to be indexed for internal linking suggestions. * * @deprecated 15.1 * @codeCoverageIgnore * * @return array The indexables data to use for generating prominent words. */ public function get() { \_deprecated_function( __METHOD__, '15.1', 'Content_Action::index' ); return $this->index(); } /** * Retrieves a batch of indexables, to be indexed for internal linking suggestions. * * @return array The indexables data to use for generating prominent words. */ public function index() { $object_sub_types = $this->get_object_sub_types(); if ( empty( $object_sub_types ) ) { return []; } $indexables = $this ->query() ->limit( $this->get_limit() ) ->find_many(); if ( \count( $indexables ) > 0 ) { \delete_transient( static::TRANSIENT_CACHE_KEY ); } // If no indexables have been left unindexed, return the empty array. if ( ! $indexables ) { return []; } return $this->format_data( $indexables ); } /** * Creates a query that can find indexables with outdated prominent words. * * @return ORM Returns an ORM instance that can be used to execute the query. */ protected function query() { $updated_version = WPSEO_Premium_Prominent_Words_Versioning::get_version_number(); return $this->indexable_repository ->query() ->where_in( 'object_type', [ 'post', 'term' ] ) ->where_in( 'object_sub_type', $this->get_object_sub_types() ) ->where_raw( '(`prominent_words_version` IS NULL OR `prominent_words_version` != ' . $updated_version . ')' ) ->where_raw( '((`post_status` IS NULL AND `object_type` = \'term\') OR (`post_status` = \'publish\' AND `object_type` = \'post\'))' ); } /** * Creates a query that checks whether the indexable table holds at least one record. * * @return bool true if at the database contains at least one indexable. */ protected function at_least_one_indexable() { return $this->indexable_repository ->query() ->select( 'id' ) ->find_one() !== false; } /** * Retrieves a list of subtypes to get indexables for. * * @return array The array with object subtypes. */ protected function get_object_sub_types() { if ( $this->object_sub_types === null ) { $this->object_sub_types = \array_merge( $this->prominent_words_support->get_supported_post_types(), $this->prominent_words_support->get_supported_taxonomies() ); } return $this->object_sub_types; } /** * Formats the data of the given array of indexables, so it can be used to generate prominent words. * * @param Indexable[] $indexables The indexables to gather data for. * * @return array The data. */ protected function format_data( $indexables ) { $data = []; foreach ( $indexables as $indexable ) { // Use the meta context, so we are sure that the data is the same as is output on the frontend. $context = $this->get_context( $indexable ); if ( ! $context ) { continue; } $data[] = [ 'object_id' => $indexable->object_id, 'object_type' => $indexable->object_type, 'content' => $this->get_content( $context ), 'meta' => [ 'primary_focus_keyword' => $context->indexable->primary_focus_keyword, 'title' => $context->title, 'description' => $context->description, 'keyphrase_synonyms' => $this->retrieve_keyphrase_synonyms( $context->indexable ), ], ]; } return $data; } /** * Gets the context for the current indexable. * * @param Indexable $indexable The indexable to get context for. * * @return Meta_Tags_Context|null The context object. */ protected function get_context( $indexable ) { if ( $indexable->object_type === 'post' ) { return $this->memoizer->get( $indexable, 'Post_Type' ); } if ( $indexable->object_type === 'term' ) { return $this->memoizer->get( $indexable, 'Term_Archive' ); } return null; } /** * Retrieves the keyphrase synonyms for the indexable. * * @param Indexable $indexable The indexable to retrieve synonyms for. * * @return string[] The keyphrase synonyms. */ protected function retrieve_keyphrase_synonyms( $indexable ) { if ( $indexable->object_type === 'post' ) { return \json_decode( $this->meta->get_value( 'keywordsynonyms', $indexable->object_id ) ); } if ( $indexable->object_type === 'term' ) { return \json_decode( $this->meta->get_term_value( $indexable->object_id, $indexable->object_sub_type, 'wpseo_keywordsynonyms' ) ); } return []; } /** * Determines the content to use. * * @param Meta_Tags_Context $context The meta tags context object. * * @return string The content associated with the given context. */ protected function get_content( Meta_Tags_Context $context ) { if ( $context->indexable->object_type === 'post' ) { global $post; /* * Set the global $post to be the post in this iteration. * This is required for post-specific shortcodes that reference the global post. */ // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- To setup the post we need to do this explicitly. $post = $context->post; // Set up WordPress data for this post, outside of "the_loop". \setup_postdata( $post ); // Wraps in output buffering to prevent shortcodes that echo stuff instead of return from breaking things. \ob_start(); $content = \do_shortcode( $post->post_content ); \ob_end_clean(); \wp_reset_postdata(); return $content; } if ( $context->indexable->object_type === 'term' ) { $term = \get_term( $context->indexable->object_id, $context->indexable->object_sub_type ); if ( $term === null || \is_wp_error( $term ) ) { return ''; } // Wraps in output buffering to prevent shortcodes that echo stuff instead of return from breaking things. \ob_start(); $description = \do_shortcode( $term->description ); \ob_end_clean(); return $description; } return ''; } } {"id":69592,"date":"2024-03-15T04:01:48","date_gmt":"2024-03-15T00:31:48","guid":{"rendered":"https:\/\/doctore-khoob.ir\/?p=69499"},"modified":"2024-04-07T09:08:59","modified_gmt":"2024-04-07T05:38:59","slug":"%d8%af%da%a9%d8%aa%d8%b1-%d8%ba%d8%b2%d8%a7%d9%84%d9%87-%d8%ad%d8%b3%d9%86%db%8c-%d8%aa%d8%b1%da%a9%db%8c","status":"publish","type":"post","link":"https:\/\/doctore-khoob.ir\/%D8%AF%DA%A9%D8%AA%D8%B1-%D8%BA%D8%B2%D8%A7%D9%84%D9%87-%D8%AD%D8%B3%D9%86%DB%8C-%D8%AA%D8%B1%DA%A9%DB%8C\/","title":{"rendered":"\u062f\u06a9\u062a\u0631 \u063a\u0632\u0627\u0644\u0647 \u062d\u0633\u0646\u06cc \u062a\u0631\u06a9\u06cc"},"content":{"rendered":"

[vc_row gap=”10″ rtl_reverse=”yes” css=”.vc_custom_1702481771449{border-radius: 35px !important;}”][vc_column width=”1\/2″ css=”.vc_custom_1701682411015{background-color: #ffffff !important;border-radius: 25px !important;}”][vc_single_image image=”10585″ alignment=”center” style=”vc_box_circle” css=”.vc_custom_1702800508768{background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}”][vc_column_text]<\/p>\n

\"\"\u062f\u06a9\u062a\u0631 \u063a\u0632\u0627\u0644\u0647 \u062d\u0633\u0646\u06cc \u062a\u0631\u06a9\u06cc
\n<\/strong><\/h1>\n

\u06a9\u062f \u0646\u0638\u0627\u0645 \u067e\u0632\u0634\u06a9\u06cc : 63734<\/h2>\n

\u062f\u06a9\u062a\u0631 \u062f\u0646\u062f\u0627\u0646\u067e\u0632\u0634\u06a9\u06cc<\/h3>\n

\"\" \u0645\u0634\u0647\u062f<\/h4>\n

[\/vc_column_text][vc_column_text]<\/p>\n

\u062a\u0639\u062f\u0627\u062f 0 \u0646\u0638\u0631 \u062f\u0631\u0628\u0627\u0631\u0647 \u062f\u06a9\u062a\u0631 \u063a\u0632\u0627\u0644\u0647 \u062d\u0633\u0646\u06cc \u062a\u0631\u06a9\u06cc \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f \u0648 \u062f\u0631 \u06a9\u0644 \u0648\u0628 \u0633\u0627\u06cc\u062a \u062a\u0639\u062f\u0627\u062f 2300<\/strong> \u0646\u0638\u0631 \u062b\u0628\u062a \u0634\u062f\u0647 \u0627\u0633\u062a.<\/strong><\/code><\/code><\/h4>\n

\u0634\u0645\u0627 \u0647\u0645 \u0645\u06cc\u062a\u0648\u0627\u0646\u06cc\u062f \u0646\u0638\u0631\u0627\u062a \u0631\u0627 \u0645\u0637\u0627\u0644\u0639\u0647 \u0648 \u062f\u0631 \u0635\u0648\u0631\u062a \u062a\u0645\u0627\u06cc\u0644 \u0646\u0638\u0631 \u062e\u0648\u062f \u0631\u0627 \u0628\u06cc\u0627\u0646 \u06a9\u0646\u06cc\u062f.<\/h4>\n

[\/vc_column_text][\/vc_column][vc_column width=”1\/2″ css=”.vc_custom_1701681457454{background-color: #ffffff !important;border-radius: 25px !important;}”][vc_column_text]<\/p>\n

\u062f\u0631\u06cc\u0627\u0641\u062a \u0646\u0648\u0628\u062a \u062f\u06a9\u062a\u0631 \u063a\u0632\u0627\u0644\u0647 \u062d\u0633\u0646\u06cc \u062a\u0631\u06a9\u06cc<\/h2>\n

[\/vc_column_text][vc_column_text]<\/p>\n