__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Yoast\WP\SEO\Routes;
use WP_REST_Request;
use WP_REST_Response;
use WPSEO_Utils;
use Yoast\WP\SEO\Actions\Indexables\Indexable_Head_Action;
use Yoast\WP\SEO\Conditionals\Headless_Rest_Endpoints_Enabled_Conditional;
use Yoast\WP\SEO\Main;
/**
* Head route for indexables.
*/
class Indexables_Head_Route implements Route_Interface {
/**
* The posts route constant.
*
* @var string
*/
public const HEAD_FOR_URL_ROUTE = 'get_head';
/**
* The full posts route constant.
*
* @var string
*/
public const FULL_HEAD_FOR_URL_ROUTE = Main::API_V1_NAMESPACE . '/' . self::HEAD_FOR_URL_ROUTE;
/**
* The head action.
*
* @var Indexable_Head_Action
*/
private $head_action;
/**
* Indexable_Indexation_Route constructor.
*
* @param Indexable_Head_Action $head_action The head action.
*/
public function __construct( Indexable_Head_Action $head_action ) {
$this->head_action = $head_action;
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @return array<string>
*/
public static function get_conditionals() {
return [ Headless_Rest_Endpoints_Enabled_Conditional::class ];
}
/**
* Registers routes with WordPress.
*
* @return void
*/
public function register_routes() {
$route_args = [
'methods' => 'GET',
'callback' => [ $this, 'get_head' ],
'permission_callback' => '__return_true',
'args' => [
'url' => [
'validate_callback' => [ $this, 'is_valid_url' ],
'required' => true,
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::HEAD_FOR_URL_ROUTE, $route_args );
}
/**
* Gets the head of a page for a given URL.
*
* @param WP_REST_Request $request The request. This request should have a url param set.
*
* @return WP_REST_Response The response.
*/
public function get_head( WP_REST_Request $request ) {
$url = \esc_url_raw( \utf8_uri_encode( $request['url'] ) );
$data = $this->head_action->for_url( $url );
return new WP_REST_Response( $data, $data->status );
}
/**
* Checks if a url is a valid url.
*
* @param string $url The url to check.
*
* @return bool Whether or not the url is valid.
*/
public function is_valid_url( $url ) {
$url = WPSEO_Utils::sanitize_url( \utf8_uri_encode( $url ) );
if ( \filter_var( $url, \FILTER_VALIDATE_URL ) === false ) {
return false;
}
return true;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| abstract-action-route.php | File | 634 B | 0775 |
|
| abstract-indexation-route.php | File | 900 B | 0775 |
|
| alert-dismissal-route.php | File | 2.33 KB | 0775 |
|
| first-time-configuration-route.php | File | 8.06 KB | 0775 |
|
| importing-route.php | File | 4.07 KB | 0775 |
|
| indexables-head-route.php | File | 2.39 KB | 0775 |
|
| indexing-route.php | File | 12.33 KB | 0775 |
|
| integrations-route.php | File | 2.19 KB | 0775 |
|
| meta-search-route.php | File | 1.95 KB | 0775 |
|
| route-interface.php | File | 267 B | 0775 |
|
| semrush-route.php | File | 6.26 KB | 0775 |
|
| supported-features-route.php | File | 1.28 KB | 0775 |
|
| wincher-route.php | File | 8.75 KB | 0775 |
|
| workouts-route.php | File | 3.1 KB | 0775 |
|
| yoast-head-rest-field.php | File | 5.79 KB | 0775 |
|