当前位置: 首页>>代码示例>>PHP>>正文


PHP Registry::loadFile方法代码示例

本文整理汇总了PHP中Joomla\Registry\Registry::loadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::loadFile方法的具体用法?PHP Registry::loadFile怎么用?PHP Registry::loadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Joomla\Registry\Registry的用法示例。


在下文中一共展示了Registry::loadFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getConfig

 /**
  * Get config
  */
 static function getConfig($var = false)
 {
     // check if config is already loaded
     $app = self::getApp();
     if (isset($app->chclient->config)) {
         return $var ? $app->chclient->config->{$var} : $app->chclient->config;
     }
     // default config
     $config = (object) [];
     $registry = new Registry();
     $config_fields = $registry->loadFile(JPATH_ROOT . '/components/com_chclient/config.yml', 'yaml');
     foreach ($config_fields as $field => $properties) {
         $config->{$field} = $properties->value;
     }
     // get site config
     $site_config = json_decode(JFactory::getDbo()->setQuery('SELECT config FROM #__chclient_config AS a WHERE a.id = 1')->loadResult());
     foreach ($config as $field => $p) {
         if (isset($site_config->{$field})) {
             $config->{$field} = $site_config->{$field};
         }
     }
     // datepicker options
     $config->datepicker_min_date = CHLibDate::getDate()->format(CHLibDate::dateLocale());
     $config->datepicker_format = str_replace('Y', 'YYYY', str_replace('m', 'MM', str_replace('d', 'DD', CHLibDate::dateLocale())));
     // store config for later use
     $app->chclient->config = $config;
     return $var ? $app->chclient->config->{$var} : $app->chclient->config;
 }
开发者ID:CloudHotelier,项目名称:com_chclient,代码行数:31,代码来源:chclient.php

示例2: loadConfig

 /**
  * Load config.
  *
  * @return  Registry Config registry object.
  */
 public function loadConfig()
 {
     $file = WINDWALKER . '/config.json';
     if (!is_file($file)) {
         \JFile::copy(WINDWALKER . '/config.dist.json', $file);
     }
     $config = new Registry();
     return $config->loadFile($file, 'json');
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:14,代码来源:SystemProvider.php

示例3: getTrackList

 /**
  * getTrackList
  *
  * @return Registry
  */
 public function getTrackList()
 {
     $track = new Registry();
     if (!file_exists($this->file)) {
         $buffer = file_get_contents($this->global);
         \JFile::write($this->file, $buffer);
     }
     $track->loadFile($this->file, 'yaml');
     return $track;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:15,代码来源:Track.php

示例4: checkout

 /**
  * checkout
  *
  * @param $profile
  *
  * @return bool
  * @throws \Exception
  */
 public function checkout($profile)
 {
     $listModel = new ProfilesModel();
     $profiles = $listModel->getList();
     if (!in_array($profile, $profiles)) {
         throw new \Exception(sprintf('Profile "%s" not exists.', $name));
     }
     $profileConfig = new Registry();
     $file = JPATH_ROOT . '/tmp/sqlsync/config.yml';
     $profileConfig->loadFile($file);
     $profileConfig->set('profile', $profile);
     $content = $profileConfig->toString('yaml');
     if (!\JFile::write($file, $content)) {
         throw new \Exception('Writing profile config fail.');
     }
     return true;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:25,代码来源:ProfileModel.php

示例5: testLoadFile

 /**
  * Test the Joomla\Registry\Registry::loadFile method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::loadFile
  * @since   1.0
  */
 public function testLoadFile()
 {
     $registry = new Registry();
     // Result is always true, no error checking in method.
     // JSON.
     $result = $registry->loadFile(__DIR__ . '/Stubs/jregistry.json');
     // Test getting a known value.
     $this->assertThat($registry->get('foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // INI.
     $result = $registry->loadFile(__DIR__ . '/Stubs/jregistry.ini', 'ini');
     // Test getting a known value.
     $this->assertThat($registry->get('foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // INI + section.
     $result = $registry->loadFile(__DIR__ . '/Stubs/jregistry.ini', 'ini', array('processSections' => true));
     // Checking result is self that we can chaining
     $this->assertEquals($result, $registry, '$result should be $registry self that support chaining');
     // Test getting a known value.
     $this->assertThat($registry->get('section.foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // XML and PHP versions do not support stringToObject.
 }
开发者ID:ZerGabriel,项目名称:joomla-framework,代码行数:28,代码来源:RegistryTest.php

示例6: defaultConfig

 /**
  * Load default config
  */
 private function defaultConfig()
 {
     $registry = new Registry();
     return $registry->loadFile(JPATH_ROOT . '/components/com_chclient/config.yml', 'yaml');
 }
开发者ID:CloudHotelier,项目名称:com_chclient,代码行数:8,代码来源:config.php

示例7: load

 /**
  * load
  *
  * @param string $type
  *
  * @return Registry
  */
 public function load($type = 'yaml')
 {
     $schema = new Registry();
     $schema->loadFile($this->getPath($type), $type);
     return $schema;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:13,代码来源:SchemaModel.php


注:本文中的Joomla\Registry\Registry::loadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。