本文整理汇总了PHP中Horde_Url::unique方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Url::unique方法的具体用法?PHP Horde_Url::unique怎么用?PHP Horde_Url::unique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Url
的用法示例。
在下文中一共展示了Horde_Url::unique方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* Copyright 1999-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('ansel');
$blocks = $injector->getInstance('Horde_Core_Factory_BlockCollection')->create(array('ansel'), 'myansel_layout');
$layout = $blocks->getLayoutManager();
// Handle requested actions.
$layout->handle(Horde_Util::getFormData('action'), (int) Horde_Util::getFormData('row'), (int) Horde_Util::getFormData('col'));
if ($layout->updated()) {
$prefs->setValue('myansel_layout', $layout->serialize());
if (Horde_Util::getFormData('url')) {
$url = new Horde_Url(Horde_Util::getFormData('url'));
$url->unique()->redirect();
}
}
$page_output->header(array('title' => _("My Photos :: Add Content")));
$notification->notify(array('listeners' => 'status'));
require $registry->get('templates', 'horde') . '/portal/edit.inc';
$page_output->footer();
示例2: handle
/**
* Process a modification to the current layout.
*
* @param string $action TODO
* @param integer $row TODO
* @param integer $col TODO
* @param string $url TODO
*
* @throws Horde_Exception
*/
public function handle($action, $row, $col, $url = null)
{
switch ($action) {
case 'moveUp':
case 'moveDown':
case 'moveLeft':
case 'moveRight':
case 'expandUp':
case 'expandDown':
case 'expandLeft':
case 'expandRight':
case 'shrinkLeft':
case 'shrinkRight':
case 'shrinkUp':
case 'shrinkDown':
case 'removeBlock':
try {
call_user_func(array($this, $action), $row, $col);
$this->_updated = true;
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push($e);
}
break;
// Save the changes made to a block.
// Save the changes made to a block.
case 'save':
// Save the changes made to a block and continue editing.
// Save the changes made to a block and continue editing.
case 'save-resume':
// Get requested block type.
list($newapp, $newtype) = explode(':', Horde_Util::getFormData('app'));
// Is this a new block?
$new = false;
if ($this->isEmpty($row, $col) || !$this->rowExists($row) || !$this->colExists($col)) {
// Check permissions.
$max_blocks = $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_blocks');
if ($max_blocks !== true && $max_blocks <= count($this)) {
Horde::permissionDeniedError('horde', 'max_blocks', sprintf(Horde_Core_Translation::ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks));
break;
}
$new = true;
// Make sure there is somewhere to put it.
$this->addBlock($row, $col);
}
// Or an existing one?
$exists = false;
$changed = false;
if (!$new) {
// Get target block info.
$info = $this->getBlockInfo($row, $col);
$exists = $this->isBlock($row, $col);
// Has a different block been selected?
if ($exists && ($info['app'] != $newapp || $info['block'] != $newtype)) {
$changed = true;
}
}
if ($new || $changed) {
// Change app or type.
$info = array('app' => $newapp, 'block' => $newtype);
$params = $this->_collection->getParams($newapp, $newtype);
foreach ($params as $newparam) {
$info['params'][$newparam] = $this->_collection->getDefaultValue($newapp, $newtype, $newparam);
}
$this->setBlockInfo($row, $col, $info);
} elseif ($exists) {
// Change values.
$this->setBlockInfo($row, $col, array('params' => Horde_Util::getFormData('params', array())));
}
$this->_updated = true;
if ($action == 'save') {
break;
}
// Make a block the current block for editing.
// Make a block the current block for editing.
case 'edit':
$this->_currentBlock = array($row, $col);
$url = null;
break;
}
if (!empty($url)) {
$url = new Horde_Url($url);
$url->unique()->redirect();
}
}