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


PHP Registry::load方法代码示例

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


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

示例1: setup

 /**
  * Register hooks and load options.
  *
  * @since 1.0.0
  */
 public static function setup()
 {
     // Setup the registry
     Registry::load();
     // Register the hooks of the subsystems
     Frontend::register_hooks();
     Backend::register_hooks();
 }
开发者ID:dougwollison,项目名称:index-pages,代码行数:13,代码来源:class-indexpages-system.php

示例2: setup

 /**
  * Register hooks and load options.
  *
  * @since 1.0.0
  *
  * @uses Registry::load() to load the options.
  * @uses Loader::register_hooks() to setup plugin management.
  * @uses System::register_hooks() to setup global functionality.
  * @uses Backend::register_hooks() to setup backend functionality.
  * @uses AJAX::register_hooks() to setup AJAX functionality.
  * @uses Manager::register_hooks() to setup admin screens.
  * @uses Documenter::register_hooks() to setup admin documentation.
  */
 public static function setup()
 {
     // Setup the registry
     Registry::load();
     // Register the Installer stuff
     Installer::register_hooks();
     // Register global hooks
     self::register_hooks();
     // Register the hooks of the subsystems
     Backend::register_hooks();
     AJAX::register_hooks();
     Manager::register_hooks();
     Documenter::register_hooks();
 }
开发者ID:dougwollison,项目名称:wp-plugin-system,代码行数:27,代码来源:class-pluginname-system.php

示例3: load_class

function load_class($className, $type = 'Core', $surpress = FALSE)
{
    // Now we need to make sure the user supplied some sort of path
    if (strpos($className, $type) === FALSE) {
        $className = $type . '\\' . $className;
    }
    // Make a lowercase version, and a storage name
    $class = strtolower($className);
    $store_name = str_replace('\\', '_', $class);
    // Check the registry for the class, If its there, then return the class
    $loaded = \Registry::load($store_name);
    if ($loaded !== NULL) {
        return $loaded;
    }
    // ---------------------------------------------------------
    // Class not in Registry, So we load it manually and then  |
    // store it in the registry for future static use          |
    // ---------------------------------------------------------
    // We need to find the file the class is stored in. Good thing the
    // Namespaces are pretty much paths to the class ;)
    $parts = explode('\\', $class);
    $last = count($parts) - 1;
    $parts[$last] = ucfirst($parts[$last]);
    // Build our filepath
    $file = implode(DS, $parts);
    $file = SYSTEM_PATH . DS . $file . '.php';
    // Include our file. If it doesnt exists, class is un-obtainable.
    require_once $file;
    //  Initiate the new class into a variable
    try {
        $Obj = new $className();
    } catch (\Exception $e) {
        $message = $e->getMessage();
        $Obj = FALSE;
    }
    // Display error?
    if (!is_object($Obj) && !$surpress) {
        show_error('class_init_failed', array($className, $message), E_ERROR);
    }
    // Store this new object in the registery
    \Registry::store($store_name, $Obj);
    // return the object.
    return $Obj;
}
开发者ID:Kheros,项目名称:Plexis,代码行数:44,代码来源:Common.php

示例4: realm

 public function realm($instance = TRUE)
 {
     // Get our emulator from the Config File
     $emulator = ucfirst(config('emulator'));
     $class_name = "Emulator_" . $emulator;
     // Make sure we havent loaded the lib already
     $realm = \Registry::load($class_name);
     if ($realm !== NULL) {
         goto Instance;
     }
     // Init the class if it doesnt exist
     if (!class_exists('Wowlib', false)) {
         $this->_initWowlib();
     }
     // Add debug tracer
     \Debug::trace('Loading Realm from Wowlib', __FILE__, __LINE__);
     // Fetch the emulator class
     try {
         $realm = \Wowlib::getRealm(0, 'RDB');
     } catch (\Exception $e) {
         \Debug::silent_mode(false);
         $message = 'Wowlib Error: ' . $e->getMessage();
         // Add debug tracer
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     }
     // Store the class statically and return the class
     \Registry::store($class_name, $realm);
     // Instance
     Instance:
     if ($instance == TRUE) {
         $FB = get_instance();
         if (is_object($FB)) {
             $FB->realm = $realm;
         }
     }
     // We need to make sure the realm loaded ok, or thrown an error
     if (!is_object($realm)) {
         // Add debug tracer
         $message = 'Wowlib failed to fetch realm. Assuming the realm database is offline.';
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     } else {
         \Debug::trace('Successfully fetched the realm connection from the Wowlib', __FILE__, __LINE__);
     }
     return $realm;
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:47,代码来源:Loader.php


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