← All changes
|
json-endpoints/class.wpcom-json-api-sharing-buttons-endpoint.php
+18
-3
13.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, |
| @@ -283,8 +288,10 @@ | ||
| 283 | 288 | /** |
| 284 | 289 | * Get sharing buttons endpoint class. |
| 285 | 290 | * |
| 286 | 291 | * GET /sites/%s/sharing-buttons -> $blog_id |
| 292 | + * | |
| 293 | + * @phan-constructor-used-for-side-effects | |
| 287 | 294 | */ |
| 288 | 295 | class WPCOM_JSON_API_Get_Sharing_Buttons_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint { |
| 289 | 296 | |
| 290 | 297 | /** |
| @@ -389,8 +396,10 @@ | ||
| 389 | 396 | /** |
| 390 | 397 | * Get sharing button endpoint class. |
| 391 | 398 | * |
| 392 | 399 | * GET /sites/%s/sharing-buttons/%s -> $blog_id, $button_id |
| 400 | + * | |
| 401 | + * @phan-constructor-used-for-side-effects | |
| 393 | 402 | */ |
| 394 | 403 | class WPCOM_JSON_API_Get_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint { |
| 395 | 404 | |
| 396 | 405 | /** |
| @@ -474,8 +483,10 @@ | ||
| 474 | 483 | /** |
| 475 | 484 | * Update sharing buttons endpoint. |
| 476 | 485 | * |
| 477 | 486 | * POST /sites/%s/sharing-buttons -> $blog_id |
| 487 | + * | |
| 488 | + * @phan-constructor-used-for-side-effects | |
| 478 | 489 | */ |
| 479 | 490 | class WPCOM_JSON_API_Update_Sharing_Buttons_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint { |
| 480 | 491 | |
| 481 | 492 | /** |
| @@ -663,8 +674,10 @@ | ||
| 663 | 674 | * Sharing button endpoint class. |
| 664 | 675 | * |
| 665 | 676 | * POST /sites/%s/sharing-buttons/new -> $blog_id |
| 666 | 677 | * POST /sites/%s/sharing-buttons/%s -> $blog_id, $button_id |
| 678 | + * | |
| 679 | + * @phan-constructor-used-for-side-effects | |
| 667 | 680 | */ |
| 668 | 681 | class WPCOM_JSON_API_Update_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint { |
| 669 | 682 | |
| 670 | 683 | /** |
| @@ -742,8 +755,10 @@ | ||
| 742 | 755 | /** |
| 743 | 756 | * Delete sharing button endpoint class. |
| 744 | 757 | * |
| 745 | 758 | * POST /sites/%s/sharing-buttons/%s/delete -> $blog_id, $button_id |
| 759 | + * | |
| 760 | + * @phan-constructor-used-for-side-effects | |
| 746 | 761 | */ |
| 747 | 762 | class WPCOM_JSON_API_Delete_Sharing_Button_Endpoint extends WPCOM_JSON_API_Sharing_Button_Endpoint { |
| 748 | 763 | /** |
| 749 | 764 | * API Callback. |