← All changes
|
json-endpoints/class.wpcom-json-api-post-endpoint.php
+9
-5
13.7.2
→
16.3-a.1
View file →
| @@ -1,6 +1,10 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit( 0 ); | |
| 5 | +} | |
| 6 | + | |
| 3 | 7 | /** |
| 4 | 8 | * Post Endpoint class. |
| 5 | 9 | */ |
| 6 | 10 | abstract class WPCOM_JSON_API_Post_Endpoint extends WPCOM_JSON_API_Endpoint { |
| @@ -191,9 +195,9 @@ | ||
| 191 | 195 | case 'title': |
| 192 | 196 | if ( 'display' === $context ) { |
| 193 | 197 | $response[ $key ] = (string) get_the_title( $post->ID ); |
| 194 | 198 | } else { |
| 195 | - $response[ $key ] = (string) htmlspecialchars_decode( $post->post_title, ENT_QUOTES ); | |
| 199 | + $response[ $key ] = htmlspecialchars_decode( $post->post_title, ENT_QUOTES ); | |
| 196 | 200 | } |
| 197 | 201 | break; |
| 198 | 202 | case 'URL': |
| 199 | 203 | if ( 'revision' === $post->post_type ) { |
| @@ -239,9 +243,9 @@ | ||
| 239 | 243 | break; |
| 240 | 244 | case 'password': |
| 241 | 245 | $response[ $key ] = (string) $post->post_password; |
| 242 | 246 | if ( 'edit' === $context ) { |
| 243 | - $response[ $key ] = htmlspecialchars_decode( (string) $response[ $key ], ENT_QUOTES ); | |
| 247 | + $response[ $key ] = htmlspecialchars_decode( $response[ $key ], ENT_QUOTES ); | |
| 244 | 248 | } |
| 245 | 249 | break; |
| 246 | 250 | /** (object|false) */ |
| 247 | 251 | case 'parent': |
| @@ -249,9 +253,9 @@ | ||
| 249 | 253 | $parent = get_post( $post->post_parent ); |
| 250 | 254 | if ( 'display' === $context ) { |
| 251 | 255 | $parent_title = (string) get_the_title( $parent->ID ); |
| 252 | 256 | } else { |
| 253 | - $parent_title = (string) htmlspecialchars_decode( $post->post_title, ENT_QUOTES ); | |
| 257 | + $parent_title = htmlspecialchars_decode( $post->post_title, ENT_QUOTES ); | |
| 254 | 258 | } |
| 255 | 259 | $response[ $key ] = (object) array( |
| 256 | 260 | 'ID' => (int) $parent->ID, |
| 257 | 261 | 'type' => (string) $parent->post_type, |
| @@ -275,9 +279,9 @@ | ||
| 275 | 279 | /** This filter is documented in modules/likes.php */ |
| 276 | 280 | $sitewide_likes_enabled = (bool) apply_filters( 'wpl_is_enabled_sitewide', ! get_option( 'disabled_likes' ) ); |
| 277 | 281 | $post_likes_switched = get_post_meta( $post->ID, 'switch_like_status', true ); |
| 278 | 282 | $post_likes_enabled = $post_likes_switched || ( $sitewide_likes_enabled && $post_likes_switched !== '0' ); |
| 279 | - $response[ $key ] = (bool) $post_likes_enabled; | |
| 283 | + $response[ $key ] = $post_likes_enabled; | |
| 280 | 284 | break; |
| 281 | 285 | case 'sharing_enabled': |
| 282 | 286 | $show = true; |
| 283 | 287 | /** This filter is documented in modules/sharedaddy/sharing-service.php */ |
| @@ -399,9 +403,9 @@ | ||
| 399 | 403 | break; |
| 400 | 404 | } |
| 401 | 405 | } |
| 402 | 406 | } |
| 403 | - $response[ $key ] = (array) $publicize_urls; | |
| 407 | + $response[ $key ] = $publicize_urls; | |
| 404 | 408 | break; |
| 405 | 409 | case 'tags': |
| 406 | 410 | $response[ $key ] = array(); |
| 407 | 411 | $terms = wp_get_post_tags( $post->ID ); |