PHP Class Jonah_Driver, horde

Copyright 2002-2014 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (BSD). If you did not did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.
Author: Chuck Hagenbuch ([email protected])
Author: Marko Djukic ([email protected])
Author: Jan Schneider ([email protected])
Author: Ben Klang ([email protected])
Author: Michael J. Rubinsky ([email protected])
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_params array Hash containing connection parameters.

Public Methods

Method Description
__construct ( array $params = [] ) Constructs a new Driver storage object.
deleteChannel ( array $info ) Remove a channel from storage.
getChannel ( integer $channel_id ) : array Fetches the requested channel, while actually passing on the request to the backend _getChannel() function to do the real work.
getChannels ( ) : array Get a list of stored channels.
getChecksum ( $story )
getIdBySlug ( $channel )
getIntervalLabel ( $seconds = null )
getStories ( integer $criteria, integer $order = Jonah::ORDER_PUBLISHED ) : array Returns the most recent or all stories from a channel.
getStory ( integer $story_id, boolean $read = false ) : array Retrieve the requested story from storage.
getStoryIdsByChannel ( integer $channel_id ) : array Return a list of story_ids contained in the specified channel.
getStoryLink ( array $channel, array $story ) : Horde_Url Returns the official link to a story.
listTagInfo ( $channel_id = null )
renderChannel ( integer $channel_id, string $tpl, integer $max = 10, integer $from, integer $order = Jonah::ORDER_PUBLISHED ) : string Returns the stories of a channel rendered with the specified template.
saveStory ( array &$info ) Save the provided story to storage.

Protected Methods

Method Description
_escapeStories ( &$value, $key )
_escapeStoryDescriptions ( &$value, $key )
getStoryAsMessage ( array $story ) : MIME_Part Returns the provided story as a MIME part.

Method Details

__construct() public method

Constructs a new Driver storage object.
public __construct ( array $params = [] )
$params array A hash containing connection parameters.

_escapeStories() protected method

protected _escapeStories ( &$value, $key )

_escapeStoryDescriptions() protected method

protected _escapeStoryDescriptions ( &$value, $key )

deleteChannel() public method

Remove a channel from storage.
public deleteChannel ( array $info )
$info array A channel info array. (@TODO: Look at passing just the id?)

getChannel() public method

Fetches the requested channel, while actually passing on the request to the backend _getChannel() function to do the real work.
public getChannel ( integer $channel_id ) : array
$channel_id integer The channel id to fetch.
return array The channel details as an array

getChannels() public method

Get a list of stored channels.
public getChannels ( ) : array
return array An array of channel hashes.

getChecksum() public method

public getChecksum ( $story )

getIdBySlug() public method

public getIdBySlug ( $channel )

getIntervalLabel() public method

public getIntervalLabel ( $seconds = null )

getStories() public method

Returns the most recent or all stories from a channel.
public getStories ( integer $criteria, integer $order = Jonah::ORDER_PUBLISHED ) : array
$criteria integer An associative array of attributes on which the resulting stories should be filtered. Examples: 'channel' => (string) Channel slug 'channel_id' => (integer) Channel ID (Either an id or slug is required) 'author' => (string) Story author 'updated-min' => (Horde_Date) Only return stories updated on or after this date 'updated-max' => (Horde_Date) Only return stories updatedon or before this date 'published-min' => (Horde_Date) Only return stories published on or after this date 'published-max' => (Horde_Date) Only return stories published on or before date 'tags' => (array) Tag names that must match to be included 'keywords' => (array) Strings which must match to be included 'published' => (boolean) Whether to return only published stories: Possible values: null return both 'published' returns publised 'unpublished' returns unpublished 'startnumber' => (integer) Story number to start at 'limit' => (integer) Max number of stories
$order integer How to order the results. A Jonah::ORDER_* constant.
return array The specified number (or less, if there are fewer) of stories from the given channel.

getStory() public method

Retrieve the requested story from storage.
public getStory ( integer $story_id, boolean $read = false ) : array
$story_id integer The story id to obtain.
$read boolean Increment the read counter?
return array The story information array

getStoryAsMessage() protected method

Returns the provided story as a MIME part.
protected getStoryAsMessage ( array $story ) : MIME_Part
$story array A data array representing a story.
return MIME_Part The MIME message part containing the story parts.

getStoryIdsByChannel() public method

Return a list of story_ids contained in the specified channel.
public getStoryIdsByChannel ( integer $channel_id ) : array
$channel_id integer The channel_id
return array An array of story_ids.

listTagInfo() public method

public listTagInfo ( $channel_id = null )

renderChannel() public method

Returns the stories of a channel rendered with the specified template.
public renderChannel ( integer $channel_id, string $tpl, integer $max = 10, integer $from, integer $order = Jonah::ORDER_PUBLISHED ) : string
$channel_id integer The news channel to get stories from.
$tpl string The name of the template to use.
$max integer The maximum number of stories to get. If null, all stories will be returned.
$from integer The number of the story to start with.
$order integer How to sort the results for internal channels Possible values are the Jonah::ORDER_* constants.
return string The rendered story listing.

saveStory() public method

Save the provided story to storage.
public saveStory ( array &$info )
$info array The story information array. Passed by reference so we can add/change the id when saved.

Property Details

$_params protected property

Hash containing connection parameters.
protected array $_params
return array