Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
actions
/
indexing
/
File Content:
indexable-post-indexation-action.php
<?php namespace Yoast\WP\SEO\Actions\Indexing; use wpdb; use Yoast\WP\Lib\Model; use Yoast\WP\SEO\Helpers\Post_Type_Helper; use Yoast\WP\SEO\Models\Indexable; use Yoast\WP\SEO\Repositories\Indexable_Repository; /** * Reindexing action for post indexables. */ class Indexable_Post_Indexation_Action implements Indexation_Action_Interface { /** * The transient cache key. */ const TRANSIENT_CACHE_KEY = 'wpseo_total_unindexed_posts'; /** * The post type helper. * * @var Post_Type_Helper */ protected $post_type_helper; /** * The indexable repository. * * @var Indexable_Repository */ protected $repository; /** * The WordPress database instance. * * @var wpdb */ private $wpdb; /** * Indexable_Post_Indexing_Action constructor * * @param Post_Type_Helper $post_type_helper The post type helper. * @param Indexable_Repository $repository The indexable repository. * @param wpdb $wpdb The WordPress database instance. */ public function __construct( Post_Type_Helper $post_type_helper, Indexable_Repository $repository, wpdb $wpdb ) { $this->post_type_helper = $post_type_helper; $this->repository = $repository; $this->wpdb = $wpdb; } /** * Returns the total number of unindexed posts. * * @return int|false The total number of unindexed posts. False if the query fails. */ public function get_total_unindexed() { $transient = \get_transient( static::TRANSIENT_CACHE_KEY ); if ( $transient !== false ) { return (int) $transient; } $query = $this->get_query( true ); $result = $this->wpdb->get_var( $query ); if ( \is_null( $result ) ) { return false; } \set_transient( static::TRANSIENT_CACHE_KEY, $result, \DAY_IN_SECONDS ); return (int) $result; } /** * Creates indexables for unindexed posts. * * @return Indexable[] The created indexables. */ public function index() { $query = $this->get_query( false, $this->get_limit() ); $post_ids = $this->wpdb->get_col( $query ); $indexables = []; foreach ( $post_ids as $post_id ) { $indexables[] = $this->repository->find_by_id_and_type( (int) $post_id, 'post' ); } \delete_transient( static::TRANSIENT_CACHE_KEY ); return $indexables; } /** * Returns the number of posts that will be indexed in a single indexing pass. * * @return int The limit. */ public function get_limit() { /** * Filter 'wpseo_post_indexation_limit' - Allow filtering the amount of posts indexed during each indexing pass. * * @api int The maximum number of posts indexed. */ $limit = \apply_filters( 'wpseo_post_indexation_limit', 25 ); if ( ! \is_int( $limit ) || $limit < 1 ) { $limit = 25; } return $limit; } /** * Queries the database for unindexed post IDs. * * @param bool $count Whether or not it should be a count query. * @param int $limit The maximum number of post IDs to return. * * @return string The query. */ protected function get_query( $count, $limit = 1 ) { $indexable_table = Model::get_table_name( 'Indexable' ); $post_types = $this->get_post_types(); $replacements = $post_types; $select = 'P.ID'; if ( $count ) { $select = 'COUNT(P.ID)'; } $limit_query = ''; if ( ! $count ) { $limit_query = 'LIMIT %d'; $replacements[] = $limit; } return $this->wpdb->prepare( " SELECT $select FROM {$this->wpdb->posts} AS P LEFT JOIN $indexable_table AS I ON P.ID = I.object_id AND I.object_type = 'post' AND I.permalink_hash IS NOT NULL WHERE I.object_id IS NULL AND P.post_type IN (" . \implode( ', ', \array_fill( 0, \count( $post_types ), '%s' ) ) . ") $limit_query", $replacements ); } /** * Returns the post types that should be indexed. * * @return array The post types that should be indexed. */ protected function get_post_types() { $public_post_types = $this->post_type_helper->get_public_post_types(); $excluded_post_types = $this->post_type_helper->get_excluded_post_types_for_indexables(); // `array_values`, to make sure that the keys are reset. return \array_values( \array_diff( $public_post_types, $excluded_post_types ) ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
.DS_Store
10234 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController.php
945 bytes
0644
LimitStream.php
4209 bytes
0644
abstract-link-indexing-action.php
3298 bytes
0644
article-modified-time-presenter.php
609 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260705194237.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260624075319.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
exceptions.php
708 bytes
0644
image-helper.php
10231 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
indexable-general-indexation-action.php
2901 bytes
0644
indexable-indexing-complete-action.php
718 bytes
0644
indexable-post-indexation-action.php
4231 bytes
0644
indexable-post-type-archive-indexation-action.php
4782 bytes
0644
indexable-term-indexation-action.php
3741 bytes
0644
indexation-action-interface.php
794 bytes
0644
indexing-complete-action.php
661 bytes
0644
indexing-prepare-action.php
1220 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
post-link-indexing-action.php
2567 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
term-link-indexing-action.php
2265 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
N4ST4R_ID | Naxtarrr