Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wordpres.../admin/endpoint...
File: class-endpoint-statistics.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Admin\Statistics
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Represents an implementation of the WPSEO_Endpoint interface to register one or multiple endpoints.
[8] Fix | Delete
*/
[9] Fix | Delete
class WPSEO_Endpoint_Statistics implements WPSEO_Endpoint {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The namespace of the REST route.
[13] Fix | Delete
*
[14] Fix | Delete
* @var string
[15] Fix | Delete
*/
[16] Fix | Delete
public const REST_NAMESPACE = 'yoast/v1';
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* The route of the statistics endpoint.
[20] Fix | Delete
*
[21] Fix | Delete
* @var string
[22] Fix | Delete
*/
[23] Fix | Delete
public const ENDPOINT_RETRIEVE = 'statistics';
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* The name of the capability needed to retrieve data using the endpoints.
[27] Fix | Delete
*
[28] Fix | Delete
* @var string
[29] Fix | Delete
*/
[30] Fix | Delete
public const CAPABILITY_RETRIEVE = 'read';
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Service to use.
[34] Fix | Delete
*
[35] Fix | Delete
* @var WPSEO_Statistics_Service
[36] Fix | Delete
*/
[37] Fix | Delete
protected $service;
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Constructs the WPSEO_Endpoint_Statistics class and sets the service to use.
[41] Fix | Delete
*
[42] Fix | Delete
* @param WPSEO_Statistics_Service $service Service to use.
[43] Fix | Delete
*/
[44] Fix | Delete
public function __construct( WPSEO_Statistics_Service $service ) {
[45] Fix | Delete
$this->service = $service;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Registers the REST routes that are available on the endpoint.
[50] Fix | Delete
*
[51] Fix | Delete
* @return void
[52] Fix | Delete
*/
[53] Fix | Delete
public function register() {
[54] Fix | Delete
// Register fetch config.
[55] Fix | Delete
$route_args = [
[56] Fix | Delete
'methods' => 'GET',
[57] Fix | Delete
'callback' => [ $this->service, 'get_statistics' ],
[58] Fix | Delete
'permission_callback' => [ $this, 'can_retrieve_data' ],
[59] Fix | Delete
];
[60] Fix | Delete
register_rest_route( self::REST_NAMESPACE, self::ENDPOINT_RETRIEVE, $route_args );
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Determines whether or not data can be retrieved for the registered endpoints.
[65] Fix | Delete
*
[66] Fix | Delete
* @return bool Whether or not data can be retrieved.
[67] Fix | Delete
*/
[68] Fix | Delete
public function can_retrieve_data() {
[69] Fix | Delete
return current_user_can( self::CAPABILITY_RETRIEVE );
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function