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


PHP Gdn::FactoryExists方法代碼示例

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


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

示例1: GetImports

 /**
  * Undocumented method.
  *
  * @todo Method GetImports() needs a description.
  */
 public function GetImports()
 {
     if (!isset($this->Uses) || !is_array($this->Uses)) {
         return;
     }
     // Load any classes in the uses array and make them properties of this class
     foreach ($this->Uses as $Class) {
         if (strlen($Class) >= 4 && substr_compare($Class, 'Gdn_', 0, 4) == 0) {
             $Property = substr($Class, 4);
         } else {
             $Property = $Class;
         }
         // Find the class and instantiate an instance..
         if (Gdn::FactoryExists($Property)) {
             $this->{$Property} = Gdn::Factory($Property);
         }
         if (Gdn::FactoryExists($Class)) {
             // Instantiate from the factory.
             $this->{$Property} = Gdn::Factory($Class);
         } elseif (class_exists($Class)) {
             // Instantiate as an object.
             $ReflectionClass = new ReflectionClass($Class);
             // Is this class a singleton?
             if ($ReflectionClass->implementsInterface("ISingleton")) {
                 eval('$this->' . $Property . ' = ' . $Class . '::GetInstance();');
             } else {
                 $this->{$Property} = new $Class();
             }
         } else {
             trigger_error(ErrorMessage('The "' . $Class . '" class could not be found.', $this->ClassName, '__construct'), E_USER_ERROR);
         }
     }
 }
開發者ID:ru4,項目名稱:arabbnota,代碼行數:38,代碼來源:class.controller.php

示例2: setlocale

Gdn::FactoryInstall(Gdn::AliasSession, 'Gdn_Session', PATH_LIBRARY_CORE . DS . 'class.session.php');
Gdn::FactoryInstall(Gdn::AliasAuthenticator, 'Gdn_Auth', PATH_LIBRARY_CORE . DS . 'class.auth.php', Gdn::FactorySingleton);
// Dispatcher.
Gdn::FactoryInstall(Gdn::AliasRouter, 'Gdn_Router', PATH_LIBRARY_CORE . DS . 'class.router.php', Gdn::FactorySingleton);
Gdn::FactoryInstall(Gdn::AliasDispatcher, 'Gdn_Dispatcher', PATH_LIBRARY_CORE . DS . 'class.dispatcher.php', Gdn::FactorySingleton);
// Smarty Templating Engine
Gdn::FactoryInstall('Smarty', 'Smarty', PATH_LIBRARY . DS . 'vendors' . DS . 'Smarty-2.6.25' . DS . 'libs' . DS . 'Smarty.class.php', Gdn::FactorySingleton);
Gdn::FactoryInstall('ViewHandler.tpl', 'Gdn_Smarty', PATH_LIBRARY_CORE . DS . 'class.smarty.php', Gdn::FactorySingleton);
// Application manager.
Gdn::FactoryInstall('ApplicationManager', 'Gdn_ApplicationManager', PATH_LIBRARY_CORE . DS . 'class.applicationmanager.php', Gdn::FactorySingleton);
// Theme manager
Gdn::FactoryInstall('ThemeManager', 'Gdn_ThemeManager', PATH_LIBRARY_CORE . DS . 'class.thememanager.php', Gdn::FactoryInstance);
Gdn::FactoryInstall(Gdn::AliasSlice, 'Gdn_Slice', PATH_LIBRARY_CORE . DS . 'class.slice.php', Gdn::FactorySingleton);
// Other objects.
Gdn::FactoryInstall('Dummy', 'Gdn_Dummy', PATH_LIBRARY_CORE . DS . 'class.dummy.php', Gdn::FactorySingleton);
if (!Gdn::FactoryExists(Gdn::AliasLocale)) {
    require_once PATH_LIBRARY_CORE . DS . 'class.locale.php';
    $Codeset = Gdn::Config('Garden.LocaleCodeset', 'UTF8');
    $CurrentLocale = Gdn::Config('Garden.Locale', 'en-CA');
    $SetLocale = str_replace('-', '_', $CurrentLocale) . '.' . $Codeset;
    setlocale(LC_ALL, $SetLocale);
    $Gdn_Locale = new Gdn_Locale($CurrentLocale, Gdn::Config('EnabledApplications'), Gdn::Config('EnabledPlugins'));
    Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', PATH_LIBRARY_CORE . DS . 'class.locale.php', Gdn::FactorySingleton, $Gdn_Locale);
    unset($Gdn_Locale);
}
// Execute other application startup.
foreach ($Gdn_EnabledApplications as $ApplicationName => $ApplicationFolder) {
    // Include the application's bootstrap.
    $Gdn_Path = PATH_APPLICATIONS . DS . $ApplicationFolder . DS . 'settings' . DS . 'bootstrap.php';
    if (file_exists($Gdn_Path)) {
        include_once $Gdn_Path;
開發者ID:kennyma,項目名稱:Garden,代碼行數:31,代碼來源:bootstrap.php


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