本文整理汇总了PHP中Horde::selfUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::selfUrl方法的具体用法?PHP Horde::selfUrl怎么用?PHP Horde::selfUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::selfUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _content
/**
*/
protected function _content()
{
/* Return empty if we don't have a thread set. */
if (empty($this->_params['thread_id'])) {
return '';
}
/* Set up the message object. */
list($forum_id, $message_id) = explode('.', $this->_params['thread_id']);
$messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $forum_id);
/* Check if valid thread, otherwise show forum list. */
if ($messages instanceof PEAR_Error || empty($messages)) {
throw new Horde_Exception(_("Unable to fetch selected thread."));
}
/* Get the sorting. */
$sort_by = Agora::getSortBy('threads');
$sort_dir = Agora::getSortDir('threads');
$view_bodies = $GLOBALS['prefs']->getValue('thread_view_bodies');
/* Get the message array and the sorted thread list. */
$threads_list = $messages->getThreads($messages->getThreadRoot($message_id), true, $sort_by, $sort_dir, $view_bodies, Horde::selfUrl());
/* Set up the column headers. */
$col_headers = array(array('message_thread' => _("Thread"), 'message_subject' => _("Subject")), 'message_author' => _("Posted by"), 'message_timestamp' => _("Date"));
$col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');
/* Set up the template tags. */
$view = new Agora_View();
$view->col_headers = $col_headers;
$view->threads_list = $threads_list;
$view->threads_list_header = _("Thread List");
$view->thread_view_bodies = $view_bodies;
return $view->render('block/thread');
}
示例2: _content
/**
*/
protected function _content()
{
if (!isset($this->_params['forum_id'])) {
throw new Horde_Exception(_("No forum selected"));
}
if (empty($this->_threads)) {
$this->_threads = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $this->_params['forum_id']);
if ($this->_threads instanceof PEAR_Error) {
throw new Horde_Exception(_("Unable to fetch threads for selected forum."));
}
}
/* Get the sorting. */
$sort_by = Agora::getSortBy('threads');
$sort_dir = Agora::getSortDir('threads');
/* Get a list of threads and display only the most recent if
* preference is set. */
$threads_list = $this->_threads->getThreads(0, false, $sort_by, $sort_dir, false, Horde::selfUrl(), null, 0, !empty($this->_params['thread_display']) ? $this->_params['thread_display'] : null);
/* Show a message if no available threads. Don't raise an error
* as it is not an error to have no threads. */
if (empty($threads_list)) {
return _("No available threads.");
}
/* Set up the column headers. */
$col_headers = array('message_subject' => _("Subject"), 'message_author' => _("Posted by"), 'message_timestamp' => _("Date"));
$col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');
/* Set up the template tags. */
$view = new Agora_View();
$view->col_headers = $col_headers;
$view->threads = $threads_list;
return $view->render('block/threads');
}
示例3: _getGalleryActions
/**
* Helper function for generating the gallery actions selection widget.
*
* @param Horde_View $view The view object.
*/
protected function _getGalleryActions(&$view)
{
global $registry, $conf;
$id = $this->_view->gallery->id;
$galleryurl = Horde::url('gallery.php')->add('gallery', $id);
$selfurl = Horde::selfUrl(true, false, true);
$view->count = $count = $this->_view->gallery->countImages();
$date = $this->_view->gallery->getDate();
// Buid the url parameters to the zip link
$view_params = array('gallery' => $this->_view->gallery->id, 'view' => 'Gallery', 'slug' => $this->_view->gallery->get('slug'), 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0);
// Append the date information to the parameters if we need it
$view_params = array_merge($view_params, $date);
// Bookmark link
if ($registry->hasMethod('bookmarks/getAddUrl')) {
$api_params = array('url' => Ansel::getUrlFor('view', $view_params, true), 'title' => $this->_view->gallery->get('name'));
try {
$view->bookmark_url = new Horde_Url($registry->bookmarks->getAddUrl($api_params));
} catch (Horde_Exception $e) {
}
}
// Download as ZIP link
if (!empty($conf['gallery']['downloadzip']) && $this->_view->gallery->canDownload() && $count && $this->_view->gallery->hasFeature('zipdownload')) {
$zip_params = array_merge(array('actionID' => 'downloadzip'), $date);
$view->zip_url = $galleryurl->copy()->add($zip_params)->link(array('class' => 'widget'));
}
// Image upload, subgalleries, captions etc..
if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$view->hasEdit = true;
$view->properties_url = $galleryurl->copy()->add(array('actionID' => 'modify', 'url' => $selfurl))->link(array('class' => 'widget'));
if ($count) {
if ($this->_view->gallery->hasFeature('image_captions')) {
$params = array_merge(array('gallery' => $id), $date);
$view->captions_url = Horde::url('gallery/captions.php')->add($params)->link(array('class' => 'widget'));
}
if ($this->_view->gallery->hasFeature('sort_images')) {
$view->sort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id), $date))->link(array('class' => 'widget'));
$view->resetsort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id, 'action' => 'Reset'), $date))->link(array('class' => 'widget'));
}
$view->regenerate_url = $galleryurl->copy()->add(array('actionID' => 'generateThumbs'))->link(array('class' => 'widget'));
$view->regenerate_all = $galleryurl->copy()->add(array('actionID' => 'deleteCache'))->link(array('class' => 'widget'));
if ($conf['faces']['driver'] && $conf['faces']['driver'] !== 'user' && $this->_view->gallery->hasFeature('faces')) {
$view->faces_url = Horde::url('faces/gallery.php')->add(array_merge($date, array('gallery' => $id, 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0)))->link(array('class' => 'widget'));
}
}
if ($this->_view->gallery->hasFeature('stacks')) {
$view->gendefault_url = $galleryurl->copy()->add(array('actionID' => 'generateDefault', 'url' => $selfurl))->link(array('class' => 'widget'));
}
}
if ($registry->getAuth() && $this->_view->gallery->get('owner') == $registry->getAuth()) {
$url = new Horde_Url('#');
$view->perms_link = $url->link(array('class' => 'popup widget', 'onclick' => Horde::popupJs(Horde::url('perms.php'), array('params' => array('cid' => $this->_view->gallery->id), 'urlencode' => true)) . 'return false;'));
} elseif (!empty($conf['report_content']['driver']) && ($conf['report_content']['allow'] == 'authenticated' && $registry->isAuthenticated() || $conf['report_content']['allow'] == 'all')) {
$view->report_url = Horde::url('report.php')->add('gallery', $id)->link(array('class' => 'widget'));
}
if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
$view->have_delete = true;
$view->deleteall_url = $galleryurl->copy()->add('actionID', 'empty')->link(array('class' => 'widget'));
$view->deletegallery_url = $galleryurl->copy()->add('actionID', 'delete')->link(array('class' => 'widget'));
}
}
示例4: __construct
/**
* Constructor.
*
* @param Horde_Core_Block_Collection $collection TODO
*/
public function __construct(Horde_Core_Block_Collection $collection)
{
$this->_collection = $collection;
$this->_editUrl = Horde::selfUrl();
$this->_layout = $collection->getLayout();
// Fill the _covered caches and empty rows.
$rows = count($this->_layout);
$emptyrows = array();
for ($row = 0; $row < $rows; $row++) {
$cols = count($this->_layout[$row]);
if (!isset($emptyrows[$row])) {
$emptyrows[$row] = true;
}
for ($col = 0; $col < $cols; ++$col) {
if (isset($this->_layout[$row][$col]) && is_array($this->_layout[$row][$col])) {
$field = $this->_layout[$row][$col];
$emptyrows[$row] = false;
if (isset($field['width'])) {
for ($i = 1; $i < $field['width']; ++$i) {
$this->_layout[$row][$col + $i] = 'covered';
}
}
if (isset($field['height'])) {
if (!isset($field['width'])) {
$field['width'] = 1;
}
for ($i = 1; $i < $field['height']; ++$i) {
$this->_layout[$row + $i][$col] = 'covered';
for ($j = 1; $j < $field['width']; $j++) {
$this->_layout[$row + $i][$col + $j] = 'covered';
}
$emptyrows[$row + $i] = false;
}
}
}
}
// Strip empty blocks from the end of the rows.
for ($col = $cols - 1; $col >= 0; --$col) {
if (isset($this->_layout[$row][$col]) && $this->_layout[$row][$col] != 'empty') {
break;
}
unset($this->_layout[$row][$col]);
}
$this->_columns = max($this->_columns, count($this->_layout[$row]));
}
// Fill all rows up to the same length.
$layout = array();
for ($row = 0; $row < $rows; ++$row) {
$cols = count($this->_layout[$row]);
if ($cols < $this->_columns) {
for ($col = $cols; $col < $this->_columns; ++$col) {
$this->_layout[$row][$col] = 'empty';
}
}
$layout[] = $this->_layout[$row];
}
$this->_layout = $layout;
}
示例5: html
/**
* Build the HTML for this widget.
*
* @return string The HTML representing this widget.
*/
public function html()
{
$view = $GLOBALS['injector']->getInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
$view->title = $this->_title;
$view->background = $this->_style->background;
$view->toggle_url = Horde::selfUrl(true, true)->add('actionID', 'show_othergalleries')->link(array('id' => 'othergalleries-toggle', 'class' => $GLOBALS['prefs']->getValue('show_othergalleries') ? 'hide' : 'show'));
$this->_getOtherGalleries($view);
return $view->render('othergalleries');
}
示例6: runTasks
/**
*/
public function runTasks(array $opts = array())
{
if (!isset($opts['url'])) {
$opts['url'] = Horde::selfUrl(true, true, true);
}
if ($this->_app != 'horde' && $GLOBALS['session']->get('horde', 'logintasks') !== true) {
$GLOBALS['injector']->getInstance('Horde_Core_Factory_LoginTasks')->create('horde')->runTasks($opts);
}
parent::runTasks($opts);
}
示例7: appTests
/**
*/
public function appTests()
{
$ret = '<h1>Mail Server Support Test</h1>';
$vars = Horde_Variables::getDefaultVariables();
if ($vars->user && $vars->passwd) {
$ret .= $this->_doConnectionTest($vars);
}
$self_url = Horde::selfUrl()->add('app', 'imp');
Horde::startBuffer();
require IMP_TEMPLATES . '/test/mailserver.inc';
return $ret . Horde::endBuffer();
}
示例8: sidebar
public function sidebar($sidebar)
{
global $registry, $session;
$sidebar->addNewButton(_("_New Ticket"), Horde::url('ticket/create.php'));
$sidebar->containers['queries'] = array('header' => array('id' => 'whups-toggle-queries', 'label' => _("Saved Queries")));
$manager = new Whups_Query_Manager();
$queries = $manager->listQueries($registry->getAuth(), true);
foreach ($queries as $id => $query) {
$row = array('selected' => strpos(strval(Horde::selfUrl()), $registry->get('webroot') . '/query') === 0 && $id == $session->get('whups', 'query'), 'cssClass' => 'whups-sidebar-query', 'url' => Whups::urlFor('query', empty($query['slug']) ? array('id' => $id) : array('slug' => $query['slug'])), 'label' => $query['name']);
$sidebar->addRow($row, 'queries');
}
}
示例9: appTests
/**
* Any application specific tests that need to be done.
*
* @return string HTML output.
*/
public function appTests()
{
$ret = '<h1>LDAP Support Test</h1>';
$params = array('server' => Horde_Util::getPost('server'), 'port' => Horde_Util::getPost('port', 389), 'basedn' => Horde_Util::getPost('basedn'), 'user' => Horde_Util::getPost('user'), 'passwd' => Horde_Util::getPost('passwd'), 'filter' => Horde_Util::getPost('filter'), 'proto' => Horde_Util::getPost('proto'));
if (!empty($params['server']) && !empty($params['basedn']) && !empty($params['filter'])) {
$ret .= $this->_doConnectionTest($params);
}
$self_url = Horde::selfUrl()->add('app', 'turba');
Horde::startBuffer();
require TURBA_TEMPLATES . '/test/ldapserver.inc';
return $ret . Horde::endBuffer();
}
示例10: run
/**
* Expects:
* $vars
* $registry
* $notification
*/
public function run()
{
extract($this->_params, EXTR_REFS);
/* Set up the form variables and the form. */
$form_submit = $vars->get('submitbutton');
$channel_id = $vars->get('channel_id');
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id);
} catch (Exception $e) {
Horde::log($e, 'ERR');
$notification->push(_("Invalid channel specified for deletion."), 'horde.message');
Horde::url('channels')->redirect();
exit;
}
/* If not yet submitted set up the form vars from the fetched channel. */
if (empty($form_submit)) {
$vars = new Horde_Variables($channel);
}
/* Check permissions and deny if not allowed. */
if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
throw new Horde_Exception_AuthenticationFailure();
}
$title = sprintf(_("Delete News Channel \"%s\"?"), $vars->get('channel_name'));
$form = new Horde_Form($vars, $title);
$form->setButtons(array(_("Delete"), _("Do not delete")));
$form->addHidden('', 'channel_id', 'int', true, true);
$msg = _("Really delete this News Channel? All stories created in this channel will be lost!");
$form->addVariable($msg, 'confirm', 'description', false);
if ($form_submit == _("Delete")) {
if ($form->validate($vars)) {
$form->getInfo($vars, $info);
try {
$delete = $GLOBALS['injector']->getInstance('Jonah_Driver')->deleteChannel($info);
$notification->push(_("The channel has been deleted."), 'horde.success');
Horde::url('channels')->redirect();
exit;
} catch (Exception $e) {
$notification->push(sprintf(_("There was an error deleting the channel: %s"), $e->getMessage()), 'horde.error');
}
}
} elseif (!empty($form_submit)) {
$notification->push(_("Channel has not been deleted."), 'horde.message');
Horde::url('channels')->redirect();
exit;
}
$GLOBALS['page_output']->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, $vars, Horde::selfUrl(), 'post');
$GLOBALS['page_output']->footer();
}
示例11: render
/**
* Render the language selection.
*
* @return string The HTML selection box.
*/
public static function render()
{
global $prefs, $registry, $session;
$html = '';
if (!$prefs->isLocked('language')) {
$session->set('horde', 'language', $registry->preferredLang());
$html = sprintf('<form name="language" action="%s">', Horde::url($registry->get('webroot', 'horde') . '/services/language.php', false, -1));
$html .= '<input type="hidden" name="url" value="' . @htmlspecialchars(Horde::selfUrl(false, false, true)) . '" />';
$html .= '<select name="new_lang" onchange="document.language.submit()">';
foreach ($registry->nlsconfig->languages as $key => $val) {
$sel = $key == $session->get('horde', 'language') ? ' selected="selected"' : '';
$html .= "<option value=\"{$key}\"{$sel}>{$val}</option>";
}
$html .= '</select></form>';
}
return $html;
}
示例12: __construct
/**
* Constructor.
*
* @param array $config Configuration key-value pairs.
*/
public function __construct($config = array())
{
global $injector, $prefs, $registry;
if (empty($config['templatePath'])) {
$config['templatePath'] = $registry->get('templates', 'horde') . '/topbar';
}
parent::__construct($config);
$this->addHelper('Text');
/* Logo. */
$this->portalUrl = $registry->getServiceLink('portal', $registry->getApp());
if (class_exists('Horde_Bundle')) {
$this->version = Horde_Bundle::SHORTNAME . ' ' . Horde_Bundle::VERSION;
} else {
$this->version = $registry->getVersion('horde');
}
/* Main menu. */
$topbar = $injector->getInstance('Horde_Core_Factory_Topbar')->create('Horde_Tree_Renderer_Menu', array('nosession' => true));
$this->menu = $topbar->getTree();
/* Search form. */
$this->searchAction = '#';
$this->searchIcon = Horde_Themes::img('search-topbar.png');
$this->searchLabel = _("Search");
/* Login/Logout. */
if ($registry->getAuth()) {
if ($registry->showService('logout')) {
$this->logoutUrl = $registry->getServiceLink('logout', $registry->getApp())->setRaw(false);
}
} else {
if ($registry->showService('login')) {
$this->loginUrl = $registry->getServiceLink('login', $registry->getApp())->setRaw(false)->add('url', Horde::selfUrl(true, true, true));
}
}
/* Sub bar. */
$this->date = strftime($prefs->getValue('date_format'));
$pageOutput = $injector->getInstance('Horde_PageOutput');
$pageOutput->addScriptPackage('Horde_Core_Script_Package_Datejs');
$pageOutput->addScriptFile('topbar.js', 'horde');
$pageOutput->addInlineJsVars(array('HordeTopbar.conf' => array('URI_AJAX' => $registry->getServiceLink('ajax', 'horde')->url, 'app' => $registry->getApp(), 'format' => Horde_Core_Script_Package_Datejs::translateFormat($prefs->getValue('date_format')), 'hash' => $topbar->getHash(), 'refresh' => intval($prefs->getValue('menu_refresh_time')))));
/* Sidebar. */
$this->sidebarWidth = $prefs->getValue('sidebar_width');
}
示例13: _content
protected function _content()
{
$vars = Horde_Variables::getDefaultVariables();
$formname = $vars->get('formname');
$done = false;
$form = new Horde_Form($vars);
$fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($this->_params['form_id']);
foreach ($fields as $field) {
/* In case of these types get array from stringlist. */
if ($field['field_type'] == 'link' || $field['field_type'] == 'enum' || $field['field_type'] == 'multienum' || $field['field_type'] == 'radio' || $field['field_type'] == 'set' || $field['field_type'] == 'sorter') {
$field['field_params']['values'] = Ulaform::getStringlistArray($field['field_params']['values']);
}
/* Setup the field with all the parameters. */
$form->addVariable($field['field_label'], $field['field_name'], $field['field_type'], $field['field_required'], $field['field_readonly'], $field['field_desc'], $field['field_params']);
}
if ($formname) {
$form->validate($vars);
if ($form->isValid() && $formname) {
$form->getInfo($vars, $info);
$info['form_id'] = $this->_params['form_id'];
try {
$submit = $GLOBALS['ulaform_driver']->submitForm($info);
$GLOBALS['notification']->push(_("Form submitted successfully."), 'horde.success');
$done = true;
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push(sprintf(_("Error submitting form. %s."), $e->getMessage()), 'horde.error');
}
}
}
/* Render active or inactive, depending if submitted or
* not. */
$render_type = $done ? 'renderInactive' : 'renderActive';
/* Render the form. */
$renderer = new Horde_Form_Renderer();
$renderer->showHeader(false);
Horde::startBuffer();
$form->{$render_type}($renderer, $vars, Horde::selfUrl(true), 'post');
return Horde::endBuffer();
}
示例14: run
/**
* $registry
* $notification
* $conf
* $criteria
*
*/
public function run()
{
extract($this->_params, EXTR_REFS);
$templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
/* Get requested channel. */
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
} catch (Exception $e) {
Horde::log($e, 'ERR');
$notification->push(_("Invalid channel."), 'horde.error');
Horde::url('delivery/index.php', true)->redirect();
exit;
}
$title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
$options = array();
foreach ($templates as $key => $info) {
$options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
}
$template = new Horde_Template();
$template->setOption('gettext', 'true');
$template->set('url', Horde::selfUrl());
$template->set('session', Horde_Util::formInput());
$template->set('channel_id', $criteria['feed']);
$template->set('channel_name', $channel['channel_name']);
$template->set('format', $criteria['format']);
$template->set('options', $options);
// @TODO: This is ugly. storage driver shouldn't be rendering any display
// refactor this to use individual views possibly with a choice of different templates
$template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
// Buffer the notifications and send to the template
Horde::startBuffer();
$GLOBALS['notification']->notify(array('listeners' => 'status'));
$template->set('notify', Horde::endBuffer());
$GLOBALS['page_output']->header(array('title' => $title));
echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
$GLOBALS['page_output']->footer();
}
示例15: getPhpVersionInformation
/**
* Obtain information on the PHP version.
*
* @return object stdClass TODO
*/
public function getPhpVersionInformation()
{
$output = new stdClass();
$vers_check = true;
$testscript = Horde::selfUrl(true);
$output->phpinfo = $testscript->copy()->add('mode', 'phpinfo');
$output->extensions = $testscript->copy()->add('mode', 'extensions');
$output->version = PHP_VERSION;
$output->major = $this->_phpver['major'];
if (isset($this->_phpver['minor'])) {
$output->minor = $this->_phpver['minor'];
}
if (isset($this->_phpver['subminor'])) {
$output->subminor = $this->_phpver['subminor'];
}
$output->class = $this->_phpver['class'];
$output->status_color = 'red';
if ($output->major < '5.3') {
$output->status = 'This version of PHP is not supported. You need to upgrade to a more recent version.';
$vers_check = false;
} elseif ($output->major == '5.3') {
$output->status = 'You are using an old, deprecated version of PHP. It is highly recommended that you upgrade to at least PHP 5.4 for performance, stability, and security reasons.';
$output->status_color = 'orange';
} elseif (in_array($output->major, $this->_supported)) {
$output->status = 'You are running a supported version of PHP.';
$output->status_color = 'green';
} else {
$output->status = 'This version of PHP has not been fully tested with this version of Horde.';
$output->status_color = 'orange';
}
if (!$vers_check) {
$output->version_check = 'Horde requires PHP 5.3.0 or greater.';
}
return $output;
}