当前位置: 首页>>代码示例>>PHP>>正文


PHP SPRequest::setAttributesAllowed方法代码示例

本文整理汇总了PHP中SPRequest::setAttributesAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP SPRequest::setAttributesAllowed方法的具体用法?PHP SPRequest::setAttributesAllowed怎么用?PHP SPRequest::setAttributesAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPRequest的用法示例。


在下文中一共展示了SPRequest::setAttributesAllowed方法的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;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:38,代码来源:config.php

示例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__);
         }
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:78,代码来源:textarea.php


注:本文中的SPRequest::setAttributesAllowed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。