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


PHP SPFactory::cache方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->_db =& SPFactory::db();
     parent::__construct();
     /** because we have always the same URL - disable Joomla! cache */
     SPFactory::cache()->setJoomlaCaching(false);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:7,代码来源:search.php

示例2: execute

 public function execute()
 {
     SPLang::load('com_sobipro.check');
     $task = $this->_task = strlen($this->_task) ? $this->_task : $this->_defTask;
     // this is need to delete all old cache after installation
     if (SPRequest::int('init')) {
         SPFactory::cache()->cleanAll();
     }
     switch ($this->_task) {
         case 'view':
             $this->view();
             break;
         case 'download':
             $this->download();
             break;
         default:
             if (method_exists($this, $this->_task)) {
                 SPFactory::mainframe()->cleanBuffer()->customHeader();
                 $this->{$task}();
                 exit;
             } else {
                 Sobi::Error('requirements', 'Task not found', SPC::WARNING, 404, __LINE__, __FILE__);
                 exit;
             }
             break;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:requirements.php

示例3: execute

 public function execute()
 {
     $this->start = microtime(true);
     $sites = $this->getSites();
     $responses = array();
     $status = 'working';
     $message = null;
     $this->format = SPRequest::bool('fullFormat') ? self::FORMAT_FULL : self::FORMAT;
     //		$this->format = SPRequest::bool( 'fullFormat' ) ? self::FORMAT_FULL : self::FORMAT_FULL;
     $task = SPRequest::task();
     if (in_array($task, array('crawler.init', 'crawler.restart'))) {
         if ($task == 'crawler.restart') {
             SPFactory::cache()->cleanSection(Sobi::Section());
         }
         SPFactory::db()->truncate(self::DB_TABLE);
         $multiLang = Sobi::Cfg('lang.multimode', false);
         if ($multiLang) {
             $langs = SPFactory::CmsHelper()->getLanguages();
             if ($multiLang && $langs) {
                 foreach ($langs as $lang) {
                     $responses[] = $this->getResponse(Sobi::Cfg('live_site') . 'index.php?option=com_sobipro&sid=' . Sobi::Section() . '&lang=' . $lang);
                 }
             }
         }
         $responses[] = $this->getResponse(Sobi::Cfg('live_site') . 'index.php?option=com_sobipro&sid=' . Sobi::Section());
         $sites = $this->getSites();
     }
     if (!count($sites) && !in_array($task, array('crawler.init', 'crawler.restart'))) {
         $message = Sobi::Txt('CRAWL_URL_PARSED_DONE', SPFactory::db()->select('count(*)', self::DB_TABLE)->loadResult());
         SPFactory::db()->truncate(self::DB_TABLE);
         $this->response(array('status' => 'done', 'data' => array(), 'message' => $message));
     }
     if (count($sites)) {
         $i = 0;
         $timeLimit = SPRequest::int('timeLimit', self::TIME_LIMIT, 'get', true);
         foreach ($sites as $site) {
             if (!strlen($site)) {
                 continue;
             }
             $responses[] = $this->getResponse($site);
             $i++;
             if (microtime(true) - $this->start > $timeLimit) {
                 break;
             }
         }
         $message = Sobi::Txt('CRAWL_URL_PARSED_WORKING', $i, count($sites));
     }
     $this->response(array('status' => $status, 'data' => $responses, 'message' => $message));
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:49,代码来源:crawler.php

示例4: delete

 /**
  * (non-PHPdoc)
  * @see Site/lib/models/SPDBObject#delete()
  * @param bool $childs - update child entries parent
  */
 public function delete($childs = true)
 {
     parent::delete();
     SPFactory::cache()->cleanSection();
     SPFactory::cache()->deleteObj('category', $this->id);
     try {
         /* get all child cats and delete these too */
         $childs = $this->getChilds('category', true);
         if (count($childs)) {
             foreach ($childs as $child) {
                 $cat = new self();
                 $cat->init($child);
                 $cat->delete(false);
             }
         }
         $childs[$this->id] = $this->id;
         SPFactory::db()->delete('spdb_category', array('id' => $this->id));
         if ($childs) {
             SPFactory::db()->update('spdb_object', array('parent' => Sobi::Section()), array('parent' => $childs));
         }
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_CATEGORY_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:29,代码来源:category.php

示例5: getChilds

 /**
  * @param string $type
  * @param bool $recursive
  * @param int $state
  * @param bool $name
  * @return array
  */
 public function getChilds($type = 'entry', $recursive = false, $state = 0, $name = false)
 {
     static $lang = null;
     if (!$lang) {
         $lang = Sobi::Lang(false);
     }
     $childs = SPFactory::cache()->getVar('childs_' . $lang . $type . ($recursive ? '_recursive' : '') . ($name ? '_full' : '') . $state, $this->id);
     if ($childs) {
         return $childs == SPC::NO_VALUE ? array() : $childs;
     }
     $db = SPFactory::db();
     $childs = array();
     try {
         $cond = array('pid' => $this->id);
         if ($state) {
             $cond['so.state'] = $state;
             $cond['so.approved'] = $state;
             $tables = $db->join(array(array('table' => 'spdb_object', 'as' => 'so', 'key' => 'id'), array('table' => 'spdb_relations', 'as' => 'sr', 'key' => 'id')));
             $db->select(array('sr.id', 'sr.oType'), $tables, $cond);
         } else {
             $db->select(array('id', 'oType'), 'spdb_relations', $cond);
         }
         $results = $db->loadAssocList('id');
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_CHILDS_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     if ($recursive && count($results)) {
         foreach ($results as $cid) {
             $this->rGetChilds($results, $cid, $type);
         }
     }
     if (count($results)) {
         if ($type == 'all') {
             foreach ($results as $id => $r) {
                 $childs[$id] = $r['id'];
             }
         } else {
             foreach ($results as $id => $r) {
                 if ($r['oType'] == $type) {
                     $childs[$id] = $id;
                 }
             }
         }
     }
     if ($name && count($childs)) {
         $names = SPLang::translateObject($childs, array('name', 'alias'), $type);
         if (is_array($names) && !empty($names)) {
             foreach ($childs as $i => $id) {
                 $childs[$i] = array('name' => $names[$id]['value'], 'alias' => $names[$id]['alias']);
             }
         }
     }
     if (!$state) {
         SPFactory::cache()->addVar($childs, 'childs_' . $lang . $type . ($recursive ? '_recursive' : '') . ($name ? '_full' : '') . $state, $this->id);
     }
     return $childs;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:64,代码来源:dbobject.php

示例6: array

 /**
  * Adds object to the pathway
  * @param SPDBObject $obj
  * @param array $site
  * @return void
  */
 public function &addObjToPathway($obj, $site = array())
 {
     if (defined('SOBI_ADM_PATH')) {
         return true;
     }
     $menu = JSite::getMenu()->getActive()->query;
     $sid = isset($menu['sid']) ? $menu['sid'] : 0;
     $resetPathway = false;
     if ($obj->get('oType') == 'entry') {
         $id = SPRequest::int('pid');
         /** if the entry isn't linked directly in the menu */
         if (!($obj->get('id') == $sid)) {
             /* if we didn't entered this entry via category */
             if (!$id || $id == Sobi::Section() || Sobi::Cfg('entry.primary_path_always')) {
                 $id = $obj->get('parent');
                 $resetPathway = true;
             }
         } else {
             /** ok - here is the weird thing:
              * When it is accessed via menu we have to force cache to create another version
              * because the pathway is stored in the cache
              * @todo find better solution for it
              */
             $mid = true;
             SPFactory::registry()->set('cache_view_recreate_request', $mid)->set('cache_view_add_itemid', JSite::getMenu()->getActive()->id);
             return $this;
         }
     } else {
         $id = $obj->get('id');
     }
     $path = SPFactory::cache()->getVar('parent_path', $id);
     if (!$path) {
         $path = SPFactory::config()->getParentPath($id, true, false, true);
         SPFactory::cache()->addVar($path, 'parent_path', $id);
     }
     if (count($path)) {
         /* skip everything above the linked sid */
         $rpath = array_reverse($path);
         $path = array();
         foreach ($rpath as $part) {
             if ($part['id'] == $sid) {
                 break;
             }
             $path[] = $part;
         }
         $path = array_reverse($path);
         /* ^^ skip everything above the linked sid */
     }
     $title = array();
     // if there was an active menu - add its title to the browser title as well
     if ($sid) {
         $title[] = JFactory::getDocument()->getTitle();
     }
     /**
      * Mon, Jul 16, 2012
      * I would relay like to know why I've added the "htmlentities" call here.
      * The second param of the 'addItem' method is URL so there should be definitely no such thing
      * Related to Bug #692
      */
     if (count($path)) {
         if ($resetPathway) {
             /** we have to reset the J! pathway in case:
              *  - we are entering an entry and we want to show the pathway corresponding to the main parent if of the entry
              *    but we have also an Itemid and Joomla! set already the pathway partialy so we need to override it
              *    It wouldn't be normally a problem but when SEF is enabled we do not have the pid so we don't know how it has been enetered
              */
             JFactory::getApplication()->getPathway()->setPathway(array());
         }
         foreach ($path as $data) {
             if (!(isset($data['name']) || isset($data['id'])) || !$data['id']) {
                 continue;
             }
             $title[] = $data['name'];
             $this->addToPathway($data['name'], self::url(array('title' => Sobi::Cfg('sef.alias', true) ? $data['alias'] : $data['name'], 'sid' => $data['id'])));
         }
     }
     if ($obj->get('oType') == 'entry') {
         $this->addToPathway($obj->get('name'), self::url(array('task' => 'entry.details', 'title' => Sobi::Cfg('sef.alias', true) ? $obj->get('nid') : $obj->get('name'), 'sid' => $obj->get('id'))));
         $title[] = $obj->get('name');
     }
     //		if ( count( $site ) && $site[ 0 ] ) {
     //			$title[ ] = Sobi::Txt( 'SITES_COUNTER', $site[ 1 ], $site[ 0 ] );
     //		}
     SPFactory::header()->addTitle($title, $site);
     return $this;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:92,代码来源:mainframe.php

示例7: getState

 protected function getState()
 {
     $state = SPFactory::cache()->getVar('system_state');
     if (!$state) {
         SPLang::load('com_sobipro.messages');
         $state = array();
         $state['accelerator'] = array('type' => Sobi::Cfg('cache.l3_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.l3_enabled', true) ? Sobi::Txt('ACCELERATOR_ENABLED') : Sobi::Txt('ACCELERATOR_DISABLED'));
         $state['xml-optimiser'] = array('type' => Sobi::Cfg('cache.xml_enabled', true) ? 'success' : 'error', 'label' => Sobi::Cfg('cache.xml_enabled', true) ? Sobi::Txt('XML_CACHE_ENABLED') : Sobi::Txt('XML_CACHE_DISABLED'));
         $state['javascript-cache'] = array('type' => Sobi::Cfg('cache.include_js_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_js_files', false) ? Sobi::Txt('JS_CACHE_ENABLED') : Sobi::Txt('JS_CACHE_DISABLED'));
         $state['css-cache'] = array('type' => Sobi::Cfg('cache.include_css_files', false) ? 'success' : 'warning', 'label' => Sobi::Cfg('cache.include_css_files', false) ? Sobi::Txt('CSS_CACHE_ENABLED') : Sobi::Txt('CSS_CACHE_DISABLED'));
         $state['display-errors'] = array('type' => Sobi::Cfg('debug.display_errors', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.display_errors', false) ? Sobi::Txt('DISPLAY_ERRORS_ENABLED') : Sobi::Txt('DISPLAY_ERRORS_DISABLED'));
         $state['debug-level'] = array('type' => Sobi::Cfg('debug.level', 0) > 2 ? 'warning' : 'success', 'label' => Sobi::Cfg('debug.level', 0) > 2 ? Sobi::Txt('DEBUG_LEVEL_TOO_HIGH') : Sobi::Txt('DEBUG_LEVEL_OK'));
         $state['debug-xml'] = array('type' => Sobi::Cfg('debug.xml_raw', false) ? 'error' : 'success', 'label' => Sobi::Cfg('debug.xml_raw', false) ? Sobi::Txt('DEBUG_XML_ENABLED') : Sobi::Txt('DEBUG_XML_DISABLED'));
         //			uasort( $state, array( $this, 'sortMessages' ) );
         $messages = SPFactory::message()->getSystemMessages();
         $content = null;
         if (count($messages)) {
             foreach ($messages as $message) {
                 $url = Sobi::Url(array('sid' => $message['section']['id']));
                 $url = "<a href=\"{$url}\">{$message['section']['name']}</a> ";
                 $message['section']['link'] = $url;
                 $message['type-text'] = ucfirst(Sobi::Txt($message['type']));
                 $state['messages'][] = $message;
             }
         }
         SPFactory::cache()->addVar($state, 'system_state');
     }
     return $state;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:29,代码来源:front.php

示例8: switchIndex

 private function switchIndex($field)
 {
     $tplPckg = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     $letters = explode(',', Sobi::Cfg('alphamenu.letters'));
     if (Sobi::Cfg('alphamenu.verify')) {
         $entries = SPFactory::cache()->getVar('alpha_entries_' . $field);
         if (!$entries) {
             $entries = array();
             foreach ($letters as $letter) {
                 $params = array('letter' => $letter);
                 if ($field) {
                     $params['field'] = $field;
                 }
                 $this->setParams($params);
                 $entries[$letter] = $this->entries($field);
             }
             SPFactory::cache()->addVar($entries, 'alpha_entries_' . $field);
         }
         foreach ($letters as $letter) {
             $le = array('_complex' => 1, '_data' => trim($letter));
             if (count($entries[$letter])) {
                 $task = 'list.alpha.' . trim(strtolower($letter)) . '.' . $field;
                 $le['_attributes'] = array('url' => Sobi::Url(array('sid' => Sobi::Section(), 'task' => $task)));
             }
             $l[] = $le;
         }
     } else {
         foreach ($letters as $letter) {
             $task = 'list.alpha.' . trim(strtolower($letter)) . '.' . $field;
             $l[] = array('_complex' => 1, '_data' => trim($letter), '_attributes' => array('url' => Sobi::Url(array('sid' => Sobi::Section(), 'task' => $task))));
         }
     }
     $data = array('_complex' => 1, '_data' => array('letters' => $l));
     /* get view class */
     $view = SPFactory::View('listing');
     $view->setTemplate($tplPckg . '.common.alphaindex');
     $view->assign($data, 'alphaMenu');
     ob_start();
     $view->display('menu', 'raw');
     $out = ob_get_contents();
     SPFactory::mainframe()->cleanBuffer()->customHeader();
     echo json_encode(array('index' => $out));
     exit;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:44,代码来源:alpha.php

示例9: 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

示例10: display

 /**
  * @param string $out - output type
  * @param array $functions - array with PHP function to register
  * @throws SPException
  * @return mixed|string
  */
 public function display($out = 'html', $functions = array())
 {
     $class = SPLoader::loadClass('helpers.template');
     $methods = get_class_methods($class);
     if (count($methods)) {
         foreach ($methods as $method) {
             $functions[] = $class . '::' . $method;
         }
     }
     /* standard function registered via the core ini file */
     $stdFunctions = SPLoader::loadIniFile('etc.template_functions');
     if (count($stdFunctions)) {
         foreach ($stdFunctions as $class => $fns) {
             if (strstr($class, '.')) {
                 $class = SPLoader::loadClass($class, false, 'sp-root');
             }
             if (count($fns)) {
                 foreach ($fns as $method => $state) {
                     if ($state) {
                         $functions[] = $class == 'functions' ? $method : $class . '::' . $method;
                     }
                 }
             }
         }
     }
     Sobi::Trigger('TemplateEngine', 'RegisterFunctions', array(&$functions));
     $this->createXML();
     if (SPRequest::cmd('xml') && Sobi::Cfg('debug.xml_raw', false) && (!Sobi::Cfg('debug.xml_ip', null) || Sobi::Cfg('debug.xml_ip') == SPRequest::ip('REMOTE_ADDR', 0, 'SERVER'))) {
         SPFactory::mainframe()->cleanBuffer();
         echo $this->_xml->saveXML();
         exit;
     } elseif (SPRequest::cmd('xml')) {
         Sobi::Error('Debug', 'You have no permission to access this site', SPC::ERROR, 403, __LINE__, __FILE__);
     }
     $template = SPLoader::loadTemplate($this->_tpl, 'xsl');
     if (!$template) {
         $template = SPLoader::loadTemplate($this->_tpl, 'xslt');
     }
     if (Sobi::Cfg('cache.xml_enabled')) {
         SPFactory::cache()->addView($this->_xml, $template, $this->_cacheData);
     }
     if ($template) {
         try {
             if (!($style = DOMDocument::load($template))) {
                 Sobi::Error('template', SPLang::e('CANNOT_PARSE_TEMPLATE_FILE', $template), SPC::ERROR, 500, __LINE__, __FILE__);
             }
         } catch (DOMException $x) {
             Sobi::Error('template', SPLang::e('CANNOT_LOAD_TEMPLATE_FILE', $template, $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         Sobi::Trigger('TemplateEngine', 'LoadStyle', array(&$style));
         $processor = new XSLTProcessor();
         $processor->setParameter('block', 'xmlns', 'http://www.w3.org/1999/xhtml');
         $processor->registerPHPFunctions($functions);
         SPException::catchErrors(SPC::WARNING);
         try {
             $processor->importStylesheet($style);
         } catch (SPException $x) {
             Sobi::Error('template', SPLang::e('CANNOT_PARSE_TEMPLATE_FILE', $template) . $x->getMessage(), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         SPException::catchErrors(0);
         if ($out == 'html') {
             $doc = $processor->transformToDoc($this->_xml);
             $doc->formatOutput = true;
             return $this->cleanOut($doc->saveXML());
         } else {
             $doc = $processor->transformToDoc($this->_xml);
             $doc->formatOutput = true;
             return $doc->saveXML();
         }
     } else {
         throw new SPException(SPLang::e('CANNOT_LOAD_TEMPLATE_FILE_AT', SPLoader::loadTemplate($this->_tpl, 'xsl', false)));
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:79,代码来源:template_xslt.php

示例11: getParentPath

 /**
  * Returns linked lists ( names or ids ) of parent elements to the given id
  *
  * @param int $id - the id of object
  * @param bool $names - names or ids only
  * @param bool $parents
  * @param bool $join
  * @return array
  */
 public function getParentPath($id, $names = false, $parents = false, $join = false)
 {
     $db = SPFactory::db();
     if (!is_numeric($id)) {
         return false;
     }
     $ident = 'relations_path' . ($names ? '_names' : '') . ($parents ? '_parents' : '') . ($join ? '_join' : '');
     $cached = SPFactory::cache()->getVar($ident, $id);
     if ($cached) {
         return $cached;
     } else {
         $cid = $id;
     }
     $path = $parents ? array() : array($id);
     while ($id > 0) {
         try {
             // it doesn't make sense but it happened because of a bug in the SigsiuTree category selector
             $id = $db->select('pid', 'spdb_relations', array('id' => $id, '!pid' => $id))->loadResult();
             if ($id) {
                 $path[] = (int) $id;
             }
         } catch (SPException $x) {
             Sobi::Error(__FUNCTION__, SPLang::e('CANNOT_GET_PARENT_ID', $x->getMessage()), SPC::WARNING, 500, __LINE__, __CLASS__);
         }
     }
     if ($names && count($path)) {
         $names = SPLang::translateObject($path, array('name', 'alias'), array('section', 'category', 'entry'));
         if (is_array($names) && !empty($names)) {
             foreach ($path as $i => $id) {
                 if ($join) {
                     $path[$i] = array('id' => $id, 'name' => $names[$id]['value'], 'alias' => $names[$id]['alias']);
                 } else {
                     $path[$i] = $names[$id]['value'];
                 }
             }
         }
     }
     $path = array_reverse($path);
     SPFactory::cache()->addVar($path, $ident, $cid);
     return $path;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:50,代码来源:config.php

示例12: details

 /**
  * Details view
  * @return void
  */
 private function details()
 {
     /* determine template package */
     $tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
     /* load template config */
     $this->template();
     $this->tplCfg($tplPackage);
     if ($this->_model->get('oType') != 'entry') {
         Sobi::Error('Entry', sprintf('Serious security violation. Trying to save an object which claims to be an entry but it is a %s. Task was %s', $this->_model->get('oType'), SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
         exit;
     }
     /* add pathway */
     SPFactory::mainframe()->addObjToPathway($this->_model);
     $this->_model->countVisit();
     $this->_model->loadFields(Sobi::Reg('current_section'));
     $class = SPLoader::loadView('entry');
     $view = new $class($this->template);
     $view->assign($this->_model, 'entry');
     $view->assign(SPFactory::user()->getCurrent(), 'visitor');
     $view->assign($this->_task, 'task');
     $view->setConfig($this->_tCfg, $this->template);
     $view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
     Sobi::Trigger($this->name(), __FUNCTION__, array(&$view));
     SPFactory::header()->objMeta($this->_model);
     $view->display();
     SPFactory::cache()->addObj($this->_model, 'entry', $this->_model->get('id'));
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:31,代码来源:entry.php

示例13: execute

 /**
  * Route task
  */
 public function execute()
 {
     /* parent class executes the plugins */
     $r = false;
     $task = $this->_task;
     if (strstr($this->_task, '.')) {
         $task = explode('.', $this->_task);
         $this->_fieldType = $task[1];
         $task = $task[0];
     }
     switch ($task) {
         case 'list':
             $r = true;
             $this->listFields();
             break;
         case 'add':
         case 'edit':
             $r = true;
             $this->edit();
             break;
         case 'cancel':
             $r = true;
             $this->checkIn();
             $this->response(Sobi::Back());
             break;
         case 'addNew':
             $r = true;
             Sobi::Redirect(Sobi::Url(array('task' => 'field.edit', 'fid' => $this->saveNew(), 'sid' => SPRequest::sid())));
             break;
         case 'apply':
         case 'save':
             $r = true;
             $this->save();
             break;
         case 'clone':
             $r = true;
             $this->save(true);
             break;
         case 'delete':
             $r = true;
             SPFactory::cache()->cleanSection();
             $this->response(Sobi::Url(array('task' => 'field.list', 'pid' => Sobi::Section())), $this->delete(), true);
             break;
         case 'reorder':
             $r = true;
             $this->reorder();
             break;
         case 'revisions':
             $r = true;
             $this->revisions();
             break;
         case 'up':
         case 'down':
             $r = true;
             $this->singleReorder($this->_task == 'up');
             break;
         case 'hide':
         case 'publish':
         case 'setRequired':
         case 'setNotRequired':
         case 'setEditable':
         case 'setNotEditable':
         case 'setFee':
         case 'setFree':
         case 'toggle':
             $r = true;
             $this->authorise($this->_task);
             SPFactory::cache()->cleanSection();
             $this->response(Sobi::Back(), $this->changeState($task), true);
             break;
         default:
             /* case plugin didn't registered this task, it was an error */
             if (!Sobi::Trigger('Execute', $this->name(), array(&$this))) {
                 $fid = SPRequest::int('fid');
                 $method = $this->_task;
                 if ($fid) {
                     SPLoader::loadModel('field', true);
                     $fdata = $this->loadField($fid);
                     $field = new SPAdmField();
                     $field->extend($fdata);
                     try {
                         $field->{$method}();
                     } catch (SPException $x) {
                         Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
                     }
                 } elseif (!parent::execute()) {
                     Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
                 }
             }
             break;
     }
     return $r;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:96,代码来源:field.php

示例14: loadCategories

 protected function loadCategories()
 {
     if (!$this->_cats || !count($this->_cats)) {
         $this->_cats = SPFactory::cache()->getVar('categories_tree', Sobi::Section());
         if (!$this->_cats || !count($this->_cats)) {
             $this->travelCats(Sobi::Section(), $this->_cats, true);
             SPFactory::cache()->addVar($this->_cats, 'categories_tree', Sobi::Section());
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:10,代码来源:category.php

示例15: approval

 /**
  */
 private function approval($approve)
 {
     $sids = SPRequest::arr('c_sid', array());
     if (!count($sids)) {
         if ($this->_model->get('id')) {
             $sids = array($this->_model->get('id'));
         } else {
             $sids = array();
         }
     }
     if (!count($sids)) {
         $this->response(Sobi::Back(), Sobi::Txt('CHANGE_NO_ID'), false, SPC::ERROR_MSG);
     } else {
         foreach ($sids as $sid) {
             try {
                 SPFactory::db()->update('spdb_object', array('approved' => $approve ? 1 : 0), array('id' => $sid, 'oType' => 'category'));
                 SPFactory::cache()->deleteObj('category', $sid);
             } catch (SPException $x) {
                 Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
             }
         }
         SPFactory::cache()->purgeSectionVars();
         $this->response(Sobi::Back(), Sobi::Txt($approve ? 'CAT.APPROVED' : 'CAT.UNAPPROVED'), false);
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:category.php


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