Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Api;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Api as CommonApi;
|
||||
|
||||
/**
|
||||
* Api class for the admin.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Api extends CommonApi\Api {
|
||||
/**
|
||||
* The routes we use in the rest API.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $liteRoutes = [
|
||||
// phpcs:disable WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||
// phpcs:enable WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
|
||||
];
|
||||
|
||||
/**
|
||||
* Get all the routes to register.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return array An array of routes.
|
||||
*/
|
||||
protected function getRoutes() {
|
||||
return array_merge_recursive( $this->routes, $this->liteRoutes );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace AIOSEO\Plugin\Lite\Api;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use AIOSEO\Plugin\Common\Api as CommonApi;
|
||||
|
||||
/**
|
||||
* Route class for the API.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Wizard extends CommonApi\Wizard {
|
||||
/**
|
||||
* Save the wizard information.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @param \WP_REST_Request $request The REST Request
|
||||
* @return \WP_REST_Response The response.
|
||||
*/
|
||||
public static function saveWizard( $request ) {
|
||||
$response = parent::saveWizard( $request );
|
||||
$body = $request->get_json_params();
|
||||
$section = ! empty( $body['section'] ) ? sanitize_text_field( $body['section'] ) : null;
|
||||
$wizard = ! empty( $body['wizard'] ) ? $body['wizard'] : null;
|
||||
|
||||
// Save the smart recommendations section.
|
||||
if ( 'smartRecommendations' === $section && ! empty( $wizard['smartRecommendations'] ) ) {
|
||||
$smartRecommendations = $wizard['smartRecommendations'];
|
||||
if ( isset( $smartRecommendations['usageTracking'] ) ) {
|
||||
aioseo()->options->advanced->usageTracking = $smartRecommendations['usageTracking'];
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user