Пример #1
0
 /**
  * @static
  * @return \RokCommon_Platform_Definition
  */
 public static function &getCurrent()
 {
     $ret = null;
     if (isset(self::$_current_platform)) {
         return self::$_current_platform;
     } else {
         foreach (self::$_platforms as $platform) {
             $classname = 'RokCommon_Platform_Definition_' . ucfirst($platform);
             if (class_exists($classname)) {
                 if (call_user_func(array($classname, 'isCurrentlyRunning'))) {
                     self::$_current_platform = new $classname();
                     return self::$_current_platform;
                 }
             }
         }
         return $ret;
     }
 }
Пример #2
0
 /**
  * @static
  * @return RokCommon_Service_Container
  */
 public static function &getContainer()
 {
     if (!isset(self::$containerInstance)) {
         self::$containerInstance = new self();
         $loader = new RokCommon_Service_Container_Loader_File_Xml(self::$containerInstance);
         // get and load the platform specific base container file
         $platform = RokCommon_PlatformFactory::getCurrent();
         foreach ($platform->getLoaderChecks() as $platform_check) {
             $platform_file = ROKCOMMON_LIB_PATH . '/config/' . $platform_check . '.xml';
             if (file_exists($platform_file)) {
                 $loader->load($platform_file);
                 /** @var $platforminfo RokCommon_IPlatformInfo */
                 $platforminfo = self::$containerInstance->platforminfo;
                 $platforminfo->setPlatformParameters(self::$containerInstance);
                 break;
             }
         }
     }
     return self::$containerInstance;
 }
 /**
  * @param RokCommon_Service_Container $container
  */
 protected function loadProviders(RokCommon_Service_Container &$container)
 {
     RokCommon_Composite::addPackagePath('roksprocket_providers', $container['roksprocket.providers.path']);
     $platform = RokCommon_PlatformFactory::getCurrent();
     $starting_priority = 19;
     foreach ($platform->getLoaderChecks() as $platform_check) {
         $platform_path = $container['roksprocket.providers.platforms_path'] . '/' . $platform_check;
         if (is_dir($platform_path)) {
             RokCommon_Composite::addPackagePath('roksprocket_providers', $platform_path, $starting_priority--);
         }
     }
     $context = RokCommon_Composite::get('roksprocket_providers');
     $priority_files = $context->getAllSubFiles($container['roksprocket.providers.file']);
     ksort($priority_files, true);
     foreach ($priority_files as $priority => $files) {
         foreach ($files as $file) {
             RokCommon_Service::addConfigFile($file);
         }
     }
 }
Пример #4
0
 /**
  *
  */
 protected function __construct()
 {
     $this->platform_definition = RokCommon_PlatformFactory::getCurrent();
 }