示例#1
0
 public function register(Devaloka $devaloka, ContainerInterface $container)
 {
     $container->add('translator.class', 'Devaloka\\Component\\Translation\\WordPressTranslator');
     $container->add('translator', function (Container $container) {
         return new $container['translator.class']();
     });
 }
 public function register(Devaloka $devaloka, ContainerInterface $container)
 {
     $container->add('transient.class', 'Devaloka\\Transient\\Transient');
     $container->add('transient', function (Container $container) {
         return new $container['transient.class']();
     });
 }
 public function register(Devaloka $devaloka, ContainerInterface $container)
 {
     $container->add('event_dispatcher.class', 'Devaloka\\Component\\EventDispatcher\\EventDispatcher');
     $container->add('event_dispatcher', function (Container $container) {
         return new $container['event_dispatcher.class']();
     });
 }
 public function boot(Devaloka $devaloka, ContainerInterface $container)
 {
     $plugin = $container->get('devaloka.plugin.query_exporter');
     if ($plugin instanceof ActivatablePluginInterface) {
         $plugin->register();
     }
     if ($plugin instanceof TranslatablePluginInterface) {
         $plugin->loadTextDomain();
         $plugin->loadLocaleFile();
     }
     $plugin->boot();
 }
示例#5
0
 public function boot(Devaloka $devaloka, ContainerInterface $container)
 {
     require_once ABSPATH . '/wp-admin/includes/plugin.php';
     $file = $container->get('devaloka.file');
     $pluginData = get_plugin_data($file, false, false);
     $directory = dirname($file);
     if ($pluginData['TextDomain'] !== '') {
         $textDomain = $pluginData['TextDomain'];
     } else {
         $textDomain = basename($directory);
     }
     if ($pluginData['DomainPath'] !== '') {
         $domainPath = $pluginData['DomainPath'];
     } else {
         $domainPath = '/languages';
     }
     load_muplugin_textdomain($textDomain, dirname(plugin_basename($file)) . $domainPath);
     $locale = get_locale();
     $localeFile = $directory . $domainPath . '/' . $locale . '.php';
     if (is_readable($localeFile)) {
         require_once $localeFile;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function subscribe(Devaloka $devaloka, ContainerInterface $container, EventDispatcherInterface $dispatcher)
 {
     $dispatcher->addSubscriber($container->get('event_converter.converter_listener'));
 }
示例#7
0
 public function subscribe(Devaloka $devaloka, ContainerInterface $container, EventDispatcherInterface $dispatcher)
 {
     $listener = $container->get('templating.templating_listener');
     $dispatcher->addSubscriber($listener);
 }
 public function subscribe(Devaloka $devaloka, ContainerInterface $container, EventDispatcherInterface $dispatcher)
 {
     $listener = $container->get('devaloka.plugin.network.network_listener');
     $dispatcher->addSubscriber($listener);
 }
示例#9
0
 /**
  * {@inheritDoc}
  */
 public function boot(Devaloka $devaloka, ContainerInterface $container)
 {
     $GLOBALS['wp_widget_factory'] = $container->get('wp_widget_factory');
 }