Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes

Post Class Reference

Inheritance diagram for Post:
Collaboration diagram for Post:

List of all members.

Public Member Functions

 __construct ($paramarray=array())
 get_schema_map ()
 insert ()
 update ($minor=true)
 delete ()
 publish ()
 __get ($name)
 __set ($name, $value)
 __call ($name, $args)
 form_publish_delete (FormUI $form)
 comment_form ($context= 'public')
 css_class ($append=array())
 get_url_args ()
 ascend ($params=null)
 descend ($params=null)
 content_type ()
 create_default_tokens ()
 has_tokens ($tokens)
 add_tokens ($tokens)
 delete_tokens ()
 remove_tokens ($tokens)
 set_tokens ($tokens)
 get_tokens ()
 get_access ($user=null)
 get_revision_data ($date)
 list_revisions ()
 set_revision ($date)
 field_save ($key, $value)
 field_load ($key)

Static Public Member Functions

static list_active_post_types ($refresh=false)
static list_all_post_types ($refresh=false)
static activate_post_type ($type)
static deactivate_post_type ($type)
static list_post_statuses ($all=true, $refresh=false)
static status ($name)
static status_name ($status)
static type ($name)
static type_name ($type)
static add_new_type ($type, $active=true)
static delete_post_type ($type)
static add_new_status ($status, $internal=false)
static delete_post_status ($status)
static default_fields ()
static __static ()
static get ($paramarray=array())
static create ($paramarray)
static filter_post_type_display_4 ($type, $foruse)
static filter_post_status_display_4 ($status)
static filter_post_get_7 ($content, $field, $post)

Public Attributes

 $schema

Static Public Attributes

static $post_status_list = array()
static $post_type_list_active = array()
static $post_type_list_all = array()

Protected Attributes

 $url_args

Detailed Description

Definition at line 47 of file post.php.


Constructor & Destructor Documentation

Post::__construct ( paramarray = array()  ) 

Constructor for the Post class.

Parameters:
array $paramarray an associative array of initial Post field values.

Definition at line 386 of file post.php.


Member Function Documentation

Post::__call ( name,
args 
)

Handle calls to this Post object that are implemented by plugins

Parameters:
string $name The name of the function called
array $args Arguments passed to the function call
Returns:
mixed The value returned from any plugin filters, null if no value is returned

Definition at line 942 of file post.php.

Post::__get ( name  ) 

Overrides QueryRecord __get to implement custom object properties

Parameters:
string $name Name of property to return
Returns:
mixed The requested field value

Definition at line 824 of file post.php.

Post::__set ( name,
value 
)

Overrides QueryRecord __set to implement custom object properties

Parameters:
string $name Name of property to return
mixed $value Value to set
Returns:
mixed The requested field value

Definition at line 910 of file post.php.

static Post::__static (  )  [static]

Register plugin hooks

Definition at line 408 of file post.php.

static Post::activate_post_type ( type  )  [static]

Activate an existing post type

Parameters:
string $type The post type to activate
Returns:
bool True on success

Definition at line 119 of file post.php.

Referenced by add_new_type().

static Post::add_new_status ( status,
internal = false 
) [static]

inserts a new post status into the database, if it doesn't exist

Parameters:
string $status The name of the new post status
bool $internal Whether this status is for internal use only. If true, this status will NOT be presented to the user

Definition at line 324 of file post.php.

Referenced by Undelete::action_plugin_activation().

static Post::add_new_type ( type,
active = true 
) [static]

inserts a new post type into the database, if it doesn't exist

Parameters:
string $type The name of the new post type
bool $active Whether the new post type is active or not

Definition at line 263 of file post.php.

Post::add_tokens ( tokens  ) 

Add a token to a post

Parameters:
array|string $tokens The name of the permission to add, or an array of permissions to add

Definition at line 1592 of file post.php.

Referenced by create_default_tokens().

Post::ascend ( params = null  ) 

Returns the ascending post, relative to this post, according to params

Parameters:
null $params The params by which to work out what is the ascending post
Returns:
Post The ascending post

Definition at line 1532 of file post.php.

Post::comment_form ( context = 'public'  ) 

Manage this post's comment form

Parameters:
string $context The context in which the form is used, used to facilitate plugin alteration of the comment form in different circumstances
Returns:
FormUI The comment form for this post

Definition at line 1253 of file post.php.

Post::content_type (  ) 

Return the content type of this object

Returns:
array An array of content types that this object represents, starting with the most specific
See also:
IsContent

Definition at line 1553 of file post.php.

Referenced by __get(), create_default_tokens(), get_access(), get_url_args(), and insert().

static Post::create ( paramarray  )  [static]

Create a post and save it.

Parameters:
array $paramarray An associative array of post fields
Returns:
Post The new Post object

Definition at line 451 of file post.php.

Referenced by __set(), insert(), publish(), and update().

Post::create_default_tokens (  ) 

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

Definition at line 1563 of file post.php.

Referenced by insert().

Post::css_class ( append = array()  ) 

Returns a list of CSS classes for the post

Parameters:
string|array $append Additional classes that should be added to the ones generated
Returns:
string The resultant classes

Definition at line 1400 of file post.php.

static Post::deactivate_post_type ( type  )  [static]

Deactivate a post type

Parameters:
string $type The post type to deactivate
Returns:
bool True on success

Definition at line 143 of file post.php.

static Post::default_fields (  )  [static]

Return the defined database columns for a Post.

Returns:
array Array of columns in the Post table

Definition at line 363 of file post.php.

Referenced by field_save(), Posts::get(), and get_schema_map().

Post::delete (  ) 

Deletes this post instance

Returns:
bool True on success

Definition at line 748 of file post.php.

Referenced by delete_post_type(), delete_tokens(), remove_tokens(), and set_tokens().

static Post::delete_post_status ( status  )  [static]

Delete a post status

Parameters:
string $status The name of the status to delete

Definition at line 343 of file post.php.

static Post::delete_post_type ( type  )  [static]

removes a post type from the database, if it exists and there are no posts of the type

Parameters:
string $type The post type name
Returns:
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)

Definition at line 293 of file post.php.

Post::delete_tokens (  ) 

Deletes all tokens from a post

Definition at line 1610 of file post.php.

Referenced by delete().

Post::descend ( params = null  ) 

Returns the descending post, relative to this post, according to params

Parameters:
$params The params by which to work out what is the descending post
Returns:
Post The descending post

Definition at line 1542 of file post.php.

Post::field_load ( key  ) 

Loads form values from this post

Parameters:
string $key The name of a form component that will be loaded
Returns:
mixed The stored value returned

Implements FormStorage.

Definition at line 1858 of file post.php.

Post::field_save ( key,
value 
)

Stores a form value into this post's info records

Parameters:
string $key The name of a form component that will be stored
mixed $value The value of the form component to store

Implements FormStorage.

Definition at line 1827 of file post.php.

static Post::filter_post_get_7 ( content,
field,
post 
) [static]

Filter post content and titles for shortcodes

Parameters:
string $content The field value to filter
string $field The name of the field to filter
Post $post The post that is being filtered
Returns:
string The fitlered field value

Definition at line 1812 of file post.php.

static Post::filter_post_status_display_4 ( status  )  [static]

How to display the built-in post statuses.

Parameters:
string $status The built-in status name
Returns:
string The translated status name, or the built-in name if there is no translation

Definition at line 1794 of file post.php.

static Post::filter_post_type_display_4 ( type,
foruse 
) [static]

How to display the built-in post types.

Parameters:
string $type The type of Post
string $foruse Either 'singular' or 'plural'
Returns:
string The translated type name, or the built-in name if there is no translation

Definition at line 1773 of file post.php.

Post::form_publish_delete ( FormUI form  ) 

The on_success handler for the delete button on the post editing form

Parameters:
FormUI $form The submitted post editing form

Definition at line 1237 of file post.php.

static Post::get ( paramarray = array()  )  [static]

Return a single requested post.

$post= Post::get( array( 'slug' => 'wooga' ) );

Parameters:
array $paramarray An associative array of parameters, or a querystring
Returns:
Post The first post that matched the given criteria

Definition at line 423 of file post.php.

Referenced by AdminHandler::act(), FeedbackHandler::act_add_comment(), FeedbackHandler::add_comment(), comment_form(), AtomHandler::delete_entry(), Menus::filter_menu_type_data(), AtomHandler::get_comments(), AtomHandler::get_entry(), AdminPostsHandler::get_publish(), AtomHandler::put_entry(), and Pingback::xmlrpc_pingback__ping().

Post::get_access ( user = null  ) 

Returns an access Bitmask for the given user on this post

Parameters:
User $user The user mask to fetch
Returns:
Bitmask

Definition at line 1667 of file post.php.

Post::get_revision_data ( date  ) 

Get the fields of the post that differ from what is stored by date

Parameters:
DateTime|string|int $date The date to fetch the revision of
Returns:
array An array of field data for the post with the values of those fields at the specified date

Definition at line 1722 of file post.php.

Referenced by set_revision().

Post::get_schema_map (  ) 

Get the schema data for this post

Returns:
array An array of schema data for this post

Definition at line 583 of file post.php.

Referenced by insert().

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

Returns:
array An array of token ids

Definition at line 1654 of file post.php.

Referenced by add_tokens(), get_access(), has_tokens(), and remove_tokens().

Post::get_url_args (  ) 

Returns a set of properties used by URL::get to create URLs

Returns:
array Properties of this post used to build a URL

Definition at line 1515 of file post.php.

Post::has_tokens ( tokens  ) 

Checks if this post has one or more tokens

Parameters:
mixed $tokens A single token string or an array of tokens
Returns:
mixed false if no tokens match, an array of matching token ids if any match

Definition at line 1576 of file post.php.

Post::insert (  ) 

Saves a new post to the posts table

Returns:
int|null The new post id on success, or false on failure

Definition at line 606 of file post.php.

Referenced by add_tokens(), set_tokens(), and update().

static Post::list_active_post_types ( refresh = false  )  [static]

returns an associative array of active post types

Parameters:
bool $refresh whether to force a refresh of the cached values
Returns:
array An array of post type names => integer values

Definition at line 71 of file post.php.

Referenced by ACL::_filter_token_description_display(), CoreBlocks::action_block_form_recent_posts(), add_new_type(), ACL::create_default_tokens(), deactivate_post_type(), delete_post_type(), CoreDashModules::filter_dash_module_post_types_and_statuses(), Posts::get(), Comments::get(), AdminHandler::get_main_menu(), AdminPostsHandler::post_posts(), Posts::search_to_get(), type(), and type_name().

static Post::list_all_post_types ( refresh = false  )  [static]

returns an associative array of all post types

Parameters:
bool $refresh whether to force a refresh of the cached values
Returns:
array An array of post type names => (integer values, active values)

Definition at line 93 of file post.php.

Referenced by activate_post_type(), add_new_type(), and delete_post_type().

static Post::list_post_statuses ( all = true,
refresh = false 
) [static]

returns an associative array of post statuses

Parameters:
mixed $all true to list all statuses, not just external ones, Post to list external and any that match the Post status
boolean $refresh true to force a refresh of the cached values
Returns:
array An array of post statuses names => integer values

Definition at line 162 of file post.php.

Referenced by add_new_status(), delete_post_status(), CoreDashModules::filter_dash_module_post_types_and_statuses(), AdminPostsHandler::get_publish(), AdminPostsHandler::post_posts(), Posts::search_to_get(), status(), and status_name().

Post::list_revisions (  ) 

List the stored revisions of this post by date and user id

Returns:
array

Definition at line 1741 of file post.php.

Post::publish (  ) 

Updates an existing post to published status

Returns:
boolean True on success, false if not

Definition at line 787 of file post.php.

Post::remove_tokens ( tokens  ) 

Deletes tokens from a post

Parameters:
array|string $tokens The name of the permission to remove, or an array of permissions to remove

Definition at line 1620 of file post.php.

Post::set_revision ( date  ) 

Set this post to have the same data as the post on the specified date

Parameters:
DateTime|string|int $date The date to fetch the revision of

Definition at line 1756 of file post.php.

Post::set_tokens ( tokens  ) 

Applies a new set of specific tokens to a post

Parameters:
mixed $tokens A string token, or an array of tokens to apply to this post

Definition at line 1636 of file post.php.

static Post::status ( name  )  [static]
static Post::status_name ( status  )  [static]

returns the friendly name of a post status, or null

Parameters:
string|integer $status a post status value, or name
Returns:
string|null a string of the status name, or null

Definition at line 212 of file post.php.

Referenced by __get(), and CoreDashModules::filter_dash_module_post_types_and_statuses().

static Post::type ( name  )  [static]
static Post::type_name ( type  )  [static]

returns the friendly name of a post type, or null

Parameters:
string|integer $type a post type name or id
Returns:
string the string of the type or emptystring if not found

Definition at line 246 of file post.php.

Referenced by __get(), AdminHandler::act(), Theme::act_display(), content_type(), form_publish_delete(), get_access(), Comment::get_access(), AtomHandler::get_comments(), AdminPostsHandler::get_publish(), get_schema_map(), get_url_args(), and insert().

Post::update ( minor = true  ) 

Updates an existing post in the posts table

Parameters:
bool $minor Indicates if this is a major or minor update
Returns:
bool True on success

Definition at line 663 of file post.php.


The documentation for this class was generated from the following file: