✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.223
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/modules-packed/infrastructure/content//manual-post-collection.php
<?php

// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Llms_Txt\Infrastructure\Content;

use WP_Post;
use Yoast\WP\SEO\Helpers\Indexable_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Llms_Txt\Domain\Content\Post_Collection_Interface;
use Yoast\WP\SEO\Llms_Txt\Domain\Content_Types\Content_Type_Entry;
use Yoast\WP\SEO\Repositories\Indexable_Repository;
use Yoast\WP\SEO\Surfaces\Meta_Surface;

/**
 * The class that handles the manual post collection. Based on either indexables or WP_Query.
 */
class Manual_Post_Collection implements Post_Collection_Interface {

	/**
	 * The options helper.
	 *
	 * @var Options_Helper
	 */
	private $options_helper;

	/**
	 * The indexable helper.
	 *
	 * @var Indexable_Helper
	 */
	private $indexable_helper;

	/**
	 * The indexable repository.
	 *
	 * @var Indexable_Repository
	 */
	private $indexable_repository;

	/**
	 * The meta surface.
	 *
	 * @var Meta_Surface
	 */
	private $meta;

	/**
	 * Constructor.
	 *
	 * @param Options_Helper       $options_helper       The options helper.
	 * @param Indexable_Helper     $indexable_helper     The indexable helper.
	 * @param Indexable_Repository $indexable_repository The indexable repository.
	 * @param Meta_Surface         $meta                 The meta surface.
	 */
	public function __construct(
		Options_Helper $options_helper,
		Indexable_Helper $indexable_helper,
		Indexable_Repository $indexable_repository,
		Meta_Surface $meta
	) {
		$this->options_helper       = $options_helper;
		$this->indexable_helper     = $indexable_helper;
		$this->indexable_repository = $indexable_repository;
		$this->meta                 = $meta;
	}

	/**
	 * The post method to get all relevant content type entries
	 *
	 * @return array<int, array<Content_Type_Entry>> The posts that are relevant for the LLMs.txt.
	 */
	public function get_posts(): array {
		$posts = [];
		$pages = [
			'about_us_page',
			'contact_page',
			'terms_page',
			'privacy_policy_page',
			'shop_page',
		];

		foreach ( $pages as $page ) {
			$page_id = $this->options_helper->get( $page );
			if ( ! empty( $page_id ) ) {
				$post = $this->get_content_type_entry( $page_id );

				if ( $post !== null ) {
					$posts[] = $post;
				}
				else {
					$this->options_helper->set( $page, 0 );
				}
			}
		}
		$other_pages    = $this->options_helper->get( 'other_included_pages' );
		$filtered_pages = [];
		if ( ! empty( $other_pages ) ) {
			foreach ( $other_pages as $page_id ) {
				$post = $this->get_content_type_entry( $page_id );

				if ( $post !== null ) {
					$posts[]          = $post;
					$filtered_pages[] = $page_id;
				}
			}

			if ( \count( $filtered_pages ) !== \count( $other_pages ) ) {
				$this->options_helper->set( 'other_included_pages', $filtered_pages );
			}
		}

		return $posts;
	}

	/**
	 * Gets the content entries.
	 *
	 * @param int $page_id The id of the page.
	 *
	 * @return Content_Type_Entry The content type entry.
	 */
	public function get_content_type_entry( int $page_id ): ?Content_Type_Entry {
		if ( $this->indexable_helper->should_index_indexables() ) {
			$post = $this->get_content_type_entry_for_indexable( $page_id );
		}
		else {
			$post = $this->get_content_type_entry_wp_query( $page_id );
		}

		return $post;
	}

	/**
	 * Gets the content entries with WP query.
	 *
	 * @param int $page_id The id of the page.
	 *
	 * @return Content_Type_Entry The content type entry.
	 */
	public function get_content_type_entry_wp_query( int $page_id ): ?Content_Type_Entry {
		$page = \get_post( $page_id );

		if ( $page !== null && $page->post_password === '' && $page->post_status === 'publish' ) {

			return Content_Type_Entry::from_post( $page, \get_permalink( $page->ID ) );
		}

		return null;
	}

	/**
	 * Gets the content entries with indexables.
	 *
	 * @param int $page_id The id of the page.
	 *
	 * @return Content_Type_Entry The content type entry.
	 */
	public function get_content_type_entry_for_indexable( int $page_id ): ?Content_Type_Entry {
		$indexable = $this->indexable_repository->find_by_id_and_type( $page_id, 'post' );
		if ( $indexable && ( $indexable->is_public === null || $indexable->is_public ) ) {
			$indexable_meta = $this->meta->for_indexable( $indexable );
			if ( $indexable_meta->post instanceof WP_Post ) {
				return Content_Type_Entry::from_meta( $indexable_meta );
			}
		}

		return null;
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
26 Aug 2026 4.26 AM
docteuh / users
0755
automatic-post-collection.php
7.013 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
manual-post-collection.php
4.344 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
post-collection-factory.php
1.586 KB
23 Jun 2026 6.19 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF