當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Phprojekt_Loader::tryToLoadLibClass方法代碼示例

本文整理匯總了PHP中Phprojekt_Loader::tryToLoadLibClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Phprojekt_Loader::tryToLoadLibClass方法的具體用法?PHP Phprojekt_Loader::tryToLoadLibClass怎麽用?PHP Phprojekt_Loader::tryToLoadLibClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phprojekt_Loader的用法示例。


在下文中一共展示了Phprojekt_Loader::tryToLoadLibClass方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getModelObject

 /**
  * Gets the core class model of the module.
  *
  * @return Phprojekt_Model_Interface An instance of Phprojekt_Model_Interface.
  */
 public function getModelObject()
 {
     static $moduleName = null;
     if (is_null($moduleName)) {
         $moduleName = ucfirst($this->getRequest()->getControllerName());
         $moduleName = "Phprojekt_" . $moduleName . "_" . $moduleName;
     }
     if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
         $db = Phprojekt::getInstance()->getDb();
         return new $moduleName($db);
     } else {
         throw new Exception('No model object could be found');
     }
 }
開發者ID:RainyBlueSky,項目名稱:PHProjekt,代碼行數:19,代碼來源:IndexController.php

示例2: getModelObject

 /**
  * Gets the core class model of the module or the default one.
  *
  * @return Phprojekt_Model_Interface An instance of Phprojekt_Model_Interface.
  */
 public function getModelObject()
 {
     static $object = null;
     if (null === $object) {
         $moduleName = ucfirst($this->getRequest()->getControllerName());
         $moduleName = "Phprojekt_" . $moduleName . "_" . $moduleName;
         if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
             $db = Phprojekt::getInstance()->getDb();
             $object = new $moduleName($db);
         } else {
             $object = null;
         }
         if (null === $object) {
             $object = Phprojekt_Loader::getModel('Default', 'Default');
         }
     }
     return $object;
 }
開發者ID:penSecIT,項目名稱:PHProjekt,代碼行數:23,代碼來源:IndexController.php

示例3: _saveUser

 /**
  * This function is used only for integration purposes and should only
  * be called when integrating the user data!
  *
  **/
 private static function _saveUser($params)
 {
     $moduleName = "Phprojekt_User_User";
     if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
         // Temporarily login as admin user
         // This is only to get rights to add user
         // Ugly hack but PHProjekt backend has not thought of this situation
         $authNamespace = new Zend_Session_Namespace('Phprojekt_Auth-login');
         $authNamespace->userId = 1;
         $authNamespace->admin = true;
         $exc = null;
         try {
             $db = Phprojekt::getInstance()->getDb();
             $model = new $moduleName($db);
             if ($params['id'] > 0) {
                 $model = $model->find($params['id']);
             }
             Default_Helpers_Save::save($model, $params);
             $setting = new Phprojekt_Setting();
             $setting->setModule('User');
             $setting->setSettings($params, $model->id);
         } catch (Exception $e) {
             $exc = $e;
         }
         // Set user not logged in
         unset($authNamespace->userId);
         unset($authNamespace->admin);
         if ($exc instanceof Exception) {
             // Throw exception if user creation failed
             throw $exc;
         }
         return true;
     }
     return false;
 }
開發者ID:RainyBlueSky,項目名稱:PHProjekt,代碼行數:40,代碼來源:Auth.php


注:本文中的Phprojekt_Loader::tryToLoadLibClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。