PHP Class Klutz, horde

Copyright 2002-2016 Horde LLC (http://www.horde.org/)
Author: Marcus I. Ryan ([email protected])
Mostrar archivo Open project: horde/horde

Public Properties

Property Type Description
$comics array Array of comics and their associated attributes
$days array Used to translate between literal dow and numeric dow (sun = 0, 7)
$image_types array MIME types for images based on the return value from getimagesize
$sort integer Sorting method to use. Options are KLUTZ_SORT_NAME (sort by comic title), KLUTZ_SORT_AUTHOR (sort by Author's last name), and KLUTZ_SORT_NOSORT (don't promise any given sorting order).

Public Methods

Method Description
Klutz ( integer $sort = KLUTZ_SORT_NAME ) Constructor - Parse the /config/comics.php config file and store the results in $comic. Also tries to validate all the data it can and adjust case, etc., to more predictible consistency than humans editing config files can give. :)
_convertDay ( string $a ) : string Convert a user-passed string into a three-letter, lowercased day abbr.
_sortComics ( string $a, string $b ) : integer Comparse two comics and return -1, 0, or 1 based on the $sort member variable
comicObject ( string $index ) : object Return a Klutz_Comic for the given index
getProperty ( string $index, string $property ) : mixed Return the requested property for the requested comic
listByDriver ( string $driver, array $list = null ) : array Return a list of comics that use the given fetch driver
listEnabled ( array $list = null, timestamp $date = null ) : array Return a list of comics that are marked as enabled, and that should appear on a given day if a date is passed in.

Method Details

Klutz() public method

Constructor - Parse the /config/comics.php config file and store the results in $comic. Also tries to validate all the data it can and adjust case, etc., to more predictible consistency than humans editing config files can give. :)
public Klutz ( integer $sort = KLUTZ_SORT_NAME )
$sort integer Sorting method to use

_convertDay() public method

Convert a user-passed string into a three-letter, lowercased day abbr.
public _convertDay ( string $a ) : string
$a string The string to convert
return string A three-letter abbreviation for the requested day, or the first three letters of the passed string lowercased.

_sortComics() public method

Comparse two comics and return -1, 0, or 1 based on the $sort member variable
public _sortComics ( string $a, string $b ) : integer
$a string The index of the first comic
$b string The index of the second comic
return integer @see strcmp

comicObject() public method

Return a Klutz_Comic for the given index
public comicObject ( string $index ) : object
$index string The index key for the desired comic
return object A Klutz_Comic object for the given index

getProperty() public method

Return the requested property for the requested comic
public getProperty ( string $index, string $property ) : mixed
$index string The index key for the desired comic
$property string The desired property
return mixed The value of $property for $index

listByDriver() public method

Return a list of comics that use the given fetch driver
public listByDriver ( string $driver, array $list = null ) : array
$driver string The driver to check for
$list array The list to filter by driver (default all comics)
return array A list of the comics passed in that have been filtered based on driver

listEnabled() public method

Return a list of comics that are marked as enabled, and that should appear on a given day if a date is passed in.
public listEnabled ( array $list = null, timestamp $date = null ) : array
$list array The list to extract from (default is all comics, but smaller arrays are okay).
$date timestamp If passed in, check the $days array to make sure the comic should appear today.
return array A list of comic indecies

Property Details

$comics public_oe property

Array of comics and their associated attributes
public array $comics
return array

$days public_oe property

Used to translate between literal dow and numeric dow (sun = 0, 7)
public array $days
return array

$image_types public_oe property

MIME types for images based on the return value from getimagesize
public array $image_types
return array

$sort public_oe property

Sorting method to use. Options are KLUTZ_SORT_NAME (sort by comic title), KLUTZ_SORT_AUTHOR (sort by Author's last name), and KLUTZ_SORT_NOSORT (don't promise any given sorting order).
public int $sort
return integer