本文整理汇总了PHP中DataUtil::sanitizeDataByDesignerTypeForSavingModel方法的典型用法代码示例。如果您正苦于以下问题:PHP DataUtil::sanitizeDataByDesignerTypeForSavingModel方法的具体用法?PHP DataUtil::sanitizeDataByDesignerTypeForSavingModel怎么用?PHP DataUtil::sanitizeDataByDesignerTypeForSavingModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataUtil
的用法示例。
在下文中一共展示了DataUtil::sanitizeDataByDesignerTypeForSavingModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSanitizeDataByDesignerTypeForSavingModel
/**
* @depends testPurifyHtmlAndModifyInputUsingArrayWalkRecursive
*/
public function testSanitizeDataByDesignerTypeForSavingModel()
{
$data = array('firstName' => 'Steve', 'lastName' => 'Thunder<SCRIPT>alert(\'XSS\')</SCRIPT>', 'boolean' => '0', 'date' => '3/25/11', 'dateTime' => '04/05/11 5:00 AM', 'float' => '3.68', 'integer' => '10', 'phone' => '435655', 'string' => 'some string<SCRIPT>alert(\'XSS\')</SCRIPT>', 'textArea' => 'more text here<SCRIPT>alert(\'XSS\')</SCRIPT>', 'url' => 'http://www.zurmo.org', 'dropDown' => array('value' => 'test value<SCRIPT>alert(\'XSS\')</SCRIPT>'), 'radioDropDown' => array('value' => 'my value'), 'multiDropDown' => array('values' => array('multi1', 'multi2')), 'tagCloud' => array('values' => 'tag1,tag2<SCRIPT>alert(\'XSS\')</SCRIPT>'));
$model = new TestDataUtilModel();
$sanitizedData = DataUtil::sanitizeDataByDesignerTypeForSavingModel($model, $data);
$compareData = array('firstName' => 'Steve', 'lastName' => 'Thunder', 'boolean' => '0', 'date' => DateTimeUtil::resolveValueForDateDBFormatted('3/25/11'), 'dateTime' => DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('04/05/11 5:00 AM'), 'float' => '3.68', 'integer' => '10', 'phone' => '435655', 'string' => 'some string', 'textArea' => 'more text here', 'url' => 'http://www.zurmo.org', 'dropDown' => array('value' => 'test value'), 'radioDropDown' => array('value' => 'my value'), 'multiDropDown' => array('values' => array('multi1', 'multi2')), 'tagCloud' => array('values' => array('tag1', 'tag2')));
$this->assertEquals($compareData, $sanitizedData);
}
示例2: sanitizePostByDesignerTypeForSavingModel
/**
* Sanitizes post data for date and date time attributes by converting them to the proper
* format and timezone for saving.
* @return - array sanitized post data
*/
public static function sanitizePostByDesignerTypeForSavingModel($model, $postData)
{
$postData = DataUtil::sanitizeDataByDesignerTypeForSavingModel($model, $postData);
return $postData;
}