Beispiel #1
0
 /**
  * @param Container                $container
  * @param \Shopware_Components_Config   $config
  * @param array                         $options
  * @return \Enlight_Components_Mail|null
  */
 public function factory(Container $container, \Shopware_Components_Config $config, array $options)
 {
     if (!$container->load('MailTransport')) {
         return null;
     }
     if (isset($options['charset'])) {
         $defaultCharSet = $options['charset'];
     } elseif (!empty($config->CharSet)) {
         $defaultCharSet = $config->CharSet;
     } else {
         $defaultCharSet = null;
     }
     $mail = new \Enlight_Components_Mail($defaultCharSet);
     return $mail;
 }
Beispiel #2
0
 /**
  * @param Container $container
  * @param \Enlight_Loader $loader
  * @param \Enlight_Event_EventManager $eventManager
  * @param \Shopware $application
  * @param array $config
  * @return \Enlight_Plugin_PluginManager
  */
 public function factory(Container $container, \Enlight_Loader $loader, \Enlight_Event_EventManager $eventManager, \Shopware $application, array $config)
 {
     $pluginManager = new \Enlight_Plugin_PluginManager($application);
     $container->load('Table');
     if (!isset($config['namespaces'])) {
         $config['namespaces'] = array('Core', 'Frontend', 'Backend');
     }
     foreach ($config['namespaces'] as $namespace) {
         $namespace = new \Shopware_Components_Plugin_Namespace($namespace);
         $pluginManager->registerNamespace($namespace);
         $eventManager->registerSubscriber($namespace->Subscriber());
     }
     foreach (array('Local', 'Community', 'Default', 'Commercial') as $dir) {
         $loader->registerNamespace('Shopware_Plugins', Shopware()->AppPath('Plugins_' . $dir));
     }
     return $pluginManager;
 }
Beispiel #3
0
 /**
  * Loads the given resource. If the resource is already registered and the status
  * is STATUS_BOOTSTRAP an Enlight_Exception is thrown.
  * The resource is initial by the Enlight_Bootstrap_InitResource event.
  * If this event doesn't exist for the given resource, the resource is initialed
  * by call_user_func.
  * After the resource is initialed the event Enlight_Bootstrap_AfterInitResource is
  * fired. In case an exception is thrown by initializing the resource,
  * Enlight sets the status STATUS_NOT_FOUND for the resource in the resource status list.
  * In case the resource successfully initialed the resource has the status STATUS_LOADED
  *
  * @param string $name
  * @return bool
  */
 public function loadResource($name)
 {
     return $this->container->load($name);
 }
Beispiel #4
-1
 /**
  * Loads the Zend resource and initials the Enlight_Controller_Front class.
  * After the front resource is loaded, the controller path is added to the
  * front dispatcher. After the controller path is set to the dispatcher,
  * the plugin namespace of the front resource is set.
  *
  * @param Container $container
  * @param \Shopware_Bootstrap $bootstrap
  * @param \Enlight_Event_EventManager $eventManager
  * @param array $options
  * @throws \Exception
  * @return \Enlight_Controller_Front
  */
 public function factory(Container $container, \Shopware_Bootstrap $bootstrap, \Enlight_Event_EventManager $eventManager, array $options)
 {
     /** @var $front \Enlight_Controller_Front */
     $front = \Enlight_Class::Instance('Enlight_Controller_Front', array($eventManager));
     $front->setDispatcher($container->get('Dispatcher'));
     $front->Dispatcher()->addModuleDirectory(Shopware()->AppPath('Controllers'));
     $front->setRouter($container->get('Router'));
     $front->setParams($options);
     /** @var $plugins  \Enlight_Plugin_PluginManager */
     $plugins = $container->get('Plugins');
     $plugins->registerNamespace($front->Plugins());
     $front->setParam('bootstrap', $bootstrap);
     if (!empty($options['throwExceptions'])) {
         $front->throwExceptions((bool) $options['throwExceptions']);
     }
     try {
         $container->load('Cache');
         $container->load('Db');
         $container->load('Plugins');
     } catch (\Exception $e) {
         if ($front->throwExceptions()) {
             throw $e;
         }
         $front->Response()->setException($e);
     }
     return $front;
 }
Beispiel #5
-1
 /**
  * @param Container $container
  * @return \Shopware_Components_TemplateMail
  */
 public function factory(Container $container)
 {
     $container->load('MailTransport');
     $stringCompiler = new \Shopware_Components_StringCompiler($container->get('Template'));
     $mailer = new \Shopware_Components_TemplateMail();
     if ($container->initialized('Shop')) {
         $mailer->setShop($container->get('Shop'));
     }
     $mailer->setModelManager($container->get('Models'));
     $mailer->setStringCompiler($stringCompiler);
     return $mailer;
 }