Public Member Functions | Static Public Member Functions | 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())
 insert ()
 update ($minor=true)
 delete ()
 publish ()
 __get ($name)
 __set ($name, $value)
 __call ($name, $args)
 get_form ($context)
 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)

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 get ($paramarray=array())
static create ($paramarray)

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

Includes an instance of the PostInfo class; for holding inforecords about a Post If the Post object describes an existing post; use the internal info object to get, set, unset and test for existence (isset) of info records. $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

Definition at line 21 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 351 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 791 of file post.php.

Post::__get ( name  ) 

function __get Overrides QueryRecord __get to implement custom object properties

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

Definition at line 695 of file post.php.

Post::__set ( name,
value 
)

function __set Overrides QueryRecord __set to implement custom object properties

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

Definition at line 759 of file post.php.

static Post::activate_post_type ( type  )  [static]

Activate an existing post type

Parameters:
string The post type to activate

Definition at line 89 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 The name of the new post status
bool Whether this status is for internal use only. If true, this status will NOT be presented to the user
Returns:
none

Definition at line 295 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 The name of the new post type
bool Whether the new post type is active or not
Returns:
none

Definition at line 233 of file post.php.

Post::add_tokens ( tokens  ) 

Add a token to a post

Parameters:
mixed $token The name of the permission to add, or an array of permissions to add

Definition at line 1245 of file post.php.

Referenced by create_default_tokens().

Post::ascend ( params = null  ) 

Returns the ascending post, relative to this post, according to params The params by which to work out what is the ascending post

Returns:
Post The ascending post

Definition at line 1187 of file post.php.

Post::comment_form ( context = 'public'  ) 

Manage this post's comment form

Parameters:
String context // What is $context for ?
Returns:
FormUI The comment form for this post

Definition at line 919 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

Implements IsContent.

Definition at line 1208 of file post.php.

Referenced by __get(), create_default_tokens(), get_access(), get_form(), 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 405 of file post.php.

Post::create_default_tokens (  ) 

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

Definition at line 1216 of file post.php.

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 1055 of file post.php.

static Post::deactivate_post_type ( type  )  [static]

Deactivate a post type

Parameters:
string The post type to deactivate

Definition at line 112 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 329 of file post.php.

Referenced by Posts::get(), and Posts::publish_scheduled_posts().

Post::delete (  ) 

function delete Deletes an existing post

Definition at line 617 of file post.php.

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

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 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 263 of file post.php.

Post::delete_tokens (  ) 

Deletes all tokens from a post

Definition at line 1262 of file post.php.

Referenced by delete().

Post::descend ( params = null  ) 

Returns the descending post, relative to this post, according to params The params by which to work out what is the descending post

Returns:
Post The descending post

Definition at line 1197 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 379 of file post.php.

Referenced by FeedbackHandler::act_add_comment(), AdminHandler::act_admin(), FeedbackHandler::add_comment(), comment_form(), AtomHandler::delete_entry(), AtomHandler::get_comments(), AtomHandler::get_entry(), AdminPostsHandler::get_publish(), AdminPostsHandler::post_delete_post(), 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 1319 of file post.php.

Referenced by get_form().

Post::get_form ( context  ) 

Returns a form for editing this post

Parameters:
string $context The context the form is being created in, most often 'admin'
Returns:
FormUI A form appropriate for creating and updating this post.

Definition at line 802 of file post.php.

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 1306 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 1171 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 1229 of file post.php.

Post::insert (  ) 

function insert Saves a new post to the posts table

Definition at line 518 of file post.php.

Referenced by add_tokens(), and set_tokens().

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

returns an associative array of active post types

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

Definition at line 42 of file post.php.

Referenced by CoreBlocks::action_block_form_recent_posts(), add_new_type(), ACL::create_default_tokens(), deactivate_post_type(), delete_post_type(), 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 whether to force a refresh of the cached values
Returns:
array An array of post type names => (integer values, active values)

Definition at line 64 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 => interger values

Definition at line 131 of file post.php.

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

Post::publish (  ) 

function publish Updates an existing post to published status

Returns:
boolean True on success, false if not

Definition at line 657 of file post.php.

Post::remove_tokens ( tokens  ) 

Deletes tokens from a post

Parameters:
mixed $token The name of the permission to remove, or an array of permissions to remove

Definition at line 1272 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 1288 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:
mixed a post status value, or name
Returns:
mixed a string of the status name, or null

Definition at line 181 of file post.php.

Referenced by __get().

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

returns the friendly name of a post type, or null

Parameters:
mixed a post type number, or name
Returns:
mixed a string of the post type, or null

Definition at line 215 of file post.php.

Referenced by __get(), AdminHandler::act_admin(), Theme::act_display(), content_type(), get_access(), Comment::get_access(), AtomHandler::get_comments(), get_form(), AdminPostsHandler::get_publish(), get_url_args(), insert(), and AdminPostsHandler::post_delete_post().

Post::update ( minor = true  ) 

function update Updates an existing post in the posts table

Parameters:
bool $minor Indicates if this is a major or minor update

Definition at line 561 of file post.php.


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