equal
deleted
inserted
replaced
112 |
112 |
113 /** |
113 /** |
114 * Comment type. |
114 * Comment type. |
115 * |
115 * |
116 * @since 4.4.0 |
116 * @since 4.4.0 |
117 * @var string |
117 * @since 5.5.0 Default value changed to `comment`. |
118 */ |
118 * @var string |
119 public $comment_type = ''; |
119 */ |
|
120 public $comment_type = 'comment'; |
120 |
121 |
121 /** |
122 /** |
122 * Parent comment ID. |
123 * Parent comment ID. |
123 * |
124 * |
124 * @since 4.4.0 |
125 * @since 4.4.0 |
249 * 'user_id', 'comment__in', 'meta_value', 'meta_value_num', |
250 * 'user_id', 'comment__in', 'meta_value', 'meta_value_num', |
250 * the value of $meta_key, and the array keys of |
251 * the value of $meta_key, and the array keys of |
251 * `$meta_query`. Also accepts false, an empty array, or |
252 * `$meta_query`. Also accepts false, an empty array, or |
252 * 'none' to disable `ORDER BY` clause. |
253 * 'none' to disable `ORDER BY` clause. |
253 * } |
254 * } |
254 * @return array Array of `WP_Comment` objects. |
255 * @return WP_Comment[] Array of `WP_Comment` objects. |
255 */ |
256 */ |
256 public function get_children( $args = array() ) { |
257 public function get_children( $args = array() ) { |
257 $defaults = array( |
258 $defaults = array( |
258 'format' => 'tree', |
259 'format' => 'tree', |
259 'status' => 'all', |
260 'status' => 'all', |
341 * |
342 * |
342 * @param string $name Property name. |
343 * @param string $name Property name. |
343 * @return bool |
344 * @return bool |
344 */ |
345 */ |
345 public function __isset( $name ) { |
346 public function __isset( $name ) { |
346 if ( in_array( $name, $this->post_fields ) && 0 !== (int) $this->comment_post_ID ) { |
347 if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) { |
347 $post = get_post( $this->comment_post_ID ); |
348 $post = get_post( $this->comment_post_ID ); |
348 return property_exists( $post, $name ); |
349 return property_exists( $post, $name ); |
349 } |
350 } |
350 } |
351 } |
351 |
352 |
358 * |
359 * |
359 * @param string $name |
360 * @param string $name |
360 * @return mixed |
361 * @return mixed |
361 */ |
362 */ |
362 public function __get( $name ) { |
363 public function __get( $name ) { |
363 if ( in_array( $name, $this->post_fields ) ) { |
364 if ( in_array( $name, $this->post_fields, true ) ) { |
364 $post = get_post( $this->comment_post_ID ); |
365 $post = get_post( $this->comment_post_ID ); |
365 return $post->$name; |
366 return $post->$name; |
366 } |
367 } |
367 } |
368 } |
368 } |
369 } |