本文整理汇总了PHP中SPRequest::setTagsAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP SPRequest::setTagsAllowed方法的具体用法?PHP SPRequest::setTagsAllowed怎么用?PHP SPRequest::setTagsAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPRequest
的用法示例。
在下文中一共展示了SPRequest::setTagsAllowed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Simple initialisation method
*
*/
public function init()
{
if (self::$cs) {
Sobi::Error('config', SPLang::e('CRITICAL_SECTION_VIOLATED'), SPC::ERROR, 500, __LINE__, __CLASS__);
}
/* define critical section to avoid infinite loops */
self::$cs = true;
$nameField = self::key('entry.name_field');
if ($nameField) {
$fc = SPLoader::loadModel('field');
$field = new $fc();
$field->init($nameField);
$this->set('name_field_nid', $field->get('nid'), 'entry');
$this->set('name_field_id', $field->get('fid'), 'entry');
}
if (defined('SOBIPRO_ADM')) {
if (self::key('language.adm_domain')) {
SPLang::registerDomain(self::key('language.adm_domain'));
}
} else {
if (self::key('language.domain')) {
SPLang::registerDomain(self::key('language.domain'));
}
}
/* set allowed request attributes and tags */
SPRequest::setTagsAllowed($this->key('html.allowed_tags_array'));
SPRequest::setAttributesAllowed($this->key('html.allowed_attributes_array'));
$this->_store['general']['root'] = SOBI_ROOT;
$this->_store['general']['path'] = SOBI_PATH;
$this->_store['general']['cms'] = SOBI_CMS;
$this->_store['general']['live_path'] = SOBI_LIVE_PATH;
/* leave critical section */
self::$cs = false;
}
示例2: 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__);
}
}
}