本文整理汇总了PHP中Horde_Url::link方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Url::link方法的具体用法?PHP Horde_Url::link怎么用?PHP Horde_Url::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Url
的用法示例。
在下文中一共展示了Horde_Url::link方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLink
public function testLink()
{
$url = new Horde_Url('test', true);
$url->add(array('foo' => 1, 'bar' => 2));
$this->assertEquals('test?foo=1&bar=2', (string) $url);
$this->assertEquals('<a href="test?foo=1&bar=2">', $url->link());
$this->assertEquals('<a href="test?foo=1&bar=2" title="foo&bar">', $url->link(array('title' => 'foo&bar')));
$this->assertEquals('<a href="test?foo=1&bar=2" title="foo&bar">', $url->link(array('title.raw' => 'foo&bar')));
}
示例2: _init
/**
*/
protected function _init()
{
global $browser, $injector, $page_output, $registry;
$page_output->addScriptFile('base.js');
$page_output->addScriptFile('passphrase.js');
$page_output->addScriptFile('viewport.js');
$page_output->addScriptFile('external/CustomElements.js');
$page_output->addScriptFile('external/time-elements.js');
$page_output->addScriptFile('external/tinycon.js');
$page_output->addScriptFile('dragdrop2.js', 'horde');
$page_output->addScriptFile('form_ghost.js', 'horde');
$page_output->addScriptFile('jstorage.js', 'horde');
$page_output->addScriptFile('slider2.js', 'horde');
$page_output->addScriptFile('toggle_quotes.js', 'horde');
$page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$page_output->addThemeStylesheet('mailbox.css');
$page_output->addThemeStylesheet('message_view.css');
$imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
if ($imp_imap->access(IMP_Imap::ACCESS_FLAGS)) {
$page_output->addScriptFile('colorpicker.js', 'horde');
$this->view->picker_img = Horde_Themes_Image::tag('colorpicker.png', array('alt' => _("Color Picker")));
}
if ($imp_imap->access(IMP_Imap::ACCESS_REMOTE)) {
$page_output->addScriptFile('external/base64.js');
}
$this->_addMailboxVars();
$this->view->show_innocent = !empty($imp_imap->config->innocent_params);
$this->view->show_search = $imp_imap->access(IMP_Imap::ACCESS_SEARCH);
$this->view->show_spam = !empty($imp_imap->config->spam_params);
$impSubinfo = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/dynamic'));
$impSubinfo->addHelper('Text');
$impSubinfo->quota = (bool) $imp_imap->config->quota;
$topbar = $injector->getInstance('Horde_View_Topbar');
$topbar->search = $this->view->show_search;
$topbar->searchMenu = true;
$topbar->subinfo = $impSubinfo->render('mailbox_subinfo');
$page_output->topbar = true;
$blank = new Horde_Url();
$impSidebar = new Horde_View(array('templatePath' => array($registry->get('templates', 'horde') . '/sidebar', IMP_TEMPLATES . '/dynamic')));
$impSidebar->addHelper('Text');
$impSidebar->containers = array(array('id' => 'imp-specialmboxes'));
if ($imp_imap->isImap()) {
$impSidebar->containers[] = array('rows' => array(array('id' => 'folderopts_link', 'cssClass' => 'folderoptsImg', 'link' => $blank->link() . _("Folder Actions") . '</a>'), array('id' => 'dropbase', 'style' => 'display:none', 'cssClass' => 'folderImg', 'link' => $blank->link() . _("Move to Base Level") . '</a>')));
$impSidebar->containers[] = array('id' => 'imp-normalmboxes');
}
$sidebar = $injector->getInstance('Horde_View_Sidebar');
$sidebar->newLink = $blank->link(array('id' => 'composelink', 'class' => 'icon'));
$sidebar->newText = _("New Message");
$sidebar->content = $impSidebar->render('sidebar');
$this->view->sidebar = $sidebar->render();
$this->view->max_fsize = intval($browser->allowFileUploads());
$page_output->noDnsPrefetch();
$this->_pages[] = 'mailbox';
}
示例3: token
/**
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*/
public function token($options)
{
try {
$link = new Horde_Url($GLOBALS['registry']->link($options['method'], $options['args']));
} catch (Horde_Exception $e) {
return $e->getMessage();
}
return $link->link() . $options['title'] . '</a>';
}
示例4: __construct
public function __construct(array $config)
{
if (!empty($config['what']) && !empty($config['loc'])) {
$this->title = $this->header = _("Search Results");
$url = new Horde_Url('list.php');
$this->backToList = $url->link() . _('Back to stock list') . '</a>';
} else {
$this->title = $this->header = _("Available Inventory");
}
$this->selectedCategories = is_array($config['selectedCategories']) ? $config['selectedCategories'] : array($config['selectedCategories']);
if (empty($this->selectedCategories[0])) {
array_shift($this->selectedCategories);
}
$this->shownProperties = $this->properties($config['propertyIds']);
$this->columnHeaders = $this->columnHeaders($config['sortDir'], $config['sortBy']);
$filters = array();
if (!empty($this->selectedCategories)) {
$filters[] = array('type' => 'categories', 'value' => $this->selectedCategories, 'exact' => $config['exact']);
}
if (!empty($config['loc'])) {
if (in_array(Sesha::SEARCH_ID, $config['loc'])) {
$filters[] = array('type' => 'stock_id', 'exact' => $config['exact'], 'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NAME, $config['loc'])) {
$filters[] = array('type' => 'stock_name', 'exact' => $config['exact'], 'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_NOTE, $config['loc'])) {
$filters[] = array('type' => 'note', 'exact' => $config['exact'], 'value' => $config['what']);
}
if (in_array(Sesha::SEARCH_PROPERTY, $config['loc'])) {
$filters[] = array('type' => 'values', 'exact' => $config['exact'], 'value' => array(array('values' => array($config['what']))));
}
}
$this->shownStock = $this->stock($filters);
parent::__construct($config);
}
示例5: _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'));
}
}
示例6: addMimeAction
/**
* Adds a MIME Viewer action to the status text.
*
* @param string $action Action ID.
* @param string $text Action description.
* @param array $attr Additional attributes.
*/
public function addMimeAction($action, $text, array $attr = array())
{
$attr['mimevieweraction'] = $action;
if (!is_null($this->_part)) {
$attr['mimeviewerid'] = $this->_part->getMimeId();
}
$url = new Horde_Url('#');
$this->addText($url->link($attr) . $text . '</a>');
}
示例7: sidebar
/**
* Add additional items to the sidebar.
*
* @param Horde_View_Sidebar $sidebar The sidebar object.
*/
public function sidebar($sidebar)
{
// @TODO: Implement an injector factory for this.
global $display_tasklists, $page_output, $prefs;
$perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
if (Nag::getDefaultTasklist(Horde_Perms::EDIT) && ($perms->hasAppPermission('max_tasks') === true || $perms->hasAppPermission('max_tasks') > Nag::countTasks())) {
$sidebar->addNewButton(_("_New Task"), Horde::url('task.php')->add('actionID', 'add_task'));
if ($GLOBALS['browser']->hasFeature('dom')) {
$page_output->addScriptFile('scriptaculous/effects.js', 'horde');
$page_output->addScriptFile('redbox.js', 'horde');
$blank = new Horde_Url();
$sidebar->newExtra = $blank->link(array_merge(array('onclick' => 'RedBox.showInline(\'quickAddInfoPanel\'); $(\'quickText\').focus(); return false;'), Horde::getAccessKeyAndTitle(_("_Quick Add"), false, true)));
require_once NAG_TEMPLATES . '/quick.inc';
}
}
$list = Horde::url('list.php');
$edit = Horde::url('tasklists/edit.php');
$user = $GLOBALS['registry']->getAuth();
$sidebar->containers['my'] = array('header' => array('id' => 'nag-toggle-my', 'label' => _("My Task Lists"), 'collapsed' => false));
if (!$GLOBALS['prefs']->isLocked('default_tasklist')) {
$sidebar->containers['my']['header']['add'] = array('url' => Horde::url('tasklists/create.php'), 'label' => _("Create a new Task List"));
}
if ($GLOBALS['registry']->isAdmin()) {
$sidebar->containers['system'] = array('header' => array('id' => 'nag-toggle-system', 'label' => _("System Task Lists"), 'collapsed' => true));
$sidebar->containers['system']['header']['add'] = array('url' => Horde::url('tasklists/create.php')->add('system', 1), 'label' => _("Create a new System Task List"));
}
$sidebar->containers['shared'] = array('header' => array('id' => 'nag-toggle-shared', 'label' => _("Shared Task Lists"), 'collapsed' => true));
foreach (Nag::listTasklists(false, Horde_Perms::SHOW, false) as $name => $tasklist) {
$url = $list->add(array('display_tasklist' => $name, 'actionID' => in_array($name, $display_tasklists) ? 'remove_displaylist' : 'add_displaylist'));
$row = array('selected' => in_array($name, $display_tasklists), 'url' => $url, 'label' => Nag::getLabel($tasklist), 'color' => $tasklist->get('color') ?: '#dddddd', 'edit' => $edit->add('t', $tasklist->getName()), 'type' => 'checkbox');
if ($GLOBALS['registry']->isAdmin() && is_null($tasklist->get('owner'))) {
$sidebar->addRow($row, 'system');
} elseif ($tasklist->get('owner') == $user) {
$sidebar->addRow($row, 'my');
} else {
$sidebar->addRow($row, 'shared');
}
}
}
示例8: _
</form>
</div>
<div class="ansel_location_sameas"><?php
echo _("Click on a thumbnail to locate at the same point.");
?>
<br />
<?php
foreach ($this->imgs as $id => $data) {
?>
<?php
if ($this->image_id != $id) {
?>
<?php
$title = !empty($data['image_location']) ? Ansel::point2Deg($data['image_latitude'], true) . ' ' . Ansel::point2Deg($data['image_longitude']) : $data['image_location'];
$url = new Horde_Url('#');
echo $url->link(array('title' => $title, 'id' => 'geo_' . $id));
?>
<img src="<?php
echo Ansel::getImageUrl($id, 'mini', true);
?>
" alt="[thumbnail]" /></a>
<?php
}
?>
<?php
}
?>
</div>
<div class="control" style="vertical-align:bottom;">
<div style="text-align:center;margin-top:6px;"><img src="<?php
echo Ansel::getImageUrl($this->image_id, 'thumb', true);
示例9: _title
/**
*/
protected function _title()
{
$title = !empty($this->_params['title']) ? $this->_params['title'] : $this->_params['iframe'];
$url = new Horde_Url(Horde::externalUrl($this->_params['iframe']));
return htmlspecialchars($title) . $url->link(array('target' => '_blank')) . Horde_Themes_Image::tag('external.png', array('attr' => array('style' => 'vertical-align:middle;padding-left:.3em'))) . '</a>';
}
示例10: link
/**
* Returns an anchor tag with the relevant parameters
*
* @param Horde_Url|string $url The full URL to be linked to.
* @param string $title The link title/description.
* @param string $class The CSS class of the link.
* @param string $target The window target to point to.
* @param string $onclick JavaScript action for the 'onclick' event.
* @param string $title2 The link title (tooltip) (deprecated - just
* use $title).
* @param string $accesskey The access key to use.
* @param array $attributes Any other name/value pairs to add to the
* <a> tag.
* @param boolean $escape Whether to escape special characters in the
* title attribute.
*
* @return string The full <a href> tag.
*/
public static function link($url = '', $title = '', $class = '', $target = '', $onclick = '', $title2 = '', $accesskey = '', $attributes = array(), $escape = true)
{
if (!$url instanceof Horde_Url) {
$url = new Horde_Url($url);
}
if (!empty($title2)) {
$title = $title2;
}
if (!empty($onclick)) {
$attributes['onclick'] = $onclick;
}
if (!empty($class)) {
$attributes['class'] = $class;
}
if (!empty($target)) {
$attributes['target'] = $target;
}
if (!empty($accesskey)) {
$attributes['accesskey'] = $accesskey;
}
if (!empty($title)) {
if ($escape) {
$title = str_replace(array("\r", "\n"), '', htmlspecialchars(nl2br(htmlspecialchars($title))));
/* Remove double encoded entities. */
$title = preg_replace('/&([a-z]+|(#\\d+));/i', '&\\1;', $title);
}
$attributes['title.raw'] = $title;
}
return $url->link($attributes);
}
示例11: _init
/**
*/
protected function _init()
{
global $browser, $injector, $notification, $page_output, $prefs, $registry, $session;
/* Mailto link handler: redirect based on current view. */
if ($this->vars->actionID == 'mailto_link') {
switch ($registry->getView()) {
case Horde_Registry::VIEW_DYNAMIC:
IMP_Dynamic_Compose::url()->add($_GET)->redirect();
exit;
case Horde_Registry::VIEW_MINIMAL:
IMP_Minimal_Compose::url()->add($_GET)->redirect();
exit;
}
}
/* The message headers and text. */
$header = array();
$msg = '';
$redirect = $resume = $spellcheck = false;
$oldrtemode = $rtemode = null;
/* Is this a popup window? */
if ($isPopup = $prefs->getValue('compose_popup') || $this->vars->popup) {
$page_output->topbar = $page_output->sidebar = false;
}
/* Set the current identity. */
$identity = $injector->getInstance('IMP_Identity');
if (!$prefs->isLocked('default_identity') && !is_null($this->vars->identity)) {
$identity->setDefault($this->vars->identity);
}
if ($this->vars->actionID) {
switch ($this->vars->actionID) {
case 'draft':
case 'editasnew':
case 'forward_attach':
case 'forward_auto':
case 'forward_body':
case 'forward_both':
case 'fwd_digest':
case 'mailto':
case 'mailto_link':
case 'reply':
case 'reply_all':
case 'reply_auto':
case 'reply_list':
case 'redirect_compose':
case 'template':
case 'template_edit':
case 'template_new':
/* These are all safe actions that might be invoked without a
* token. */
break;
default:
try {
$session->checkToken($this->vars->compose_requestToken);
} catch (Horde_Exception $e) {
$notification->push($e);
$this->vars->actionID = null;
}
}
}
/* Check for duplicate submits. */
if ($reload = $this->vars->compose_formToken) {
try {
$session->checkNonce($reload);
} catch (Horde_Exception $e) {
$notification->push(_("You have already submitted this page."), 'horde.error');
$this->vars->actionID = null;
}
}
/* Determine if compose mode is disabled. */
$compose_disable = !IMP_Compose::canCompose();
/* Determine if mailboxes are readonly. */
$draft = IMP_Mailbox::getPref(IMP_Mailbox::MBOX_DRAFTS);
$readonly_drafts = $draft && $draft->readonly;
$sent_mail = $identity->getValue(IMP_Mailbox::MBOX_SENT);
if (!$sent_mail) {
$readonly_sentmail = $save_sent_mail = false;
} elseif ($sent_mail->readonly) {
$readonly_sentmail = true;
$save_sent_mail = false;
} else {
$readonly_sentmail = false;
$save_sent_mail = $reload ? (bool) $this->vars->save_sent_mail : true;
}
/* Initialize the IMP_Compose:: object. */
$imp_compose = $injector->getInstance('IMP_Factory_Compose')->create($this->vars->composeCache);
/* Init objects. */
$imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
$imp_ui = new IMP_Compose_Ui();
/* Determine the composition type - text or HTML.
$rtemode is null if browser does not support it. */
if ($session->get('imp', 'rteavail')) {
if ($prefs->isLocked('compose_html')) {
$rtemode = $prefs->getValue('compose_html');
} else {
$rtemode = $this->vars->rtemode;
if (is_null($rtemode)) {
$rtemode = $prefs->getValue('compose_html');
} else {
//.........这里部分代码省略.........