callback' => [ $this, 'get_tracked_keyphrases' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
'args' => [
'keyphrases' => [
'required' => false,
],
'permalink' => [
'required' => false,
],
'startAt' => [
'required' => false,
],
],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::TRACKED_KEYPHRASES_ROUTE, $get_keyphrases_route_args );
$delete_keyphrase_route_args = [
'methods' => 'DELETE',
'callback' => [ $this, 'untrack_keyphrase' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::UNTRACK_KEYPHRASE_ROUTE, $delete_keyphrase_route_args );
$check_limit_route_args = [
'methods' => 'GET',
'callback' => [ $this, 'check_limit' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::CHECK_LIMIT_ROUTE, $check_limit_route_args );
$get_upgrade_campaign_route_args = [
'methods' => 'GET',
'callback' => [ $this, 'get_upgrade_campaign' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::UPGRADE_CAMPAIGN_ROUTE, $get_upgrade_campaign_route_args );
}
/**
* Returns the authorization URL.
*
* @return WP_REST_Response The response.
*/
public function get_authorization_url() {
$data = $this->login_action->get_authorization_url();
return new WP_REST_Response( $data, $data->status );
}
/**
* Authenticates with Wincher.
*
* @param WP_REST_Request $request The request. This request should have a code param set.
*
* @return WP_REST_Response The response.
*/
public function authenticate( WP_REST_Request $request ) {
$data = $this
->login_action
->authenticate( $request['code'], (string) $request['websiteId'] );
return new WP_REST_Response( $data, $data->status );
}
/**
* Posts keyphrases to track.
*
* @param WP_REST_Request $request The request. This request should have a code param set.
*
* @return WP_REST_Response The response.
*/
public function track_keyphrases( WP_REST_Request $request ) {
$limits = $this->account_action->check_limit();
if ( $limits->status !== 200 ) {
return new WP_REST_Response( $limits, $limits->status );
}
$data = $this->keyphrases_action->track_keyphrases( $request['keyphrases'], $limits );
return new WP_REST_Response( $data, $data->status );
}
/**
* Gets the tracked keyphrases via POST.
* This is done via POST, so we don't potentially run into URL limit issues when a lot of long keyphrases are tracked.
*
* @param WP_REST_Request $request The request. This request should have a code param set.
*
* @return WP_REST_Response The response.
*/
public function get_tracked_keyphrases( WP_REST_Request $request ) {
$data = $this->keyphrases_action->get_tracked_keyphrases( $request['keyphrases'], $request['permalink'], $request['startAt'] );
return new WP_REST_Response( $data, $data->status );
}
/**
* Untracks the tracked keyphrase.
*
* @param WP_REST_Request $request The request. This request should have a code param set.
*
* @return WP_REST_Response The response.
*/
public function untrack_keyphrase( WP_REST_Request $request ) {
$data = $this->keyphrases_action->untrack_keyphrase( $request['keyphraseID'] );
return new WP_REST_Response( $data, $data->status );
}
/**
* Checks the account limit.
*
* @return WP_REST_Response The response.
*/
public function check_limit() {
$data = $this->account_action->check_limit();
return new WP_REST_Response( $data, $data->status );
}
/**
* Gets the upgrade campaign.
* If it's not a free user, no campaign is returned.
*
* @return WP_REST_Response The response.
*/
public function get_upgrade_campaign() {
$data = $this->account_action->get_upgrade_campaign();
return new WP_REST_Response( $data, $data->status );
}
/**
* Checks if a valid code was returned.
*
* @param string $code The code to check.
*
* @return bool Whether the code is valid.
*/
public function has_valid_code( $code ) {
return $code !== '';
}
/**
* Checks if a valid website_id was returned.
*
* @param int $website_id The website_id to check.
*
* @return bool Whether the website_id is valid.
*/
public function has_valid_website_id( $website_id ) {
return ! empty( $website_id ) && \is_int( $website_id );
}
/**
* Whether the current user is allowed to publish post/pages and thus use the Wincher integration.
*
* @return bool Whether the current user is allowed to use Wincher.
*/
public function can_use_wincher() {
return \current_user_can( 'publish_posts' ) || \current_user_can( 'publish_pages' );
}
}
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/despertacidade.com/web/wp-content/plugins/wordpress-seo/src/routes/wincher-route.php:1) in /var/www/html/despertacidade.com/web/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"version":"1.0","provider_name":"Desperta Not\u00edcias - Portal de not\u00edcias de Feira de Santana - Bahia","provider_url":"https:\/\/despertanoticias.com.br","author_name":"Desperta Not\u00edcias","author_url":"https:\/\/despertanoticias.com.br\/author\/admin\/","title":"Liverpool vence Flamengo e conquista Mundial de Clubes - Desperta Not\u00edcias - Portal de not\u00edcias de Feira de Santana - Bahia","type":"rich","width":600,"height":338,"html":"Liverpool vence Flamengo e conquista Mundial de Clubes<\/a><\/blockquote>