diff --git a/cake/basics.php b/cake/basics.php index 2cb63b130..cbc7e8616 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -120,6 +120,11 @@ function loadView($viewClass) { if(strpos($viewClass, '.') !== false){ list($plugin, $viewClass) = explode('.', $viewClass); + $file = APP . 'plugins' . DS . $plugin . DS . 'views' . DS . Inflector::underscore($viewClass) . '.php'; + if (file_exists($file)) { + require($file); + return true; + } } if (!class_exists($viewClass . 'View')) { diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index fcf9fe814..c4a4631a8 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -599,7 +599,10 @@ class Controller extends Object { $viewClass = $this->view; if ($this->view != 'View') { - $viewClass = $this->view . 'View'; + if(strpos($viewClass, '.') !== false){ + list($plugin, $viewClass) = explode('.', $viewClass); + } + $viewClass = $viewClass . 'View'; loadView($this->view); } diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index ace55f283..6d47417e5 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -429,8 +429,9 @@ class Helper extends Overloadable { * @param array $options * @param string $key * @return array + * @access public */ - function __value($options = array(), $field = null, $key = 'value') { + function value($options = array(), $field = null, $key = 'value') { if ($options === null) { $options = array(); } elseif (is_string($options)) { @@ -481,7 +482,7 @@ class Helper extends Overloadable { $this->setFormTag($field); $options = (array)$options; $options = $this->__name($options); - $options = $this->__value($options); + $options = $this->value($options); $options = $this->domId($options); if ($this->tagIsInvalid()) { $options = $this->addClass($options, 'form-error'); diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index ff02696d3..852ec5cd3 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -741,7 +741,7 @@ class FormHelper extends AppHelper { trigger_error(__("Don't use me yet"), E_USER_ERROR); if (isset($options['name'])) { if (strpos($options['name'], "/") !== false || strpos($options['name'], ".") !== false) { - if ($this->__value($options['name'])) { + if ($this->value($options['name'])) { $options['checked'] = 'checked'; } $this->setFieldName($options['name']); @@ -854,7 +854,7 @@ class FormHelper extends AppHelper { } if (!isset($selected)) { - $selected = $this->__value($fieldName); + $selected = $this->value($fieldName); } if (isset($attributes) && array_key_exists('multiple', $attributes)) { @@ -887,7 +887,7 @@ class FormHelper extends AppHelper { * @return string */ function day($fieldName, $selected = null, $attributes = array(), $showEmpty = true) { - $value = $this->__value($fieldName); + $value = $this->value($fieldName); if (empty($value)) { if(!$showEmpty) { $value = 'now'; @@ -914,7 +914,7 @@ class FormHelper extends AppHelper { * @return string */ function year($fieldName, $minYear = null, $maxYear = null, $selected = null, $attributes = array(), $showEmpty = true) { - $value = $this->__value($fieldName); + $value = $this->value($fieldName); if (empty($value)) { if(!$showEmpty && !$maxYear) { $value = 'now'; @@ -940,7 +940,7 @@ class FormHelper extends AppHelper { * @return string */ function month($fieldName, $selected = null, $attributes = array(), $showEmpty = true) { - $value = $this->__value($fieldName); + $value = $this->value($fieldName); if (empty($value)) { if(!$showEmpty) { $value = 'now'; @@ -966,7 +966,7 @@ class FormHelper extends AppHelper { * @return string */ function hour($fieldName, $format24Hours = false, $selected = null, $attributes = array(), $showEmpty = true) { - $value = $this->__value($fieldName); + $value = $this->value($fieldName); if (empty($value)) { if(!$showEmpty) { $value = 'now'; @@ -992,7 +992,7 @@ class FormHelper extends AppHelper { * @return string */ function minute($fieldName, $selected = null, $attributes = array(), $showEmpty = true) { - $value = $this->__value($fieldName); + $value = $this->value($fieldName); if (empty($value)) { if(!$showEmpty) { $value = 'now'; @@ -1015,7 +1015,7 @@ class FormHelper extends AppHelper { * @return string */ function meridian($fieldName, $selected = null, $attributes = array(), $showEmpty = true) { - if (empty($selected) && $value = $this->__value($fieldName)) { + if (empty($selected) && $value = $this->value($fieldName)) { $selected = date('a', strtotime($value)); } $selected = empty($selected) ? ($showEmpty ? null : date('a')) : $selected; @@ -1039,7 +1039,7 @@ class FormHelper extends AppHelper { $meridian = null; if (empty($selected)) { - $selected = $this->__value($fieldName); + $selected = $this->value($fieldName); } if (!empty($selected)) { diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 45dc69066..28af4cadc 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -403,7 +403,7 @@ class HtmlHelper extends AppHelper { function radio($fieldName, $options, $inbetween = null, $htmlAttributes = array()) { $this->setFormTag($fieldName); - $value = isset($htmlAttributes['value']) ? $htmlAttributes['value'] : $this->__value($fieldName); + $value = isset($htmlAttributes['value']) ? $htmlAttributes['value'] : $this->value($fieldName); $out = array(); foreach($options as $optValue => $optTitle) { @@ -461,15 +461,6 @@ class HtmlHelper extends AppHelper { } return $this->output(join("\n", $out)); } -/** - * Returns value of $fieldName. False if the tag does not exist. - * - * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated - * @return unknown Value of the named tag. - */ - function value($fieldName) { - return $this->__value($fieldName); - } /** * Returns a formatted DIV tag for HTML FORMs. * @@ -517,7 +508,7 @@ class HtmlHelper extends AppHelper { } return $this->output(sprintf($this->tags[$tag], $this->_parseAttributes($attributes, null, ' ', ''), $text)); } - + /** * Creates a password input widget. * @@ -526,7 +517,7 @@ class HtmlHelper extends AppHelper { */ function password($fieldName, $htmlAttributes = array()) { trigger_error(sprintf(__('Method password() is deprecated in %s: see FormHelper::input or FormHelper::password', true), get_class($this)), E_USER_NOTICE); - $htmlAttributes = $this->__value($htmlAttributes, $fieldName); + $htmlAttributes = $this->value($htmlAttributes, $fieldName); $htmlAttributes = $this->domId($htmlAttributes); if ($this->tagIsInvalid()) { $htmlAttributes = $this->addClass($htmlAttributes, 'form_error'); @@ -541,7 +532,7 @@ class HtmlHelper extends AppHelper { */ function textarea($fieldName, $htmlAttributes = array()) { trigger_error(sprintf(__('Method textarea() is deprecated in %s: see FormHelper::input or FormHelper::textarea', true), get_class($this)), E_USER_NOTICE); - $htmlAttributes = $this->__value($htmlAttributes, $fieldName); + $htmlAttributes = $this->value($htmlAttributes, $fieldName); $value = null; if (isset($htmlAttributes['value']) && !empty($htmlAttributes['value'])) { @@ -605,7 +596,7 @@ class HtmlHelper extends AppHelper { */ function hidden($fieldName, $htmlAttributes = array()) { trigger_error(sprintf(__('Method hidden() is deprecated in %s: see FormHelper::input or FormHelper::hidden', true), get_class($this)), E_USER_NOTICE); - $htmlAttributes = $this->__value($htmlAttributes, $fieldName); + $htmlAttributes = $this->value($htmlAttributes, $fieldName); $htmlAttributes = $this->domId($htmlAttributes); return $this->output(sprintf($this->tags['hidden'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' '))); } @@ -617,7 +608,7 @@ class HtmlHelper extends AppHelper { */ function input($fieldName, $htmlAttributes = array()) { trigger_error(sprintf(__('Method input() is deprecated in %s: see FormHelper::input or FormHelper::text', true), get_class($this)), E_USER_NOTICE); - $htmlAttributes = $this->__value($htmlAttributes, $fieldName); + $htmlAttributes = $this->value($htmlAttributes, $fieldName); $htmlAttributes = $this->domId($htmlAttributes); if (!isset($htmlAttributes['type'])) {