public function load() { $params = JComponentHelper::getComponent('com_files')->params; $registry = new JRegistry(); $registry->loadIni($params); $this->setData($registry->toArray()); return $this; }
private static function paramsToObject($data) { $registry = new JRegistry(); $registry->loadIni($data); return $registry->toObject(); }
/** * Test the JRegistry::loadIni method. */ public function testLoadINI() { //$string = "[section]\nfoo=\"testloadini\""; $registry = new JRegistry(); $result = $registry->loadIni("foo=\"testloadini1\""); // Result is always true, no error checking in method. // Test getting a known value. $this->assertThat($registry->get('foo'), $this->equalTo('testloadini1'), 'Line: ' . __LINE__ . '.'); $result = $registry->loadIni("[section]\nfoo=\"testloadini2\""); // Test getting a known value. $this->assertThat($registry->get('foo'), $this->equalTo('testloadini2'), 'Line: ' . __LINE__ . '.'); $result = $registry->loadIni("[section]\nfoo=\"testloadini3\"", null, true); // Test getting a known value after processing sections. $this->assertThat($registry->get('section.foo'), $this->equalTo('testloadini3'), 'Line: ' . __LINE__ . '.'); }