本文整理汇总了PHP中JFactory::container方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::container方法的具体用法?PHP JFactory::container怎么用?PHP JFactory::container使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::container方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restoreFactoryState
/**
* Sets the Factory pointers
*
* @return void
*
* @since 12.1
*/
protected function restoreFactoryState()
{
JFactory::$application = $this->_stashedFactoryState['application'];
JFactory::$config = $this->_stashedFactoryState['config'];
JFactory::$container = $this->_stashedFactoryState['container'];
JFactory::$dates = $this->_stashedFactoryState['dates'];
JFactory::$session = $this->_stashedFactoryState['session'];
JFactory::$language = $this->_stashedFactoryState['language'];
JFactory::$document = $this->_stashedFactoryState['document'];
JFactory::$acl = $this->_stashedFactoryState['acl'];
JFactory::$mailer = $this->_stashedFactoryState['mailer'];
JFactory::$database = $this->_stashedFactoryState['database'];
}
示例2: dirname
<?php
/**
* @package Joomla.Installation
* @subpackage Application
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Define the base path and require the other defines
define('JPATH_BASE', dirname(__DIR__));
require_once __DIR__ . '/defines.php';
// Launch the application
require_once __DIR__ . '/framework.php';
// Register the Installation application
JLoader::registerPrefix('Installation', JPATH_INSTALLATION);
// Register the application's router due to non-standard include
JLoader::register('JRouterInstallation', __DIR__ . '/router.php');
// Instantiate the dependency injection container
JFactory::$container = (new \Joomla\DI\Container())->registerServiceProvider(new InstallationServiceProviderApplication())->registerServiceProvider(new InstallationServiceProviderSession())->registerServiceProvider(new \Joomla\Cms\Service\Provider\Dispatcher())->registerServiceProvider(new \Joomla\Cms\Service\Provider\Database());
示例3: testActivateUser
/**
* Testing activateUser().
*
* @param string $activation Activation string
* @param boolean $expected Expected params
*
* @dataProvider casesActivateUser
* @covers JUserHelper::activateUser
* @return void
*
* @since 12.3
*/
public function testActivateUser($activation, $expected)
{
// Configure the container
$container = (new \Joomla\DI\Container())->set('dispatcher', $this->getMockDispatcher())->set('db', static::$driver);
JFactory::$container = $container;
$this->assertEquals(JUserHelper::activateUser($activation), $expected);
}
示例4: getContainer
/**
* Get a container object
*
* Returns the global service container object, only creating it if it doesn't already exist.
*
* @return Container
*
* @since 4.0
*/
public static function getContainer()
{
if (!self::$container) {
self::$container = self::createContainer();
}
return self::$container;
}