\Jonah_Driver

Jonah_Driver:: is responsible for storing, searching, sorting and filtering locally generated and managed articles. Aggregation is left to Hippo.

Copyright 2002-2017 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.

Summary

Methods
Properties
Constants
__construct()
deleteChannel()
getChannels()
getChannel()
getStories()
saveStory()
getStory()
getStoryLink()
getChecksum()
getIntervalLabel()
renderChannel()
getStoryIdsByChannel()
listTagInfo()
getIdBySlug()
No public properties found
No constants found
_escapeStories()
_escapeStoryDescriptions()
getStoryAsMessage()
$_params
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Hash containing connection parameters.

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructs a new Driver storage object.

Parameters

array $params

A hash containing connection parameters.

deleteChannel()

deleteChannel(array  $info) 

Remove a channel from storage.

Parameters

array $info

A channel info array. (@TODO: Look at passing just the id?)

getChannels()

getChannels() : array

Get a list of stored channels.

Throws

\Jonah_Exception

Returns

array —

An array of channel hashes.

getChannel()

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.

Parameters

integer $channel_id

The channel id to fetch.

Throws

\InvalidArgumentException

Returns

array —

The channel details as an array

getStories()

getStories(integer  $criteria, integer  $order = \Jonah::ORDER_PUBLISHED) : array

Returns the most recent or all stories from a channel.

Parameters

integer $criteria

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

integer $order

How to order the results. A Jonah::ORDER_* constant.

Throws

\InvalidArgumentException

Returns

array —

The specified number (or less, if there are fewer) of stories from the given channel.

saveStory()

saveStory(array  $info) 

Save the provided story to storage.

Parameters

array $info

The story information array. Passed by reference so we can add/change the id when saved.

getStory()

getStory(integer  $story_id, boolean  $read = false) : array

Retrieve the requested story from storage.

Parameters

integer $story_id

The story id to obtain.

boolean $read

Increment the read counter?

Returns

array —

The story information array

getStoryLink()

getStoryLink(array  $channel, array  $story) : \Horde_Url

Returns the official link to a story.

Parameters

array $channel

A channel hash.

array $story

A story hash.

Returns

\Horde_Url —

The story link.

getChecksum()

getChecksum(  $story) 

Parameters

$story

getIntervalLabel()

getIntervalLabel(  $seconds = null) 

Parameters

$seconds

renderChannel()

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.

Parameters

integer $channel_id

The news channel to get stories from.

string $tpl

The name of the template to use.

integer $max

The maximum number of stories to get. If null, all stories will be returned.

integer $from

The number of the story to start with.

integer $order

How to sort the results for internal channels Possible values are the Jonah::ORDER_* constants.

Returns

string —

The rendered story listing.

getStoryIdsByChannel()

getStoryIdsByChannel(integer  $channel_id) : array

Return a list of story_ids contained in the specified channel.

Parameters

integer $channel_id

The channel_id

Returns

array —

An array of story_ids.

listTagInfo()

listTagInfo(  $channel_id = null) 

Parameters

$channel_id

getIdBySlug()

getIdBySlug(  $channel) 

Parameters

$channel

_escapeStories()

_escapeStories(  $value,   $key) 

Parameters

$value
$key

_escapeStoryDescriptions()

_escapeStoryDescriptions(  $value,   $key) 

Parameters

$value
$key

getStoryAsMessage()

getStoryAsMessage(array  $story) : \MIME_Part

Returns the provided story as a MIME part.

Parameters

array $story

A data array representing a story.

Returns

\MIME_Part —

The MIME message part containing the story parts.