| | 214 | |
| | 215 | /** |
| | 216 | * Whether a comment has post from which to retrieve magic properties |
| | 217 | * |
| | 218 | * @since 4.4.0 |
| | 219 | * @access public |
| | 220 | * |
| | 221 | * @param string $name |
| | 222 | * @return bool |
| | 223 | */ |
| | 224 | public function __isset( $name ) { |
| | 225 | if ( |
| | 226 | 0 === (int) $this->comment_post_ID |
| | 227 | || property_exists( $this, $name ) |
| | 228 | ) { |
| | 229 | return; |
| | 230 | } |
| | 231 | |
| | 232 | $post = get_post( $this->comment_post_ID ); |
| | 233 | if ( $post ) { |
| | 234 | return property_exists( $post, $name ); |
| | 235 | } |
| | 236 | } |
| | 237 | |
| | 238 | /** |
| | 239 | * Magic getter for $post properties |
| | 240 | * |
| | 241 | * @since 4.4.0 |
| | 242 | * @access public |
| | 243 | * |
| | 244 | * @param string $name |
| | 245 | * @return mixed |
| | 246 | */ |
| | 247 | public function __get( $name ) { |
| | 248 | $post = get_post( $this->comment_post_ID ); |
| | 249 | if ( $post ) { |
| | 250 | return $post->$name; |
| | 251 | } |
| | 252 | } |