Example #1
0
 /**
  * Constructor. Must define DI for CmsPermissions and RouterInterface
  *
  * @param  ApplicationContainerInterface  $di
  */
 public function __construct(ApplicationContainerInterface $di)
 {
     $di->set('CBLib\\Cms\\CmsPermissionsInterface', 'CBLib\\Cms\\Joomla\\Joomla3\\CmsPermissions', true)->alias('CBLib\\Cms\\CmsPermissionsInterface', 'CmsPermissions');
     $di->set('CBLib\\Controller\\RouterInterface', 'CBLib\\Cms\\Joomla\\Joomla3\\CmsRouter', true)->alias('CBLib\\Controller\\RouterInterface', 'Router');
     /* This one is to work-around a bug in Joomla 3.3.6- that prevents using closures in observer objects:
      * ( https://github.com/joomla/joomla-cms/pull/4865 )
      */
     $di->set('CBLib\\Cms\\Joomla\\Joomla3\\CmsEventsRegistry', 'CBLib\\Registry\\Registry', true);
 }
Example #2
0
 /**
  * Constructor, sets the dependency-injection Container
  *
  * @param  InputInterface                  $input      Input object
  * @param  OutputInterface                 $output     Output object
  * @param  CmsInterface                    $cms        Cms object
  * @param  ApplicationContainerInterface   $di         DI Container
  * @param  array                           $options    Main request options for dispatching
  * @param  array                           $getParams  [optional] Get params for form target of form
  * @param  TableInterface|ParamsInterface  $data       The data to render
  */
 public function __construct(InputInterface $input, OutputInterface $output, CmsInterface $cms, ApplicationContainerInterface $di, array $options, array $getParams = array(), $data = null)
 {
     $this->input = $input;
     $this->output = $output;
     $this->cms = $cms;
     $this->di = $di;
     $this->options = $options;
     $this->getParams = $getParams;
     $this->data = $data;
     $extensionName = $this->cms->getExtensionName();
     $extensionPath = $this->cms->getFolderPath($this->cms->getClientId());
     // Make sure it's shared:
     /** @see AutoLoaderXml */
     $this->di->set('CBLib\\AhaWow\\AutoLoaderXml', null, true);
     /** @var AutoLoaderXml $autoLoaderXml::_construct() */
     $autoLoaderXml = $this->di->get('CBLib\\AhaWow\\AutoLoaderXml');
     $autoLoaderXml->registerMap($extensionName, $extensionPath . '/xmlcb/controllers/frontcontroller.xml');
 }
 /**
  * Constructor (do not call directly, use DI to call it)
  *
  * Code in here was previously in plugin.foundation.php
  *
  * @param  ApplicationContainerInterface  $di  (This is injected by DI)
  */
 function __construct(ApplicationContainerInterface $di)
 {
     if (self::$loaded) {
         return;
     }
     self::$loaded = true;
     define('_CB_JQUERY_VERSION', '1.11.2');
     // IMPORTANT: when changing version here also change in the 2 XML installation files
     /**
      * CB GLOBALS and initializations
      */
     global $mainframe;
     $mainframe = JFactory::getApplication();
     /** @noinspection PhpDeprecationInspection */
     $acl = JFactory::getACL();
     $sefFunc = array('JRoute', '_');
     $getVarFunction = array('JRequest', 'getVar');
     $Jdocument = JFactory::getDocument();
     if ($Jdocument->getType() == 'html') {
         $getDocFunction = array('JFactory', 'getDocument');
     } else {
         $getDocFunction = false;
     }
     $editor = JFactory::getEditor();
     $editorDisplay = array('display' => array('call' => array($editor, 'display'), 'args' => 'noid'), 'save' => array('call' => array($editor, 'save'), 'args' => 'noid'), 'returns' => true);
     $aclParams = array('canEditUsers' => array('com_comprofiler', 'core.edit', 'users', null), 'canBlockUsers' => array('com_comprofiler', 'core.edit.state', 'users', null), 'canReceiveAdminEmails' => array('com_comprofiler', 'core.admin', 'users', null), 'canEditOwnContent' => array('com_content', 'core.edit.own', 'users', null, 'content', 'own'), 'canAddAllContent' => array('com_content', 'core.create', 'users', null, 'content', 'all'), 'canEditAllContent' => array('com_content', 'core.edit', 'users', null, 'content', 'all'), 'canPublishContent' => array('com_content', 'core.edit.state', 'users', null, 'content', 'all'), 'canInstallPlugins' => array('com_installer', 'core.manage', 'users', null), 'canManageUsers' => array('com_comprofiler', 'core.manage', 'users', null));
     /**
      * CB framework
      * @global CBframework $_CB_framework
      */
     global $_CB_framework;
     $_CB_framework = new CBframework($mainframe, $aclParams, $sefFunc, array('option' => 'com_comprofiler'), $getVarFunction, $getDocFunction, $editorDisplay);
     /** @see CBACL */
     $_CB_framework->acl = $di->get('CBACL', array('acl' => $acl));
     $di->set('CBFramework', $_CB_framework, true);
     /**
      * CB Config
      * @deprecated 2.0, use Application::Config() to get the Configuration Registry object
      * @see Application::Config()
      * @var array
      */
     global $ueConfig;
     $ueConfig['version'] = CBLIB;
     // This doesn't load if yet if in installer, as config database table may not yet be created:
     CBConfig::loadLegacyCBueConfig(true);
     // Lazy-loads later the language files:
     // This is useful if CBLib is loaded too early by plugins before language selection happened in Joomla (solves bug #5360).
     $di->get('Language')->addLanguageFile(function () use($di) {
         if ($di->getCms()->getClientId() === 0) {
             cbimport('language.front');
         } else {
             cbimport('language.all');
         }
     });
     define('_CB_SPOOFCHECKS', isset($ueConfig['enableSpoofCheck']) && $ueConfig['enableSpoofCheck'] ? 1 : 0);
 }