/**
  * test boolean reading
  *
  * @return void
  */
 function testBooleanReading()
 {
     $reader = new IniReader($this->path);
     $config = $reader->read('nested.ini');
     $this->assertTrue($config['bools']['test_on']);
     $this->assertFalse($config['bools']['test_off']);
     $this->assertTrue($config['bools']['test_yes']);
     $this->assertFalse($config['bools']['test_no']);
     $this->assertTrue($config['bools']['test_true']);
     $this->assertFalse($config['bools']['test_false']);
     $this->assertFalse($config['bools']['test_null']);
 }
예제 #2
0
 public static function get($key)
 {
     if (is_null(self::$_file)) {
         self::$_file = "conf/settings.ini";
     }
     return parent::get($key);
 }
예제 #3
0
 public static function copyTenantSettingFile($data = array())
 {
     $site_slug = $data['Site']['alias'];
     $defaultSettingsConfig = array('name' => 'default', 'datasource' => Configure::read('Risto.dataSourceType'), 'persistent' => false);
     $installSettingsIniPath = App::pluginPath('Install') . 'Config' . DS . 'TenantInstallFiles' . DS . $data['Site']['type'] . DS;
     $IniSetting = new IniReader($installSettingsIniPath);
     $settings = $IniSetting->read('settings.ini');
     $settings['Config']['timezone'] = $data['Site']['timezone'];
     $settings['Site']['ip'] = $data['Site']['ip'];
     $settings['Site']['name'] = $data['Site']['name'];
     $settings['Site']['alias'] = $data['Site']['alias'];
     $settings['Geo'] = GeoPlugin::locate($data['Site']['ip']);
     unset($settings['Geo']['currency_symbol']);
     // el simbolo me rompe el settings.ini file
     TenantSettings::write($settings, $site_slug);
     return true;
 }
예제 #4
0
 /**
  * Test that dump() makes files read() can read.
  *
  * @return void
  */
 public function testDumpRead()
 {
     $reader = new IniReader(TMP);
     $reader->dump('test.ini', $this->testData);
     $result = $reader->read('test.ini');
     unlink(TMP . 'test.ini');
     $expected = $this->testData;
     $expected['One']['is_null'] = false;
     $this->assertEquals($expected, $result);
 }
예제 #5
0
 /**
  * test read file without extension
  *
  * @return void
  */
 public function testReadingWithoutExtension()
 {
     $reader = new IniReader($this->path);
     $config = $reader->read('nested');
     $this->assertTrue($config['bools']['test_on']);
 }
예제 #6
0
 /**
  * Parses an INI file and returns an array that reflects the 
  * INI file's section structure. Double-quote friendly.
  *
  * @param string $filename File
  * @return array INI section structure
  */
 public function readConfigFile($filename)
 {
     App::uses('IniReader', 'Configure');
     $iniFile = new IniReader(dirname($filename) . DS);
     return $iniFile->read(basename($filename));
 }
예제 #7
0
파일: acl.php 프로젝트: robotarmy/Phog
 /**
  * Parses an INI file and returns an array that reflects the INI file's section structure. Double-quote friendly.
  *
  * @param string $filename File
  * @return array INI section structure
  */
 public function readConfigFile($filename)
 {
     App::import('Core', 'config/IniReader');
     $iniFile = new IniReader(dirname($filename) . DS);
     return $iniFile->read(basename($filename));
 }