本文整理汇总了PHP中Kronolith::feedUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::feedUrl方法的具体用法?PHP Kronolith::feedUrl怎么用?PHP Kronolith::feedUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::feedUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($vars, $calendar)
{
global $conf, $injector, $registry;
$this->_calendar = $calendar;
$owner = $calendar->get('owner') == $registry->getAuth() || is_null($calendar->get('owner')) && $registry->isAdmin();
parent::__construct($vars, $owner ? sprintf(_("Edit %s"), $calendar->get('name')) : $calendar->get('name'));
$this->addHidden('', 'c', 'text', true);
$this->addVariable(_("Name"), 'name', 'text', true);
if (!$owner) {
$v = $this->addVariable(_("Owner"), 'owner', 'text', false);
$owner_name = $injector->getInstance('Horde_Core_Factory_Identity')->create($calendar->get('owner'))->getValue('fullname');
if (trim($owner_name) == '') {
$owner_name = $calendar->get('owner');
}
$v->setDefault($owner_name ? $owner_name : _("System"));
}
$this->addVariable(_("Color"), 'color', 'colorpicker', false);
if ($registry->isAdmin()) {
$this->addVariable(_("System Calendar"), 'system', 'boolean', false, false, _("System calendars don't have an owner. Only administrators can change the calendar settings and permissions."));
}
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->addVariable(_("Tags"), 'tags', 'Kronolith:KronolithTags', false);
/* Display URL. */
$url = Horde::url('month.php', true, -1)->add('display_cal', $calendar->getName());
$this->addVariable(_("Display URL"), '', 'link', false, false, null, array(array('url' => $url, 'text' => $url, 'title' => _("Click or copy this URL to display this calendar"), 'target' => '_blank')));
/* Subscription URLs. */
$url = $registry->get('webroot', 'horde');
if (isset($conf['urls']['pretty']) && $conf['urls']['pretty'] == 'rewrite') {
$webdavUrl = $url . '/rpc/kronolith/';
$caldavUrl = $url . '/rpc/calendars/';
$accountUrl = $url . '/rpc/';
} else {
$webdavUrl = $url . '/rpc.php/kronolith/';
$caldavUrl = $url . '/rpc.php/calendars/';
$accountUrl = $url . '/rpc.php/';
}
try {
$accountUrl = Horde::url($accountUrl, true, -1) . 'principals/' . $registry->convertUsername($registry->getAuth(), false) . '/';
$caldavUrl = Horde::url($caldavUrl, true, -1) . $registry->convertUsername($registry->getAuth(), false) . '/' . $injector->getInstance('Horde_Dav_Storage')->getExternalCollectionId($calendar->getName(), 'calendar') . '/';
$this->addVariable(_("CalDAV Subscription URL"), '', 'link', false, false, null, array(array('url' => $caldavUrl, 'text' => $caldavUrl, 'title' => _("Copy this URL to a CalDAV client to subscribe to this calendar"), 'target' => '_blank')));
$this->addVariable(_("CalDAV Account URL"), '', 'link', false, false, null, array(array('url' => $accountUrl, 'text' => $accountUrl, 'title' => _("Copy this URL to a CalDAV client to subscribe to all your calendars"), 'target' => '_blank')));
} catch (Horde_Exception $e) {
}
$webdavUrl = Horde::url($webdavUrl, true, -1) . ($calendar->get('owner') ? $registry->convertUsername($calendar->get('owner'), false) : '-system-') . '/' . $calendar->getName() . '.ics';
$this->addVariable(_("WebDAV/ICS Subscription URL"), '', 'link', false, false, null, array(array('url' => $webdavUrl, 'text' => $webdavUrl, 'title' => _("Copy this URL to a WebDAV or ICS client to subscribe to this calendar"), 'target' => '_blank')));
/* Feed URL. */
$url = Kronolith::feedUrl($calendar->getName());
$this->addVariable(_("Feed URL"), '', 'link', false, false, null, array(array('url' => $url, 'text' => $url, 'title' => _("Copy this URL to a news feed reader to subscribe to this calendar"), 'target' => '_blank')));
/* Embed code. */
$v = $this->addVariable(_("Embed code"), '', 'longtext', false, false, _("To embed this calendar in another website, use the code above."), array(4, 60));
$v->setHelp('embed');
$v->setDefault(Kronolith::embedCode($calendar->getName()));
/* Permissions link. */
if (empty($conf['share']['no_sharing']) && $owner) {
$url = Horde::url('perms.php')->add('share', $calendar->getName());
$this->addVariable('', '', 'link', false, false, null, array(array('url' => $url, 'text' => _("Change Permissions"), 'onclick' => Horde::popupJs($url, array('params' => array('urlencode' => true))) . 'return false;', 'class' => 'horde-button', 'target' => '_blank')));
}
$this->setButtons(array(_("Save"), array('class' => 'horde-delete', 'value' => _("Delete")), array('class' => 'horde-cancel', 'value' => _("Cancel"))));
}
示例2: array
global $prefs, $registry;
$kronolith_webroot = $registry->get('webroot');
$horde_webroot = $registry->get('webroot', 'horde');
$has_tasks = Kronolith::hasApiPermission('tasks');
/* Variables used in core javascript files. */
$code['conf'] = array('images' => array('attendees' => (string) Horde_Themes::img('attendees-fff.png'), 'alarm' => (string) Horde_Themes::img('alarm-fff.png'), 'recur' => (string) Horde_Themes::img('recur-fff.png'), 'exception' => (string) Horde_Themes::img('exception-fff.png')), 'user' => $GLOBALS['registry']->convertUsername($GLOBALS['registry']->getAuth(), false), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'name' => $registry->get('name'), 'has_tasks' => $has_tasks, 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'week_start' => (int) $prefs->getValue('week_start_monday'), 'max_events' => (int) $prefs->getValue('max_events'), 'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'), array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'), Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'status' => array('tentative' => Kronolith::STATUS_TENTATIVE, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'cancelled' => Kronolith::STATUS_CANCELLED, 'free' => Kronolith::STATUS_FREE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_LAST_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE));
if ($has_tasks) {
$code['conf']['tasks'] = $registry->tasks->ajaxDefaults();
}
// Calendars
foreach (array(true, false) as $my) {
foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_CALENDARS) as $id => $calendar) {
$owner = $GLOBALS['registry']->getAuth() && $calendar->owner() == $GLOBALS['registry']->getAuth();
if ($my && $owner || !$my && !$owner) {
$code['conf']['calendars']['internal'][$id] = array('name' => ($owner || !$calendar->owner() ? '' : '[' . $GLOBALS['registry']->convertUsername($calendar->owner(), false) . '] ') . $calendar->name(), 'desc' => $calendar->description(), 'owner' => $owner, 'fg' => $calendar->foreground(), 'bg' => $calendar->background(), 'show' => in_array($id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS)), 'edit' => $calendar->hasPermission(Horde_Perms::EDIT), 'feed' => (string) Kronolith::feedUrl($id), 'embed' => Kronolith::embedCode($id));
if ($owner) {
$code['conf']['calendars']['internal'][$id]['perms'] = Kronolith::permissionToJson($calendar->share()->getPermission());
}
}
}
// Tasklists
if (!$has_tasks) {
continue;
}
foreach ($registry->tasks->listTasklists($my, Horde_Perms::SHOW) as $id => $tasklist) {
$owner = $GLOBALS['registry']->getAuth() && $tasklist->get('owner') == $GLOBALS['registry']->getAuth();
if ($my && $owner || !$my && !$owner) {
$code['conf']['calendars']['tasklists']['tasks/' . $id] = array('name' => Kronolith::getLabel($tasklist), 'desc' => $tasklist->get('desc'), 'owner' => $owner, 'fg' => Kronolith::foregroundColor($tasklist), 'bg' => Kronolith::backgroundColor($tasklist), 'show' => in_array('tasks/' . $id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS)), 'edit' => $tasklist->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT));
if ($owner) {
$code['conf']['calendars']['tasklists']['tasks/' . $id]['perms'] = Kronolith::permissionToJson($tasklist->getPermission());
示例3: toHash
/**
* Returns a hash representing this calendar.
*
* @return array A simple hash.
*/
public function toHash()
{
global $calendar_manager, $conf, $injector, $registry;
$id = $this->_share->getName();
$owner = $registry->getAuth() && $this->owner() == $registry->getAuth();
$hash = parent::toHash();
$hash['name'] = $this->name();
$hash['owner'] = $owner;
$hash['users'] = Kronolith::listShareUsers($this->_share);
$hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
$hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
try {
$hash['caldav'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/calendars/' : '/rpc.php/calendars/'), true, -1) . $registry->getAuth() . '/' . $injector->getInstance('Horde_Dav_Storage')->getExternalCollectionId($id, 'calendar') . '/';
} catch (Horde_Exception $e) {
}
$hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $this->owner() : '-system-') . '/' . $id . '.ics';
$hash['feed'] = (string) Kronolith::feedUrl($id);
$hash['embed'] = Kronolith::embedCode($id);
$hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
if ($owner) {
$hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission());
}
return $hash;
}
示例4: addCalendarLinks
/**
* Adds <link> tags for calendar feeds to the HTML header.
*/
public static function addCalendarLinks()
{
foreach ($GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS) as $calendar) {
$GLOBALS['page_output']->addLinkTag(array('href' => Kronolith::feedUrl($calendar), 'type' => 'application/atom+xml'));
}
}
示例5: toHash
/**
* Returns a hash representing this calendar.
*
* @return array A simple hash.
*/
public function toHash()
{
global $calendar_manager, $conf, $injector, $registry;
$id = $this->_share->getName();
$owner = $registry->getAuth() && ($this->owner() == $registry->getAuth() || $this->isSystem() && $registry->isAdmin());
$hash = parent::toHash();
$hash['name'] = $this->name();
$hash['owner'] = $owner;
$hash['system'] = $this->isSystem();
$hash['users'] = Kronolith::listShareUsers($this->_share);
$hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
$hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
$hash['delete'] = $this->hasPermission(Horde_Perms::DELETE);
$hash['caldav'] = $this->caldavUrl();
$hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $registry->convertUsername($this->owner(), false) : '-system-') . '/' . $id . '.ics';
$hash['feed'] = (string) Kronolith::feedUrl($id);
$hash['embed'] = Kronolith::embedCode($id);
$hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
if ($owner) {
$hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission(), is_null($this->_share->get('owner')));
}
return $hash;
}