Example #1
0
/**
 * Get a parameter from the current URI object
 *
 * @param   mixed    $key The key to look for. Pass false or null to return the entire params array.
 * @param   mixed    $default Optional default value, which should be returned if no element has been found
 * @return  mixed
 */
function param($key = null, $default = null)
{
    static $params;
    if (!$params) {
        $params = url::params();
    }
    return a::get($params, $key, $default);
}
Example #2
0
 /**
  * Returns a page url for any given page number
  * 
  * @param int $page The page number
  * @return string The url
  */
 public function pageURL($page)
 {
     if ($this->options['method'] == 'query') {
         $query = url::query();
         if ($page == 1) {
             unset($query[$this->options['variable']]);
         } else {
             $query[$this->options['variable']] = $page;
         }
         return url::build(array('query' => $query));
     } else {
         $params = url::params();
         if ($page == 1) {
             unset($params[$this->options['variable']]);
         } else {
             $params[$this->options['variable']] = $page;
         }
         return url::build(array('params' => $params));
     }
 }
Example #3
0
 public static function paramsToString($params = null)
 {
     if (is_null($params)) {
         $params = url::params();
     }
     $result = array();
     foreach ($params as $key => $val) {
         $result[] = $key . ':' . $val;
     }
     return implode('/', $result);
 }
Example #4
0
 public function params()
 {
     return new Request\Params(url::params());
 }