本文整理汇总了PHP中FrmAppHelper::sanitize_request方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::sanitize_request方法的具体用法?PHP FrmAppHelper::sanitize_request怎么用?PHP FrmAppHelper::sanitize_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::sanitize_request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitize_entry_post
/**
* Sanitize the POST values before we use them
*
* @since 2.0
* @param array $values The POST values by reference
*/
public static function sanitize_entry_post(&$values)
{
$sanitize_method = array('form_id' => 'absint', 'frm_action' => 'sanitize_title', 'form_key' => 'sanitize_title', 'item_key' => 'sanitize_title', 'item_name' => 'sanitize_text_field', 'frm_saving_draft' => 'absint', 'is_draft' => 'absint', 'post_id' => 'absint', 'parent_item_id' => 'absint', 'created_at' => 'sanitize_text_field', 'updated_at' => 'sanitize_text_field');
FrmAppHelper::sanitize_request($sanitize_method, $values);
}
示例2: test_sanitize_request
/**
* @covers FrmAppHelper::sanitize_request
*/
function test_sanitize_request()
{
$values = array('form_id' => '<script></script>12', 'frm_action' => '<script></script>create me', 'form_key' => '<script></script>This is a <b>text</b> field', 'content' => '<script></script>This is a <b>text</b> field');
$sanitize_method = array('form_id' => 'absint', 'frm_action' => 'sanitize_title', 'form_key' => 'sanitize_text_field', 'content' => 'wp_kses_post');
FrmAppHelper::sanitize_request($sanitize_method, $values);
$this->assertEquals($values['form_id'], absint($values['form_id']));
$this->assertEquals($values['frm_action'], sanitize_title($values['frm_action']));
$this->assertEquals($values['form_key'], sanitize_text_field($values['form_key']));
$this->assertEquals($values['content'], wp_kses_post($values['content']));
}