PluginProbe
Parse.ly / 3.24.3
Parse.ly v3.24.3
3.24.3 3.24.2 3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 All 107 releases
← All changes | src/rest-api/settings/class-base-settings-endpoint.php +6 -26 3.24.2 → 3.24.3 View file →
@@ -57,18 +57,8 @@
57 57 */
58 58 protected $valid_subvalues = array();
59 59
60 60 /**
61 - * The current user's ID.
62 - *
63 - * @since 3.14.0
64 - * @since 3.17.0 Moved from Base_Endpoint_User_Meta.
65 - *
66 - * @var int
67 - */
68 - protected $current_user_id = 0;
69 -
70 - /**
71 61 * Returns the meta entry's key.
72 62 *
73 63 * @since 3.13.0
74 64 * @since 3.17.0 Moved from Base_Endpoint_User_Meta.
@@ -135,18 +125,8 @@
135 125 }
136 126 }
137 127
138 128 /**
139 - * Initializes the endpoint and sets the current user ID.
140 - *
141 - * @since 3.17.0
142 - */
143 - public function init(): void {
144 - parent::init();
145 - $this->current_user_id = get_current_user_id();
146 - }
147 -
148 - /**
149 129 * Registers the routes for the endpoint.
150 130 *
151 131 * @since 3.17.0
152 132 */
@@ -263,9 +243,9 @@
263 243 return new WP_REST_Response( $current_settings, 200 );
264 244 }
265 245
266 246 $update_meta = update_user_meta(
267 - $this->current_user_id,
247 + get_current_user_id(),
268 248 $this->get_meta_key(),
269 249 $this->strip_inherited_values( $sanitized_value, $stored_settings )
270 250 );
271 251
@@ -289,9 +269,9 @@
289 269 *
290 270 * @return array<string, mixed> The stored settings.
291 271 */
292 272 protected function get_stored_settings(): array {
293 - $settings = get_user_meta( $this->current_user_id, $this->get_meta_key(), true );
273 + $settings = get_user_meta( get_current_user_id(), $this->get_meta_key(), true );
294 274 $settings = is_array( $settings ) ? $settings : array();
295 275
296 276 return $this->needs_normalizing( $settings )
297 277 ? $this->normalize_stored_settings( $settings )
@@ -310,9 +290,9 @@
310 290 if ( 0 === count( $settings ) || 0 === count( $this->get_inheritable_keys() ) ) {
311 291 return false;
312 292 }
313 293
314 - $format = get_user_meta( $this->current_user_id, $this->get_format_meta_key(), true );
294 + $format = get_user_meta( get_current_user_id(), $this->get_format_meta_key(), true );
315 295
316 296 return static::STORED_FORMAT_VERSION !== ( is_numeric( $format ) ? (int) $format : 0 );
317 297 }
318 298
@@ -349,9 +329,9 @@
349 329 $this->unset_path_value( $settings, $keys );
350 330 }
351 331 }
352 332
353 - update_user_meta( $this->current_user_id, $this->get_meta_key(), $settings );
333 + update_user_meta( get_current_user_id(), $this->get_meta_key(), $settings );
354 334 $this->record_stored_format();
355 335
356 336 return $settings;
357 337 }
@@ -414,9 +394,9 @@
414 394 return;
415 395 }
416 396
417 397 update_user_meta(
418 - $this->current_user_id,
398 + get_current_user_id(),
419 399 $this->get_format_meta_key(),
420 400 static::STORED_FORMAT_VERSION
421 401 );
422 402 }
@@ -443,9 +423,9 @@
443 423 * @param WP_REST_Request|null $request The request object.
444 424 * @return bool
445 425 */
446 426 public function is_available_to_current_user( ?WP_REST_Request $request = null ): bool {
447 - return current_user_can( 'edit_user', $this->current_user_id );
427 + return current_user_can( 'edit_user', get_current_user_id() );
448 428 }
449 429
450 430 /**
451 431 * Sanitizes the passed meta value.