當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JFactory::config方法代碼示例

本文整理匯總了PHP中JFactory::config方法的典型用法代碼示例。如果您正苦於以下問題:PHP JFactory::config方法的具體用法?PHP JFactory::config怎麽用?PHP JFactory::config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JFactory的用法示例。


在下文中一共展示了JFactory::config方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Class constructor.
  *
  * @since   3.1
  */
 public function __construct()
 {
     // Run the parent constructor
     parent::__construct();
     // Load and set the dispatcher
     $this->loadDispatcher();
     // Enable sessions by default.
     if (is_null($this->config->get('session'))) {
         $this->config->set('session', true);
     }
     // Set the session default name.
     if (is_null($this->config->get('session_name'))) {
         $this->config->set('session_name', 'installation');
     }
     // Create the session if a session name is passed.
     if ($this->config->get('session') !== false) {
         $this->loadSession();
         // Register the session with JFactory
         JFactory::$session = $this->getSession();
     }
     // Store the debug value to config based on the JDEBUG flag
     $this->config->set('debug', JDEBUG);
     // Register the config to JFactory
     JFactory::$config = $this->config;
     // Register the application to JFactory
     JFactory::$application = $this;
     // Set the root in the URI based on the application name
     JUri::root(null, str_ireplace('/installation', '', JUri::base(true)));
 }
開發者ID:karimzg,項目名稱:joomla,代碼行數:34,代碼來源:web.php

示例2: __construct

 /**
  * Constructor.
  *
  * @since   3.2
  */
 public function __construct()
 {
     parent::__construct();
     // Overrides application config and set the configuration.php file so the send function will work
     JFactory::$config = null;
     JFactory::getConfig(JPATH_SITE . '/configuration.php');
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:12,代碼來源:email.php

示例3: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  */
 protected function setUp()
 {
     $this->saveFactoryState();
     JFactory::$application = $this->getMockCmsApp();
     JFactory::$config = $this->getMockConfig();
     parent::setUp();
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:13,代碼來源:JControllerFormTest.php

示例4: __construct

 /**
  * Class constructor.
  *
  * @since   3.1
  */
 public function __construct()
 {
     // Run the parent constructor
     parent::__construct();
     // Load and set the dispatcher
     $this->loadDispatcher();
     // Enable sessions by default.
     if (is_null($this->config->get('session'))) {
         $this->config->set('session', true);
     }
     // Set the session default name.
     if (is_null($this->config->get('session_name'))) {
         $this->config->set('session_name', 'installation');
     }
     // Create the session if a session name is passed.
     if ($this->config->get('session') !== false) {
         $this->loadSession();
         // Register the session with JFactory
         JFactory::$session = $this->getSession();
     }
     // Store the debug value to config based on the JDEBUG flag
     $this->config->set('debug', JDEBUG);
     // Register the config to JFactory
     JFactory::$config = $this->config;
     // Register the application to JFactory
     JFactory::$application = $this;
     // Register the application name
     $this->_name = 'installation';
     // Register the client ID
     $this->_clientId = 2;
     // Set the root in the URI one level up.
     $parts = explode('/', JUri::base(true));
     array_pop($parts);
     JUri::root(null, implode('/', $parts));
 }
開發者ID:shoffmann52,項目名稱:install-from-web-server,代碼行數:40,代碼來源:web.php

示例5: __construct

 /**
  * Constructor.
  *
  * @since   3.1
  */
 public function __construct()
 {
     parent::__construct();
     // Overrides application config and set the configuration.php file so tokens and database works
     JFactory::$config = null;
     JFactory::getConfig(JPATH_SITE . '/configuration.php');
 }
開發者ID:ITPrism,項目名稱:CrowdfundingDistribution,代碼行數:12,代碼來源:setdefaultlanguage.php

示例6: testCalendar

 /**
  * Tests JHtml::calendar() method with and without 'readonly' attribute.
  */
 public function testCalendar()
 {
     // Create a world for the test
     jimport('joomla.session.session');
     jimport('joomla.application.application');
     jimport('joomla.document.document');
     $cfg = new JObject();
     JFactory::$session = $this->getMock('JSession', array('_start'));
     JFactory::$application = $this->getMock('ApplicationMock');
     JFactory::$config = $cfg;
     JFactory::$application->expects($this->any())->method('getTemplate')->will($this->returnValue('atomic'));
     $cfg->live_site = 'http://example.com';
     $cfg->offset = 'Europe/Kiev';
     $_SERVER['HTTP_USER_AGENT'] = 'Test Browser';
     // two sets of test data
     $test_data = array('date' => '2010-05-28 00:00:00', 'friendly_date' => 'Friday, 28 May 2010', 'name' => 'cal1_name', 'id' => 'cal1_id', 'format' => '%Y-%m-%d', 'attribs' => array());
     $test_data_ro = array_merge($test_data, array('attribs' => array('readonly' => 'readonly')));
     foreach (array($test_data, $test_data_ro) as $data) {
         // Reset the document
         JFactory::$document = JDocument::getInstance('html', array('unique_key' => serialize($data)));
         $input = JHtml::calendar($data['date'], $data['name'], $data['id'], $data['format'], $data['attribs']);
         $this->assertEquals((string) $xml->input['title'], $data['friendly_date'], 'Line:' . __LINE__ . ' The calendar input should have `title == "' . $data['friendly_date'] . '"`');
         $this->assertEquals((string) $xml->input['name'], $data['name'], 'Line:' . __LINE__ . ' The calendar input should have `name == "' . $data['name'] . '"`');
         $this->assertEquals((string) $xml->input['id'], $data['id'], 'Line:' . __LINE__ . ' The calendar input should have `id == "' . $data['id'] . '"`');
         $head_data = JFactory::getDocument()->getHeadData();
         if (!isset($data['attribs']['readonly']) || !$data['attribs']['readonly'] === 'readonly') {
             $this->assertArrayHasKey('/media/system/js/calendar.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar.js" should be loaded');
             $this->assertArrayHasKey('/media/system/js/calendar-setup.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar-setup.js" should be loaded');
         }
     }
 }
開發者ID:realityking,項目名稱:oldunittests,代碼行數:34,代碼來源:JHtmlTest.php

示例7: getConfig

 /**
  * Return a config object populated with the config from the Joomlas config file
  */
 public static function getConfig()
 {
     if (!self::$config) {
         self::$config = new FakeConfig();
     }
     return self::$config;
 }
開發者ID:uinerd,項目名稱:Code,代碼行數:10,代碼來源:FakeJoomla.php

示例8: testEncrypt

 /**
  * Testing testEncrypt().
  *
  * @param string $text	The text to be encrypted
  * @param string $key	The key to use
  * @param string $expected The expected result of encryption
  *
  * @return void
  * @dataProvider casesEncryption
  */
 public function testEncrypt($text, $key, $expected)
 {
     $cfg = $this->getMock('JObject', array('get'));
     $cfg->expects($this->any())->method('get')->will($this->returnValue(''));
     JFactory::$config = $cfg;
     $this->object = new JSimpleCrypt($key);
     $this->assertThat($this->object->encrypt($text), $this->equalTo($expected));
 }
開發者ID:raquelsa,項目名稱:Joomla,代碼行數:18,代碼來源:JSimpleCryptTest.php

示例9: testGetConfig

 /**
  * Tests the JFactory::getConfig method.
  *
  * @return  void
  *
  * @since   11.3
  * @covers  JFactory::getConfig
  * @covers  JFactory::createConfig
  */
 function testGetConfig()
 {
     // Temporarily override the config cache in JFactory.
     $temp = JFactory::$config;
     JFactory::$config = null;
     $this->assertInstanceOf('JRegistry', JFactory::getConfig(JPATH_TESTS . '/config.php'), 'Line: ' . __LINE__);
     JFactory::$config = $temp;
 }
開發者ID:nprasath002,項目名稱:joomla-platform,代碼行數:17,代碼來源:JFactoryTest.php

示例10: testGetConfig

 /**
  * Tests the JFactory::getConfig method.
  *
  * @return  void
  *
  * @since   11.3
  */
 function testGetConfig()
 {
     // Temporarily override the config cache in JFactory.
     $temp = JFactory::$config;
     JFactory::$config = null;
     $this->assertThat(JFactory::getConfig(JPATH_TESTS . '/config.php'), $this->isInstanceOf('JRegistry'));
     JFactory::$config = $temp;
 }
開發者ID:raquelsa,項目名稱:Joomla,代碼行數:15,代碼來源:JFactoryTest.php

示例11: testGetHash

 /**
  * Testing JApplication::getHash
  *
  * @return  void
  */
 public function testGetHash()
 {
     // Temporarily override the config cache in JFactory.
     $temp = JFactory::$config;
     JFactory::$config = new JObject(array('secret' => 'foo'));
     $this->assertThat(JApplication::getHash('This is a test'), $this->equalTo(md5('foo' . 'This is a test')), 'Tests that the secret string is added to the hash.');
     JFactory::$config = $temp;
 }
開發者ID:SysBind,項目名稱:joomla-cms,代碼行數:13,代碼來源:JApplicationTest.php

示例12: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->saveFactoryState();
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SCRIPT_NAME'] = '';
     JFactory::$application = $this->getMockApplication();
     JFactory::$config = $this->getMockConfig();
     $this->object = new JDocumentOpensearch();
 }
開發者ID:nogsus,項目名稱:joomla-platform,代碼行數:13,代碼來源:JDocumentOpensearchTest.php

示例13: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->saveFactoryState();
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SCRIPT_NAME'] = '';
     JFactory::$application = $this->getMock('JApplication', array('get', 'getCfg', 'getRouter', 'getTemplate'), array(array('session' => false)));
     JFactory::$config = $this->getMock('JConfig', array('get'));
     $this->object = new JDocumentOpensearch();
 }
開發者ID:GMaup,項目名稱:joomla-platform,代碼行數:13,代碼來源:JDocumentOpensearchTest.php

示例14: getConfig

 /**
  * Get a configuration object
  *
  * Returns the global {@link JRegistry} object, only creating it
  * if it doesn't already exist.
  *
  * @param string	The path to the configuration file
  * @param string	The type of the configuration file
  * @return object JRegistry
  */
 public static function getConfig($file = null, $type = 'PHP')
 {
     if (!is_object(JFactory::$config)) {
         if ($file === null) {
             $file = dirname(__FILE__) . DS . 'config.php';
         }
         JFactory::$config = JFactory::_createConfig($file, $type);
     }
     return JFactory::$config;
 }
開發者ID:joebushi,項目名稱:joomla,代碼行數:20,代碼來源:factory.php

示例15: getConfig

 /**
  * Get a configuration object
  *
  * Returns the global {@link JRegistry} object, only creating it
  * if it doesn't already exist.
  *
  * @param string $file The path to the configuration file
  * @param string $type The type of the configuration file
  *
  * @return JRegistry object
  */
 public static function getConfig($file = null, $type = 'PHP')
 {
     if (!self::$config) {
         if ($file === null) {
             $file = dirname(__FILE__) . DS . 'config.php';
         }
         self::$config = self::_createConfig($file, $type);
     }
     return self::$config;
 }
開發者ID:Joomla-on-NoSQL,項目名稱:LaMojo,代碼行數:21,代碼來源:factory.php


注:本文中的JFactory::config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。