PHP 클래스 Habari\Post

$this->info= new PostInfo( 1 ); // Info records of post with id = 1 $this->info->option1= "blah"; // set info record with name "option1" to value "blah" $info_value= $this->info->option1; // get value of info record with name "option1" into variable $info_value if ( isset ( $this->info->option1 ) ) // test for existence of "option1" unset ( $this->info->option1 ); // delete "option1" info record
상속: extends QueryRecord, implements IsContent, implements habari\FormStorage
파일 보기 프로젝트 열기: habari/system 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$post_status_list static variables to hold post status and post type values
$post_type_list_active
$post_type_list_all
$schema

보호된 프로퍼티들

프로퍼티 타입 설명
$url_args

공개 메소드들

메소드 설명
__call ( string $name, array $args ) : mixed Handle calls to this Post object that are implemented by plugins
__construct ( array $paramarray = [] ) Constructor for the Post class.
__get ( string $name ) : mixed Overrides QueryRecord __get to implement custom object properties
__isset ( string $name ) : boolean Overrides QueryRecord __isset to implement custom object properties
__set ( string $name, mixed $value ) : mixed Overrides QueryRecord __set to implement custom object properties
__static ( ) Register plugin hooks
activate_post_type ( string $type ) : boolean Activate an existing post type
add_new_status ( string $status, boolean $internal = false ) inserts a new post status into the database, if it doesn't exist
add_new_type ( string $type, boolean $active = true ) inserts a new post type into the database, if it doesn't exist
add_tokens ( array | string $tokens ) Add a token to a post
ascend ( null $params = null ) : Post Returns the ascending post, relative to this post, according to params
comment_form ( string $context = 'public' ) : FormUI Manage this post's comment form
content_type ( ) : array Return the content type of this object
create ( array $paramarray ) : Post Create a post and save it.
create_default_tokens ( ) Adds the default tokens to this post when it's saved
css_class ( string | array $append = [] ) : string Returns a list of CSS classes for the post
deactivate_post_type ( string $type ) : boolean Deactivate a post type
default_fields ( ) : array Return the defined database columns for a Post.
delete ( ) : boolean Deletes this post instance
delete_post_status ( string $status ) Delete a post status
delete_post_type ( string $type ) : boolean removes a post type from the database, if it exists and there are no posts of the type
delete_tokens ( ) Deletes all tokens from a post
descend ( $params = null ) : Post Returns the descending post, relative to this post, according to params
field_load ( string $key ) : mixed Loads form values from this post
field_save ( string $key, mixed $value ) Stores a form value into this post's info records
filter_post_get_7 ( string $content, string $field, Post $post ) : string Filter post content and titles for shortcodes
filter_post_status_display_4 ( string $status ) : string How to display the built-in post statuses.
filter_post_type_display_4 ( string $type, string $foruse ) : string How to display the built-in post types.
form_publish_delete ( FormUI $form ) The on_success handler for the delete button on the post editing form
form_publish_success ( FormUI $form ) Called when the publish form is successfully submitted
get ( array $paramarray = [] ) : Post Return a single requested post.
get_access ( User $user = null ) : Bitmask Returns an access Bitmask for the given user on this post
get_form ( string $context ) : FormUI Returns a form for editing this post
get_revision_data ( DateTime | string | integer $date ) : array Get the fields of the post that differ from what is stored by date
get_schema_map ( ) : array Get the schema data for this post
get_tokens ( ) : array Returns an array of token ids that are associated with this post Also initializes the internal token array for use by other token operations
get_url_args ( ) : array Returns a set of properties used by URL::get to create URLs
has_tokens ( mixed $tokens ) : mixed Checks if this post has one or more tokens
insert ( ) : integer | null Saves a new post to the posts table
list_active_post_types ( boolean $refresh = false ) : array returns an associative array of active post types
list_all_post_types ( boolean $refresh = false ) : array returns an associative array of all post types
list_post_statuses ( mixed $all = true, boolean $refresh = false ) : array returns an associative array of post statuses
list_revisions ( ) : array List the stored revisions of this post by date and user id
publish ( ) : boolean Updates an existing post to published status
remove_tokens ( array | string $tokens ) Deletes tokens from a post
set_revision ( DateTime | string | integer $date ) Set this post to have the same data as the post on the specified date
set_tokens ( mixed $tokens ) Applies a new set of specific tokens to a post
status ( string | integer $name ) : integer | boolean returns the integer value of the specified post status, or false
status_name ( string | integer $status ) : string | null returns the friendly name of a post status, or null
type ( string | integer $name ) : boolean | integer returns the integer value of the specified post type, or false
type_name ( string | integer $type ) : string returns the friendly name of a post type, or null
update ( boolean $minor = true ) : boolean Updates an existing post in the posts table

비공개 메소드들

메소드 설명
get_author ( ) : User private function get_author() returns a User object for the author of this post
get_comment_feed_link ( ) : string private function get_comment_feed_link Returns the permalink for this post's comments Atom feed
get_comments ( ) : Comments Gets the comments for the post
get_editlink ( ) : string Returns a URL for the ->editlink property of this class.
get_info ( ) : PostInfo function get_info Gets the info object for this post, which contains data from the postinfo table related to this post.
get_permalink ( ) : string Returns a URL for the ->permalink property of this class.
get_tags ( ) : Terms function get_tags Gets the tags for the post
save_tags ( ) : boolean Save the tags associated to this post into the terms and object_terms tables
setguid ( ) Generate the GUID for the new post.
setslug ( ) : string Generate a new slug for the post.
setstatus ( string | integer $value ) : integer | boolean Sets the status for a post, given a string or integer.

메소드 상세

__call() 공개 메소드

Handle calls to this Post object that are implemented by plugins
public __call ( string $name, array $args ) : mixed
$name string The name of the function called
$args array Arguments passed to the function call
리턴 mixed The value returned from any plugin filters, null if no value is returned

__construct() 공개 메소드

Constructor for the Post class.
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial Post field values.

__get() 공개 메소드

Overrides QueryRecord __get to implement custom object properties
public __get ( string $name ) : mixed
$name string Name of property to return
리턴 mixed The requested field value

__isset() 공개 메소드

Overrides QueryRecord __isset to implement custom object properties
public __isset ( string $name ) : boolean
$name string Name of property to return
리턴 boolean true if var is set and not NULL, false otherwise

__set() 공개 메소드

Overrides QueryRecord __set to implement custom object properties
public __set ( string $name, mixed $value ) : mixed
$name string Name of property to return
$value mixed Value to set
리턴 mixed The requested field value

__static() 공개 정적인 메소드

Register plugin hooks
public static __static ( )

activate_post_type() 공개 정적인 메소드

Activate an existing post type
public static activate_post_type ( string $type ) : boolean
$type string The post type to activate
리턴 boolean True on success

add_new_status() 공개 정적인 메소드

inserts a new post status into the database, if it doesn't exist
public static add_new_status ( string $status, boolean $internal = false )
$status string The name of the new post status
$internal boolean Whether this status is for internal use only. If true, this status will NOT be presented to the user

add_new_type() 공개 정적인 메소드

inserts a new post type into the database, if it doesn't exist
public static add_new_type ( string $type, boolean $active = true )
$type string The name of the new post type
$active boolean Whether the new post type is active or not

add_tokens() 공개 메소드

Add a token to a post
public add_tokens ( array | string $tokens )
$tokens array | string The name of the permission to add, or an array of permissions to add

ascend() 공개 메소드

Returns the ascending post, relative to this post, according to params
public ascend ( null $params = null ) : Post
$params null The params by which to work out what is the ascending post
리턴 Post The ascending post

comment_form() 공개 메소드

Manage this post's comment form
public comment_form ( string $context = 'public' ) : FormUI
$context string The context in which the form is used, used to facilitate plugin alteration of the comment form in different circumstances
리턴 FormUI The comment form for this post

content_type() 공개 메소드

Return the content type of this object
또한 보기: IsContent
public content_type ( ) : array
리턴 array An array of content types that this object represents, starting with the most specific

create() 정적인 공개 메소드

Create a post and save it.
static public create ( array $paramarray ) : Post
$paramarray array An associative array of post fields
리턴 Post The new Post object

create_default_tokens() 공개 메소드

Adds the default tokens to this post when it's saved

css_class() 공개 메소드

Returns a list of CSS classes for the post
public css_class ( string | array $append = [] ) : string
$append string | array Additional classes that should be added to the ones generated
리턴 string The resultant classes

deactivate_post_type() 공개 정적인 메소드

Deactivate a post type
public static deactivate_post_type ( string $type ) : boolean
$type string The post type to deactivate
리턴 boolean True on success

default_fields() 공개 정적인 메소드

Return the defined database columns for a Post.
public static default_fields ( ) : array
리턴 array Array of columns in the Post table

delete() 공개 메소드

Deletes this post instance
public delete ( ) : boolean
리턴 boolean True on success

delete_post_status() 공개 정적인 메소드

Delete a post status
public static delete_post_status ( string $status )
$status string The name of the status to delete

delete_post_type() 공개 정적인 메소드

removes a post type from the database, if it exists and there are no posts of the type
public static delete_post_type ( string $type ) : boolean
$type string The post type name
리턴 boolean true if post type has been deleted false if it has not been deleted (does not exist or there are posts using this content type)

delete_tokens() 공개 메소드

Deletes all tokens from a post
public delete_tokens ( )

descend() 공개 메소드

Returns the descending post, relative to this post, according to params
public descend ( $params = null ) : Post
$params The params by which to work out what is the descending post
리턴 Post The descending post

field_load() 공개 메소드

Loads form values from this post
public field_load ( string $key ) : mixed
$key string The name of a form component that will be loaded
리턴 mixed The stored value returned

field_save() 공개 메소드

Stores a form value into this post's info records
public field_save ( string $key, mixed $value )
$key string The name of a form component that will be stored
$value mixed The value of the form component to store

filter_post_get_7() 공개 정적인 메소드

Filter post content and titles for shortcodes
public static filter_post_get_7 ( string $content, string $field, Post $post ) : string
$content string The field value to filter
$field string The name of the field to filter
$post Post The post that is being filtered
리턴 string The fitlered field value

filter_post_status_display_4() 공개 정적인 메소드

How to display the built-in post statuses.
public static filter_post_status_display_4 ( string $status ) : string
$status string The built-in status name
리턴 string The translated status name, or the built-in name if there is no translation

filter_post_type_display_4() 공개 정적인 메소드

How to display the built-in post types.
public static filter_post_type_display_4 ( string $type, string $foruse ) : string
$type string The type of Post
$foruse string Either 'singular' or 'plural'
리턴 string The translated type name, or the built-in name if there is no translation

form_publish_delete() 공개 메소드

The on_success handler for the delete button on the post editing form
public form_publish_delete ( FormUI $form )
$form FormUI The submitted post editing form

form_publish_success() 공개 메소드

Called when the publish form is successfully submitted
public form_publish_success ( FormUI $form )
$form FormUI

get() 정적인 공개 메소드

$post= Post::get( array( 'slug' => 'wooga' ) );
static public get ( array $paramarray = [] ) : Post
$paramarray array An associative array of parameters, or a querystring
리턴 Post The first post that matched the given criteria

get_access() 공개 메소드

Returns an access Bitmask for the given user on this post
public get_access ( User $user = null ) : Bitmask
$user User The user mask to fetch
리턴 Bitmask

get_form() 공개 메소드

Returns a form for editing this post
public get_form ( string $context ) : FormUI
$context string The context the form is being created in, most often 'admin'
리턴 FormUI A form appropriate for creating and updating this post.

get_revision_data() 공개 메소드

Get the fields of the post that differ from what is stored by date
public get_revision_data ( DateTime | string | integer $date ) : array
$date DateTime | string | integer The date to fetch the revision of
리턴 array An array of field data for the post with the values of those fields at the specified date

get_schema_map() 공개 메소드

Get the schema data for this post
public get_schema_map ( ) : array
리턴 array An array of schema data for this post

get_tokens() 공개 메소드

Returns an array of token ids that are associated with this post Also initializes the internal token array for use by other token operations
public get_tokens ( ) : array
리턴 array An array of token ids

get_url_args() 공개 메소드

Returns a set of properties used by URL::get to create URLs
public get_url_args ( ) : array
리턴 array Properties of this post used to build a URL

has_tokens() 공개 메소드

Checks if this post has one or more tokens
public has_tokens ( mixed $tokens ) : mixed
$tokens mixed A single token string or an array of tokens
리턴 mixed false if no tokens match, an array of matching token ids if any match

insert() 공개 메소드

Saves a new post to the posts table
public insert ( ) : integer | null
리턴 integer | null The new post id on success, or false on failure

list_active_post_types() 공개 정적인 메소드

returns an associative array of active post types
public static list_active_post_types ( boolean $refresh = false ) : array
$refresh boolean whether to force a refresh of the cached values
리턴 array An array of post type names => integer values

list_all_post_types() 공개 정적인 메소드

returns an associative array of all post types
public static list_all_post_types ( boolean $refresh = false ) : array
$refresh boolean whether to force a refresh of the cached values
리턴 array An array of post type names => (integer values, active values)

list_post_statuses() 공개 정적인 메소드

returns an associative array of post statuses
public static list_post_statuses ( mixed $all = true, boolean $refresh = false ) : array
$all mixed true to list all statuses, not just external ones, Post to list external and any that match the Post status
$refresh boolean true to force a refresh of the cached values
리턴 array An array of post statuses names => integer values

list_revisions() 공개 메소드

List the stored revisions of this post by date and user id
public list_revisions ( ) : array
리턴 array

publish() 공개 메소드

Updates an existing post to published status
public publish ( ) : boolean
리턴 boolean True on success, false if not

remove_tokens() 공개 메소드

Deletes tokens from a post
public remove_tokens ( array | string $tokens )
$tokens array | string The name of the permission to remove, or an array of permissions to remove

set_revision() 공개 메소드

Set this post to have the same data as the post on the specified date
public set_revision ( DateTime | string | integer $date )
$date DateTime | string | integer The date to fetch the revision of

set_tokens() 공개 메소드

Applies a new set of specific tokens to a post
public set_tokens ( mixed $tokens )
$tokens mixed A string token, or an array of tokens to apply to this post

status() 공개 정적인 메소드

returns the integer value of the specified post status, or false
public static status ( string | integer $name ) : integer | boolean
$name string | integer a post status name or value
리턴 integer | boolean an integer or boolean false

status_name() 공개 정적인 메소드

returns the friendly name of a post status, or null
public static status_name ( string | integer $status ) : string | null
$status string | integer a post status value, or name
리턴 string | null a string of the status name, or null

type() 공개 정적인 메소드

returns the integer value of the specified post type, or false
public static type ( string | integer $name ) : boolean | integer
$name string | integer a post type name or id
리턴 boolean | integer the id of the type or false if not found

type_name() 공개 정적인 메소드

returns the friendly name of a post type, or null
public static type_name ( string | integer $type ) : string
$type string | integer a post type name or id
리턴 string the string of the type or emptystring if not found

update() 공개 메소드

Updates an existing post in the posts table
public update ( boolean $minor = true ) : boolean
$minor boolean Indicates if this is a major or minor update
리턴 boolean True on success

프로퍼티 상세

$post_status_list 정적으로 공개적으로 프로퍼티

static variables to hold post status and post type values
static public $post_status_list

$post_type_list_active 정적으로 공개적으로 프로퍼티

static public $post_type_list_active

$post_type_list_all 정적으로 공개적으로 프로퍼티

static public $post_type_list_all

$schema 공개적으로 프로퍼티

public $schema

$url_args 보호되어 있는 프로퍼티

protected $url_args