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


PHP SPFactory::object方法代码示例

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


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

示例1: validateCache

 public function validateCache()
 {
     static $remove = array('name', 'nid', 'metaDesc', 'metaKeys', 'metaRobots', 'options', 'oType', 'parent');
     $core = SPFactory::object($this->id);
     foreach ($core as $a => $v) {
         if (!in_array($a, $remove)) {
             $this->_set($a, $v);
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:10,代码来源:entry.php

示例2: Init

 /**
  * @deprecated since 1.1 replaced by {@link #Initialise()}
  * @param int $sid - section id
  * @param null $root - root of Joomla!
  * @param null $lang - language
  * @return null
  */
 public static function Init($root = null, $lang = null, $sid = 0)
 {
     static $loaded = false;
     if (!$loaded) {
         if (!defined('SOBI_CMS')) {
             define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15'));
         }
         defined('SOBIPRO') || define('SOBIPRO', true);
         defined('SOBI_TASK') || define('SOBI_TASK', 'task');
         defined('SOBI_DEFLANG') || define('SOBI_DEFLANG', $lang);
         defined('SOBI_ACL') || define('SOBI_ACL', 'front');
         defined('SOBI_ROOT') || define('SOBI_ROOT', $root);
         defined('SOBI_MEDIA') || define('SOBI_MEDIA', implode('/', array($root, 'media', 'sobipro')));
         defined('SOBI_PATH') || define('SOBI_PATH', SOBI_ROOT . '/components/com_sobipro');
         defined('SOBI_LIVE_PATH') || define('SOBI_LIVE_PATH', 'components/com_sobipro');
         require_once SOBI_PATH . '/lib/base/fs/loader.php';
         SPLoader::loadController('sobipro');
         SPLoader::loadController('interface');
         SPLoader::loadClass('base.exception');
         SPLoader::loadClass('base.const');
         SPLoader::loadClass('base.object');
         SPLoader::loadClass('base.filter');
         SPLoader::loadClass('base.request');
         SPLoader::loadClass('cms.base.lang');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadClass('base.factory');
         SPLoader::loadClass('base.config');
         SPLoader::loadClass('cms.base.fs');
         // in case it is a CLI call
         if (isset($_SERVER['REQUEST_URI'])) {
             SPFactory::config()->set('live_site', JURI::root());
         }
         $loaded = true;
     }
     if ($sid) {
         $section = null;
         if ($sid) {
             $path = array();
             $id = $sid;
             $path[] = (int) $id;
             while ($id > 0) {
                 try {
                     $id = SPFactory::db()->select('pid', 'spdb_relations', array('id' => $id))->loadResult();
                     if ($id) {
                         $path[] = (int) $id;
                     }
                 } catch (SPException $x) {
                     Sobi::Error('ExtCoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
                 }
             }
             $path = array_reverse($path);
             $section = SPFactory::object($path[0]);
         }
         /* set current section in the registry */
         SPFactory::registry()->set('current_section', $section->id);
         $_config =& SPFactory::config();
         /* load basic configuration settings */
         $_config->addIniFile('etc.config', true);
         $_config->addTable('spdb_config', $sid);
         /* initialise interface config setting */
         SPFactory::mainframe()->getBasicCfg();
         /* initialise config */
         $_config->init();
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:72,代码来源:sobi.php

示例3: routeObj

 /**
  * @return bool
  */
 private function routeObj()
 {
     if ($this->_model instanceof stdClass && isset($this->_model->id)) {
         if ($this->_sid && $this->_model->id != $this->_sid) {
             $this->_model = SPFactory::object($this->_sid);
         }
     }
     try {
         $ctrl = SPFactory::Controller($this->_model->oType, true);
         if ($ctrl instanceof SPController) {
             $this->setController($ctrl);
             $this->_ctrl->setModel(SPLoader::loadModel($this->_model->oType));
             /** @noinspection PhpParamsInspection */
             $this->_ctrl->extend($this->_model);
             $this->_ctrl->setTask($this->_task);
         }
     } catch (SPException $x) {
         Sobi::Error('CoreCtrl', SPLang::e('Cannot route object: %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:24,代码来源:sobipro.php

示例4: array

 public function &getInstance($id = 0)
 {
     static $instances = array();
     $id = $id ? $id : Sobi::Reg('current_section');
     if (!isset($instances[$id]) || !$instances[$id] instanceof self) {
         $instances[$id] = new self();
         $instances[$id]->extend(SPFactory::object($id));
     }
     return $instances[$id];
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:10,代码来源:section.php

示例5: fetchElement

 public function fetchElement($name)
 {
     static $sid = 0;
     $selected = 0;
     $db = SPFactory::db();
     if (!$sid) {
         $sid = 0;
         if ($this->cid) {
             $link = $this->getLink();
             if (strstr($link, 'sid')) {
                 $query = array();
                 parse_str($link, $query);
                 $sid = $query['sid'];
                 if (isset($query['sptpl'])) {
                     $this->tpl = $query['sptpl'];
                 }
             }
             if ($sid) {
                 $section = SPFactory::object($sid);
                 if ($section->oType == 'section') {
                     $selected = $section->id;
                     $this->section = $selected;
                 } else {
                     $path = array();
                     $id = $sid;
                     while ($id > 0) {
                         try {
                             $db->select('pid', 'spdb_relations', array('id' => $id));
                             $id = $db->loadResult();
                             if ($id) {
                                 $path[] = (int) $id;
                             }
                         } catch (SPException $x) {
                         }
                     }
                     $path = array_reverse($path);
                     $selected = $path[0];
                     $this->section = $selected;
                 }
             } else {
                 // just to not repeating
                 $sid = -1;
             }
         }
     }
     $this->sid = $sid;
     $this->determineObjectType($sid);
     switch ($name) {
         case 'sid':
             $params = array('id' => 'sid', 'class' => 'input-mini', 'style' => 'text-align: center; margin-top: 10px; margin-left: 10px;', 'readonly' => 'readonly');
             return '<div class="SobiPro" id="jform_request_sid">' . SPHtml_Input::text('type', $this->oTypeName, array('id' => 'otype', 'class' => 'input-medium', 'style' => 'text-align: center; margin-top: 10px;', 'readonly' => 'readonly')) . SPHtml_Input::text('urlparams[sid]', $sid, $params) . '</div>';
             break;
         case 'cid':
             return $this->getCat();
             break;
         case 'eid':
             return $this->getEntry();
             break;
         case 'did':
         case 'date':
             return $this->getCalendar();
             break;
         case 'tpl':
         case 'sptpl':
             return $this->getTemplates();
             break;
     }
     $sections = array();
     $sout = array();
     try {
         $sections = $db->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), $x->getMessage(), SPC::ERROR, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         $sout[] = Sobi::Txt('SOBI_SELECT_SECTION');
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', 'valid', $section->id)) {
                 $s = new SPSection();
                 $s->extend($section);
                 $sout[$s->get('id')] = $s->get('name');
             }
         }
     }
     $params = array('id' => 'spsection', 'class' => 'required');
     $field = SPHtml_Input::select('sid', $sout, $selected, false, $params);
     return "<div class=\"SobiPro\" style=\"margin-top: 2px;\">{$field}</div>";
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:91,代码来源:spsection.php

示例6: ucfirst

 /**
  * @param int $id
  * @return \SPDBObject
  * @internal param \stdClass $obj
  */
 public function &init($id = 0)
 {
     Sobi::Trigger($this->name(), ucfirst(__FUNCTION__) . 'Start', array(&$id));
     $this->id = $id ? $id : $this->id;
     if ($this->id) {
         try {
             $obj = SPFactory::object($this->id);
             if (!empty($obj)) {
                 /* ensure that the id was right */
                 if ($obj->oType == $this->oType) {
                     $this->extend($obj);
                 } else {
                     $this->id = 0;
                 }
             }
             $this->createdTime = SPFactory::config()->date($this->createdTime);
             $this->validSince = SPFactory::config()->date($this->validSince);
             if ($this->validUntil) {
                 $this->validUntil = SPFactory::config()->date($this->validUntil);
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_GET_OBJECT_DB_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         }
         $this->loadTable();
     }
     return $this;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:32,代码来源:dbobject.php

示例7: routeObj

 /**
  * @return bool
  */
 private function routeObj()
 {
     try {
         $ctrl = SPFactory::Controller($this->_model->oType);
         if ($ctrl instanceof SPController) {
             $this->setController($ctrl);
             if ($this->_model->id == SPRequest::sid()) {
                 // just to use the pre-fetched entry
                 if ($this->_model->oType == 'entry') {
                     $e = SPFactory::Entry($this->_model->id);
                     // object has been stored anyway in the SPFactory::object method
                     // and also already initialized
                     // therefore it will be now rewritten and because the init flag is set to true
                     // the name is getting lost
                     // $e->extend( $this->_model );
                     $this->_ctrl->setModel($e);
                 } else {
                     $this->_ctrl->setModel(SPLoader::loadModel($this->_model->oType));
                     $this->_ctrl->extend($this->_model);
                 }
             } else {
                 $this->_ctrl->extend(SPFactory::object(SPRequest::sid()));
             }
             $this->_ctrl->setTask($this->_task);
         }
     } catch (SPException $x) {
         if (defined('SOBI_TESTS')) {
             Sobi::Error('CoreCtrl', SPLang::e('Cannot set controller. %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
         } else {
             SPFactory::mainframe()->setRedirect(Sobi::Reg('live_site'), SPLang::e('PAGE_NOT_FOUND'), SPC::ERROR_MSG, true);
         }
     }
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:37,代码来源:sobipro.php


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