PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/routes/first-time-configuration-route.php +10 -106 19.0 → trunk View file →
@@ -7,9 +7,8 @@
7 7 use Yoast\WP\SEO\Actions\Configuration\First_Time_Configuration_Action;
8 8 use Yoast\WP\SEO\Conditionals\No_Conditionals;
9 9 use Yoast\WP\SEO\Main;
10 10
11 -// phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- First time configuration simply has a lot of words.
12 11 /**
13 12 * First_Time_Configuration_Route class.
14 13 */
15 14 class First_Time_Configuration_Route implements Route_Interface {
@@ -20,9 +19,9 @@
20 19 * Represents the first time configuration route.
21 20 *
22 21 * @var string
23 22 */
24 - const CONFIGURATION_ROUTE = '/configuration';
23 + public const CONFIGURATION_ROUTE = '/configuration';
25 24
26 25 /**
27 26 * Represents a site representation route.
28 27 *
@@ -27,9 +26,9 @@
27 26 * Represents a site representation route.
28 27 *
29 28 * @var string
30 29 */
31 - const SITE_REPRESENTATION_ROUTE = '/site_representation';
30 + public const SITE_REPRESENTATION_ROUTE = '/site_representation';
32 31
33 32 /**
34 33 * Represents a social profiles route.
35 34 *
@@ -34,23 +33,16 @@
34 33 * Represents a social profiles route.
35 34 *
36 35 * @var string
37 36 */
38 - const SOCIAL_PROFILES_ROUTE = '/social_profiles';
37 + public const SOCIAL_PROFILES_ROUTE = '/social_profiles';
39 38
40 39 /**
41 - * Represents a person's social profiles route.
42 - *
43 - * @var string
44 - */
45 - const PERSON_SOCIAL_PROFILES_ROUTE = '/person_social_profiles';
46 -
47 - /**
48 40 * Represents a route to enable/disable tracking.
49 41 *
50 42 * @var string
51 43 */
52 - const ENABLE_TRACKING_ROUTE = '/enable_tracking';
44 + public const ENABLE_TRACKING_ROUTE = '/enable_tracking';
53 45
54 46 /**
55 47 * Represents a route to check if current user has the correct capabilities to edit another user's profile.
56 48 *
@@ -55,9 +47,9 @@
55 47 * Represents a route to check if current user has the correct capabilities to edit another user's profile.
56 48 *
57 49 * @var string
58 50 */
59 - const CHECK_CAPABILITY_ROUTE = '/check_capability';
51 + public const CHECK_CAPABILITY_ROUTE = '/check_capability';
60 52
61 53 /**
62 54 * Represents a route to save the first time configuration state.
63 55 *
@@ -62,9 +54,9 @@
62 54 * Represents a route to save the first time configuration state.
63 55 *
64 56 * @var string
65 57 */
66 - const SAVE_CONFIGURATION_STATE_ROUTE = '/save_configuration_state';
58 + public const SAVE_CONFIGURATION_STATE_ROUTE = '/save_configuration_state';
67 59
68 60 /**
69 61 * Represents a route to save the first time configuration state.
70 62 *
@@ -69,9 +61,9 @@
69 61 * Represents a route to save the first time configuration state.
70 62 *
71 63 * @var string
72 64 */
73 - const GET_CONFIGURATION_STATE_ROUTE = '/get_configuration_state';
65 + public const GET_CONFIGURATION_STATE_ROUTE = '/get_configuration_state';
74 66
75 67 /**
76 68 * The first tinme configuration action.
77 69 *
@@ -83,11 +75,9 @@
83 75 * First_Time_Configuration_Route constructor.
84 76 *
85 77 * @param First_Time_Configuration_Action $first_time_configuration_action The first-time configuration action.
86 78 */
87 - public function __construct(
88 - First_Time_Configuration_Action $first_time_configuration_action
89 - ) {
79 + public function __construct( First_Time_Configuration_Action $first_time_configuration_action ) {
90 80 $this->first_time_configuration_action = $first_time_configuration_action;
91 81 }
92 82
93 83 /**
@@ -151,62 +141,8 @@
151 141 ],
152 142 ];
153 143 \register_rest_route( Main::API_V1_NAMESPACE, self::CONFIGURATION_ROUTE . self::SOCIAL_PROFILES_ROUTE, $social_profiles_route );
154 144
155 - $person_social_profiles_route = [
156 - [
157 - 'methods' => 'GET',
158 - 'callback' => [ $this, 'get_person_social_profiles' ],
159 - 'permission_callback' => [ $this, 'can_manage_options' ],
160 - 'args' => [
161 - 'user_id' => [
162 - 'required' => true,
163 - ],
164 - ],
165 - ],
166 - [
167 - 'methods' => 'POST',
168 - 'callback' => [ $this, 'set_person_social_profiles' ],
169 - 'permission_callback' => [ $this, 'can_edit_user' ],
170 - 'args' => [
171 - 'user_id' => [
172 - 'type' => 'integer',
173 - ],
174 - 'facebook' => [
175 - 'type' => 'string',
176 - ],
177 - 'instagram' => [
178 - 'type' => 'string',
179 - ],
180 - 'linkedin' => [
181 - 'type' => 'string',
182 - ],
183 - 'myspace' => [
184 - 'type' => 'string',
185 - ],
186 - 'pinterest' => [
187 - 'type' => 'string',
188 - ],
189 - 'soundcloud' => [
190 - 'type' => 'string',
191 - ],
192 - 'tumblr' => [
193 - 'type' => 'string',
194 - ],
195 - 'twitter' => [
196 - 'type' => 'string',
197 - ],
198 - 'youtube' => [
199 - 'type' => 'string',
200 - ],
201 - 'wikipedia' => [
202 - 'type' => 'string',
203 - ],
204 - ],
205 - ],
206 - ];
207 - \register_rest_route( Main::API_V1_NAMESPACE, self::CONFIGURATION_ROUTE . self::PERSON_SOCIAL_PROFILES_ROUTE, $person_social_profiles_route );
208 -
209 145 $check_capability_route = [
210 146 'methods' => 'GET',
211 147 'callback' => [ $this, 'check_capability' ],
212 148 'permission_callback' => [ $this, 'can_manage_options' ],
@@ -281,45 +217,13 @@
281 217 ->first_time_configuration_action
282 218 ->set_social_profiles( $request->get_json_params() );
283 219
284 220 return new WP_REST_Response(
285 - [ 'json' => $data ]
221 + [ 'json' => $data ],
286 222 );
287 223 }
288 224
289 225 /**
290 - * Gets a person's social profiles values.
291 - *
292 - * @param WP_REST_Request $request The request.
293 - *
294 - * @return WP_REST_Response
295 - */
296 - public function get_person_social_profiles( WP_REST_Request $request ) {
297 - $data = $this
298 - ->first_time_configuration_action
299 - ->get_person_social_profiles( $request->get_param( 'user_id' ) );
300 -
301 - return new WP_REST_Response( $data, $data->status );
302 - }
303 -
304 - /**
305 - * Sets a person's social profiles values.
306 - *
307 - * @param WP_REST_Request $request The request.
308 - *
309 - * @return WP_REST_Response
310 - */
311 - public function set_person_social_profiles( WP_REST_Request $request ) {
312 - $data = $this
313 - ->first_time_configuration_action
314 - ->set_person_social_profiles( $request->get_json_params() );
315 -
316 - return new WP_REST_Response(
317 - [ 'json' => $data ]
318 - );
319 - }
320 -
321 - /**
322 226 * Checks if the current user has the correct capability to edit a specific user.
323 227 *
324 228 * @param WP_REST_Request $request The request.
325 229 *
@@ -395,9 +299,9 @@
395 299
396 300 /**
397 301 * Returns the first time configuration state.
398 302 *
399 - * @return WP_REST_Response the configuration of the workouts.
303 + * @return WP_REST_Response the state of the configuration.
400 304 */
401 305 public function get_configuration_state() {
402 306 $data = $this
403 307 ->first_time_configuration_action