Class Posts

Description

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).

Located in /system/classes/posts.php (line 21)

ArrayObject
   |
   --Posts
Variable Summary
Method Summary
static Post ascend ( $post, [ $params = null])
static array by_slug ([string $slug = ''])
static array by_status (int $status)
static void count_by_author ([ $user_id = ''],  $status)
static int count_by_tag ([string $tag = ''], mixed $status)
static void count_total ( $status)
static Post descend ( $post, [ $params = null])
static array get ([ $paramarray = array()], array $paramarry)
static void publish_scheduled_posts ( $params)
static bool reassign (mixed $user, mixed $posts)
static array search_to_get (string $search_string)
void count_all ()
mixed search (Post $needle)
void __get (string $name)
Variables
mixed $get_param_cache (line 23)
  • access: public
Methods
static method ascend (line 642)

Returns an ascending post

  • return: The ascending post
  • access: public
static Post ascend ( $post, [ $params = null])
  • $post
  • $params
static method by_slug (line 501)

function by_slug

select all post content by slug

  • return: an array of post content
  • access: public
static array by_slug ([string $slug = ''])
  • string $slug: a post slug
static method by_status (line 489)

function by_status

select all posts of a given status

  • return: an array of Comment objects with the same status
  • access: public
static array by_status (int $status)
  • int $status: a status value
static method count_by_author (line 535)
  • access: public
static void count_by_author ([ $user_id = ''],  $status)
  • $user_id
  • $status
static method count_by_tag (line 551)

static count_by_tag

return a count of the number of posts with the assigned tag

  • return: the number of posts with the specified tag
  • access: public
static int count_by_tag ([string $tag = ''], mixed $status)
  • string $tag: A tag
  • mixed $status: a status value to filter posts by; if FALSE, then no filtering will be performed
static method count_total (line 512)
  • access: public
static void count_total ( $status)
  • $status
static method descend (line 675)

Returns a descending post

  • return: The descending post
  • access: public
static Post descend ( $post, [ $params = null])
  • $post
  • $params
static method get (line 54)

Returns a post or posts based on supplied parameters.

THIS CLASS SHOULD CACHE QUERY RESULTS!

  • return: An array of Post objects, or a single post object, depending on request
  • access: public
static array get ([ $paramarray = array()], array $paramarry)
  • array $paramarry: An associated array of parameters, or a querystring
  • $paramarray
static method publish_scheduled_posts (line 609)

function publish_scheduled_posts

Callback function to publish scheduled posts

  • access: public
static void publish_scheduled_posts ( $params)
  • $params
static method reassign (line 566)

Reassigns the author of a specified set of posts

  • return: Whether the rename operation succeeded or not
  • access: public
static bool reassign (mixed $user, mixed $posts)
  • mixed $user: a user ID or name
  • mixed $posts: an array of post IDs, an array of Post objects, or an instance of Posts
static method search_to_get (line 721)

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.

  • return: An associative array which can be passed to Posts::get()
  • access: public
static array search_to_get (string $search_string)
  • string $search_string: The search string
static method update_scheduled_posts_cronjob (line 625)

function update_scheduled_posts_cronjob

Creates or recreates the cronjob to publish scheduled posts. It is called whenever a post is updated or created

  • access: public
static void update_scheduled_posts_cronjob ()
count_all (line 522)
  • access: public
void count_all ()
search (line 707)

Search this Posts object for the needle, returns its key if found

  • return: Returns the index of the needle, on failure, null is returned
  • access: public
mixed search (Post $needle)
  • Post $needle: Post object to find within this Posts object
__get (line 37)

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.

  • access: public
void __get (string $name)
  • string $name: The name of the property to return.

Inherited Methods

Inherited From ArrayObject (Internal Class)

constructor __construct ( $array )
append ( $value )
asort ( )
count ( )
exchangeArray ( $array )
getArrayCopy ( )
getFlags ( )
getIterator ( )
getIteratorClass ( )
ksort ( )
natcasesort ( )
natsort ( )
offsetExists ( $index )
offsetGet ( $index )
offsetSet ( $index, $newval )
offsetUnset ( $index )
setFlags ( $flags )
setIteratorClass ( $iteratorClass )
uasort ( $cmp_function )
uksort ( $cmp_function )
Class Constants

Inherited Constants

Inherited from ArrayObject (Internal Class)

ARRAY_AS_PROPS = 2
STD_PROP_LIST = 1

Documentation generated on Thu, 30 Oct 2008 20:31:24 +0100 by phpDocumentor 1.3.2