mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Changing Helper::_ _value(); to Helper::value();
Removed HtmlHelper::value(); Changed all references to _ _value() to value(); Started changes needed for loading custom view classes located in a plugin git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5213 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b77586db23
commit
cbd5bc9e47
5 changed files with 27 additions and 27 deletions
|
@ -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')) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
Loading…
Add table
Reference in a new issue