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


PHP SPRequest::arr方法代码示例

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


在下文中一共展示了SPRequest::arr方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * @param SPEntry $entry
  * @param string $request
  * @return string
  */
 public function validate($entry, $request)
 {
     /** it can be for core files only at the moment because a stupid developer (yes, we all know which one) declared too many private methods and inherited classes returning always wrong results */
     $class = strtolower(get_class($this));
     if (strstr($class, 'select') || strstr($class, 'radio') || strstr($class, 'chbxgr')) {
         return $this->verify($entry, $request, $this->fetchData($this->multi ? SPRequest::arr($this->nid, array(), $request) : SPRequest::word($this->nid, null, $request)));
     } else {
         return true;
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:15,代码来源:select.php

示例2: save

 /**
  * Save the config
  */
 protected function save($apply, $clone = false)
 {
     $sid = Sobi::Section();
     $this->authorise($sid);
     if ($sid) {
         $this->validate('config.general', array('task' => 'config.general', 'sid' => $sid));
     } else {
         $this->validate('config.global', array('task' => 'config.global'));
     }
     $fields = array();
     $section = false;
     $data = SPRequest::arr('spcfg', array());
     // strange thing =8-O
     if (!isset($data['alphamenu.extra_fields_array'])) {
         $data['alphamenu.extra_fields_array'] = array();
     }
     if (!isset($data['template.icon_fonts_arr'])) {
         $data['template.icon_fonts_arr'] = array();
     }
     foreach ($data as $k => $v) {
         if (is_string($v)) {
             $v = htmlspecialchars_decode($v);
         }
         //			$k = str_replace( array( 'spcfg_', '.' ), array( null, '_' ), $k );
         $k = str_replace('spcfg_', null, $k);
         $s = explode('.', $k);
         $s = $s[0];
         if (!isset($fields[$s])) {
             $fields[$s] = array();
         }
         $k = str_replace("{$s}.", null, $k);
         $c = explode('_', $k);
         if ($c[count($c) - 1] == 'array' && !is_array($v)) {
             if (!strstr($v, '|')) {
                 $v = explode(',', $v);
             } else {
                 $v = explode('|', $v);
             }
         }
         $fields[$s][$k] = $v;
         if (preg_match('/^section.*/', $k)) {
             $section = true;
         }
     }
     $values = array();
     if (count($fields)) {
         foreach ($fields as $sec => $keys) {
             if (count($keys)) {
                 foreach ($keys as $k => $v) {
                     $values[] = array('sKey' => $k, 'sValue' => $v, 'section' => Sobi::Section(), 'critical' => 0, 'cSection' => $sec);
                 }
             }
         }
     }
     if ($section) {
         /* @var $sec SPSection */
         $sec = SPFactory::Model('section');
         $sec->init(SPRequest::sid());
         $sec->getRequest('section');
         $sec->save(true);
     }
     Sobi::Trigger('SaveConfig', $this->name(), array(&$values));
     try {
         SPFactory::db()->insertArray('spdb_config', $values, true);
     } catch (SPException $x) {
         $this->response(Sobi::Back(), $x->getMessage(), false, SPC::ERROR_MSG);
     }
     if (!($section && !Sobi::Section())) {
         SPFactory::cache()->cleanAll();
     } else {
         SPFactory::cache()->cleanSection();
     }
     Sobi::Trigger('After', 'SaveConfig', array(&$values));
     $this->response(Sobi::Back(), Sobi::Txt('MSG.CONFIG_SAVED'), false, 'success');
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:78,代码来源:config.php

示例3: save

 /**
  * (non-PHPdoc)
  * @see Site/lib/models/SPDBObject#save()
  */
 public function save($request = 'post')
 {
     $this->loadFields(Sobi::Section(), true);
     // Thu, Feb 19, 2015 12:12:47 - it should be actually "beforeSave"
     Sobi::Trigger($this->name(), 'Before' . ucfirst(__FUNCTION__), array($this->id));
     /* save the base object data */
     /* @var SPdb $db */
     $db = SPFactory::db();
     $db->transaction();
     if (!$this->nid || SPRequest::task() == 'entry.clone') {
         $this->nid = SPRequest::string($this->nameField, null, false, $request);
         $this->nid = $this->createAlias();
         $this->name = $this->nid;
     }
     if (Sobi::Cfg('entry.publish_limit', 0) && !defined('SOBI_ADM_PATH')) {
         SPRequest::set('entry_createdTime', 0, $request);
         SPRequest::set('entry_validSince', 0, $request);
         SPRequest::set('entry_validUntil', 0, $request);
         $this->validUntil = gmdate('Y-m-d H:i:s', time() + Sobi::Cfg('entry.publish_limit', 0) * 24 * 3600);
     }
     $preState = Sobi::Reg('object_previous_state');
     parent::save($request);
     $nameField = $this->nameField();
     /* get the fields for this section */
     foreach ($this->fields as $field) {
         /* @var $field SPField */
         try {
             if ($field->enabled('form', $preState['new'])) {
                 $field->saveData($this, $request);
             } else {
                 $field->finaliseSave($this, $request);
             }
             if ($field->get('id') == $nameField) {
                 /* get the entry name */
                 $this->name = $field->getRaw();
                 /* save the nid (name id) of the field where the entry name is saved */
                 $this->nameField = $field->get('nid');
             }
         } catch (SPException $x) {
             if (SPRequest::task() != 'entry.clone') {
                 $db->rollback();
                 throw new SPException(SPLang::e('CANNOT_SAVE_FIELS_DATA', $x->getMessage()));
             } else {
                 Sobi::Error($this->name(), SPLang::e('CANNOT_SAVE_FIELS_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
             }
         }
     }
     $values = array();
     /* get categories */
     $cats = Sobi::Reg('request_categories');
     if (!count($cats)) {
         $cats = SPRequest::arr('entry_parent', SPFactory::registry()->get('request_categories', array()), $request);
     }
     /* by default it should be comma separated string */
     if (!count($cats)) {
         $cats = SPRequest::string('entry_parent', null, $request);
         if (strlen($cats) && strpos($cats, ',')) {
             $cats = explode(',', $cats);
             foreach ($cats as $i => $cat) {
                 $c = (int) trim($cat);
                 if ($c) {
                     $cats[$i] = $c;
                 } else {
                     unset($cats[$i]);
                 }
             }
         } elseif (strlen($cats)) {
             $cats = array((int) $cats);
         }
     }
     if (is_array($cats) && count($cats)) {
         foreach ($cats as $i => $v) {
             if (!$v) {
                 unset($cats[$i]);
             }
         }
     }
     if (is_array($cats) && count($cats)) {
         /* get the ordering in these categories */
         try {
             $db->select('pid, MAX(position)', 'spdb_relations', array('pid' => $cats, 'oType' => 'entry'), null, 0, 0, false, 'pid');
             $cPos = $db->loadAssocList('pid');
             $currPos = $db->select(array('pid', 'position'), 'spdb_relations', array('id' => $this->id, 'oType' => 'entry'))->loadAssocList('pid');
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         /* set the right position */
         foreach ($cats as $i => $cat) {
             $copy = 0;
             if (!$this->approved) {
                 $copy = isset($this->categories[$cats[$i]]) ? 0 : 1;
             } else {
                 $db->delete('spdb_relations', array('id' => $this->id, 'oType' => 'entry'));
             }
             if (isset($currPos[$cat])) {
                 $pos = $currPos[$cat]['position'];
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:entry.php

示例4: reorder

 /**
  */
 private function reorder()
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     $sids = SPRequest::arr('ep_sid', array());
     /* re-order it to the valid ordering */
     $order = array();
     asort($sids);
     $eLimStart = SPRequest::int('eLimStart', 0);
     $eLimit = Sobi::GetUserState('adm.entries.limit', 'elimit', Sobi::Cfg('adm_list.entries_limit', 25));
     $LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
     if (count($sids)) {
         $c = 0;
         foreach ($sids as $sid => $pos) {
             $order[++$c] = $sid;
         }
     }
     $pid = SPRequest::int('sid');
     foreach ($order as $sid) {
         try {
             $db->update('spdb_relations', array('position' => ++$LimStart), array('id' => $sid, 'oType' => 'entry', 'pid' => $pid));
             SPFactory::cache()->deleteObj('entry', $sid);
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     $this->response(Sobi::Back(), Sobi::Txt('EMN.REORDERED'), true, SPC::SUCCESS_MSG);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:30,代码来源:entry.php

示例5: routeTask

 /**
  * Route by task
  * @return bool
  */
 private function routeTask()
 {
     $r = true;
     if (strstr($this->_task, '.')) {
         /* task consist of the real task and the object type */
         $task = explode('.', $this->_task);
         $obj = trim(array_shift($task));
         $task = trim(implode('.', $task));
         /* load the controller class definition and get the class name */
         $ctrl = SPLoader::loadController($obj, true);
         /* route task for multiple objects - e.g removing or publishing elements from a list */
         $sids = SPRequest::arr('sid');
         $csids = SPRequest::arr('c_sid');
         $esids = SPRequest::arr('e_sid');
         if (count($sids) || count($csids) || count($esids)) {
             $sid = array_key_exists('sid', $_REQUEST) && is_array($_REQUEST['sid']) ? 'sid' : (array_key_exists('c_sid', $_REQUEST) ? 'c_sid' : 'e_sid');
             if (count(SPRequest::arr($sid))) {
                 /* @var SPdb $db */
                 $db =& SPFactory::db();
                 $objects = null;
                 try {
                     $db->select('*', 'spdb_object', array('id' => SPRequest::arr($sid)));
                     $objects = $db->loadObjectList();
                 } catch (SPException $x) {
                     Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
                     $r = false;
                 }
                 /** @noinspection PhpUndefinedVariableInspection */
                 if (count($objects)) {
                     $this->_ctrl = array();
                     foreach ($objects as $object) {
                         $o = $this->extendObj($object, $obj, $ctrl, $task);
                         if ($o) {
                             $this->_ctrl[] = $o;
                         }
                     }
                     if (!count($this->_ctrl)) {
                         Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                         Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                     }
                 } else {
                     Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                     Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                     $r = false;
                     //break;
                 }
             } else {
                 Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
                 Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
                 $r = false;
                 //break;
             }
         } else {
             /* set controller and model */
             try {
                 $ctrl = new $ctrl();
                 $this->setController($ctrl);
                 if ($ctrl instanceof SPController) {
                     $model = SPLoader::loadModel($obj, false, false);
                     if ($model) {
                         $this->_ctrl->setModel($model);
                     }
                 }
             } catch (SPException $x) {
                 Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
             }
             if ($this->_sid) {
                 $this->_model =& SPFactory::object($this->_sid);
             }
             /* if the basic object we got from the #getSection method is the same one ... */
             if ($this->_model instanceof stdClass && $this->_model->oType == $obj) {
                 /*... extend the empty model of these data we've already got */
                 /** @noinspection PhpParamsInspection */
                 $this->_ctrl->extend($this->_model);
             }
             /* ... and so on... */
             $this->_ctrl->setTask($task);
         }
     } else {
         /** Special controllers not inherited from object and without model */
         $task = $this->_task;
         $ctrl = SPLoader::loadController($task, true);
         try {
             $this->setController(new $ctrl());
         } catch (SPException $x) {
             Sobi::Error('CoreCtrl', SPLang::e('Cannot set controller. %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
     }
     return $r;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:94,代码来源:sobipro.php

示例6: registerRepo

 private function registerRepo()
 {
     $repo = trim(preg_replace('/[^a-zA-Z0-9\\.\\-\\_]/', null, SPRequest::string('repository')));
     $data = SPRequest::arr('RepositoryResponse');
     $answer = array();
     if (count($data)) {
         foreach ($data as $k => $v) {
             $v = strlen($v) && $v != '' ? $v : SPC::NO_VALUE;
             $answer[$k] = $v;
         }
     }
     $defFile = SPLoader::path("etc.repos.{$repo}.repository", 'front', true, 'xml');
     $repository = SPFactory::Instance('services.installers.repository');
     $repository->loadDefinition($defFile);
     try {
         $repository->connect();
     } catch (SPException $x) {
         $this->ajaxResponse(true, SPLang::e('REPO_ERR', $x->getMessage()), Sobi::Url('extensions.browse'), SPC::ERROR_MSG);
     }
     $callback = SPRequest::word('callback');
     $response = call_user_func_array(array($repository, $callback), $answer);
     if (is_array($response) && isset($response['callback'])) {
         return $this->parseSoapRequest($response, $repo);
     } elseif ($response === true || isset($response['welcome_msg'])) {
         SPFactory::mainframe()->cleanBuffer()->customHeader();
         if (isset($response['token'])) {
             $repository->saveToken($response['token']);
         }
         if (isset($response['welcome_msg']) && $response['welcome_msg']) {
             echo json_encode(array('message' => array('type' => SPC::SUCCESS_MSG, 'response' => $response['welcome_msg']), 'callback' => null, 'redirect' => true));
         } else {
             echo json_encode(array('message' => array('type' => SPC::SUCCESS_MSG, 'response' => Sobi::Txt('EX.REPO_HAS_BEEN_ADDED', array('location' => $repo))), 'callback' => null, 'redirect' => true));
         }
         exit;
     } else {
         if (isset($response['error'])) {
             $this->ajaxResponse(true, SPLang::e('REPO_ERR', $response['msg']), Sobi::Url('extensions.browse'), SPC::ERROR_MSG, false);
         } else {
             $this->ajaxResponse(true, SPLang::e('UNKNOWN_ERR'), Sobi::Url('extensions.browse'), SPC::ERROR_MSG, false);
         }
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:42,代码来源:extensions.php

示例7: state

 /**
  * @param bool $state
  * @return bool
  */
 protected function state($state)
 {
     $rid = SPRequest::int('rid');
     $where = null;
     if (!$rid) {
         $rid = SPRequest::arr('rid');
         if (is_array($rid) && !empty($rid)) {
             $where = array('rid' => $rid);
         }
     } else {
         $where = array('rid' => $rid);
     }
     if (!$where) {
         $this->response(Sobi::Back(), Sobi::Txt('ACL_SELECT_RULE_FIRST'), true, SPC::ERROR_MSG);
         return false;
     }
     try {
         SPFactory::db()->update('spdb_permissions_rules', array('state' => $state), $where);
     } catch (SPException $x) {
         Sobi::Error('ACL', SPLang::e('Db reports %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     $this->response(Sobi::Back(), Sobi::Txt('ACL.MSG_STATE_CHANGED'), true, SPC::SUCCESS_MSG);
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:27,代码来源:acl.php

示例8: changeState

 /**
  *
  * @param task
  * @return array
  */
 protected function changeState($task)
 {
     $fIds = SPRequest::arr('p_fid');
     $col = 'enabled';
     $state = '0';
     $msg = null;
     if (!$fIds) {
         if (SPRequest::int('fid')) {
             $fIds = array(SPRequest::int('fid'));
         } else {
             $fIds = array();
         }
     }
     if (!count($fIds)) {
         return array('text' => Sobi::Txt('FMN.STATE_CHANGE_NO_ID'), 'type' => SPC::ERROR_MSG);
     }
     switch ($task) {
         case 'hide':
         case 'publish':
             $col = 'enabled';
             $state = $task == 'publish' ? 1 : 0;
             break;
         case 'setRequired':
         case 'setNotRequired':
             $col = 'required';
             $state = $task == 'setRequired' ? 1 : 0;
             break;
         case 'setEditable':
         case 'setNotEditable':
             $col = 'editable';
             $state = $task == 'setEditable' ? 1 : 0;
             break;
         case 'setFee':
         case 'setFree':
             $col = 'isFree';
             $state = $task == 'setFree' ? 1 : 0;
             break;
             /** @since 1.1 - single row only from the field list */
         /** @since 1.1 - single row only from the field list */
         case 'toggle':
             $fIds = array();
             $fid = SPRequest::int('fid');
             $attribute = explode('.', SPRequest::task());
             /** now you know what a naming convention is for! Right? Damn!!! */
             $attribute = in_array($attribute[2], array('editable', 'enabled', 'required')) ? $attribute[2] : 'is' . ucfirst($attribute[2]);
             $this->_model = SPFactory::Model('field', true)->init($fid);
             $current = $this->_model->get($attribute);
             try {
                 SPFactory::db()->update('spdb_field', array($attribute => !$current), array('fid' => $fid), 1);
                 $msg = Sobi::Txt('FM.STATE_CHANGED', array('fid' => $fid));
             } catch (SPException $x) {
                 Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
                 $msg = Sobi::Txt('FM.STATE_NOT_CHANGED', array('fid' => $fid));
             }
             break;
     }
     if (count($fIds)) {
         $msg = array();
         foreach ($fIds as $fid) {
             try {
                 SPFactory::db()->update('spdb_field', array($col => $state), array('fid' => $fid), 1);
                 $msg[] = array('text' => Sobi::Txt('FM.STATE_CHANGED', array('fid' => $fid)), 'type' => 'success');
             } catch (SPException $x) {
                 Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
                 $msg[] = array('text' => Sobi::Txt('FM.STATE_NOT_CHANGED', array('fid' => $fid)), 'type' => 'error');
             }
         }
     }
     SPFactory::cache()->cleanSection(Sobi::Section());
     return $msg;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:76,代码来源:field.php

示例9: verify

 /**
  * @param SPEntry $entry
  * @param string $request
  * @throws SPException
  * @return string
  * @throw SPException
  */
 private function verify($entry, $request)
 {
     $data = SPRequest::arr($this->nid, array(), $request);
     if (!$data) {
         $dataString = SPRequest::string($this->nid, null, false, $request);
         if (strstr($dataString, '://')) {
             $data = SPFactory::config()->structuralData($dataString);
         } else {
             $dataString = SPRequest::int($this->nid, 0, $request);
             if ($dataString) {
                 $data = array($dataString);
             }
         }
     } else {
         if (count($data) > $this->catsMaxLimit && count($data) > 1) {
             $data = array_slice($data, 0, $this->catsMaxLimit);
         }
     }
     $dexs = count($data);
     /* check if it was required */
     if ($this->required && !$dexs && $this->method != 'fixed') {
         throw new SPException(SPLang::e('FIELD_REQUIRED_ERR', $this->name));
     }
     /* check if there was an adminField */
     if ($this->adminField && $dexs && $this->method != 'fixed') {
         if (!Sobi::Can('entry.adm_fields.edit')) {
             throw new SPException(SPLang::e('FIELD_NOT_AUTH', $this->name));
         }
     }
     /* check if it was free */
     if (!$this->isFree && $this->fee && $dexs) {
         SPFactory::payment()->add($this->fee, $this->name, $entry->get('id'), $this->fid);
     }
     /* check if it was editLimit */
     if ($this->editLimit == 0 && !Sobi::Can('entry.adm_fields.edit') && $dexs) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_EXP', $this->name));
     }
     /* check if it was editable */
     if (!$this->editable && !Sobi::Can('entry.adm_fields.edit') && $dexs && $entry->get('version') > 1) {
         throw new SPException(SPLang::e('FIELD_NOT_AUTH_NOT_ED', $this->name));
     }
     if (!$dexs) {
         $data = array();
     }
     $this->setData($data);
     return $data;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:54,代码来源:category.php

示例10: reorder

 /**
  */
 private function reorder()
 {
     /* @var SPdb $db */
     $db =& SPFactory::db();
     /* get the requested ordering */
     $sids = SPRequest::arr('cp_sid', array());
     /* re-order it to the valid ordering */
     $order = array();
     asort($sids);
     $cLimStart = SPRequest::int('cLimStart', 0);
     $cLimit = Sobi::GetUserState('adm.categories.limit', 'climit', Sobi::Cfg('adm_list.cats_limit', 15));
     $LimStart = $cLimStart ? ($cLimStart - 1) * $cLimit : $cLimStart;
     if (count($sids)) {
         $c = 0;
         foreach ($sids as $sid => $pos) {
             $order[++$c] = $sid;
         }
     }
     $c = 0;
     foreach ($order as $sid) {
         try {
             $db->update('spdb_relations', array('position' => ++$LimStart), array('id' => $sid, 'oType' => 'category'));
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     $this->response(Sobi::Back(), Sobi::Txt('CATEGORIES_ARE_RE_ORDERED'), true, SPC::SUCCESS_MSG);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:30,代码来源:category.php

示例11: saveConfig

 protected function saveConfig()
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $config = SPRequest::arr('settings');
     $templateName = SPRequest::cmd('templateName');
     if (!strlen($templateName)) {
         $templateName = SPC::DEFAULT_TEMPLATE;
     }
     foreach ($config as $configFile => $settings) {
         $store = json_encode($settings);
         if (isset($settings['less']) && count($settings['less'])) {
             foreach ($settings['less'] as $file => $variables) {
                 $lessFile = Sobi::FixPath($this->dir($templateName) . '/css/' . $file . '.less');
                 if (SPFs::exists($lessFile)) {
                     $lessContent = SPFs::read($lessFile);
                     foreach ($variables as $variable => $value) {
                         // @colour-set: sobipro;
                         $lessContent = preg_replace("/@{$variable}:[^\n]*\\;/", "@{$variable}: {$value};", $lessContent);
                     }
                 }
                 try {
                     SPFs::write($lessFile, $lessContent);
                     $this->compileLessFile($lessFile, str_replace('less', 'css', $lessFile), Sobi::Url('template.settings'), true);
                 } catch (SPException $x) {
                     $this->response(Sobi::Url('template.settings'), Sobi::Txt('TP.SETTINGS_NOT_SAVED', $x->getMessage()), false, SPC::ERROR_MSG);
                 }
             }
         }
         try {
             SPFs::write(Sobi::FixPath($this->dir($templateName) . str_replace('.', '/', $configFile) . '.json'), $store);
         } catch (SPException $x) {
             $this->response(Sobi::Url('template.settings'), Sobi::Txt('TP.SETTINGS_NOT_SAVED', $x->getMessage()), false, SPC::ERROR_MSG);
         }
     }
     $this->response(Sobi::Url('template.settings'), Sobi::Txt('TP.SETTINGS_SAVED'), false, SPC::SUCCESS_MSG);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:38,代码来源:template.php

示例12: __construct

    public function __construct()
    {
        static $loaded = false;
        if ($loaded) {
            return true;
        }
        $jConfig = JFactory::getConfig();
        defined('DS') || define('DS', DIRECTORY_SEPARATOR);
        require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php';
        if (method_exists($jConfig, 'getValue')) {
            Sobi::Init(JPATH_SITE, JFactory::getConfig()->getValue('config.language'));
        } else {
            Sobi::Init(JPATH_SITE, JFactory::getConfig()->get('config.language'));
        }
        if (!defined('SOBI_CMS')) {
            define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15'));
        }
        SPLoader::loadClass('mlo.input');
        define('SOBIPRO_ADM', true);
        define('SOBI_ADM_PATH', JPATH_ADMINISTRATOR . '/components/com_sobipro');
        $adm = str_replace(JPATH_ROOT, null, JPATH_ADMINISTRATOR);
        define('SOBI_ADM_FOLDER', $adm);
        define('SOBI_ADM_LIVE_PATH', $adm . '/components/com_sobipro');
        SPLang::load('com_sobipro.sys');
        $head = SPFactory::header();
        if (SOBI_CMS == 'joomla3') {
            $head->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jmenu'));
        } else {
            $head->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jmenu', 'jquery-migrate'));
        }
        if (SOBI_CMS != 'joomla3') {
            $head->addCssFile('bootstrap.bootstrap')->addJsFile(array('bootstrap'))->addCSSCode('
							#jform_request_SOBI_SELECT_SECTION-lbl { margin-top: 8px; }
                            #jform_request_cid-lbl { margin-top: 8px; }
                            #jform_request_eid-lbl { margin-top: 18px; }
                            #jform_request_sid-lbl { margin-top: 20px; }
                            #jform_request_sptpl-lbl { margin-top: 8px; }
                            .typeahead-width { width: 320px; }
					');
        } else {
            $head->addCSSCode('
                .typeahead-width { width: 70%; }
            ');
        }
        // Joomla! 1.5
        $this->cid = SPRequest::arr('cid');
        // Joomla! 1.6+
        if (!(count($this->cid) && is_numeric($this->cid[0]))) {
            $this->cid = SPRequest::int('id', 0);
        }
        $this->determineTask();
        $strings = array('objects' => array('entry' => Sobi::Txt('OTYPE_ENTRY'), 'category' => Sobi::Txt('OTYPE_CATEGORY'), 'section' => Sobi::Txt('OTYPE_SECTION')), 'labels' => array('category' => Sobi::Txt('SOBI_SELECT_CATEGORY'), 'entry' => Sobi::Txt('SOBI_SELECT_ENTRY')), 'task' => $this->task);
        $strings = json_encode($strings);
        $head->addJsCode("SPJmenuFixTask( '{$this->taskName}' );")->addJsFile('bootstrap.typeahead')->addJsCode("var SPJmenuStrings = {$strings}");
        if ($this->task != 'list.date') {
            if (SOBI_CMS == 'joomla3') {
                $head->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( "#spCalendar" ).parent().parent().css( "display", "none" ); } );');
            } else {
                $head->addJsCode('SobiPro.jQuery( document ).ready( function () { SobiPro.jQuery( "#spCalendar" ).parent().css( "display", "none" ); } );');
            }
        } else {
            $head->addCSSCode('.SobiProCalendar .chzn-container {width: 100px!important; } ');
            $head->addCSSCode('.SobiProCalendar select {width: inherit;} ');
        }
        $head->send();
        parent::__construct();
        $loaded = true;
    }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:68,代码来源:spsection.php


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