From 6ea8a477732cc1522e403253618a7466e6d558bd Mon Sep 17 00:00:00 2001 From: guilhermeblanco Date: Thu, 21 Feb 2008 14:12:01 +0000 Subject: [PATCH] Split of methods in _parseTemplate in 0.10 and trunk --- lib/Doctrine/Pager/Layout.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Pager/Layout.php b/lib/Doctrine/Pager/Layout.php index a57b61af6..d54b5151d 100644 --- a/lib/Doctrine/Pager/Layout.php +++ b/lib/Doctrine/Pager/Layout.php @@ -415,6 +415,24 @@ class Doctrine_Pager_Layout * @return string */ protected function _parseTemplate($options = array()) + { + $str = $this->_parseUrlTemplate($options); + $replacements = $this->_parseReplacementsTemplate($options); + + return strtr($str, $replacements); + } + + + /** + * _parseUrlTemplate + * + * Processes the url mask to return the correct template depending of the options sent. + * Already process the mask replacements assigned. + * + * @param $options Optional parameters to be applied in template and url mask + * @return string + */ + protected function _parseUrlTemplate($options = array()) { $str = ''; @@ -428,6 +446,20 @@ class Doctrine_Pager_Layout $str = $this->_parseMaskReplacements($this->getTemplate()); } + return $str; + } + + + /** + * _parseUrl + * + * Process the url mask of a given page and return the processed url + * + * @param $options Optional parameters to be applied in template and url mask + * @return string + */ + protected function _parseReplacementsTemplate($options = array()) + { // Defining "url" options index to allow {%url} mask $options['url'] = $this->_parseUrl($options); @@ -437,7 +469,7 @@ class Doctrine_Pager_Layout $replacements['{%'.$k.'}'] = $v; } - return strtr($str, $replacements); + return $replacements; }