diff --git a/cake/basics.php b/cake/basics.php index 31fee0104..506c4af58 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -628,52 +628,6 @@ } return true; } -/** - * Normalizes a string or array list - * - * @param mixed $list - * @param boolean $assoc If true, $list will be converted to an associative array - * @param string $sep If $list is a string, it will be split into an array with $sep - * @param boolean $trim If true, separated strings will be trimmed - * @return array - */ - function normalizeList($list, $assoc = true, $sep = ',', $trim = true) { - trigger_error(__('normalizeList Deprecated: use Set::normalize', true), E_USER_WARNING); - if (is_string($list)) { - $list = explode($sep, $list); - if ($trim) { - $list = array_map('trim', $list); - } - if ($assoc) { - return normalizeList($list); - } - } elseif (is_array($list)) { - $keys = array_keys($list); - $count = count($keys); - $numeric = true; - - if (!$assoc) { - for ($i = 0; $i < $count; $i++) { - if (!is_int($keys[$i])) { - $numeric = false; - break; - } - } - } - if (!$numeric || $assoc) { - $newList = array(); - for ($i = 0; $i < $count; $i++) { - if (is_int($keys[$i])) { - $newList[$list[$keys[$i]]] = null; - } else { - $newList[$keys[$i]] = $list[$keys[$i]]; - } - } - $list = $newList; - } - } - return $list; - } /** * Prints out debug information about given variable. * @@ -1415,19 +1369,6 @@ return $res; } } -/** - * @deprecated - * @see Set::countDim - */ - function countdim($array) { - trigger_error(__('Deprecated: Use Set::countDim instead', true), E_USER_WARNING); - if (is_array(reset($array))) { - $return = countdim(reset($array)) + 1; - } else { - $return = 1; - } - return $return; - } /** * Shortcut to Log::write. */ diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index a37c2e0ed..933362c28 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -48,15 +48,6 @@ class RequestHandlerComponent extends Object { * @see RequestHandler::setAjax() */ var $ajaxLayout = 'ajax'; -/** - * Determines whether or not callbacks will be fired on this component - * - * @var boolean - * @access public - * @deprecated - * @see RequestHandler::$enabled - */ - var $disableStartup = false; /** * Determines whether or not callbacks will be fired on this component * @@ -218,28 +209,6 @@ class RequestHandlerComponent extends Object { } } } -/** - * @deprecated - * @see RequestHandlerComponent::renderAs() - */ - function setView(&$controller) { - trigger_error('Deprecated: Use RequestHandlerComponent::renderAs() instead', E_USER_WARNING); - if ($this->setAjax($controller)) { - return; - } - } -/** - * @deprecated - * @see RequestHandlerComponent::renderAs() - */ - function setAjax(&$controller) { - trigger_error('Deprecated: Use RequestHandlerComponent::renderAs() instead', E_USER_WARNING); - if ($this->isAjax()) { - $controller->layout = $this->ajaxLayout; - return $this->respondAs('html', array('charset' => 'UTF-8')); - } - return false; - } /** * Returns true if the current HTTP request is Ajax, false otherwise * diff --git a/cake/libs/controller/components/session.php b/cake/libs/controller/components/session.php index 7d7d50ab8..9421dd49b 100644 --- a/cake/libs/controller/components/session.php +++ b/cake/libs/controller/components/session.php @@ -203,24 +203,6 @@ class SessionComponent extends CakeSession { $this->write('Message.' . $key, compact('message', 'layout', 'params')); } } -/** - * This method is deprecated. - * You should use $session->flash('key'); in your views - * - * @param string $key Optional message key - * @return boolean or renders output directly. - * @deprecated - */ - function flash($key = 'flash') { - if ($this->__active === true) { - if ($this->check('Message.' . $key)) { - e($this->read('Message.' . $key)); - $this->del('Message.' . $key); - return; - } - } - return false; - } /** * Used to renew a session id * diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 944159814..aac1f4e26 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -660,14 +660,6 @@ class Controller extends Object { header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } -/** - * @deprecated - * @see Controller::set - */ - function _setTitle($pageTitle) { - trigger_error(__('Deprecated: Use Controller::set("title", "...") instead', true), E_USER_WARNING); - $this->pageTitle = $pageTitle; - } /** * Shows a message to the user $time seconds, then redirects to $url * Uses flash.thtml as a layout for the messages diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index f08cec6c9..498c5458d 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -313,22 +313,6 @@ class DboSource extends DataSource { return null; } } -/** - * @deprecated - * @see DboSource::fetchRow - */ - function fetchArray() { - trigger_error(__('Deprecated: Use DboSource::fetchRow() instead', true), E_USER_WARNING); - return $this->fetchRow(); - } -/** - * @deprecated - * @see DboSource::fetchRow - */ - function one($sql) { - trigger_error(__('Deprecated: Use DboSource::fetchRow($sql) instead', true), E_USER_WARNING); - return $this->fetchRow($sql); - } /** * Returns an array of all result rows for a given SQL query. * Returns false if no rows matched. diff --git a/cake/libs/model/db_acl.php b/cake/libs/model/db_acl.php index 110c88317..4ee85150b 100644 --- a/cake/libs/model/db_acl.php +++ b/cake/libs/model/db_acl.php @@ -203,26 +203,6 @@ class DB_ACL extends AclBase { function revoke($aro, $aco, $action = "*") { return $this->deny($aro, $aco, $action); } -/** - * Get an ARO object from the given id or alias - * - * @param mixed $id - * @return Aro - */ - function getAro($id = null) { - trigger_error(__('DB_ACL::getAro() - Usage deprecated. Use AclComponent::$Aro::node().', true), E_USER_WARNING); - return $this->__getObject($id, 'Aro'); - } -/** - * Get an ACO object from the given id or alias - * - * @param mixed $id - * @return Aco - */ - function getAco($id = null) { - trigger_error(__('DB_ACL::getAco() - Usage deprecated. Use AclComponent::$Aco::node().', true), E_USER_WARNING); - return $this->__getObject($id, 'Aco'); - } /** * Private method * diff --git a/cake/libs/neat_array.php b/cake/libs/neat_array.php deleted file mode 100644 index c63103eb8..000000000 --- a/cake/libs/neat_array.php +++ /dev/null @@ -1,319 +0,0 @@ - - * Copyright 2005-2007, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2007, Cake Software Foundation, Inc. - * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project - * @package cake - * @subpackage cake.cake.libs - * @since CakePHP(tm) v 0.2.9 - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -/** - * Class used for internal manipulation of multi-dimensional arrays (arrays of arrays). - * - * Long description for class - * - * @package cake - * @subpackage cake.cake.libs - * @deprecated - */ -class NeatArray { -/** - * Value of NeatArray. - * - * @var array - * @access public - */ - var $value; -/** - * Constructor. Defaults to an empty array. - * - * @param array $value - * @access public - * @uses NeatArray::value - */ - function NeatArray($value = array()) { - $this->value = $value; - } -/** - * Finds and returns records with $fieldName equal to $value from this NeatArray. - * - * @param string $fieldName - * @param string $value - * @return mixed - * @access public - * @uses NeatArray::value - */ - function findIn($fieldName, $value) { - if (!is_array($this->value)) { - return false; - } - $out = false; - $keys = array_keys($this->value); - $count = sizeof($keys); - - for($i = 0; $i < $count; $i++) { - if (isset($this->value[$keys[$i]][$fieldName]) && ($this->value[$keys[$i]][$fieldName] == $value)) - { - $out[$keys[$i]] = $this->value[$keys[$i]]; - } - } - return $out; - } -/** - * Checks if $this->value is an array, and removes all empty elements. - * - * @access public - * @uses NeatArray::value - */ - function cleanup() { - $out = is_array($this->value) ? array(): null; - foreach($this->value as $k => $v) { - if ($v == "0") { - $out[$k] = $v; - } elseif ($v) { - $out[$k] = $v; - } - } - $this->value=$out; - } -/** - * Adds elements from given array to itself. - * - * @param string $value - * @return bool - * @access public - * @uses NeatArray::value - */ - function add($value) { - return ($this->value = $this->plus($value)) ? true : false; - } -/** - * Returns itself merged with given array. - * - * @param array $value Array to add to NeatArray. - * @return array - * @access public - * @uses NeatArray::value - */ - function plus($value) { - $merge = array_merge($this->value, (is_array($value) ? $value : array($value))); - return $merge; - } -/** - * Counts repeating strings and returns an array of totals. - * - * @param int $sortedBy A value of 1 sorts by values, a value of 2 sorts by keys. Defaults to null (no sorting). - * @return array - * @access public - * @uses NeatArray::value - */ - function totals($sortedBy = 1, $reverse = true) { - $out = array(); - foreach($this->value as $val) { - isset($out[$val]) ? $out[$val]++ : $out[$val] = 1; - } - - if ($sortedBy == 1) { - $reverse ? arsort($out, SORT_NUMERIC) : asort($out, SORT_NUMERIC); - } - - if ($sortedBy == 2) { - $reverse ? krsort($out, SORT_STRING) : ksort($out, SORT_STRING); - } - return $out; - } -/** - * Performs an array_filter() on the contents of this NeatArray. - * - * @param string $with Name of callback function to perform on each element of this NeatArray. - * @return array - */ - function filter($with) { - return $this->value = array_filter($this->value, $with); - } -/** - * Passes each of its values through a specified function or method. - * Think of PHP's {@link http://php.net/array_walk array_walk()}. - * - * @param string $with Name of callback function - * @return array Returns value of NeatArray::value - * @access public - * @uses NeatArray::value - */ - function walk($with) { - array_walk($this->value, $with); - return $this->value; - } -/** - * Apply $template to all elements of this NeatArray, and return the array itself. - * - * @param string $template {@link http://php.net/sprintf sprintf()}-compatible string to be applied to all values of this NeatArray. - * @return array - */ - function sprintf($template) { - $count = count($this->value); - for($ii = 0; $ii < $count; $ii++) { - $this->value[$ii] = sprintf($template, $this->value[$ii]); - } - return $this->value; - } -/** - * Extracts a value from all array items. - * - * @return array - * @access public - * @uses NeatArray::value - */ - function extract($name) { - $out = array(); - foreach($this->value as $val) { - if (isset($val[$name])) - $out[]=$val[$name]; - } - return $out; - } -/** - * Returns a list of unique elements. - * - * @return array - */ - function unique() { - $unique = array_unique($this->value); - return $unique; - } -/** - * Removes duplicate elements from the value and returns it. - * - * @return array - */ - function makeUnique() { - return $this->value = array_unique($this->value); - } -/** - * Joins an array with myself using a key (like a join between database tables). - * - * Example: - * - * $alice = array('id'=>'1', 'name'=>'Alice'); - * $bob = array('id'=>'2', 'name'=>'Bob'); - * - * $users = new NeatArray(array($alice, $bob)); - * - * $born = array - * ( - * array('user_id'=>'1', 'born'=>'1980'), - * array('user_id'=>'2', 'born'=>'1976') - * ); - * - * $users->joinWith($born, 'id', 'user_id'); - * - * Result: - * - * $users->value == array - * ( - * array('id'=>'1', 'name'=>'Alice', 'born'=>'1980'), - * array('id'=>'2', 'name'=>'Bob', 'born'=>'1976') - * ); - * - * @param array $his The array to join with myself. - * @param string $onMine Key to use on myself. - * @param string $onHis Key to use on him. - * @return array - */ - function joinWith($his, $onMine, $onHis = null) { - if (empty($onHis)) { - $onHis = $onMine; - } - $his = new NeatArray($his); - $out = array(); - - foreach($this->value as $key => $val) { - if ($fromHis = $his->findIn($onHis, $val[$onMine])) { - list($fromHis) = array_values($fromHis); - $out[$key] = array_merge($val, $fromHis); - } else { - $out[$key] = $val; - } - } - return $this->value = $out; - } -/** - * Enter description here... - * @todo Explain this function. almost looks like it creates a tree - * - * @param string $root - * @param string $idKey - * @param string $parentIdKey - * @param string $childrenKey - * @return array - */ - function threaded($root = null, $idKey = 'id', $parentIdKey = 'parent_id', $childrenKey = 'children') { - $out = array(); - $sizeof = sizeof($this->value); - - for($ii = 0; $ii < $sizeof; $ii++) { - if ($this->value[$ii][$parentIdKey] == $root) { - $tmp = $this->value[$ii]; - $tmp[$childrenKey]=isset($this->value[$ii][$idKey]) - ? $this->threaded($this->value[$ii][$idKey], $idKey, $parentIdKey, $childrenKey) : null; - $out[] = $tmp; - } - } - return $out; - } -/** - * Array multi search - * - * @param string $search_value - * @param array $the_array - * @return array - * @link http://php.net/array_search#47116 - */ - function multi_search($search_value, $the_array = null) { - if ($the_array == null) { - $the_array = $this->value; - } - - if (is_array($the_array)) { - foreach($the_array as $key => $value) { - $result = $this->multi_search($search_value, $value); - - if (is_array($result)) { - $return = $result; - array_unshift($return, $key); - return $return; - } elseif ($result == true) { - $return[]=$key; - return $return; - } - } - return false; - } else { - if ($search_value == $the_array) { - return true; - } else { - return false; - } - } - } -} -?> \ No newline at end of file diff --git a/cake/libs/sanitize.php b/cake/libs/sanitize.php index 57df28d9d..67028563a 100644 --- a/cake/libs/sanitize.php +++ b/cake/libs/sanitize.php @@ -255,33 +255,5 @@ class Sanitize{ } } } -/** - * @deprecated - * @see Sanitize::escape() - */ - function sql($string) { - return Sanitize::escape($string); - } -/** - * @deprecated - * @see Sanitize::clean - */ - function cleanArray($toClean) { - return Sanitize::clean($toClean); - } -/** - * @deprecated - * @see Sanitize::clean - */ - function cleanArrayR($toClean) { - return Sanitize::clean($toClean); - } -/** - * @deprecated - * @see Sanitize::clean - */ - function cleanValue($val) { - return Sanitize::clean($val); - } } ?> \ No newline at end of file diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index d38377722..ad98d5cc3 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -297,34 +297,6 @@ class Helper extends Overloadable { } return $attribute; } -/** - * @deprecated Name changed to '_parseAttributes'. Version 0.9.2. - * @see HtmlHelper::_parseAttributes() - * @param array $options Array of options. - * @param array $exclude Array of options to be excluded. - * @param string $insertBefore String to be inserted before options. - * @param string $insertAfter String to be inserted ater options. - * @return string - */ - function parseHtmlOptions($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { - if (!is_array($exclude)) { - $exclude = array(); - } - - if (is_array($options)) { - $out = array(); - - foreach($options as $k => $v) { - if (!in_array($k, $exclude)) { - $out[] = "{$k}=\"{$v}\""; - } - } - $out = join(' ', $out); - return $out ? $insertBefore . $out . $insertAfter : null; - } else { - return $options ? $insertBefore . $options . $insertAfter : null; - } - } /** * Sets this helper's model and field properties to the slash-separated value-pair in $tagValue. * @@ -559,8 +531,8 @@ class Helper extends Overloadable { if (isset($this->tags) && isset($this->tags[$keyName])) { $out = $this->tags[$keyName]; } - - //$out = + + //$out = } /** * Before render callback. Overridden in subclasses. diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index b44ce3c79..a47dcd0da 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -26,26 +26,6 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ - -/* Deprecated */ - -/** - * Tag template for a div with a class attribute. - * @deprecated - */ - define('TAG_DIV', '
%s
'); -/** - * Tag template for a paragraph with a class attribute. - */ - define('TAG_P_CLASS', '

%s

'); -/** - * Tag template for a label with a for attribute. - */ - define('TAG_LABEL', ''); -/** - * Tag template for a fieldset with a legend tag inside. - */ - define('TAG_FIELDSET', '
%s%s'); /** * Form helper library. * @@ -55,22 +35,32 @@ * @subpackage cake.cake.libs.view.helpers */ class FormHelper extends AppHelper { - +/** + * Enter description here... + * + * @var unknown_type + */ var $helpers = array('Html'); - - /** - * holds the fields array('field_name'=>'type'), sizes array('field_name'=>'size'), - * primaryKey and validates array('field_name') - * - * @access public - */ +/** + * holds the fields array('field_name'=>'type'), sizes array('field_name'=>'size'), + * primaryKey and validates array('field_name') + * + * @access public + */ var $fieldset = array('fields'=>array(), 'sizes'=>array(), 'key'=>'id', 'validates'=>array()); - +/** + * Enter description here... + * + * @var unknown_type + */ var $__options = array('day' => array(), 'minute' => array(), 'hour' => array(), 'month' => array(), 'year' => array(), 'meridian' => array()); - +/** + * Enter description here... + * + * @var unknown_type + */ var $fields = array(); - /** * Returns an HTML FORM element. * @@ -204,7 +194,7 @@ class FormHelper extends AppHelper { } $this->setFormTag($model . '.'); - return $this->output(sprintf($this->Html->tags['form'], $this->Html->parseHtmlOptions($htmlAttributes, null, ''))) . $append; + return $this->output(sprintf($this->Html->tags['form'], $this->Html->_parseAttributes($htmlAttributes, null, ''))) . $append; } /** * Closes an HTML form. @@ -789,7 +779,7 @@ class FormHelper extends AppHelper { } else { $tag = $this->Html->tags['selectstart']; } - $select[] = sprintf($tag, $this->model(), $this->field(), $this->Html->parseHtmlOptions($attributes)); + $select[] = sprintf($tag, $this->model(), $this->field(), $this->Html->_parseAttributes($attributes)); if ($showEmpty !== null && $showEmpty !== false) { if($showEmpty === true) { @@ -1070,7 +1060,7 @@ class FormHelper extends AppHelper { } if($showParents || (!in_array($title, $parents))) { - $select[] = sprintf($this->Html->tags['selectoption'], $name, $this->Html->parseHtmlOptions($htmlOptions), h($title)); + $select[] = sprintf($this->Html->tags['selectoption'], $name, $this->Html->_parseAttributes($htmlOptions), h($title)); } } } @@ -1140,319 +1130,5 @@ class FormHelper extends AppHelper { $this->__options[$name] = $data; return $this->__options[$name]; } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateInputDiv($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null) { - trigger_error(__('Deprecated: Use FormHelper::input() or FormHelper::text() instead'), E_USER_WARNING); - $htmlOptions['id'] = strtolower(str_replace('/', '_', $tagName)); - $htmlAttributes = $htmlOptions; - $htmlAttributes['size'] = $size; - $str = $this->Html->input($tagName, $htmlAttributes); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - return $this->divTag($divClass, $divTagInside); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateCheckboxDiv($tagName, $prompt, $required = false, $errorMsg = null, $htmlOptions = null) { - trigger_error(__('Deprecated: Use FormHelper::input() or FormHelper::checkbox() instead'), E_USER_WARNING); - $htmlOptions['class'] = "inputCheckbox"; - $htmlOptions['id'] = strtolower(str_replace('/', '_', $tagName)); - $str = $this->Html->checkbox($tagName, null, $htmlOptions); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - return $this->divTag($divClass, $divTagInside); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateDate($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null) { - trigger_error(__('Deprecated: Use FormHelper::input() instead'), E_USER_WARNING); - $htmlOptions['id']=strtolower(str_replace('/', '_', $tagName)); - $str = $this->dateTime($tagName, 'MDY', 'NONE', $selected, $htmlOptions); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - $requiredDiv = $this->divTag($divClass, $divTagInside); - return $this->divTag("date", $requiredDiv); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateTime($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null) { - trigger_error(__('Deprecated: Use FormHelper::input() instead'), E_USER_WARNING); - $str = $this->dateTime($tagName, 'NONE', '24', $selected, $htmlOptions); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - $requiredDiv = $this->divTag($divClass, $divTagInside); - return $this->divTag("time", $requiredDiv); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateDateTime($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null) { - trigger_error(__('Deprecated: Use FormHelper::input() instead'), E_USER_WARNING); - $htmlOptions['id']=strtolower(str_replace('/', '_', $tagName)); - $str = $this->dateTime($tagName, 'MDY', '12', $selected, $htmlOptions, null, false); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - $requiredDiv = $this->divTag($divClass, $divTagInside); - return $this->divTag("date", $requiredDiv); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateAreaDiv($tagName, $prompt, $required = false, $errorMsg = null, $cols = 60, $rows = 10, $htmlOptions = null) { - trigger_error(__('Deprecated: Use FormHelper::input() instead'), E_USER_WARNING); - $htmlOptions['id'] = strtolower(str_replace('/', '_', $tagName)); - $htmlAttributes = $htmlOptions; - $htmlAttributes['cols'] = $cols; - $htmlAttributes['rows'] = $rows; - $str = $this->Html->textarea($tagName, $htmlAttributes); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - - if ($required) { - $divClass="required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - return $this->divTag($divClass, $divTagInside); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateSelectDiv($tagName, $prompt, $options, $selected = null, $selectAttr = null, $optionAttr = null, $required = false, $errorMsg = null) { - trigger_error(__('Deprecated: Use FormHelper::input() or FormHelper::select() instead'), E_USER_WARNING); - $selectAttr['id'] = strtolower(str_replace('/', '_', $tagName)); - $str = $this->Html->selectTag($tagName, $options, $selected, $selectAttr, $optionAttr); - $strLabel = $this->label($tagName, $prompt); - $divClass = "optional"; - - if ($required) { - $divClass = "required"; - } - $strError = ""; - - if ($this->isFieldError($tagName)) { - $strError = $this->Html->para('error', $errorMsg); - $divClass = sprintf("%s error", $divClass); - } - $divTagInside = sprintf("%s %s %s", $strError, $strLabel, $str); - return $this->divTag($divClass, $divTagInside); - } -/** - * @deprecated - * @see FormHelper::input() - */ - function generateSubmitDiv($displayText, $htmlOptions = null) { - trigger_error(__('Deprecated: Use FormHelper::submit() instead'), E_USER_WARNING); - return $this->divTag('submit', $this->Html->submit($displayText, $htmlOptions)); - } -/** - * @deprecated - * @see FormHelper::inputs() - */ - function generateFields($fields, $readOnly = false) { - trigger_error(__('Deprecated: Use FormHelper::input() instead'), E_USER_WARNING); - $strFormFields = ''; - - foreach($fields as $field) { - if (isset($field['type'])) { - - if (!isset($field['required'])) { - $field['required'] = false; - } - - if (!isset($field['errorMsg'])) { - $field['errorMsg'] = null; - } - - if (!isset($field['htmlOptions'])) { - $field['htmlOptions'] = array(); - } - - if ($readOnly) { - $field['htmlOptions']['READONLY'] = "readonly"; - } - - switch($field['type']) { - case "input": - if (!isset($field['size'])) { - $field['size'] = 40; - } - $strFormFields = $strFormFields . $this->generateInputDiv($field['tagName'], $field['prompt'], - $field['required'], $field['errorMsg'], $field['size'], $field['htmlOptions']); - break; - case "checkbox": - $strFormFields = $strFormFields . $this->generateCheckboxDiv($field['tagName'], $field['prompt'], - $field['required'], $field['errorMsg'], $field['htmlOptions']); - break; - case "select": - case "selectMultiple": - if ("selectMultiple" == $field['type']) { - $field['selectAttr']['multiple'] = 'multiple'; - $field['selectAttr']['class'] = 'selectMultiple'; - } - - if (!isset($field['selected'])) { - $field['selected'] = null; - } - - if (!isset($field['selectAttr'])) { - $field['selectAttr'] = null; - } - - if (!isset($field['optionsAttr'])) { - $field['optionsAttr'] = null; - } - - if ($readOnly) { - $field['selectAttr']['DISABLED'] = true; - } - - if (!isset($field['options'])) { - $field['options'] = null; - } - $strFormFields = $strFormFields . $this->generateSelectDiv($field['tagName'], $field['prompt'], $field['options'], - $field['selected'], $field['selectAttr'], $field['optionsAttr'], $field['required'], $field['errorMsg']); - break; - case "area": - if (!isset($field['rows'])) { - $field['rows'] = 10; - } - - if (!isset($field['cols'])) { - $field['cols'] = 60; - } - $strFormFields = $strFormFields . $this->generateAreaDiv($field['tagName'], $field['prompt'], - $field['required'], $field['errorMsg'], $field['cols'], $field['rows'], $field['htmlOptions']); - break; - case "fieldset": - $strFieldsetFields = $this->generateFields($field['fields']); - $strFieldSet = sprintf('
%s

%s

%s

%s
', - $field['legend'], $field['noteHeading'], $field['note'], $strFieldsetFields); - $strFormFields = $strFormFields . $strFieldSet; - break; - case "hidden": - if(!isset($field['value'])){ - $field['value'] = null; - } - $strFormFields = $strFormFields . $this->hidden($field['tagName'], $field['value']); - break; - case "date": - if (!isset($field['selected'])) { - $field['selected'] = null; - } - $strFormFields = $strFormFields . $this->generateDate($field['tagName'], $field['prompt'], null, - null, null, null, $field['selected']); - break; - case "datetime": - if (!isset($field['selected'])) { - $field['selected'] = null; - } - $strFormFields = $strFormFields . $this->generateDateTime($field['tagName'], $field['prompt'], '', '', '', '', $field['selected']); - break; - case "time": - if (!isset($field['selected'])) { - $field['selected'] = null; - } - $strFormFields = $strFormFields . $this->generateTime($field['tagName'], $field['prompt'], '', '', '', '', $field['selected']); - break; - default: - break; - } - } - } - return $strFormFields; - } -/** - * @deprecated will not be available after 1.1.x.x - * @see FormHelper::label() - */ - function labelTag($tagName, $text) { - trigger_error(__('Deprecated: Use FormHelper::label() instead'), E_USER_WARNING); - return sprintf($this->Html->tags['label'], Inflector::camelize(r('/', '_', $tagName)), $text); - } -/** - * @deprecated - * @see HtmlHelper::div - */ - function divTag($class, $text) { - //trigger_error(__('(FormHelper::divTag) Deprecated: Use HtmlHelper::div instead'), E_USER_WARNING); - return sprintf(TAG_DIV, $class, $text); - } -/** - * @deprecated - * @see HtmlHelper::para - */ - function pTag($class, $text) { - //trigger_error(__('(FormHelper::pTag) Deprecated: Use HtmlHelper::para instead'), E_USER_WARNING); - return sprintf(TAG_P_CLASS, $class, $text); - } } - ?> diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index c73adcf8a..31346210f 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -664,182 +664,5 @@ class HtmlHelper extends AppHelper { } return $this->output(sprintf($this->tags[$tag], $this->_parseAttributes($attributes, null, ' ', ''), $text)); } -/**#@-*/ -/************************************************************************* - * Deprecated methods - *************************************************************************/ -/** - * @deprecated - * @see FormHelper::file - */ - function file($fieldName, $htmlAttributes = array()) { - trigger_error(__('(HtmlHelper::file) Deprecated: Use FormHelper::file instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->file($fieldName, $htmlAttributes); - } -/** - * @deprecated - * @see FormHelper::submit - */ - function submit($caption = 'Submit', $htmlAttributes = array()) { - trigger_error(__('(HtmlHelper::submit) Deprecated: Use FormHelper::submit instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->submit($caption, $htmlAttributes); - } - /** - * @deprecated - * @see FormHelper::select - */ - function selectTag($fieldName, $optionElements, $selected = array(), $selectAttr = array(), $optionAttr = array(), $showEmpty = true) { - trigger_error(__('(HtmlHelper::selectTag) Deprecated: Use FormHelper::select instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->select($fieldName, $optionElements, $selected, $selectAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::create - */ - function formTag($target = null, $type = 'post', $htmlAttributes = array()) { - trigger_error(__('(HtmlHelper::formTag) Deprecated: Use FormHelper::create instead', true), E_USER_WARNING); - $htmlAttributes['action'] = $this->url($target); - $htmlAttributes['method'] = low($type) == 'get' ? 'get' : 'post'; - $type == 'file' ? $htmlAttributes['enctype'] = 'multipart/form-data' : null; - $append = ''; - - if (isset($this->params['_Token']) && !empty($this->params['_Token'])) { - $append .= '

'; - $append .= $this->hidden('_Token/key', array('value' => $this->params['_Token']['key'], 'id' => '_TokenKey' . mt_rand()), true); - $append .= '

'; - } - - return sprintf($this->tags['form'], $this->parseHtmlOptions($htmlAttributes, null, '')) . $append; - } -/** - * @deprecated - * @see HtmlHelper::link - */ - function linkEmail($title, $email = null, $options = null) { - trigger_error(__('(HtmlHelper::linkEmail) Deprecated: Use HtmlHelper::link instead', true), E_USER_WARNING); - // if no $email, then title contains the email. - if (empty($email)) { - $email = $title; - } - - // does the address contain extra attributes? - $match = array(); - preg_match('!^(.*)(\?.*)$!', $email, $match); - - // plaintext - if (empty($options['encode']) || !empty($match[2])) { - return sprintf($this->tags['mailto'], $email, $this->parseHtmlOptions($options), $title); - } else { - // encoded to avoid spiders - $email_encoded = null; - - for($ii = 0; $ii < strlen($email); $ii++) { - if (preg_match('!\w!', $email[$ii])) { - $email_encoded .= '%' . bin2hex($email[$ii]); - } else { - $email_encoded .= $email[$ii]; - } - } - - $title_encoded = null; - - for($ii = 0; $ii < strlen($title); $ii++) { - $title_encoded .= preg_match('/^[A-Za-z0-9]$/', $title[$ii]) ? '&#x' . bin2hex($title[$ii]) . ';' : $title[$ii]; - } - return sprintf($this->tags['mailto'], $email_encoded, $this->parseHtmlOptions($options, array('encode')), $title_encoded); - } - } -/** - * @deprecated - * @see FormHelper::day - */ - function dayOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::dayOptionTag) Deprecated: Use FormHelper::day instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->day($tagName, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::year - */ - function yearOptionTag($tagName, $value = null, $minYear = null, $maxYear = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::yearOptionTag) Deprecated: Use FormHelper::year instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->year($tagName, $minYear, $maxYear, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::month - */ - function monthOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::monthOptionTag) Deprecated: Use FormHelper::month instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->month($tagName, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::hour - */ - function hourOptionTag($tagName, $value = null, $format24Hours = false, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::hourOptionTag) Deprecated: Use FormHelper::hour instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->hour($tagName, $format24Hours, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::minute - */ - function minuteOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::minuteOptionTag) Deprecated: Use FormHelper::minute instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->minute($tagName, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::meridian - */ - function meridianOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::meridianOptionTag) Deprecated: Use FormHelper::meridian instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->meridian($tagName, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated - * @see FormHelper::dateTime - */ - function dateTimeOptionTag($tagName, $dateFormat = 'DMY', $timeFormat = '12', $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true) { - trigger_error(__('(HtmlHelper::dateTimeOptionTag) Deprecated: Use FormHelper::dateTime instead', true), E_USER_WARNING); - $this->__loadForm(); - $form = new FormHelper(); - $form->Html = $this; - return $form->dateTime($tagName, $dateFormat, $timeFormat, $selected, $selectAttr, $optionAttr, $showEmpty); - } -/** - * @deprecated will not be in final release. - */ - function __loadForm() { - uses('view'.DS.'helpers'.DS.'form'); - } } ?> diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 8f2888494..3962cdb6c 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -144,21 +144,6 @@ class JavascriptHelper extends AppHelper { $view->addScript($out); } } -/** - * Returns a JavaScript include tag for an externally-hosted script - * - * @param string $url URL to JavaScript file. - * @return string - * @deprecated As of 1.2, use JavascriptHelper::link() - * @see JavascriptHelper::link - */ - function linkOut($url) { - trigger_error(__('(JavascriptHelper::linkOut) Deprecated: Use JavascriptHelper::link instead'), E_USER_WARNING); - if (strpos($url, ".") === false) { - $url .= ".js"; - } - return sprintf($this->tags['javascriptlink'], $url); - } /** * Escape carriage returns and single and double quotes for JavaScript segments. * diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index e777ed750..4633502d7 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -569,13 +569,6 @@ class View extends Object { $this->uuids[] = $hash; return $hash; } -/** - * @deprecated - */ - function setLayout($layout) { - trigger_error(__('(View::setLayout) Deprecated: Use $this->layout = "..." instead'), E_USER_WARNING); - $this->layout = $layout; - } /** * Allows a template or element to set a variable that will be available in * a layout or other element. Analagous to Controller::set.