LLMS_Post_Model::__get( string $key )
Magic Getter
Description Description
Parameters Parameters
- $key
-
(string) (Required) key to retrieve
Return Return
(mixed)
Source Source
File: includes/abstracts/abstract.llms.post.model.php
public function __get( $key ) { // force numeric id and prevent filtering on the id if ( 'id' === $key ) { return absint( $this->$key ); } elseif ( in_array( $key, array_keys( $this->get_post_properties() ) ) ) { $post_key = 'post_' . $key; // ensure post is set globally for filters below global $post; $temp = $post; $post = $this->post; switch ( $key ) { case 'content': $val = llms_content( $this->post->$post_key ); break; case 'excerpt': $val = apply_filters( 'get_the_excerpt', $this->post->$post_key ); break; case 'menu_order': $val = $this->post->menu_order; break; case 'title': $val = apply_filters( 'the_title', $this->post->$post_key, $this->get( 'id' ) ); break; default: $val = $this->post->$post_key; } // return the original global $post = $temp; } elseif ( ! in_array( $key, $this->get_unsettable_properties() ) ) { if ( metadata_exists( 'post', $this->id, $this->meta_prefix . $key ) ) { $val = get_post_meta( $this->id, $this->meta_prefix . $key, true ); } else { $val = $this->get_default_value( $key ); } } else { return $this->$key; }// End if(). // if we found a valid, apply default llms get get filter and return the value if ( isset( $val ) ) { if ( 'content' !== $key ) { $val = $this->scrub( $key, $val ); } return apply_filters( 'llms_get_' . $this->model_post_type . '_' . $key, $val, $this ); } // shouldn't ever get here return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: