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


PHP Manager::getInstance方法代码示例

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


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

示例1: getQuestion

 /**
  * Provides the object of the question this response is for.
  * 
  * @return \Wannabe\Question
  */
 public function getQuestion()
 {
     if ($this->getQuestionID() < 1) {
         return null;
     }
     return Manager::getInstance()->getQuestionByID($this->getQuestionID());
 }
开发者ID:hultberg,项目名称:relancms,代码行数:12,代码来源:QuestionResponse.php

示例2: getCrew

 /**
  * Provides the object of the crew.
  *
  * @return \Wannabe\Crew
  */
 public function getCrew()
 {
     if ($this->getCrewID() < 1) {
         return null;
     }
     return Manager::getInstance()->getCrewByID($this->getCrewID());
 }
开发者ID:hultberg,项目名称:relancms,代码行数:12,代码来源:AdminComment.php

示例3: handlerRequest

 public function handlerRequest($data = NULL)
 {
     try {
         $this->context = new MContext($this->request);
         Manager::getInstance()->baseURL = $this->request->getBaseURL(false);
         $app = $this->context->app;
         Manager::getInstance()->app = $app;
         $appPath = $this->context->isCore ? Manager::getInstance()->coreAppsPath : Manager::getInstance()->appsPath;
         Manager::getInstance()->appPath = $appPath . '/' . $app;
         $this->removeInputSlashes();
         $this->setData($data ?: $_REQUEST);
         mtrace('DTO Data:');
         mtrace($this->getData());
         $this->loadExtensions();
         $this->init();
         do {
             $this->prepare();
             $this->handler();
         } while ($this->forward != '');
         $this->terminate();
     } catch (ENotFoundException $e) {
         $this->result = new MNotFound($e->getMessage());
     } catch (ESecurityException $e) {
         $this->result = new MInternalError($e);
     } catch (ETimeOutException $e) {
         $this->result = new MInternalError($e);
     } catch (ERuntimeException $e) {
         $this->result = new MRunTimeError($e);
     } catch (EMException $e) {
         $this->result = new MInternalError($e);
     } catch (Exception $e) {
         $this->result = new MInternalError($e);
     }
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:34,代码来源:mfrontcontroller.php

示例4: install

 /**
  * Install: module install action
  *
  * @return boolean
  */
 public function install()
 {
     $module = Core::app()->getModuleById($this->sModuleAlias);
     if (!$module) {
         // 1. add row to the modules table
         $moduleDir = RX_PATH . '/ruxon/modules/' . $this->sModuleAlias;
         $info = Loader::loadConfigFile($moduleDir, 'module');
         $module = array('Name' => $info['Name'], 'Description' => $info['Description'], 'Version' => $info['Version'], 'DbRevision' => '-1');
         Core::app()->updateModuleById($this->sModuleAlias, $module);
         $sClassName = $this->sModuleAlias . 'Module';
         $classNameWithNamespaces = '\\ruxon\\modules\\' . $this->sModuleAlias . '\\classes\\' . $sClassName;
         Manager::getInstance()->setModule($this->sModuleAlias, class_exists($classNameWithNamespaces) ? new $classNameWithNamespaces() : new $sClassName());
         // 2. create table structure
         $migrator = new MysqlDbMigrator($this->sModuleAlias);
         $migrator->migrateTo('last');
         // 3. copy default config to config folder
         $file1 = RX_PATH . '/ruxon/modules/' . $this->sModuleAlias . '/config/module.inc.php';
         $file2 = RX_PATH . '/ruxon/config/modules/' . $this->sModuleAlias . '.inc.php';
         if (file_exists($file1) && !file_exists($file2)) {
             copy($file1, $file2);
         }
         return true;
     }
     return false;
 }
开发者ID:ruxon,项目名称:framework,代码行数:30,代码来源:BaseModuleInstaller.class.php

示例5: __construct

 public function __construct($name = NULL)
 {
     $this->property = new stdClass();
     $this->property->className = strtolower(get_class($this));
     $this->property->name = $name;
     $this->manager = Manager::getInstance();
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:7,代码来源:mcomponent.php

示例6: get

 public function get(Object $oObject, $aParams = array())
 {
     if (isset($this->aParams['ToModuleAlias'])) {
         Core::import('Modules.' . $this->aParams['ToModuleAlias']);
     }
     $oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
     $nLimit = 0;
     $nOffset = 0;
     $aLocCriteria = array($this->aParams['Field'] => $oObject->getId());
     $aLocOrder = array('Pos' => 'ASC');
     if (count($aParams) > 0) {
         if (isset($aParams['Criteria'])) {
             foreach ($aParams['Criteria'] as $key => $val) {
                 $aLocCriteria[$key] = $val;
             }
         }
         if (isset($aParams['Order'])) {
             $aLocOrder = $aParams['Order'];
         }
         if (isset($aParams['Limit'])) {
             $nLimit = intval($aParams['Limit']);
         }
         if (isset($aParams['Offset'])) {
             $nOffset = intval($aParams['Offset']);
         }
     }
     $aDefaultParams = isset($this->aParams['Params']) ? $this->aParams['Params'] : array();
     return $oMapper->find(ArrayHelper::merge($aDefaultParams, array('Order' => $aLocOrder, 'Criteria' => $aLocCriteria, 'Limit' => $nLimit, 'Offset' => $nOffset)));
 }
开发者ID:ruxon,项目名称:framework,代码行数:29,代码来源:HasManyObjectRelation.class.php

示例7: run

 public function run(FilterChain $oFilterChain)
 {
     $aDb = Core::app()->config()->getCache();
     foreach ($aDb as $k => $val) {
         Manager::getInstance()->getCache()->add(Cache::factory($val['Driver'], $val['Params']), $k);
     }
     $oFilterChain->next();
 }
开发者ID:ruxon,项目名称:framework,代码行数:8,代码来源:CacheFilter.class.php

示例8: getInstance

 public static function getInstance($configLoader = 'PHP')
 {
     if (self::$instance == NULL) {
         $manager = self::$instance = new PersistentManager();
         self::$container = Manager::getInstance();
         $manager->setConfigLoader($configLoader);
     }
     return self::$instance;
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:9,代码来源:persistentmanager.php

示例9: get

 public function get(Object $oObject, $aParams = array())
 {
     if (isset($this->aParams['ToModuleAlias'])) {
         Core::import('Modules.' . $this->aParams['ToModuleAlias']);
     }
     $oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
     $aParams['Criteria'][$this->aParams['Field']] = $oObject->getId();
     return $oMapper->findFirst($aParams);
 }
开发者ID:ruxon,项目名称:framework,代码行数:9,代码来源:HasOneObjectRelation.class.php

示例10: run

 public function run(FilterChain $oFilterChain)
 {
     $aDb = Core::app()->config()->getDb();
     foreach ($aDb as $k => $val) {
         $oDb = new Db($val['ConnectionString'], $val['Username'], $val['Password'], $val['Params']);
         $oDb->open();
         Manager::getInstance()->getDb()->add($oDb, $k);
     }
     $oFilterChain->next();
 }
开发者ID:ruxon,项目名称:framework,代码行数:10,代码来源:DbConnectionFilter.class.php

示例11: init

 public function init()
 {
     parent::init();
     $sms = Manager::getInstance()->getMapper('SmsProviderMapper')->findFirst(array('Criteria' => array('IsActive' => true, 'Handler' => 'Sms')));
     if ($sms->getId()) {
         $this->login = $sms->getLogin();
         $this->password = $sms->getPassword();
         $this->secretkey = $sms->getSecretkey();
     }
 }
开发者ID:ruxon,项目名称:framework,代码行数:10,代码来源:SmsSms.class.php

示例12: Login

 public static function Login()
 {
     if (@$_COOKIE[MODLOGIN_LOGIN] != '' || @$_POST[MODLOGIN_LOGIN] != '') {
         $new_connection = true;
         @($login = $_POST[MODLOGIN_LOGIN]);
         @($pass = Site::crypt_pwd($_POST[MODLOGIN_PASSWORD]));
         @($keep = $_POST['keep']);
         if (@$_COOKIE[MODLOGIN_LOGIN] != '') {
             $new_connection = false;
             $login = $_COOKIE[MODLOGIN_LOGIN];
             $pass = $_COOKIE[MODLOGIN_PASSWORD];
         }
         $login = DB::ProtectData($login);
         $class = MODLOGIN_OBJECT;
         $pref = $class::getStaticPref();
         //Récupération du mot de passe de la bdd lié au compte $login
         $pass_crypt = DB::SqlOne("select " . $pref . MODLOGIN_PASSWORD . " from " . DBPRE . MODLOGIN_OBJECT . " where " . $pref . MODLOGIN_LOGIN . "='{$login}'");
         //vérification des conditions de connexion (compte existant et mot de passe valide)
         if ($pass_crypt != '' && $pass == $pass_crypt) {
             if ($new_connection) {
                 if ($keep == 1) {
                     setcookie(MODLOGIN_LOGIN, $login, time() + 31536000, '/');
                     setcookie(MODLOGIN_PASSWORD, $pass, time() + 31536000, '/');
                 } else {
                     setcookie(MODLOGIN_LOGIN, $login, 0, '/');
                     setcookie(MODLOGIN_PASSWORD, $pass, 0, '/');
                 }
                 //Link du compte Facebook
                 /*if($_SESSION['fb_action']=='link')
                   {
                     user::LinkFacebook($login);
                   }*/
                 //Redirection vers la page qui nous amenait à nous connecter, ou sur l'accueil
                 if (Site::isNextUrl()) {
                     Site::goToNextUrl();
                 } else {
                     Site::redirect(WEBDIR);
                 }
                 exit;
             } else {
                 Session::setMe(Manager::getInstance()->selectAll(MODLOGIN_OBJECT)->where($pref . MODLOGIN_LOGIN . "='{$login}'")->query()[0][MODLOGIN_OBJECT]);
             }
         } else {
             if ($new_connection) {
                 Site::message_info("Les informations de connexion sont fausses. Vérifiez votre nom d'utilisateur et votre mot de passe. Avez vous bien créé un compte sur ce site ?", 'ERROR');
             } else {
                 setcookie(MODLOGIN_LOGIN, '', 0, '/');
                 setcookie(MODLOGIN_PASSWORD, '', 0, '/');
                 Site::message_info("Session expirée, vous avez été déconnecté.", 'WARNING');
                 Site::redirect(WEBDIR);
                 exit;
             }
         }
     }
 }
开发者ID:Zangdar1111,项目名称:WhatTheFramework,代码行数:55,代码来源:Session.class.php

示例13: getDynamicText

 public function getDynamicText()
 {
     if ($this->edition_prefixe != false) {
         Manager::getInstance()->selectAllFrom("content")->where("cont_name LIKE '" . $this->edition_prefixe . "%'")->query();
         $this->content = Manager::getInstance()->getObjects("content");
         foreach ($this->content as $c) {
             $this->content[$c->getAttr('name')] = $c;
         }
     } else {
         Site::addDevError("Il faut remplir le préfixe édition du controller avant d'appeler getDynamicText()");
     }
 }
开发者ID:Zangdar1111,项目名称:WhatTheFramework,代码行数:12,代码来源:Controller.class.php

示例14: eagerFetching

 public function eagerFetching(DbFetcher $oQuery, ObjectMapper $oParentMapper, $sPrefix, $aParams = array(), $aLocalParams = array())
 {
     if (isset($this->aParams['ToModuleAlias'])) {
         Core::import('Modules.' . $this->aParams['ToModuleAlias']);
     }
     $oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
     //echo '<pre>', print_r($oMapper, true), '</pre>'; die();
     $aContainer = $oMapper->getContainer();
     if ($oMapper) {
         $oParentFields = $oParentMapper->getFields();
         $oQuery->addJoinTable($aContainer['TableName'], $sPrefix . '_' . $this->getAlias(), DbFetcher::JOIN_LEFT, $sPrefix . '.' . $oParentFields->get($this->getField())->getField() . ' = ' . $sPrefix . '_' . $this->getAlias() . '.id');
         $oFields = $oMapper->getFields();
         foreach ($oFields as $alias => $field) {
             if ($field->getType() != 'Object' && $field->getField()) {
                 $oQuery->addSelectField($sPrefix . '_' . $this->getAlias() . '.' . $field->getField(), $sPrefix . '_' . $this->getAlias() . '_' . $field->getField());
             }
         }
         // Условия выборки
         if (isset($aLocalParams['Criteria']) && is_object($aLocalParams['Criteria'])) {
             $oQuery->addCriteria(call_user_func(array($aLocalParams['Criteria'], 'renderWhere')));
         }
         if (isset($aLocalParams['Criteria']) && is_array($aLocalParams['Criteria']) && count($aLocalParams['Criteria']) > 0) {
             $oCriteria = new CriteriaGroup(Criteria::TYPE_AND);
             foreach ($aLocalParams['Criteria'] as $k => $itm) {
                 if (is_object($itm)) {
                     $oCriteria->addElement($itm);
                 } else {
                     if (is_array($itm)) {
                         $oCriteria->addElement(new CriteriaElement($k, $itm['Type'], $itm['Value']));
                     } else {
                         $oCriteria->addElement(new CriteriaElement($k, '=', $itm));
                     }
                 }
             }
             $oQuery->addCriteria($oMapper->parseFindCriteria($oCriteria->renderWhere(), $sPrefix . '_' . $this->getAlias()));
         }
         if (isset($aLocalParams['Criteria']) && is_string($aLocalParams['Criteria'])) {
             $oQuery->addCriteria($oMapper->parseFindCriteria($aLocalParams['Criteria'], $sPrefix . '_' . $this->getAlias()));
         }
         // Сортировка
         if (isset($aLocalParams['Order']) && is_array($aLocalParams['Order']) && count($aLocalParams['Order']) > 0) {
             foreach ($aLocalParams['Order'] as $k => $itm) {
                 $oQuery->addOrder($oMapper->parseFindField($k, $sPrefix . '_' . $this->getAlias()), $itm);
             }
         }
         if (isset($aLocalParams['With']) && is_array($aLocalParams['With']) && count($aLocalParams['With'])) {
             // TODO: Вложенные JOINы
         }
     }
     return $oQuery;
 }
开发者ID:ruxon,项目名称:framework,代码行数:51,代码来源:BelongsToObjectRelation.class.php

示例15: beforeDelete

 public function beforeDelete()
 {
     if ($this->getOwner()->getGalleryId()) {
         $mapper = Manager::getInstance()->getMapper($this->mapper_alias);
         $aContainer = $mapper->getContainer();
         $categoryId = $this->getOwner()->getGalleryId();
         // Удаляем все записи о фотках из базы
         $oQuery = new DbUpdater(DbUpdater::TYPE_DELETE, $aContainer['TableName'], $aContainer['Object'], $this->getDbConnectionAlias());
         $oCriteria = new CriteriaElement('category_id', Criteria::EQUAL, $categoryId);
         $oQuery->addCriteria($mapper->parseUpdateCriteria($oCriteria->renderWhere()));
         $oQuery->delete();
         $this->getOwner()->getGallery()->delete();
     }
     return true;
 }
开发者ID:ruxon,项目名称:framework,代码行数:15,代码来源:GalleryBehavior.class.php


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