From 6c75e3697d5b0d70ed0cc73403b16d2812bd02ad Mon Sep 17 00:00:00 2001 From: Hikkijp Date: Tue, 27 May 2014 13:50:08 -0300 Subject: [PATCH 01/19] Fixes bug described in #3581 Routes with '/**' are now correctly handled when called by $this->Html->link() in a view. --- lib/Cake/Routing/Route/CakeRoute.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 74595c400..47bd57e6b 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -536,7 +536,10 @@ class CakeRoute { $out = str_replace($search, $replace, $out); } - if (strpos($this->template, '*')) { + if (strpos($this->template, '**')) { + $out = str_replace('**', $params['pass'], $out); + } + elseif (strpos($this->template, '*')) { $out = str_replace('*', $params['pass'], $out); } $out = str_replace('//', '/', $out); From 952c7192f4a9746244625362d65d7844f2c86825 Mon Sep 17 00:00:00 2001 From: Hikkijp Date: Tue, 27 May 2014 14:00:20 -0300 Subject: [PATCH 02/19] Revert "Fixes bug described in #3581" This reverts commit 6c75e3697d5b0d70ed0cc73403b16d2812bd02ad. --- lib/Cake/Routing/Route/CakeRoute.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 47bd57e6b..74595c400 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -536,10 +536,7 @@ class CakeRoute { $out = str_replace($search, $replace, $out); } - if (strpos($this->template, '**')) { - $out = str_replace('**', $params['pass'], $out); - } - elseif (strpos($this->template, '*')) { + if (strpos($this->template, '*')) { $out = str_replace('*', $params['pass'], $out); } $out = str_replace('//', '/', $out); From e6c6e0bf2c541885f890968d6047974d587a422e Mon Sep 17 00:00:00 2001 From: Hikkijp Date: Tue, 27 May 2014 14:03:56 -0300 Subject: [PATCH 03/19] Fixes bug described in #3581 Routes with '/**' are now correctly handled by the HtmlHelper->link() --- lib/Cake/Routing/Route/CakeRoute.php | 5 ++++- lib/Cake/View/Helper/HtmlHelper.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 74595c400..47bd57e6b 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -536,7 +536,10 @@ class CakeRoute { $out = str_replace($search, $replace, $out); } - if (strpos($this->template, '*')) { + if (strpos($this->template, '**')) { + $out = str_replace('**', $params['pass'], $out); + } + elseif (strpos($this->template, '*')) { $out = str_replace('*', $params['pass'], $out); } $out = str_replace('//', '/', $out); diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 6a8640bc8..ee83328fe 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -334,6 +334,7 @@ class HtmlHelper extends AppHelper { $escapeTitle = true; if ($url !== null) { $url = $this->url($url); + $url = str_replace('%2F', '/', $url); } else { $url = $this->url($title); $title = htmlspecialchars_decode($url, ENT_QUOTES); From f7e98e742705921641f1d1ebb3b741fa823216d4 Mon Sep 17 00:00:00 2001 From: Hikkijp Date: Tue, 27 May 2014 17:25:28 -0300 Subject: [PATCH 04/19] Revert "Fixes bug described in #3581" This reverts commit e6c6e0bf2c541885f890968d6047974d587a422e. --- lib/Cake/Routing/Route/CakeRoute.php | 5 +---- lib/Cake/View/Helper/HtmlHelper.php | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 47bd57e6b..74595c400 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -536,10 +536,7 @@ class CakeRoute { $out = str_replace($search, $replace, $out); } - if (strpos($this->template, '**')) { - $out = str_replace('**', $params['pass'], $out); - } - elseif (strpos($this->template, '*')) { + if (strpos($this->template, '*')) { $out = str_replace('*', $params['pass'], $out); } $out = str_replace('//', '/', $out); diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index ee83328fe..6a8640bc8 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -334,7 +334,6 @@ class HtmlHelper extends AppHelper { $escapeTitle = true; if ($url !== null) { $url = $this->url($url); - $url = str_replace('%2F', '/', $url); } else { $url = $this->url($title); $title = htmlspecialchars_decode($url, ENT_QUOTES); From c622a9dfc250bba1fb3a4a4928a3f61f743dbaec Mon Sep 17 00:00:00 2001 From: Hikkijp Date: Tue, 27 May 2014 17:30:38 -0300 Subject: [PATCH 05/19] Fixes bug #3581 Fixes bug #3581 and the issue noticed by markstory --- lib/Cake/Routing/Route/CakeRoute.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 74595c400..332aa804c 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -536,7 +536,11 @@ class CakeRoute { $out = str_replace($search, $replace, $out); } - if (strpos($this->template, '*')) { + if (strpos($this->template, '**')) { + $out = str_replace('**', $params['pass'], $out); + $out = str_replace('%2F', '/', $out); + } + elseif (strpos($this->template, '*')) { $out = str_replace('*', $params['pass'], $out); } $out = str_replace('//', '/', $out); From 16df061d669f99e11b420852d34f30f16fda6c84 Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 30 May 2014 00:31:20 +0530 Subject: [PATCH 06/19] Fix api docblocks for View layer classes. --- lib/Cake/View/Helper.php | 12 +-- lib/Cake/View/Helper/CacheHelper.php | 7 +- lib/Cake/View/Helper/FormHelper.php | 49 ++++++------ lib/Cake/View/Helper/JqueryEngineHelper.php | 2 +- lib/Cake/View/Helper/JsBaseEngineHelper.php | 1 + lib/Cake/View/Helper/JsHelper.php | 1 + lib/Cake/View/Helper/MootoolsEngineHelper.php | 4 +- lib/Cake/View/Helper/NumberHelper.php | 27 +++---- lib/Cake/View/Helper/PaginatorHelper.php | 15 ++-- .../View/Helper/PrototypeEngineHelper.php | 4 +- lib/Cake/View/Helper/RssHelper.php | 4 +- lib/Cake/View/Helper/SessionHelper.php | 2 +- lib/Cake/View/Helper/TextHelper.php | 21 +++-- lib/Cake/View/Helper/TimeHelper.php | 76 +++++++------------ lib/Cake/View/HelperCollection.php | 5 +- lib/Cake/View/JsonView.php | 2 +- lib/Cake/View/View.php | 2 +- lib/Cake/View/XmlView.php | 2 +- 18 files changed, 105 insertions(+), 131 deletions(-) diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 165ad6681..ed27e4da4 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -224,7 +224,7 @@ class Helper extends Object { * Provides backwards compatibility access for setting values to the request object. * * @param string $name Name of the property being accessed. - * @param mixed $value + * @param mixed $value Value to set. * @return void * @deprecated This method will be removed in 3.0 */ @@ -299,7 +299,7 @@ class Helper extends Object { * Generate URL for given asset file. Depending on options passed provides full URL with domain name. * Also calls Helper::assetTimestamp() to add timestamp to local files * - * @param string|array Path string or URL array + * @param string|array $path Path string or URL array * @param array $options Options array. Possible keys: * `fullBase` Return full URL with domain name * `pathPrefix` Path prefix for relative URLs @@ -665,7 +665,7 @@ class Helper extends Object { * * @param array|string $options If an array, should be an array of attributes that $key needs to be added to. * If a string or null, will be used as the View entity. - * @param string $field + * @param string $field Field name. * @param string $key The name of the attribute to be set, defaults to 'name' * @return mixed If an array was given for $options, an array with $key set will be returned. * If a string was supplied a string will be returned. @@ -706,7 +706,7 @@ class Helper extends Object { * * @param array|string $options If an array, should be an array of attributes that $key needs to be added to. * If a string or null, will be used as the View entity. - * @param string $field + * @param string $field Field name. * @param string $key The name of the attribute to be set, defaults to 'value' * @return mixed If an array was given for $options, an array with $key set will be returned. * If a string was supplied a string will be returned. @@ -881,8 +881,8 @@ class Helper extends Object { * Transforms a recordset from a hasAndBelongsToMany association to a list of selected * options for a multiple select element * - * @param string|array $data - * @param string $key + * @param string|array $data Data array or model name. + * @param string $key Field name. * @return array */ protected function _selectedArray($data, $key = 'id') { diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index e54d6b2cb..b725ca43e 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -64,7 +64,7 @@ class CacheHelper extends AppHelper { /** * Parses the view file and stores content for cache file building. * - * @param string $viewFile + * @param string $viewFile View file name. * @param string $output The output for the file. * @return string Updated content. */ @@ -77,7 +77,7 @@ class CacheHelper extends AppHelper { /** * Parses the layout file and stores content for cache file building. * - * @param string $layoutFile + * @param string $layoutFile Layout file name. * @return void */ public function afterLayout($layoutFile) { @@ -266,7 +266,8 @@ class CacheHelper extends AppHelper { * * @param string $content view content to write to a cache file. * @param string $timestamp Duration to set for cache file. - * @param boolean $useCallbacks + * @param boolean $useCallbacks Whether to include statements in cached file which + * run callbacks. * @return boolean success of caching view. */ protected function _writeFile($content, $timestamp, $useCallbacks = false) { diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 77ae39450..b5ae1564c 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -140,7 +140,7 @@ class FormHelper extends AppHelper { * Guess the location for a model based on its name and tries to create a new instance * or get an already created instance of the model * - * @param string $model + * @param string $model Model name. * @return Model model instance */ protected function _getModel($model) { @@ -254,7 +254,7 @@ class FormHelper extends AppHelper { /** * Returns if a field is required to be filled based on validation properties from the validating object. * - * @param CakeValidationSet $validationRules + * @param CakeValidationSet $validationRules Validation rules set. * @return boolean true if field is required to be filled, false otherwise */ protected function _isRequiredField($validationRules) { @@ -1107,7 +1107,7 @@ class FormHelper extends AppHelper { /** * Generates input options array * - * @param array $options + * @param array $options Options list. * @return array Options */ protected function _parseOptions($options) { @@ -1138,7 +1138,7 @@ class FormHelper extends AppHelper { /** * Generates list of options for multiple select * - * @param array $options + * @param array $options Options list. * @return array */ protected function _optionsOptions($options) { @@ -1162,7 +1162,7 @@ class FormHelper extends AppHelper { /** * Magically set option type and corresponding options * - * @param array $options + * @param array $options Options list. * @return array */ protected function _magicOptions($options) { @@ -1235,7 +1235,7 @@ class FormHelper extends AppHelper { /** * Generate format options * - * @param array $options + * @param array $options Options list. * @return array */ protected function _getFormat($options) { @@ -1254,8 +1254,8 @@ class FormHelper extends AppHelper { /** * Generate label for input * - * @param string $fieldName - * @param array $options + * @param string $fieldName Field name. + * @param array $options Options list. * @return boolean|string false or Generated label element */ protected function _getLabel($fieldName, $options) { @@ -1277,7 +1277,7 @@ class FormHelper extends AppHelper { /** * Calculates maxlength option * - * @param array $options + * @param array $options Options list. * @return array */ protected function _maxLength($options) { @@ -1299,7 +1299,7 @@ class FormHelper extends AppHelper { /** * Generate div options for input * - * @param array $options + * @param array $options Options list. * @return array */ protected function _divOptions($options) { @@ -1351,9 +1351,10 @@ class FormHelper extends AppHelper { * $options can contain a hash of id overrides. These overrides will be * used instead of the generated values if present. * - * @param string $fieldName - * @param string $label - * @param array $options Options for the label element. 'NONE' option is deprecated and will be removed in 3.0 + * @param string $fieldName Field name. + * @param string|array $label Label text or array with text and options. + * @param array $options Options for the label element. 'NONE' option is + * deprecated and will be removed in 3.0 * @return string Generated label element */ protected function _inputLabel($fieldName, $label, $options) { @@ -2668,9 +2669,9 @@ class FormHelper extends AppHelper { /** * Gets the input field name for the current tag * - * @param array $options - * @param string $field - * @param string $key + * @param array $options Options list. + * @param string $field Field name. + * @param string $key Key name. * @return array */ protected function _name($options = array(), $field = null, $key = 'name') { @@ -2710,10 +2711,10 @@ class FormHelper extends AppHelper { /** * Returns an array of formatted OPTION/OPTGROUP elements * - * @param array $elements - * @param array $parents - * @param boolean $showParents - * @param array $attributes + * @param array $elements Elements to format. + * @param array $parents Parents for OPTGROUP. + * @param boolean $showParents Whether to show parents. + * @param array $attributes HTML attributes. * @return array */ protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) { @@ -2828,8 +2829,8 @@ class FormHelper extends AppHelper { /** * Generates option lists for common