Removing the double escape
This commit is contained in:
1 parent
6ac052cbe5
commit
28df2ea235
4 files changed
+12
-24
No files matched your search
+5
-5
@@ -485,7 +485,7 @@ class FormBuilder
|
||||
// the element. Then we'll create the final textarea elements HTML for us.
|
||||
$options = $this->html->attributes($options);
|
||||
|
||||
return $this->toHtmlString('<textarea' . $options . '>' . $this->html->escapeAll($value). '</textarea>');
|
||||
return $this->toHtmlString('<textarea' . $options . '>' . $value. '</textarea>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,7 +662,7 @@ class FormBuilder
|
||||
$html[] = $this->option($display, $value, $selected);
|
||||
}
|
||||
|
||||
return $this->toHtmlString('<optgroup label="' . $this->html->escapeAll($label) . '">' . implode('', $html) . '</optgroup>');
|
||||
return $this->toHtmlString('<optgroup label="' . e($label) . '">' . implode('', $html) . '</optgroup>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,7 +680,7 @@ class FormBuilder
|
||||
|
||||
$options = ['value' => $value, 'selected' => $selected];
|
||||
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . $this->html->escapeAll($display) . '</option>');
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,7 +694,7 @@ class FormBuilder
|
||||
protected function placeholderOption($display, $selected)
|
||||
{
|
||||
$selected = $this->getSelectedValue(null, $selected);
|
||||
|
||||
|
||||
$options = [
|
||||
'selected' => $selected,
|
||||
'disabled' => 'disabled',
|
||||
@@ -702,7 +702,7 @@ class FormBuilder
|
||||
'value' => ''
|
||||
];
|
||||
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . $this->html->escapeAll($display) . '</option>');
|
||||
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-14
@@ -53,18 +53,6 @@ class HtmlBuilder
|
||||
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert all applicable characters to HTML entities.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeAll($value)
|
||||
{
|
||||
return htmlentities($value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert entities to HTML characters.
|
||||
*
|
||||
@@ -399,7 +387,7 @@ class HtmlBuilder
|
||||
if (is_array($value)) {
|
||||
return $this->nestedListing($key, $type, $value);
|
||||
} else {
|
||||
return '<li>' . $this->escapeAll($value) . '</li>';
|
||||
return '<li>' . e($value) . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +449,7 @@ class HtmlBuilder
|
||||
}
|
||||
|
||||
if (! is_null($value)) {
|
||||
return $key . '="' . $this->escapeAll($value) . '"';
|
||||
return $key . '="' . e($value) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('<textarea name="foo" cols="50" rows="10">foobar</textarea>', $form2);
|
||||
$this->assertEquals('<textarea class="span2" name="foo" cols="50" rows="10"></textarea>', $form3);
|
||||
$this->assertEquals('<textarea name="foo" cols="60" rows="15"></textarea>', $form4);
|
||||
$this->assertEquals('<textarea name="encoded_html" cols="50" rows="10">&amp;</textarea>', $form5);
|
||||
$this->assertEquals('<textarea name="encoded_html" cols="50" rows="10">&</textarea>', $form5);
|
||||
}
|
||||
|
||||
public function testSelect()
|
||||
@@ -312,7 +312,7 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
$select,
|
||||
'<select name="encoded_html"><option value="no_break_space">&nbsp;</option><option value="ampersand">&amp;</option><option value="lower_than">&lt;</option></select>'
|
||||
'<select name="encoded_html"><option value="no_break_space"> </option><option value="ampersand">&</option><option value="lower_than"><</option></select>'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
|
||||
['placeholder' => 'Select the ']
|
||||
);
|
||||
$this->assertEquals($select,
|
||||
'<select name="encoded_html"><option selected="selected" disabled="disabled" hidden="hidden" value="">Select the &nbsp;</option><option value="no_break_space">&nbsp;</option><option value="ampersand">&amp;</option><option value="lower_than">&lt;</option></select>'
|
||||
'<select name="encoded_html"><option selected="selected" disabled="disabled" hidden="hidden" value="">Select the </option><option value="no_break_space"> </option><option value="ampersand">&</option><option value="lower_than"><</option></select>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$ol = $this->htmlBuilder->ol($list, $attributes);
|
||||
|
||||
$this->assertEquals('<ol class="example"><li>foo</li><li>bar</li><li>&amp;</li></ol>', $ol);
|
||||
$this->assertEquals('<ol class="example"><li>foo</li><li>bar</li><li>&</li></ol>', $ol);
|
||||
}
|
||||
|
||||
public function testUl()
|
||||
@@ -58,7 +58,7 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$ul = $this->htmlBuilder->ul($list, $attributes);
|
||||
|
||||
$this->assertEquals('<ul class="example"><li>foo</li><li>bar</li><li>&amp;</li></ul>', $ul);
|
||||
$this->assertEquals('<ul class="example"><li>foo</li><li>bar</li><li>&</li></ul>', $ul);
|
||||
}
|
||||
|
||||
public function testMeta()
|
||||
|
||||
Reference in new issue
Block a user