Inheritance diagram for Posts:
Collaboration diagram for Posts:Public Member Functions | |
| __get ($name) | |
| count_all () | |
| search ($needle) | |
| content_type () | |
Static Public Member Functions | |
| static | get ($paramarray=array()) |
| static | by_status ($status) |
| static | by_slug ($slug= '') |
| static | count_total ($status=false) |
| static | count_by_author ($user_id, $status=false) |
| static | count_by_tag ($tag, $status=false) |
| static | reassign ($user, $posts) |
| static | publish_scheduled_posts ($params) |
| static | update_scheduled_posts_cronjob () |
| static | ascend ($post, $params=null) |
| static | descend ($post, $params=null) |
| static | search_to_get ($search_string) |
| static | rewrite_match_type ($rule, $slug, $parameters) |
Public Attributes | |
| $get_param_cache | |
class Posts This class provides two key features. 1: Posts contains static method get() that returns the requested posts based on the passed criteria. Depending on the type of request, different types are returned. See the function for details 2: An instance of Posts functions as an array (by extending ArrayObject) and is returned by Posts::get() as the results of a query. This allows the result of Posts::get() to be iterated (for example, in a foreach construct) and to have properties that can be accessed that describe the results (for example, $posts->onepost).
Definition at line 21 of file posts.php.
| Posts::__get | ( | $ | name | ) |
function __get Returns properties of a Posts object. This is the function that returns information about the set of posts that was requested. This function should offer property names that are identical to properties of instances of the URL class. A call to Posts::get() without parameters should return mostly the same property values as the global $url object for the request. The difference would occur when the data returned doesn't necessarily match the request, such as when several posts are requested, but only one is available to return.
| string | The name of the property to return. |
| static Posts::ascend | ( | $ | post, | |
| $ | params = null | |||
| ) | [static] |
| static Posts::by_slug | ( | $ | slug = '' |
) | [static] |
| static Posts::by_status | ( | $ | status | ) | [static] |
| Posts::content_type | ( | ) |
| Posts::count_all | ( | ) |
| static Posts::count_by_author | ( | $ | user_id, | |
| $ | status = false | |||
| ) | [static] |
static count_by_author return a count of the number of posts by the specified author
| int | an author ID | |
| mixed | a status value to filter posts by; if false, then no filtering will be performed |
Definition at line 894 of file posts.php.
Referenced by User::count_posts().
| static Posts::count_by_tag | ( | $ | tag, | |
| $ | status = false | |||
| ) | [static] |
static count_by_tag return a count of the number of posts with the assigned tag
| string | A tag | |
| mixed | a status value to filter posts by; if false, then no filtering will be performed |
Definition at line 910 of file posts.php.
Referenced by CoreBlocks::action_block_content_tag_archives(), and Tag::rewrite_tag_exists().
| static Posts::count_total | ( | $ | status = false |
) | [static] |
static count_total return a count for the total number of posts
| mixed | a status value to filter posts by; if false, then no filtering will be performed |
Definition at line 868 of file posts.php.
Referenced by AtomHandler::get_collection().
| static Posts::descend | ( | $ | post, | |
| $ | params = null | |||
| ) | [static] |
| static Posts::get | ( | $ | paramarray = array() |
) | [static] |
Returns a post or posts based on supplied parameters.
| array | $paramarray An associative array of parameters, or a querystring. The following keys are supported:
|
Further description of parameters, including usage examples, can be found at http://wiki.habariproject.org/en/Dev:Retrieving_Posts
Build the statement needed to filter by pubdate: If we've got the day, then get the date; If we've got the month, but no date, get the month; If we've only got the year, get the whole year.
Determine which fetch function to use: If it is specified, make sure it is valid (based on the $fns array defined at the beginning of this function); Else, use 'get_results' which will return a Posts array of Post objects.
Turn the requested fields into a comma-separated SELECT field clause
If a count is requested: Replace the current fields to select with a COUNT(); Change the fetch function to 'get_value'; Remove the ORDER BY since it's useless. Remove the GROUP BY (tag search added it)
Build the final SQL statement
DEBUG: Uncomment the following line to display everything that happens in this function
Execute the SQL statement using the PDO extension
Return the results
Definition at line 104 of file posts.php.
Referenced by Theme::act_display(), Charcoal::action_block_content_charcoal_menu(), K2::action_block_content_k2_menu(), CoreBlocks::action_block_content_monthly_archives(), CoreBlocks::action_block_content_recent_posts(), Mzingi::add_template_vars(), K2::add_template_vars(), Charcoal::add_template_vars(), AdminPostsHandler::ajax_update_posts(), ascend(), by_slug(), by_status(), count_all(), count_by_author(), count_by_tag(), count_total(), descend(), CoreDashModules::filter_dash_module_latest_entries(), AdminUsersHandler::form_user_success(), AtomHandler::get_collection(), AdminDashboardHandler::get_dashboard(), reassign(), rewrite_match_type(), and AdminUsersHandler::update_users().
| static Posts::publish_scheduled_posts | ( | $ | params | ) | [static] |
| static Posts::reassign | ( | $ | user, | |
| $ | posts | |||
| ) | [static] |
Reassigns the author of a specified set of posts
| mixed | a user ID or name | |
| mixed | an array of post IDs, an array of Post objects, or an instance of Posts |
Definition at line 925 of file posts.php.
Referenced by AdminUsersHandler::form_user_success(), and AdminUsersHandler::update_users().
| static Posts::rewrite_match_type | ( | $ | rule, | |
| $ | slug, | |||
| $ | parameters | |||
| ) | [static] |
| Posts::search | ( | $ | needle | ) |
| static Posts::search_to_get | ( | $ | search_string | ) | [static] |
Parses a search string for status, type, author, and tag keywords. Returns an associative array which can be passed to Posts::get(). If multiple authors, statuses, tags, or types are specified, we assume an implicit OR such that (e.g.) any author that matches would be returned.
| string | $search_string The search string |
| static Posts::update_scheduled_posts_cronjob | ( | ) | [static] |
function update_scheduled_posts_cronjob
Creates or recreates the cronjob to publish scheduled posts. It is called whenever a post is updated or created
Definition at line 994 of file posts.php.
Referenced by Post::delete(), Post::insert(), and Post::update().
1.7.1