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; }
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); }
/** * 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); }
/** * 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); }
/** * 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); }
public function testFullUrlWithRequestParams() { $this->AppHelper->request->params['locale'] = 'por'; $url = $this->AppHelper->url(null, true); $this->assertEqual($url, Router::url('/por/index', true)); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * ベースを考慮したURLを取得 * * @param string $url * @param boolean $full */ function getUrl($url, $full = false) { return parent::url($url, $full); }
/** * 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); }
/** * 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); }