mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merged revisions 48168 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r48168 | ischommer | 2008-01-17 17:20:45 +1300 (Thu, 17 Jan 2008) | 1 line renamed escapeFlagForField() to escapeTypeForField(), updated documentation ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@48163 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0b5ab1fc7b
commit
a1451739a4
@ -20,6 +20,10 @@
|
||||
* html: HTML source suitable for use in a page or email
|
||||
* text: Plain-text content, suitable for display to a user as-is, or insertion in a plaintext email.
|
||||
*
|
||||
* Objects of type {@link ViewableData} can have an "escaping type",
|
||||
* which determines if they are automatically escaped before output by {@link SSViewer}.
|
||||
*
|
||||
* @usedby ViewableData::XML_val()
|
||||
* @package sapphire
|
||||
* @subpackage misc
|
||||
*/
|
||||
|
@ -273,10 +273,11 @@ class ViewableData extends Object implements Iterator {
|
||||
/**
|
||||
* Return the string-format type for the given field.
|
||||
*
|
||||
* @usedby ViewableData::XML_val()
|
||||
* @param string $fieldName
|
||||
* @return string 'xml'|'raw'
|
||||
*/
|
||||
function escapeFlagForField($fieldName) {
|
||||
function escapeTypeForField($fieldName) {
|
||||
$helperPair = $this->castingHelperPair($fieldName);
|
||||
$castedClass = $helperPair['className'];
|
||||
if(!$castedClass || $castedClass == 'HTMLText' || $castedClass == 'HTMLVarchar') return "xml";
|
||||
@ -417,7 +418,7 @@ class ViewableData extends Object implements Iterator {
|
||||
}
|
||||
|
||||
// Case 2: Check if the value is raw and must be made XML-safe
|
||||
if($this->escapeFlagForField($fieldName) != 'xml') $val = Convert::raw2xml($val);
|
||||
if($this->escapeTypeForField($fieldName) != 'xml') $val = Convert::raw2xml($val);
|
||||
|
||||
if(isset($_GET['debug_profile'])) {
|
||||
Profiler::unmark('casting cost');
|
||||
|
@ -90,7 +90,7 @@ class HtmlEditorField extends TextareaField {
|
||||
}
|
||||
|
||||
function saveInto($record) {
|
||||
if(!$record->escapeFlagForField($this->name) != 'xml') {
|
||||
if($record->escapeTypeForField($this->name) != 'xml') {
|
||||
user_error("HTMLEditorField should save into an HTMLText or HTMLVarchar field.
|
||||
If you don't, your template won't display properly.
|
||||
This changed in version 2.2.2, so please update
|
||||
|
Loading…
Reference in New Issue
Block a user