✘✘ 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/cache//get-outline-route.php
<?php

// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\AI\Content_Planner\User_Interface;

use RuntimeException;
use WP_REST_Request;
use WP_REST_Response;
use Yoast\WP\SEO\AI\Content_Planner\Application\Content_Outline_Command;
use Yoast\WP\SEO\AI\Content_Planner\Application\Content_Outline_Command_Handler;
use Yoast\WP\SEO\AI\HTTP_Request\Domain\Exceptions\Payment_Required_Exception;
use Yoast\WP\SEO\AI\HTTP_Request\Domain\Exceptions\Remote_Request_Exception;
use Yoast\WP\SEO\AI\HTTP_Request\Domain\Exceptions\Too_Many_Requests_Exception;
use Yoast\WP\SEO\Conditionals\AI_Conditional;
use Yoast\WP\SEO\Main;
use Yoast\WP\SEO\Routes\Route_Interface;

/**
 * Registers a route to get a content outline from the AI API.
 *
 * @internal This route powers the Yoast SEO admin UI's Content Planner feature. It is not part of the plugin's public REST API surface, requires the capability to edit posts of the requested post type (see {@see self::check_permissions()}), and may change at any time without notice.
 *
 * @makePublic
 *
 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
 */
class Get_Outline_Route implements Route_Interface {

	/**
	 * The namespace for this route.
	 *
	 * @var string
	 */
	public const ROUTE_NAMESPACE = Main::API_V1_NAMESPACE;

	/**
	 * The prefix for this route.
	 *
	 * @var string
	 */
	public const ROUTE_PREFIX = '/ai_content_planner/get_outline';

	/**
	 * The command handler instance.
	 *
	 * @var Content_Outline_Command_Handler
	 */
	private $command_handler;

	/**
	 * Returns the conditionals based in which this loadable should be active.
	 *
	 * @return array<string> The conditionals.
	 */
	public static function get_conditionals() {
		return [ AI_Conditional::class ];
	}

	/**
	 * Class constructor.
	 *
	 * @param Content_Outline_Command_Handler $command_handler The command handler instance.
	 */
	public function __construct( Content_Outline_Command_Handler $command_handler ) {
		$this->command_handler = $command_handler;
	}

	/**
	 * Registers routes with WordPress.
	 *
	 * @return void
	 */
	public function register_routes() {
		\register_rest_route(
			self::ROUTE_NAMESPACE,
			self::ROUTE_PREFIX,
			[
				'methods'             => 'POST',
				'args'                => [
					'post_type'        => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The post type to get a content outline for.',
					],
					'language'         => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The language the content is written in.',
					],
					'editor'           => [
						'required'    => true,
						'type'        => 'string',
						'enum'        => [
							'classic',
							'elementor',
							'gutenberg',
						],
						'description' => 'The current editor.',
					],
					'title'            => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The title of the chosen content suggestion.',
					],
					'intent'           => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The intent of the chosen content suggestion.',
					],
					'explanation'      => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The explanation of the chosen content suggestion.',
					],
					'keyphrase'        => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The keyphrase of the chosen content suggestion.',
					],
					'meta_description' => [
						'required'    => true,
						'type'        => 'string',
						'description' => 'The meta description of the chosen content suggestion.',
					],
					'category'         => [
						'required'    => true,
						'type'        => 'object',
						'properties'  => [
							'name' => [
								'type'     => 'string',
								'required' => true,
							],
							'id'   => [
								'type'     => 'integer',
								'required' => true,
							],
						],
						'description' => 'The category of the chosen content suggestion. Use name "" and id -1 to indicate no category.',
					],
					'recent_content'   => [
						'required'    => true,
						'type'        => 'array',
						'maxItems'    => 100,
						'items'       => [
							'type'                 => 'object',
							'properties'           => [
								'title'       => [
									'type'      => 'string',
									'required'  => true,
									'maxLength' => 500,
								],
								'description' => [
									'type'      => 'string',
									'required'  => true,
									'maxLength' => 1000,
								],
							],
							'additionalProperties' => false,
						],
						'description' => 'The recent content returned by the get_suggestions response.',
					],
				],
				'callback'            => [ $this, 'get_outline' ],
				'permission_callback' => [ $this, 'check_permissions' ],
			],
		);
	}

	/**
	 * Runs the callback to get an AI-generated content outline.
	 *
	 * @param WP_REST_Request $request The request object.
	 *
	 * @return WP_REST_Response The response of the get_outline action.
	 */
	public function get_outline( WP_REST_Request $request ): WP_REST_Response {
		try {
			$user = \wp_get_current_user();

			$category_param = $request->get_param( 'category' );

			$command = new Content_Outline_Command(
				$user,
				$request->get_param( 'post_type' ),
				$request->get_param( 'language' ),
				$request->get_param( 'editor' ),
				$request->get_param( 'title' ),
				$request->get_param( 'intent' ),
				$request->get_param( 'explanation' ),
				$request->get_param( 'keyphrase' ),
				$request->get_param( 'meta_description' ),
				$category_param['name'],
				(int) $category_param['id'],
				$request->get_param( 'recent_content' ),
			);
			$data    = $this->command_handler->handle( $command );
		} catch ( Remote_Request_Exception $e ) {
			$message = [
				'message'         => $e->getMessage(),
				'errorIdentifier' => $e->get_error_identifier(),
			];
			if ( $e instanceof Payment_Required_Exception || $e instanceof Too_Many_Requests_Exception ) {
				$message['missingLicenses'] = $e->get_missing_licenses();
			}
			return new WP_REST_Response(
				$message,
				$e->getCode(),
			);
		} catch ( RuntimeException $e ) {
			return new WP_REST_Response( 'Failed to get content outline.', 500 );
		}

		return new WP_REST_Response( $data->to_array() );
	}

	/**
	 * Checks if the user is logged in and can edit posts of the requested post type.
	 *
	 * The requested post_type is caller-controlled, so the permission must be evaluated
	 * against that post type's own edit_posts meta-capability — not the generic
	 * 'edit_posts' string, which would let a user with edit_posts but no edit_pages
	 * (e.g. an Author) trigger outline generation for pages or arbitrary CPTs.
	 *
	 * @param WP_REST_Request $request The request object.
	 *
	 * @return bool Whether the user can edit posts of the requested post type.
	 */
	public function check_permissions( WP_REST_Request $request ): bool {
		$user = \wp_get_current_user();
		if ( $user === null || $user->ID < 1 ) {
			return false;
		}

		$post_type        = $request->get_param( 'post_type' );
		$post_type_object = \get_post_type_object( $post_type );
		if ( $post_type_object === null ) {
			return false;
		}

		return \user_can( $user, $post_type_object->cap->edit_posts );
	}
}


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


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
23 Sep 2026 9.09 AM
docteuh / users
0777
Exception
--
13 Sep 2026 7.55 PM
docteuh / users
0755
Handler
--
19 Sep 2026 2.57 AM
docteuh / users
0755
cache
--
11 Sep 2026 12.18 PM
docteuh / users
0755
composer
--
31 Aug 2026 2.40 AM
docteuh / users
0755
default-seo-data
--
10 Sep 2026 2.01 PM
docteuh / users
0755
endpoints
--
9 Sep 2026 2.58 PM
docteuh / users
0755
fusion-builder
--
15 Sep 2026 8.07 PM
docteuh / users
0755
icomoon-admin
--
12 Sep 2026 5.33 PM
docteuh / users
0755
library
--
9 Sep 2026 1.41 PM
docteuh / users
0755
public
--
17 Sep 2026 6.51 AM
docteuh / users
0755
sensei
--
11 Sep 2026 9.04 PM
docteuh / users
0755
serverhttpxforwardedssl1
--
12 Sep 2026 3.33 AM
docteuh / users
0755
templates
--
19 Sep 2026 6.23 AM
docteuh / users
0755
third-party
--
18 Sep 2026 1.53 AM
docteuh / users
0755
user-interface
--
17 Sep 2026 2.13 PM
docteuh / users
0755
EasyHandle.php
2.94 KB
23 Jun 2026 6.20 PM
docteuh / users
0644
Middleware.php
11.089 KB
23 Jun 2026 6.20 PM
docteuh / users
0644
addons-20260829203316.json
131.71 KB
27 Sep 2023 12.53 AM
docteuh / users
0644
addons.json
131.71 KB
27 Sep 2023 12.53 AM
docteuh / users
0644
docs-20260830021828.json
30.034 KB
27 Sep 2023 12.53 AM
docteuh / users
0644
docs.json
30.034 KB
27 Sep 2023 12.53 AM
docteuh / users
0644
get-outline-route.php
7.272 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260827192224-20260829103225-20260831111900-20260901204506.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260827192224-20260829103225.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260827192224.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager-20260828150339.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
icon-redirect-manager.svg
1.299 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
index.html
0 KB
27 Sep 2023 12.53 AM
docteuh / users
0644
media-new-20260829154003.php
3.173 KB
21 May 2026 2.34 PM
docteuh / users
0644
ms-themes.php
0.212 KB
6 Feb 2020 7.33 AM
docteuh / users
0644
schema-map-builder.php
2.985 KB
23 Jun 2026 6.19 PM
docteuh / users
0644
ssl-test-page.html
0.155 KB
18 Jun 2026 6.25 PM
docteuh / users
0644

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