本文整理汇总了PHP中Helper::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::url方法的具体用法?PHP Helper::url怎么用?PHP Helper::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper
的用法示例。
在下文中一共展示了Helper::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apiUrl
/**
* Convenience method to generate an API Url
*
* @param string|array $url
* @param bool $full
* @return string
*/
public function apiUrl($url = null, $full = false)
{
if (is_array($url)) {
$url = Hash::merge(array('admin' => false, 'api' => Configure::read('Croogo.Api.path'), 'prefix' => 'v1.0', 'ext' => 'json'), $url);
}
return parent::url($url, $full);
}
示例2: url
public function url($url = null, $full = false)
{
if (is_array($url) && !array_key_exists('lang', $url)) {
$url['lang'] = Configure::read('Config.language');
}
return parent::url($url, $full);
}
示例3: url
/**
* Url helper function
*
* @param string $url
* @param bool $full
* @return mixed
* @access public
*/
public function url($url = null, $full = false)
{
if (!isset($url['locale']) && isset($this->params['locale'])) {
$url['locale'] = $this->params['locale'];
}
return parent::url($url, $full);
}
示例4: url
function url($url = null, $full = false)
{
if (isset($this->params['admin']) && is_array($url) && !isset($url['admin'])) {
$url['admin'] = false;
}
return parent::url($url, $full);
}
示例5: url
public function url($url = null, $full = false)
{
if (empty($this->params['admin']) && is_array($url) && empty($url['admin']) && !array_key_exists('lang', $url)) {
$url['lang'] = $this->request['lang'];
}
return parent::url($url, $full);
}
示例6: url
public function url($url, $full = false)
{
if (is_string($url) && preg_match(sprintf('/^%s.+/', preg_quote('//', '/')), $url)) {
return h($url);
}
return parent::url($url, $full);
}
示例7: url
/**
* Url helper function
*
* @param string $url
* @param bool $full
* @return mixed
* @access public
*/
public function url($url = null, $full = false)
{
if (isset($this->request->params['locale'])) {
if ($url === null || is_array($url) && !isset($url['locale'])) {
$url['locale'] = $this->request->params['locale'];
}
}
return parent::url($url, $full);
}
示例8: url
/**
* Return link the pagination.
* - Force return of the first page.
*
* @param array $options Opções da paginação
* @param bool $asArray Retorna a url como array ou como string
* @param string $model Model para paginação
* @return mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::url
*/
public function url($options = array(), $asArray = false, $model = null)
{
if (is_array($options)) {
if (!isset($options['page'])) {
$options['page'] = 1;
}
}
return parent::url($options, $asArray, $model);
}
示例9: url
/**
* Url helper function
*
* - Localize URL.
*
* @param string $url
* @param bool $full
* @return mixed
* @access public
*/
public function url($url = null, $full = false)
{
if (CakePlugin::loaded('I18n')) {
$url = Common::url($url);
if (is_array($url) && !array_key_exists('lang', $url)) {
$url['lang'] = Configure::read('Config.language');
}
}
return parent::url($url, $full);
}
示例10: url
/**
* Overrides the default url method in order to clear any/all prefixes
* that aren't explicitly requested. This will prevent a subsequent request
* (e.g. redirect or link on a prefixed page) from inheriting the current
* prefix.
*
* @access public
* @see Helper::url()
*/
function url($url = null, $full = false)
{
if (isset($this->params['prefix'])) {
$prefix = $this->params['prefix'];
if ($this->params[$prefix] && (!isset($url[$prefix]) || empty($url[$prefix]))) {
$url[$prefix] = false;
}
}
return parent::url($url, $full);
}
示例11: getDelete
public function getDelete($id)
{
DB::beginTransaction();
try {
$model = $this->model->find($id);
$model->delete();
DB::commit();
return redirect(\Helper::url('index'))->withMessage('Data has been deleted');
} catch (\Exception $e) {
DB::rollback();
return redirect(\Helper::url('index'))->withMessage('Data cannot be deleted');
}
}
示例12: url
function url($url = null, $full = false)
{
$keyUrl = $url;
if (is_array($keyUrl)) {
$keyUrl += $this->_extras;
}
$key = md5(serialize($keyUrl));
if (!empty($this->_cache[$key])) {
return $this->_cache[$key];
}
$url = parent::url($url, $full);
$this->_cache[$key] = $url;
return $url;
}
示例13: url
/**
* url function
*
* @param mixed $url
* @param bool $full
* @access public
* @return void
*/
function url($url = null, $full = false)
{
if (!is_array($url)) {
return parent::url($url, $full);
}
$defaults = array('controller' => $this->params['controller'], 'action' => $this->params['action'], 'admin' => !empty($this->params['admin']), 'lang' => $this->params['lang'], 'theme' => $this->params['theme']);
$url = am($defaults, $url);
if (isset($url[0])) {
$id = Configure::read('Site.homeNode');
if (empty($url['admin']) && $url['controller'] === 'nodes' && $url['action'] === 'view' && $url[0] == $id) {
$url = array('action' => 'index', 'lang' => $this->params['lang'], 'theme' => $this->params['theme']);
}
}
return parent::url($url, $full);
}
示例14: url
function url($url = null, $full = false)
{
$keyUrl = $url;
if (is_array($keyUrl)) {
$keyUrl += $this->_extras;
}
$key = md5(serialize($keyUrl) . $full);
$key += md5_file(CONFIGS . DS . 'routes.php');
if (!empty($this->_cache[$key])) {
return $this->_cache[$key];
}
$url = parent::url($url, $full);
$this->_cache[$key] = $url;
return $url;
}
示例15: url
/**
* Intercepts the parent URL function to first look if the cache was already generated for the same params
*
* @param mixed $url URL to generate using CakePHP array syntax
* @param boolean $full whether to generate a full url or not (http scheme)
* @return string
* @see Helper::url()
*/
public function url($url = null, $full = false)
{
if (Configure::read('UrlCache.runtime.afterLayout')) {
return parent::url($url, $full);
}
if (Configure::read('UrlCache.active')) {
if ($cachedUrl = UrlCacheManager::get($url, $full)) {
return $cachedUrl;
}
}
$routerUrl = parent::url($url, $full);
if (Configure::read('UrlCache.active')) {
UrlCacheManager::set($routerUrl);
}
return $routerUrl;
}