diff options
Diffstat (limited to 'app/php/url')
-rw-r--r-- | app/php/url/UrlManager.php | 57 | ||||
-rw-r--r-- | app/php/url/config.xml | 44 |
2 files changed, 0 insertions, 101 deletions
diff --git a/app/php/url/UrlManager.php b/app/php/url/UrlManager.php deleted file mode 100644 index a33d98e..0000000 --- a/app/php/url/UrlManager.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -Prado::using('System.Web.TUrlMapping'); - -class UrlManager extends TUrlMapping { - - public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) { - $url = parent::constructUrl( - $serviceID, - $serviceParam, - $getItems, - $encodeAmpersand, - $encodeGetItems - ); - return rtrim( - preg_replace( - '#^/' . $serviceParam . '#', - '/' . $this->_convertServiceParam($serviceParam), - preg_replace('#^/' . $serviceID . '#', '', $url) - ), - '/' - ) . '/'; - } - - public function parseUrl() { - $params = parent::parseUrl(); - if ($this->MatchingPattern) { - $serviceID = $this->MatchingPattern->ServiceID; - if (isset($params[$serviceID])) { - $params[$serviceID] = $this->_parseServiceParam($params[$serviceID]); - } - } - return $params; - } - - /** - * Convert service param from camelCase to hyphenated-form. - **/ - private function _convertServiceParam($param) { - return implode( - '-', - array_map('mb_strtolower', array_filter(preg_split('/(?=[A-Z])/', $param))) - ); - } - - /** - * Convert service param from hyphenated-form to camelCase. - **/ - private function _parseServiceParam($param) { - return implode( - '', - array_map('ucfirst', explode('-', $param)) - ); - } -} - -?> diff --git a/app/php/url/config.xml b/app/php/url/config.xml deleted file mode 100644 index b072b2d..0000000 --- a/app/php/url/config.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <modules> - <module id="url" - class="Application.url.UrlManager" - UrlPrefix="/" - EnableCustomUrl="True"> - - <url ServiceParameter="Home" - UrlFormat="HiddenPath" - pattern="{month}/{year}/" - parameters.month="\d{2}" - parameters.year="\d{4}" /> - <url ServiceParameter="Home" - UrlFormat="HiddenPath" - pattern="{month}/" - parameters.month="\d{2}" /> - <url ServiceParameter="Home" - UrlFormat="HiddenPath" - EnableCustomUrl="false" - pattern="" /> - - <url ServiceParameter="Calendar" - UrlFormat="HiddenPath" - pattern="calendar/{calendar}/" - parameters.calendar=".*" /> - - <url ServiceParameter="*" - UrlFormat="HiddenPath" - EnableCustomUrl="false" - pattern="{*}" /> - </module> - - <module id="request" - class="THttpRequest" - UrlFormat="HiddenPath" - UrlParamSeparator="/" - UrlManager="url" /> - <module id="response" - class="THttpResponse" - CacheControl="public" - CacheExpire="10" /> - </modules> -</configuration> |