Documentation

Jonah_Driver
in package

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.

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Marko Djukic marko@oblo.com

author

Jan Schneider jan@horde.org

author

Ben Klang ben@alkaloid.net

author

Michael J. Rubinsky mrubinsk@horde.org

Table of Contents

$_params  : array<string|int, mixed>
Hash containing connection parameters.
__construct()  : mixed
Constructs a new Driver storage object.
deleteChannel()  : mixed
Remove a channel from storage.
getChannel()  : array<string|int, mixed>
Fetches the requested channel, while actually passing on the request to the backend _getChannel() function to do the real work.
getChannels()  : array<string|int, mixed>
Get a list of stored channels.
getChecksum()  : mixed
getIdBySlug()  : mixed
getIntervalLabel()  : mixed
getStories()  : array<string|int, mixed>
Returns the most recent or all stories from a channel.
getStory()  : array<string|int, mixed>
Retrieve the requested story from storage.
getStoryIdsByChannel()  : array<string|int, mixed>
Return a list of story_ids contained in the specified channel.
getStoryLink()  : Horde_Url
Returns the official link to a story.
listTagInfo()  : mixed
renderChannel()  : string
Returns the stories of a channel rendered with the specified template.
saveStory()  : mixed
Save the provided story to storage.
_escapeStories()  : mixed
_escapeStoryDescriptions()  : mixed
getStoryAsMessage()  : MIME_Part
Returns the provided story as a MIME part.

Properties

$_params

Hash containing connection parameters.

protected array<string|int, mixed> $_params = array()

Methods

__construct()

Constructs a new Driver storage object.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

A hash containing connection parameters.

Return values
mixed

deleteChannel()

Remove a channel from storage.

public deleteChannel(array<string|int, mixed> $info) : mixed
Parameters
$info : array<string|int, mixed>

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

Return values
mixed

getChannel()

Fetches the requested channel, while actually passing on the request to the backend _getChannel() function to do the real work.

public getChannel(int $channel_id) : array<string|int, mixed>
Parameters
$channel_id : int

The channel id to fetch.

Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>

The channel details as an array

getChannels()

Get a list of stored channels.

public getChannels() : array<string|int, mixed>
Tags
throws
Jonah_Exception
Return values
array<string|int, mixed>

An array of channel hashes.

getChecksum()

public getChecksum(mixed $story) : mixed
Parameters
$story : mixed
Return values
mixed

getIdBySlug()

public getIdBySlug(mixed $channel) : mixed
Parameters
$channel : mixed
Return values
mixed

getIntervalLabel()

public getIntervalLabel([mixed $seconds = null ]) : mixed
Parameters
$seconds : mixed = null
Return values
mixed

getStories()

Returns the most recent or all stories from a channel.

public getStories(int $criteria[, int $order = Jonah::ORDER_PUBLISHED ]) : array<string|int, mixed>
Parameters
$criteria : int

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 : int = Jonah::ORDER_PUBLISHED

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

Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>

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

getStory()

Retrieve the requested story from storage.

public getStory(int $story_id[, bool $read = false ]) : array<string|int, mixed>
Parameters
$story_id : int

The story id to obtain.

$read : bool = false

Increment the read counter?

Return values
array<string|int, mixed>

The story information array

getStoryIdsByChannel()

Return a list of story_ids contained in the specified channel.

public getStoryIdsByChannel(int $channel_id) : array<string|int, mixed>
Parameters
$channel_id : int

The channel_id

Return values
array<string|int, mixed>

An array of story_ids.

Returns the official link to a story.

public getStoryLink(array<string|int, mixed> $channel, array<string|int, mixed> $story) : Horde_Url
Parameters
$channel : array<string|int, mixed>

A channel hash.

$story : array<string|int, mixed>

A story hash.

Return values
Horde_Url

The story link.

listTagInfo()

public listTagInfo([mixed $channel_id = null ]) : mixed
Parameters
$channel_id : mixed = null
Return values
mixed

renderChannel()

Returns the stories of a channel rendered with the specified template.

public renderChannel(int $channel_id, string $tpl[, int $max = 10 ], int $from[, int $order = Jonah::ORDER_PUBLISHED ]) : string
Parameters
$channel_id : int

The news channel to get stories from.

$tpl : string

The name of the template to use.

$max : int = 10

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

$from : int

The number of the story to start with.

$order : int = Jonah::ORDER_PUBLISHED

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

Tags
TODO:

This doesn't belong in a storage driver class. Move it to a view or possible a static method in Jonah::?

Return values
string

The rendered story listing.

saveStory()

Save the provided story to storage.

public saveStory(array<string|int, mixed> &$info) : mixed
Parameters
$info : array<string|int, mixed>

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

Return values
mixed

_escapeStories()

protected _escapeStories(mixed &$value, mixed $key) : mixed
Parameters
$value : mixed
$key : mixed
Tags
TODO:

Move to a view class or static Jonah:: method?

Return values
mixed

_escapeStoryDescriptions()

protected _escapeStoryDescriptions(mixed &$value, mixed $key) : mixed
Parameters
$value : mixed
$key : mixed
Tags
TODO:

Move to a view class or static Jonah:: method?

Return values
mixed

getStoryAsMessage()

Returns the provided story as a MIME part.

protected getStoryAsMessage(array<string|int, mixed> $story) : MIME_Part
Parameters
$story : array<string|int, mixed>

A data array representing a story.

Tags
TODO:

Refactor to use new Horde MIME library

Return values
MIME_Part

The MIME message part containing the story parts.

Search results