本文整理汇总了PHP中AppHelper::url方法的典型用法代码示例。如果您正苦于以下问题:PHP AppHelper::url方法的具体用法?PHP AppHelper::url怎么用?PHP AppHelper::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppHelper
的用法示例。
在下文中一共展示了AppHelper::url方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUrl
public function actionUrl($action, $dir = null, $file = null, $full = false)
{
$url = array('plugin' => 'media', 'controller' => 'file_explorer', 'action' => $action, 'config' => $this->settings['config']);
$url = parent::url($url, $full);
//$dir = urlencode($dir);
//$file = urlencode($file);
$url .= '?' . http_build_query(compact('dir', 'file'));
return $url;
}
示例2: url
public function url($data, $fieldName, $full = false)
{
$this->setEntity($fieldName);
if (isset($data[$this->model()])) {
$data = $data[$this->model()];
}
$path = $this->_path();
$dir = $this->_dir($data);
$filename = $this->_filename($data);
$Model = ClassRegistry::init($this->model());
$filePath = ROOT . DS . APP_DIR . DS . str_replace('/', DS, "/{$path}{$dir}/{$filename}");
if (!file_exists($filePath) && !empty($data[$Model->primaryKey])) {
$Model->id = $data[$Model->primaryKey];
$Model->createThumbnail($this->field(), $this->_style());
}
if (substr($path, 0, 8) == 'webroot/') {
$path = substr($path, 8);
}
return parent::url($this->webroot("/{$path}{$dir}/{$filename}"), $full);
}
示例3: url
/**
* Merges passed URL options with current pagination state to generate a pagination URL.
*
* @param array $options Pagination/URL options array
* @param boolean $asArray
* @param string $model Which model to paginate on
* @return mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)
*/
function url($options = array(), $asArray = false, $model = null)
{
$paging = $this->params($model);
if (!empty($paging['defaults'])) {
$url = array_merge(array_filter(Set::diff(array_merge($paging['defaults'], $paging['options']), [])), $options);
} else {
$url = array_merge(array_filter(Set::diff(array_merge([], $paging['options']), [])), $options);
}
if (isset($url['order'])) {
$sort = $direction = null;
if (is_array($url['order'])) {
list($sort, $direction) = array($this->sortKey($model, $url), current($url['order']));
}
unset($url['order']);
$url = array_merge($url, compact('sort', 'direction'));
}
if ($asArray) {
return $url;
}
return parent::url($url);
}
示例4: url
/**
* Merges passed URL options with current pagination state to generate a pagination URL.
*
* @param array $options Pagination/URL options array
* @param boolean $asArray
* @param string $model Which model to paginate on
* @return mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)
*/
function url($options = array(), $asArray = false, $model = null)
{
$paging = $this->params($model);
$url = array_merge(array_filter(Set::diff(array_merge($paging['defaults'], $paging['options']), $paging['defaults'])), $options);
if (isset($url['order'])) {
$sort = $direction = null;
if (is_array($url['order'])) {
list($sort, $direction) = array($this->sortKey($model, $url), current($url['order']));
$key = array_keys($url['order']);
if (strpos($key[0], '.') !== false) {
list($model) = explode('.', $key[0]);
$sort = $model . '.' . $sort;
}
}
unset($url['order']);
$url = array_merge($url, compact('sort', 'direction'));
}
if ($asArray) {
return $url;
}
return parent::url($url);
}
示例5: url
/**
* Convenience method to generate url to a node or current node
*
* @param array $node Node data
* @return string
*/
public function url($url = null, $full = false)
{
if ($url === null && $this->node) {
$url = $this->node;
}
$alias = is_array($url) ? key($url) : null;
if (isset($url[$alias]['url'])) {
$url = $url[$alias]['url'];
} elseif (isset($url[$alias]['type']) && isset($url[$alias]['slug'])) {
$url = array('plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view', 'type' => $url[$alias]['type'], 'slug' => $url[$alias]['slug']);
}
return parent::url($url, $full);
}
示例6: testFullUrlWithRequestParams
public function testFullUrlWithRequestParams()
{
$this->AppHelper->request->params['locale'] = 'por';
$url = $this->AppHelper->url(null, true);
$this->assertEqual($url, Router::url('/por/index', true));
}
示例7: url
/**
* Merges passed URL options with current pagination state to generate a pagination URL.
*
* @param array $options Pagination/URL options array
* @param boolean $asArray Return the URL as an array, or a URI string
* @param string $model Which model to paginate on
* @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)
{
$paging = $this->params($model);
$url = array_merge(array_filter($paging['options']), $options);
if (isset($url['order'])) {
$sort = $direction = null;
if (is_array($url['order'])) {
list($sort, $direction) = array($this->sortKey($model, $url), current($url['order']));
}
unset($url['order']);
$url = array_merge($url, compact('sort', 'direction'));
}
$url = $this->_convertUrlKeys($url, $paging['paramType']);
if (!empty($url['page']) && $url['page'] == 1) {
$url['page'] = null;
}
if (!empty($url['?']['page']) && $url['?']['page'] == 1) {
unset($url['?']['page']);
}
if ($asArray) {
return $url;
}
return parent::url($url);
}
示例8: url
/**
* Turns a file path into a (routed) URL
*
* Reimplemented method from Helper
*
* @param string $path Absolute or partial path to a file
* @param boolean $full
* @return string
*/
function url($path = null, $full = false)
{
if (is_array($path) || strpos($path, '://') !== false) {
return parent::url($path, $full);
}
if (!($path = $this->webroot($path))) {
return null;
}
return $full ? FULL_BASE_URL . $path : $path;
}
示例9: wsdlUrl
/**
* Return the url to the wsdl file.
*
* @return string
*/
public function wsdlUrl()
{
return AppHelper::url(array('controller' => Inflector::underscore($this->controller->name), 'action' => $this->__settings['wsdlAction'], $this->__settings['prefix'] => true), true);
}
示例10: getUrl
/**
* ベースを考慮したURLを取得
*
* @param string $url
* @param boolean $full
*/
function getUrl($url, $full = false)
{
return parent::url($url, $full);
}
示例11: getUrl
/**
* baserCMSの設置フォルダを考慮したURLを取得する
*
* 《利用例》
* <a href="<?php echo $this->BcBaser->getUrl('/about') ?>">会社概要</a>
*
* @param mixed $url baserCMS設置フォルダからの絶対URL、もしくは配列形式のURL情報
* 省略した場合には、PC用のトップページのURLを取得する
* @param bool $full httpから始まるURLを取得するかどうか
* @param bool $sessionId セションIDを付加するかどうか
* @return string URL
*/
public function getUrl($url = null, $full = false, $sessionId = true)
{
return parent::url($url, $full, $sessionId);
}
示例12: url
/**
* Turns a file path into a (routed) URL
*
* Reimplemented method from Helper
*
* @param string $path Absolute or partial path to a file
* @param boolean $full
* @return string
*/
function url($path = null, $full = false)
{
return parent::url($this->webroot($path), $full);
}