Permalink
Browse files

Removing empty strings that caused undefined string offset errors.

Trimming trailing spaces.
  • Loading branch information...
1 parent 2f0598b commit 6123ed47c42ee0b7b4e1945031db9dfe84db5a5a @markstory markstory committed Oct 22, 2009
Showing with 17 additions and 17 deletions.
  1. +12 −12 cake/libs/view/helpers/form.php
  2. +1 −1 cake/libs/view/view.php
  3. +4 −4 cake/tests/cases/libs/view/helpers/form.test.php
@@ -71,9 +71,9 @@ class FormHelper extends AppHelper {
* @access public
*/
var $requestType = null;
-
+
var $defaultModel = null;
-
+
function &_introspectModel($model) {
$object = null;
if (is_string($model) && strpos($model, '.') !== false) {
@@ -118,7 +118,7 @@ function &_introspectModel($model) {
$key = $object->primaryKey;
$this->fieldset[$object->name] = array_merge($defaults,compact('fields', 'key', 'validates'));
}
-
+
return $object;
}
@@ -140,7 +140,7 @@ function &_introspectModel($model) {
* - 'url' The url the form submits to. Can be a string or a url array,
* - 'default' Allows for the creation of Ajax forms.
* - 'onsubmit' Used in conjunction with 'default' to create ajax forms.
- * - 'inputDefaults' set the default $options for FormHelper::input(). Any options that would
+ * - 'inputDefaults' set the default $options for FormHelper::input(). Any options that would
* be set when using FormHelper::input() can be set here. Options set with `inputDefaults`
* can be overridden when calling input()
*
@@ -163,7 +163,7 @@ function create($model = null, $options = array()) {
} elseif (empty($model) && empty($this->params['models'])) {
$model = false;
}
-
+
$models = ClassRegistry::keys();
foreach ($models as $currentModel) {
if (ClassRegistry::isKeySet($currentModel)) {
@@ -176,15 +176,15 @@ function create($model = null, $options = array()) {
$object =& $this->_introspectModel($model);
$this->setEntity($model . '.', true);
-
+
if (isset($this->fieldset[$this->model()]['key'])) {
$data = $this->fieldset[$this->model()];
$recordExists = (
isset($this->data[$model]) &&
isset($this->data[$model][$data['key']]) &&
!empty($this->data[$model][$data['key']])
);
-
+
if ($recordExists) {
$created = true;
$id = $this->data[$model][$data['key']];
@@ -517,10 +517,10 @@ function label($fieldName = null, $text = null, $options = array()) {
* will be used.
*
* In addition to controller fields output, `$fields` can be used to control legend
- * and fieldset rendering with the `fieldset` and `legend` keys.
- * `$form->inputs(array('legend' => 'My legend'));` Would generate an input set with
+ * and fieldset rendering with the `fieldset` and `legend` keys.
+ * `$form->inputs(array('legend' => 'My legend'));` Would generate an input set with
* a custom legend. You can customize individual inputs through `$fields` as well.
- *
+ *
* {{{
* $form->inputs(array(
* 'name' => array('label' => 'custom label')
@@ -634,7 +634,7 @@ function input($fieldName, $options = array()) {
);
$defaults = array('before' => null, 'between' => null, 'after' => null);
$options = array_merge($defaults, $options);
-
+
if (!isset($this->fieldset[$this->model()])) {
//Try to load fieldset for this model
$this->_introspectModel($this->model());
@@ -1119,7 +1119,7 @@ function file($fieldName, $options = array()) {
*
* Options:
*
- * - `escape` - HTML entity encode the $title of the button. Defaults to false.
+ * - `escape` - HTML entity encode the $title of the button. Defaults to false.
*
* @param string $title The button's caption. Not automatically HTML encoded
* @param array $options Array of options and HTML attributes.
View
@@ -614,7 +614,7 @@ function entity() {
$count = count($path);
if (
($count == 1 && !empty($this->association)) ||
- ($count == 1 && $this->model != $this->entityPath) ||
+ ($count == 1 && $this->model != $this->entityPath) ||
($count == 2 && !empty($this->fieldSuffix)) ||
is_numeric($path[0])
) {
@@ -5477,7 +5477,7 @@ function testBrokenness() {
);
$this->assertTags($result, $expected);
}
-
+
function testMultiRecordForm() {
$this->Form->create('ValidateProfile');
$this->Form->data['ValidateProfile'][1]['ValidateItem'][2]['name'] = 'Value';
@@ -5510,23 +5510,23 @@ function testMultiRecordForm() {
'id' => 'ValidateProfile1ValidateItem2CreatedMonth'
)
),
- array('option' => array('value' => '')), '', '/option',
+ array('option' => array('value' => '')), '/option',
$this->dateRegex['monthsRegex'],
'/select', '-',
array('select' => array(
'name' => 'data[ValidateProfile][1][ValidateItem][2][created][day]',
'id' => 'ValidateProfile1ValidateItem2CreatedDay'
)
),
- array('option' => array('value' => '')), '', '/option',
+ array('option' => array('value' => '')), '/option',
$this->dateRegex['daysRegex'],
'/select', '-',
array('select' => array(
'name' => 'data[ValidateProfile][1][ValidateItem][2][created][year]',
'id' => 'ValidateProfile1ValidateItem2CreatedYear'
)
),
- array('option' => array('value' => '')), '', '/option',
+ array('option' => array('value' => '')), '/option',
$this->dateRegex['yearsRegex'],
'/select',
'/div'

0 comments on commit 6123ed4

Please sign in to comment.