__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ 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 Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
use Yoast\WP\SEO\Conditionals\No_Conditionals;
use Yoast\WP\SEO\Main;
/**
* Class Alert_Dismissal_Route.
*/
class Alert_Dismissal_Route implements Route_Interface {
use No_Conditionals;
/**
* Represents the alerts route prefix.
*
* @var string
*/
public const ROUTE_PREFIX = 'alerts';
/**
* Represents the dismiss route.
*
* @var string
*/
public const DISMISS_ROUTE = self::ROUTE_PREFIX . '/dismiss';
/**
* Represents the full dismiss route.
*
* @var string
*/
public const FULL_DISMISS_ROUTE = Main::API_V1_NAMESPACE . '/' . self::DISMISS_ROUTE;
/**
* Represents the alert dismissal action.
*
* @var Alert_Dismissal_Action
*/
protected $alert_dismissal_action;
/**
* Constructs Alert_Dismissal_Route.
*
* @param Alert_Dismissal_Action $alert_dismissal_action The alert dismissal action.
*/
public function __construct( Alert_Dismissal_Action $alert_dismissal_action ) {
$this->alert_dismissal_action = $alert_dismissal_action;
}
/**
* Registers routes with WordPress.
*
* @return void
*/
public function register_routes() {
$dismiss_route_args = [
'methods' => 'POST',
'callback' => [ $this, 'dismiss' ],
'permission_callback' => [ $this, 'can_dismiss' ],
'args' => [
'key' => [
'validate_callback' => [ $this->alert_dismissal_action, 'is_allowed' ],
'required' => true,
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::DISMISS_ROUTE, $dismiss_route_args );
}
/**
* Dismisses an alert.
*
* @param WP_REST_Request $request The request. This request should have a key param set.
*
* @return WP_REST_Response The response.
*/
public function dismiss( WP_REST_Request $request ) {
$success = $this->alert_dismissal_action->dismiss( $request['key'] );
$status = $success === ( true ) ? 200 : 400;
return new WP_REST_Response(
(object) [
'success' => $success,
'status' => $status,
],
$status
);
}
/**
* Whether or not the current user is allowed to dismiss alerts.
*
* @return bool Whether or not the current user is allowed to dismiss alerts.
*/
public function can_dismiss() {
return \current_user_can( 'edit_posts' );
}
}
| 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 |
|