本文整理汇总了PHP中SPRequest::resetFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP SPRequest::resetFilter方法的具体用法?PHP SPRequest::resetFilter怎么用?PHP SPRequest::resetFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPRequest
的用法示例。
在下文中一共展示了SPRequest::resetFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveData
/**
* Gets the data for a field and save it in the database
* @param SPEntry $entry
* @param string $request
* @return bool
*/
public function saveData(&$entry, $request = 'POST')
{
if (!$this->enabled) {
return false;
}
$data = $this->verify($entry, $request);
$time = SPRequest::now();
$IP = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
$uid = Sobi::My('id');
/* if we are here, we can save these data */
/* @var SPdb $db */
$db =& SPFactory::db();
if ($this->allowHtml) {
/* filter data */
if (count($this->allowedAttributes)) {
SPRequest::setAttributesAllowed($this->allowedAttributes);
}
if (count($this->allowedTags)) {
SPRequest::setTagsAllowed($this->allowedTags);
}
$data = SPRequest::string($this->nid, null, $this->allowHtml, $request);
SPRequest::resetFilter();
if (!$this->editor && $this->maxLength && strlen($data) > $this->maxLength) {
$data = substr($data, 0, $this->maxLength);
}
} else {
$data = strip_tags($data);
}
/* collect the needed params */
$params = array();
$params['publishUp'] = $entry->get('publishUp');
$params['publishDown'] = $entry->get('publishDown');
$params['fid'] = $this->fid;
$params['sid'] = $entry->get('id');
$params['section'] = Sobi::Reg('current_section');
$params['lang'] = Sobi::Lang();
$params['enabled'] = $entry->get('state');
$params['params'] = null;
$params['options'] = null;
$params['baseData'] = $data;
$params['approved'] = $entry->get('approved');
$params['confirmed'] = $entry->get('confirmed');
/* if it is the first version, it is new entry */
if ($entry->get('version') == 1) {
$params['createdTime'] = $time;
$params['createdBy'] = $uid;
$params['createdIP'] = $IP;
}
$params['updatedTime'] = $time;
$params['updatedBy'] = $uid;
$params['updatedIP'] = $IP;
$params['copy'] = !$entry->get('approved');
if (Sobi::My('id') == $entry->get('owner')) {
--$this->editLimit;
}
$params['editLimit'] = $this->editLimit;
/* save it */
try {
$db->insertUpdate('spdb_field_data', $params);
} catch (SPException $x) {
Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
/* if it wasn't edited in the default language, we have to try to insert it also for def lang */
if (Sobi::Lang() != Sobi::DefLang()) {
$params['lang'] = Sobi::DefLang();
try {
$db->insert('spdb_field_data', $params, true, true);
} catch (SPException $x) {
Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
}
}