public function DisablePlugin($PluginName)
 {
     // Get the plugin and make sure its name is the correct case.
     $Plugin = $this->GetPluginInfo($PluginName);
     if ($Plugin) {
         $PluginName = $Plugin['Index'];
     }
     Gdn_Autoloader::SmartFree(Gdn_Autoloader::CONTEXT_PLUGIN, $Plugin);
     // 1. Check to make sure that no other enabled plugins rely on this one
     // Get all available plugins and compile their requirements
     foreach ($this->EnabledPlugins() as $CheckingName => $Trash) {
         $CheckingInfo = $this->GetPluginInfo($CheckingName);
         $RequiredPlugins = ArrayValue('RequiredPlugins', $CheckingInfo, FALSE);
         if (is_array($RequiredPlugins) && array_key_exists($PluginName, $RequiredPlugins) === TRUE) {
             throw new Exception(sprintf(T('You cannot disable the %1$s plugin because the %2$s plugin requires it in order to function.'), $PluginName, $CheckingName));
         }
     }
     // 2. Perform necessary hook action
     $this->_PluginHook($PluginName, self::ACTION_DISABLE, TRUE);
     // 3. Disable it
     RemoveFromConfig("EnabledPlugins.{$PluginName}");
     unset($this->EnabledPlugins[$PluginName]);
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
     Gdn::Locale()->Refresh();
     return TRUE;
 }
Example #2
0
<?php

if (!defined("APPLICATION")) {
    exit;
}
$path = paths(PATH_APPLICATIONS, "api/library");
// Register API library with the Garden Autoloader
Gdn_Autoloader::registerMap(Gdn_Autoloader::MAP_LIBRARY, Gdn_Autoloader::CONTEXT_APPLICATION, $path, ["Extension" => "api"]);
// Include Composer autoloader
require_once paths($path, "vendors/autoload.php");
Example #3
0
 /**
  * Clear the contents of the supplied cache, and remove it from disk.
  *
  * @param string|bool $CacheName name of cache library
  * @return void
  */
 public static function clearCache($CacheName = false)
 {
     Gdn_Autoloader::smartFree();
     if ($CacheName != 'locale') {
         return;
     }
     if (!array_key_exists($CacheName, self::$Caches)) {
         return self::prepareCache($CacheName);
     }
     $UseCache = Gdn::cache()->type() == Gdn_Cache::CACHE_TYPE_MEMORY && Gdn::cache()->activeEnabled();
     if ($UseCache) {
         $CacheKey = sprintf(Gdn_LibraryMap::CACHE_CACHE_NAME_FORMAT, $CacheName);
         $Deleted = Gdn::cache()->remove($CacheKey);
     } else {
         @unlink(PATH_CACHE . DS . self::$Caches[$CacheName]['ondisk']);
     }
     self::$Caches[$CacheName]['cache'] = array();
 }
 protected function FindController($ControllerKey, $Parts)
 {
     $Controller = GetValue($ControllerKey, $Parts, NULL);
     $Controller = ucfirst(strtolower($Controller));
     $Application = GetValue($ControllerKey - 1, $Parts, NULL);
     // Check for a file extension on the controller.
     list($Controller, $this->_DeliveryMethod) = $this->_SplitDeliveryMethod($Controller, FALSE);
     // If we're loading from a fully qualified path, prioritize this app's library
     if (!is_null($Application)) {
         Gdn_Autoloader::Priority(Gdn_Autoloader::CONTEXT_APPLICATION, $Application, Gdn_Autoloader::MAP_CONTROLLER, Gdn_Autoloader::PRIORITY_TYPE_RESTRICT, Gdn_Autoloader::PRIORITY_ONCE);
     }
     $ControllerName = $Controller . 'Controller';
     $ControllerPath = Gdn_Autoloader::Lookup($ControllerName, array('Quiet' => TRUE));
     if ($ControllerPath) {
         // This was a guess search with no specified application. Look up
         // the application folder from the controller path.
         if (is_null($Application)) {
             $InterimPath = explode('/controllers/', $ControllerPath);
             array_pop($InterimPath);
             // Get rid of the end. Useless;
             $InterimPath = explode('/', trim(array_pop($InterimPath)));
             $Application = array_pop($InterimPath);
             if (!in_array($Application, $this->EnabledApplicationFolders())) {
                 return FALSE;
             }
         }
         Gdn_Autoloader::Priority(Gdn_Autoloader::CONTEXT_APPLICATION, $Application, Gdn_Autoloader::MAP_CONTROLLER, Gdn_Autoloader::PRIORITY_TYPE_PREFER, Gdn_Autoloader::PRIORITY_PERSIST);
         $this->ControllerName = $Controller;
         $this->_ApplicationFolder = is_null($Application) ? '' : $Application;
         $this->ControllerFolder = '';
         $Length = sizeof($Parts);
         if ($Length > $ControllerKey + 1) {
             list($this->ControllerMethod, $this->_DeliveryMethod) = $this->_SplitDeliveryMethod($Parts[$ControllerKey + 1], FALSE);
         }
         if ($Length > $ControllerKey + 2) {
             for ($i = $ControllerKey + 2; $i < $Length; ++$i) {
                 if ($Parts[$i] != '') {
                     $this->_ControllerMethodArgs[] = $Parts[$i];
                 }
             }
         }
         require_once $ControllerPath;
         throw new GdnDispatcherControllerFoundException();
     }
     return FALSE;
 }
Example #5
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
// Register Yaga library classes and interfaces in the autoloader
$Map = Gdn_Autoloader::MAP_LIBRARY;
$Context = Gdn_Autoloader::CONTEXT_APPLICATION;
$Path = PATH_APPLICATIONS . DS . 'yaga' . DS . 'library';
$Options = array('Extension' => 'yaga');
Gdn_Autoloader::RegisterMap($Map, $Context, $Path, $Options);
require_once PATH_APPLICATIONS . DS . 'yaga' . DS . 'library' . DS . 'functions.render.php';
 /**
  *
  *
  * @param $PluginName
  * @return bool
  * @throws Exception
  */
 public function disablePlugin($PluginName)
 {
     // Get the plugin and make sure its name is the correct case.
     $Plugin = $this->getPluginInfo($PluginName);
     if ($Plugin) {
         $PluginName = $Plugin['Index'];
     }
     Gdn_Autoloader::smartFree(Gdn_Autoloader::CONTEXT_PLUGIN, $Plugin);
     $enabled = $this->isEnabled($PluginName);
     // 1. Check to make sure that no other enabled plugins rely on this one
     // Get all available plugins and compile their requirements
     foreach ($this->enabledPlugins() as $CheckingName => $Trash) {
         $CheckingInfo = $this->getPluginInfo($CheckingName);
         $RequiredPlugins = ArrayValue('RequiredPlugins', $CheckingInfo, false);
         if (is_array($RequiredPlugins) && array_key_exists($PluginName, $RequiredPlugins) === true) {
             throw new Exception(sprintf(T('You cannot disable the %1$s plugin because the %2$s plugin requires it in order to function.'), $PluginName, $CheckingName));
         }
     }
     // 2. Perform necessary hook action
     $this->pluginHook($PluginName, self::ACTION_DISABLE, true);
     // 3. Disable it.
     SaveToConfig("EnabledPlugins.{$PluginName}", false);
     unset($this->EnabledPlugins[$PluginName]);
     if ($enabled) {
         Logger::event('addon_disabled', LogLevel::NOTICE, 'The {addonName} plugin was disabled.', array('addonName' => $PluginName));
     }
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
     Gdn::locale()->refresh();
     $this->EventArguments['AddonName'] = $PluginName;
     $this->fireEvent('AddonDisabled');
     return true;
 }
 /**
  * Undocumented method.
  *
  * @param string $ApplicationName Undocumented variable.
  * @todo Document DisableApplication() method.
  */
 public function DisableApplication($ApplicationName)
 {
     // 1. Check to make sure that this application is allowed to be disabled
     $ApplicationInfo = ArrayValueI($ApplicationName, $this->AvailableApplications(), array());
     $ApplicationName = $ApplicationInfo['Index'];
     if (!ArrayValue('AllowDisable', $ApplicationInfo, TRUE)) {
         throw new Exception(sprintf(T('You cannot disable the %s application.'), $ApplicationName));
     }
     // 2. Check to make sure that no other enabled applications rely on this one
     foreach ($this->EnabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = ArrayValue('RequiredApplications', $CheckingInfo, FALSE);
         if (is_array($RequiredApplications) && array_key_exists($ApplicationName, $RequiredApplications) === TRUE) {
             throw new Exception(sprintf(T('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $ApplicationName, $CheckingName));
         }
     }
     // 2. Disable it
     RemoveFromConfig("EnabledApplications.{$ApplicationName}");
     // Clear the object caches.
     Gdn_Autoloader::SmartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
     $Locale = Gdn::Locale();
     $Locale->Set($Locale->Current(), $this->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
     $this->EventArguments['AddonName'] = $ApplicationName;
     Gdn::PluginManager()->CallEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
 }
Example #8
0
        include_once $Gdn_Path;
    }
    // Include the application's hooks.
    $Hooks_Path = PATH_APPLICATIONS . "/{$ApplicationFolder}/settings/class.hooks.php";
    if (file_exists($Hooks_Path)) {
        include_once $Hooks_Path;
    }
}
unset($Gdn_Path);
unset($Hooks_Path);
// Themes startup
Gdn::ThemeManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_THEME);
// Plugins startup
Gdn::PluginManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_PLUGIN);
/**
 * Locales
 *
 * Install any custom locales provided by applications and plugins, and set up
 * the locale management system.
 */
// Load the Garden locale system
$Gdn_Locale = new Gdn_Locale(C('Garden.Locale', 'en-CA'), Gdn::ApplicationManager()->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders());
Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', NULL, Gdn::FactorySingleton, $Gdn_Locale);
unset($Gdn_Locale);
require_once PATH_LIBRARY_CORE . '/functions.validation.php';
// Start Authenticators
Gdn::Authenticator()->StartAuthenticator();
/**
 * Bootstrap After
Example #9
0
 /**
  *
  *
  * @param $ControllerKey
  * @param $Parts
  * @return bool
  * @throws Exception
  * @throws GdnDispatcherControllerFoundException
  */
 protected function findController($ControllerKey, $Parts)
 {
     $Controller = val($ControllerKey, $Parts, null);
     $Controller = ucfirst(strtolower($Controller));
     $Application = val($ControllerKey - 1, $Parts, null);
     // Check for a file extension on the controller.
     list($Controller, $this->_DeliveryMethod) = $this->_splitDeliveryMethod($Controller, false);
     // If we're loading from a fully qualified path, prioritize this app's library
     if (!is_null($Application)) {
         Gdn_Autoloader::priority(Gdn_Autoloader::CONTEXT_APPLICATION, $Application, Gdn_Autoloader::MAP_CONTROLLER, Gdn_Autoloader::PRIORITY_TYPE_RESTRICT, Gdn_Autoloader::PRIORITY_ONCE);
     }
     $ControllerName = $Controller . 'Controller';
     $ControllerPath = Gdn_Autoloader::lookup($ControllerName, array('MapType' => null));
     try {
         // If the lookup succeeded, good to go
         if (class_exists($ControllerName, false)) {
             throw new GdnDispatcherControllerFoundException();
         }
     } catch (GdnDispatcherControllerFoundException $Ex) {
         // This was a guess search with no specified application. Look up
         // the application folder from the controller path.
         if (is_null($Application)) {
             if (!$ControllerPath && class_exists($ControllerName, false)) {
                 $Reflect = new ReflectionClass($ControllerName);
                 $Found = false;
                 do {
                     $ControllerPath = $Reflect->getFilename();
                     $Found = (bool) preg_match('`\\/controllers\\/`i', $ControllerPath);
                     if (!$Found) {
                         $Reflect = $Reflect->getParentClass();
                     }
                 } while (!$Found && $Reflect);
                 if (!$Found) {
                     return false;
                 }
             }
             if ($ControllerPath) {
                 $InterimPath = explode('/controllers/', $ControllerPath);
                 array_pop($InterimPath);
                 // Get rid of the end. Useless;
                 $InterimPath = explode('/', trim(array_pop($InterimPath)));
                 $Application = array_pop($InterimPath);
                 $AddonType = array_pop($InterimPath);
                 switch ($AddonType) {
                     case 'plugins':
                         if (!in_array($Application, Gdn::pluginManager()->enabledPluginFolders())) {
                             return false;
                         }
                         $Application = 'plugins/' . $Application;
                         break;
                     case 'applications':
                         if (!in_array($Application, $this->enabledApplicationFolders())) {
                             return false;
                         }
                         break;
                     default:
                         return false;
                 }
             } else {
                 return false;
             }
         }
         // If we need to autoload the class, do it here
         if (!class_exists($ControllerName, false)) {
             Gdn_Autoloader::priority(Gdn_Autoloader::CONTEXT_APPLICATION, $Application, Gdn_Autoloader::MAP_CONTROLLER, Gdn_Autoloader::PRIORITY_TYPE_PREFER, Gdn_Autoloader::PRIORITY_PERSIST);
             require_once $ControllerPath;
         }
         $this->ControllerName = $Controller;
         $this->_ApplicationFolder = is_null($Application) ? '' : $Application;
         $Length = sizeof($Parts);
         if ($Length > $ControllerKey + 1) {
             list($this->ControllerMethod, $this->_DeliveryMethod) = $this->_splitDeliveryMethod($Parts[$ControllerKey + 1], false);
         }
         if ($Length > $ControllerKey + 2) {
             for ($i = $ControllerKey + 2; $i < $Length; ++$i) {
                 if ($Parts[$i] != '') {
                     $this->_ControllerMethodArgs[] = $Parts[$i];
                 }
             }
         }
         throw $Ex;
     }
     return false;
 }
Example #10
0
 /**
  * Clear the contents of the supplied cache, and remove it from disk
  *
  * @param string $CacheName name of cache library
  * @return void
  */
 public static function ClearCache($CacheName = FALSE)
 {
     Gdn_Autoloader::SmartFree();
     if ($CacheName != 'locale') {
         return;
     }
     if (!array_key_exists($CacheName, self::$_Caches)) {
         return self::PrepareCache($CacheName);
     }
     self::$_Caches[$CacheName]['cache'] = array();
     @unlink(PATH_LOCAL_CACHE . DS . self::$_Caches[$CacheName]['ondisk']);
 }
Example #11
0
 /**
  * Register core mappings
  *
  * Set up the autoloader with known searchg directories, hook into the SPL autoloader
  * and load existing caches.
  *
  * @param void
  */
 public static function Start()
 {
     self::$Prefixes = array(self::CONTEXT_CORE => 'c', self::CONTEXT_APPLICATION => 'a', self::CONTEXT_PLUGIN => 'p', self::CONTEXT_THEME => 't');
     self::$ContextOrder = array(self::CONTEXT_THEME, self::CONTEXT_LOCALE, self::CONTEXT_PLUGIN, self::CONTEXT_APPLICATION, self::CONTEXT_CORE);
     self::$Maps = array();
     self::$MapGroups = array();
     // Register autoloader with the SPL
     spl_autoload_register(array('Gdn_Autoloader', 'Lookup'));
     // Configure library/core and library/database
     self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY . '/core');
     self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY . '/database');
     self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY . '/vendors');
     // Register shutdown function to auto save changed cache files
     register_shutdown_function(array('Gdn_Autoloader', 'Shutdown'));
 }
   protected function FindController($ControllerKey, $Parts) {
      
      $Application = GetValue($ControllerKey-1, $Parts, NULL);
      $Controller = GetValue($ControllerKey, $Parts, NULL);
      $Controller = ucfirst(strtolower($Controller));

      // Check for a file extension on the controller.
      $Ext = strrchr($Controller, '.');
      if ($Ext) {
         $Controller = substr($Controller, 0, -strlen($Ext));
         $Ext = strtoupper(trim($Ext, '.'));
         if (in_array($Ext, array(DELIVERY_METHOD_JSON, DELIVERY_METHOD_XHTML, DELIVERY_METHOD_XML))) {
            $this->_DeliveryMethod = strtoupper($Ext);
         }
      }
      
      if (!is_null($Application)) {
         Gdn_Autoloader::Priority(
            Gdn_Autoloader::CONTEXT_APPLICATION, 
            $Application,
            Gdn_Autoloader::MAP_CONTROLLER, 
            Gdn_Autoloader::PRIORITY_TYPE_RESTRICT,
            Gdn_Autoloader::PRIORITY_ONCE);
      }
      
      
      $ControllerName = $Controller.'Controller';
      $ControllerPath = Gdn_Autoloader::Lookup($ControllerName, array('Quiet' => TRUE));
      
      if ($ControllerPath !== FALSE) {
         
         // This was a guess search with no specified application. Look up
         // the application folder from the controller path.
         if (is_null($Application)) {
            $InterimPath = explode('/controllers/', $ControllerPath);
            array_pop($InterimPath); // Get rid of the end. Useless;
            $InterimPath = explode('/', trim(array_pop($InterimPath)));
            $Application = array_pop($InterimPath);
            if (!in_array($Application, $this->EnabledApplicationFolders()))
               return FALSE;
         }
      
         Gdn_Autoloader::Priority(
            Gdn_Autoloader::CONTEXT_APPLICATION, 
            $Application,
            Gdn_Autoloader::MAP_CONTROLLER, 
            Gdn_Autoloader::PRIORITY_TYPE_PREFER,
            Gdn_Autoloader::PRIORITY_PERSIST);
      
         $this->_ControllerName = $Controller;
         $this->_ApplicationFolder = (is_null($Application) ? '' : $Application);
         $this->_ControllerFolder = '';
         
         $Length = sizeof($Parts);
         if ($Length > $ControllerKey + 1)
            list($this->_ControllerMethod, $this->_DeliveryMethod) = $this->_SplitDeliveryMethod($Parts[$ControllerKey + 1]);
   
         if ($Length > $ControllerKey + 2) {
            for ($i = $ControllerKey + 2; $i < $Length; ++$i) {
               if ($Parts[$i] != '')
                  $this->_ControllerMethodArgs[] = $Parts[$i];
            }
         }
         
         require_once($ControllerPath);
         
         throw new GdnDispatcherControllerFoundException();
      }
      
      return FALSE;
   }
 /**
  * Disable an application.
  *
  * @param string $applicationName The name of the application to disable.
  * @throws \Exception Throws an exception if the application can't be disabled.
  */
 public function disableApplication($applicationName)
 {
     // 1. Check to make sure that this application is allowed to be disabled
     $ApplicationInfo = (array) arrayValueI($applicationName, $this->availableApplications(), array());
     $applicationName = $ApplicationInfo['Index'];
     if (!val('AllowDisable', $ApplicationInfo, true)) {
         throw new Exception(sprintf(t('You cannot disable the %s application.'), $applicationName));
     }
     // 2. Check to make sure that no other enabled applications rely on this one
     foreach ($this->enabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = val('RequiredApplications', $CheckingInfo, false);
         if (is_array($RequiredApplications) && array_key_exists($applicationName, $RequiredApplications) === true) {
             throw new Exception(sprintf(t('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $applicationName, $CheckingName));
         }
     }
     // 3. Check to make sure that no other enabled plugins rely on this one
     $DependendPlugins = array();
     foreach (Gdn::pluginManager()->enabledPlugins() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = val('RequiredApplications', $CheckingInfo, false);
         if (is_array($RequiredApplications) && array_key_exists($applicationName, $RequiredApplications) === true) {
             $DependendPlugins[] = $CheckingName;
         }
     }
     if (!empty($DependendPlugins)) {
         throw new Exception(sprintf(t('You cannot disable the %1$s application because the following plugins require it in order to function: %2$s'), $applicationName, implode(', ', $DependendPlugins)));
     }
     // 2. Disable it
     removeFromConfig("EnabledApplications.{$applicationName}");
     Logger::event('addon_disabled', Logger::NOTICE, 'The {addonName} application was disabled.', array('addonName' => $applicationName));
     // Clear the object caches.
     Gdn_Autoloader::smartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);
     // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, true);
     $Locale = Gdn::locale();
     $Locale->set($Locale->current(), $this->enabledApplicationFolders(), Gdn::pluginManager()->enabledPluginFolders(), true);
     $this->EventArguments['AddonName'] = $applicationName;
     Gdn::pluginManager()->callEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
 }
Example #14
0
 /**
  * Map the API request to the corrosponding controller
  *
  * @since  0.1.0
  * @access public
  * @throws Exception
  * @return void
  * @static
  */
 public static function dispatchRequest()
 {
     $request = Gdn::request();
     $requestUri = static::getRequestUri();
     $requestMethod = static::getRequestMethod();
     if (!in_array($requestMethod, static::$supportedMethods)) {
         throw new Exception(t("API.Error.MethodNotAllowed"), 405);
     }
     if (!Gdn::session()->isValid()) {
         $username = getIncomingValue("username");
         $email = getIncomingValue("email");
         if ($username || $email) {
             APIAuth::authenticateRequest();
         }
     }
     $resource = val(1, $requestUri);
     $apiClass = ucfirst($resource) . "API";
     if (!class_exists($apiClass)) {
         throw new Exception(sprintf(t("API.Error.Class.Invalid"), $apiClass), 404);
     }
     if (!is_subclass_of($apiClass, "APIMapper")) {
         throw new Exception(t("API.Error.Mapper"), 500);
     }
     $apiClass = new $apiClass();
     $isWriteMethod = in_array($requestMethod, ["post", "put", "delete"]);
     $requestArguments = $isWriteMethod ? static::getRequestArguments() : [];
     $dispatch = static::map($resource, $apiClass, $requestUri, $requestMethod, $requestArguments);
     $controller = $dispatch["controller"];
     if (!$controller) {
         throw new Exception(t("API.Error.Controller.Missing"), 500);
     }
     $inputData = array_merge($requestArguments, $dispatch["arguments"]);
     if ($isWriteMethod) {
         // Set the transient key since we no longer have a front-end that
         // takes care of doing it for us
         $inputData["TransientKey"] = Gdn::session()->transientKey();
         // Authentication is always required for write-methods
         $dispatch["authenticate"] = true;
         // As Garden doesn"t take PUT and DELETE requests into account when
         // verifying requests using IsPostBack() and IsAuthencatedPostBack(),
         // we need to mask PUTs and DELETEs as POSTs.
         $request->requestMethod("post");
         // Add any API-specific arguments to the requests arguments
         $request->setRequestArguments(Gdn_Request::INPUT_POST, $inputData);
         // Set the PHP $_POST global as the result of any form data picked
         // up by Garden.
         $_POST = $request->post();
     }
     if ($dispatch["authenticate"] && !Gdn::session()->isValid()) {
         throw new Exception(t("API.Error.AuthRequired"), 401);
     }
     $application = $dispatch["application"];
     if ($application) {
         Gdn_Autoloader::attachApplication($application);
     }
     $method = $dispatch["method"];
     $arguments = $dispatch["arguments"];
     Gdn::request()->withControllerMethod($controller, $method, $arguments);
 }
Example #15
0
 /**
  * Register core mappings.
  *
  * Set up the autoloader with known search directories, hook into the SPL autoloader
  * and load existing caches.
  */
 public static function start()
 {
     self::$prefixes = array(self::CONTEXT_APPLICATION => 'a', self::CONTEXT_PLUGIN => 'p', self::CONTEXT_THEME => 't');
     self::$contextOrder = array(self::CONTEXT_THEME, self::CONTEXT_LOCALE, self::CONTEXT_PLUGIN, self::CONTEXT_APPLICATION);
     self::$maps = array();
     self::$mapGroups = array();
     // Register autoloader with the SPL
     spl_autoload_register(array('Gdn_Autoloader', 'lookup'));
     // Register shutdown function to auto save changed cache files
     register_shutdown_function(array('Gdn_Autoloader', 'shutdown'));
 }