/usr/share/horde/timeobjects/lib/Api.php is in php-horde-timeobjects 2.1.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | <?php
/**
* API methods for exposing various bits of data via the listTimeObjects API.
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Timeobjects
*/
class Timeobjects_Api extends Horde_Registry_Api
{
/**
* Links.
*
* @var array
*/
protected $_links = array(
// @TODO: Probably implement a URL endpoint or something so we can
// link to the correct external site depending on what time object
// category we are referring to.
'show' => '#'
);
/**
* Returns the available categories.
*
* @return array An array of available time object categories.
*/
public function listTimeObjectCategories()
{
$factory = $GLOBALS['injector']
->getInstance('TimeObjects_Factory_Driver');
$tests = array('Weather' => _("Weather"),
'FacebookEvents' => _("Facebook Events"));
$drivers = array();
foreach ($tests as $driver => $description) {
try {
if ($factory->create($driver)->ensure()) {
$drivers[$driver] = array('title' => $description, 'type' => 'single');
}
} catch (Timeobjects_Exception $e) {
}
}
return $drivers;
}
/**
* Returns time objects for the requested category.
*
* @param array $time_categories An array of categories to list.
* @param mixed $start The start of the time period to list for.
* @param mixed $end The end of the time period to list for.
*
* @return array A list of time object hashes.
*/
public function listTimeObjects($time_categories, $start, $end)
{
$return = array();
foreach ($time_categories as $category) {
try {
$return = array_merge(
$return,
$GLOBALS['injector']
->getInstance('TimeObjects_Factory_Driver')
->create($category)
->listTimeObjects($start, $end));
} catch (TimeObjects_Exception $e) {
}
}
return $return;
}
}
|