PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | json-endpoints/class.wpcom-json-api-sharing-buttons-endpoint.php +18 -8 12.5.2 → 16.3-a.1 View file →
@@ -1,7 +1,12 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 3 // phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
4 +
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit( 0 );
7 +}
8 +
4 9 /**
5 10 * Sharing button endpoint class.
6 11 */
7 12 abstract class WPCOM_JSON_API_Sharing_Button_Endpoint extends WPCOM_JSON_API_Endpoint {
@@ -187,11 +192,11 @@
187 192 $service_id = $updated_service->get_id();
188 193 if ( is_a( $all_buttons[ $button_id ], 'Share_Custom' ) ) {
189 194 // Replace options for existing custom button
190 195 $options = $updated_service->get_options();
191 - $name = isset( $button['name'] ) ? $button['name'] : $options['name'];
192 - $url = isset( $button['URL'] ) ? $button['URL'] : $options['url'];
193 - $icon = isset( $button['icon'] ) ? $button['icon'] : $options['icon'];
196 + $name = $button['name'] ?? $options['name'];
197 + $url = $button['URL'] ?? $options['url'];
198 + $icon = $button['icon'] ?? $options['icon'];
194 199 $updated_service = new Share_Custom(
195 200 $service_id,
196 201 array(
197 202 'name' => $name,
@@ -228,9 +233,8 @@
228 233 }
229 234
230 235 return $updated_service;
231 236 }
232 -
233 237 }
234 238
235 239 new WPCOM_JSON_API_Get_Sharing_Buttons_Endpoint(
236 240 array(
@@ -284,8 +288,10 @@
284 288 /**
285 289 * Get sharing buttons endpoint class.
286 290 *
287 291 * GET /sites/%s/sharing-buttons -> $blog_id
292 + *
293 + * @phan-constructor-used-for-side-effects
288 294 */
289 295 class WPCOM_JSON_API_Get_Sharing_Buttons_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint {
290 296
291 297 /**
@@ -390,8 +396,10 @@
390 396 /**
391 397 * Get sharing button endpoint class.
392 398 *
393 399 * GET /sites/%s/sharing-buttons/%s -> $blog_id, $button_id
400 + *
401 + * @phan-constructor-used-for-side-effects
394 402 */
395 403 class WPCOM_JSON_API_Get_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint {
396 404
397 405 /**
@@ -421,9 +429,8 @@
421 429 } else {
422 430 return $this->format_sharing_button( $all_buttons[ $button_id ] );
423 431 }
424 432 }
425 -
426 433 }
427 434
428 435 new WPCOM_JSON_API_Update_Sharing_Buttons_Endpoint(
429 436 array(
@@ -476,8 +483,10 @@
476 483 /**
477 484 * Update sharing buttons endpoint.
478 485 *
479 486 * POST /sites/%s/sharing-buttons -> $blog_id
487 + *
488 + * @phan-constructor-used-for-side-effects
480 489 */
481 490 class WPCOM_JSON_API_Update_Sharing_Buttons_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint {
482 491
483 492 /**
@@ -554,9 +563,8 @@
554 563 'success' => $success,
555 564 'updated' => $updated,
556 565 );
557 566 }
558 -
559 567 }
560 568
561 569 new WPCOM_JSON_API_Update_Sharing_Button_Endpoint(
562 570 array(
@@ -666,8 +674,10 @@
666 674 * Sharing button endpoint class.
667 675 *
668 676 * POST /sites/%s/sharing-buttons/new -> $blog_id
669 677 * POST /sites/%s/sharing-buttons/%s -> $blog_id, $button_id
678 + *
679 + * @phan-constructor-used-for-side-effects
670 680 */
671 681 class WPCOM_JSON_API_Update_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint {
672 682
673 683 /**
@@ -713,9 +723,8 @@
713 723 } else {
714 724 return $this->format_sharing_button( $updated_service );
715 725 }
716 726 }
717 -
718 727 }
719 728
720 729 new WPCOM_JSON_API_Delete_Sharing_Button_Endpoint(
721 730 array(
@@ -746,8 +755,10 @@
746 755 /**
747 756 * Delete sharing button endpoint class.
748 757 *
749 758 * POST /sites/%s/sharing-buttons/%s/delete -> $blog_id, $button_id
759 + *
760 + * @phan-constructor-used-for-side-effects
750 761 */
751 762 class WPCOM_JSON_API_Delete_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint {
752 763 /**
753 764 * API Callback.
@@ -787,6 +798,5 @@
787 798 'ID' => $button_id,
788 799 'success' => $success,
789 800 );
790 801 }
791 -
792 802 }