function _get_recursive($key, $filename, $locale_id) { $path = $this->_get_path($filename, $locale_id); $md5_path = md5($path); if(isset($this->_cache[$md5_path][$key])) return $this->_cache[$md5_path][$key]; if(isset($this->_ini_objects[$md5_path])) $ini =& $this->_ini_objects[$md5_path]; else { $ini =& ini :: instance($path); $this->_ini_objects[$md5_path] =& $ini; } if(!($value = $ini->get_option($key, 'constants'))) { if($ini->has_option('filename', 'extends')) { $extend_filename = $ini->get_option('filename', 'extends'); $value = $this->_get_recursive($key, $extend_filename, $locale_id); } } if($value) $this->_cache[$md5_path][$key] = $value; return $value; }
function test_group() { $ini =& ini::instance('test.ini', TEST_CASES_DIR, false); debug_mock::expect_write_notice('unknown block', array('ini' => $ini->file_name(), 'block_name' => 'no_group')); $this->assertNull($ini->group('no_group')); $this->assertNotNull($ini->group('default')); $group = $ini->group('test2'); $this->assertTrue(is_array($group) && sizeof($group) == 3); $this->assertEqual($group['test1'], 2); $this->assertEqual($group['test2'], 3); $this->assertEqual($group['test3'], " #It's just a \"test\"!# "); }
function &get_ini($file_name, $use_cache = null) { if (!($path = get_ini_real_path($file_name))) { error('ini file not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $file_name)); } if (isset($GLOBALS['testing_ini'][$file_name])) { $use_cache = false; } if (!($ini =& ini::instance($path, $use_cache))) { error('couldnt retrieve ini instance', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $path)); } return $ini; }
/** * @return unknown * @param $filename unknown * @param $use_cache unknown * @desc Enter description here... */ function &get_ini($filename, $use_cache = null) { if (file_exists(PROJECT_DIR . 'core/settings/' . $filename)) { $root_dir = PROJECT_DIR . 'core/settings/'; } elseif (file_exists(LIMB_DIR . 'core/settings/' . $filename)) { $root_dir = LIMB_DIR . 'core/settings/'; } else { error('ini file not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $filename)); } if (!($ini =& ini::instance($filename, $root_dir, $use_cache))) { error('couldnt retrieve ini instance', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $filename)); } return $ini; }
function &get_ini($file_name, $use_cache = null) { if (isset($GLOBALS['testing_ini'][$file_name])) { $dir = VAR_DIR; $use_cache = false; } elseif (file_exists(PROJECT_DIR . 'core/settings/' . $file_name)) { $dir = PROJECT_DIR . 'core/settings/'; } elseif (file_exists(LIMB_DIR . 'core/settings/' . $file_name)) { $dir = LIMB_DIR . 'core/settings/'; } else { error('ini file not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $file_name)); } if (!($ini =& ini::instance($dir . $file_name, $use_cache))) { error('couldnt retrieve ini instance', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('file' => $dir . $file_name)); } return $ini; }
function _do_get($key, $filename, $locale_id) { $path = $this->_get_path($filename, $locale_id); if (isset($this->_cache[$path][$key])) { return $this->_cache[$path][$key]; } if (isset($this->_ini_objects[$path])) { $ini =& $this->_ini_objects[$path]; } else { $ini =& ini::instance($path); $this->_ini_objects[$path] =& $ini; } if ($value = $ini->get_option($key, 'constants')) { $this->_cache[$path][$key] = $value; } return $value; }
function _get_recursive($key, $filename, $language_id) { $path = $this->_get_path($filename, $language_id); if (isset($this->_cache[$path][$key])) { return $this->_cache[$path][$key]; } if (isset($this->_ini_objects[$path])) { $ini =& $this->_ini_objects[$path]; } else { $ini =& ini::instance($path); $this->_ini_objects[$path] =& $ini; } if (!($value = $ini->variable('constants', $key))) { if ($ini->has_variable('extends', 'filename')) { $extend_filename = $ini->variable('extends', 'filename'); $value = $this->_get_recursive($key, $extend_filename, $language_id); } } if ($value) { $this->_cache[$path][$key] = $value; } return $value; }
function &_get_ini($with_variation = false, $directory = '') { $type = $with_variation ? 'variation' : 'default'; $country = $this->get_country_code(); $country_variation = $this->get_country_variation(); $language = $this->get_language_code(); $locale = $language; if ($country !== '') { $locale .= '-' . $country; } if ($with_variation) { if ($country_variation !== '') { $locale .= '@' . $country_variation; } } $file_name = $locale . '.ini'; if (file_exists($directory . '/' . $file_name)) { return ini::instance($directory . '/' . $file_name); } else { return null; } }
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) *********************************************************************************** * * $Id$ * ***********************************************************************************/ ob_start(); $site_path = $argv[1]; if (file_exists($site_path . '/setup_custom.php')) { include_once $site_path . '/setup_custom.php'; } require_once $site_path . '/setup.php'; require_once LIMB_DIR . 'core/lib/util/ini.class.php'; require_once LIMB_DIR . 'core/lib/debug/debug.class.php'; $cron_scripts_dir = $site_path . '/cron/'; $ini =& ini::instance('cron.ini', $cron_scripts_dir, false); $cron_last_run_file = $cron_scripts_dir . '.scripts_last_run'; $scripts_last_run = array(); if (file_exists($cron_last_run_file)) { $fp = fopen($cron_last_run_file, 'r'); if ($contents = fread($fp, filesize($cron_last_run_file))) { $scripts_last_run = explode("\n", $contents); } fclose($fp); } $scripts =& $ini->variable('cron', 'scripts'); foreach ($scripts as $id => $script_string) { if (!isset($scripts_last_run[$id])) { $scripts_last_run[$id] = 0; } $script_settings = explode(';', $script_string);
function &_get_ini($with_variation = false, $directory = '') { $type = $with_variation ? 'variation' : 'default'; $country = $this->get_country_code(); $country_variation = $this->get_country_variation(); $language = $this->get_language_code(); $locale = $language; if ($country !== '') { $locale .= '-' . $country; } if ($with_variation) { if ($country_variation !== '') { $locale .= '@' . $country_variation; } } $file_name = $locale . '.ini'; if (locale::is_debug_enabled()) { debug::write_notice("Requesting {$file_name}", 'locale :: _get_locale_ini'); } if (ini::exists($file_name, $directory)) { return ini::instance($file_name, $directory); } else { return null; } }
function test_parse_real_file() { $ini =& ini :: instance(LIMB_DIR . '/tests/cases/util/ini_test.ini', false); $this->assertEqual($ini->get_all(), array('test' => array('test' => 1))); }