本文整理汇总了PHP中JoomlapackHelperUtils::_parse_ini_file方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomlapackHelperUtils::_parse_ini_file方法的具体用法?PHP JoomlapackHelperUtils::_parse_ini_file怎么用?PHP JoomlapackHelperUtils::_parse_ini_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomlapackHelperUtils
的用法示例。
在下文中一共展示了JoomlapackHelperUtils::_parse_ini_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_ini_file
/**
* Parse an INI file and return an associative array. Since PHP versions before 5.1 are
* bitches with regards to INI parsing, I use a PHP-only solution to overcome this
* obstacle.
*
* @param string $file The file to process
* @param bool $process_sections True to also process INI sections
* @return array An associative array of sections, keys and values
*/
function parse_ini_file($file, $process_sections)
{
if (version_compare(PHP_VERSION, '5.1.0', '>=')) {
if (function_exists('parse_ini_file')) {
return parse_ini_file($file, $process_sections);
} else {
return JoomlapackHelperUtils::_parse_ini_file($file, $process_sections);
}
} else {
return JoomlapackHelperUtils::_parse_ini_file($file, $process_sections);
}
}
示例2: _getLatestVersion
/**
* Gets an object with the latest version information, taken from the update.ini data
* @return JObject|bool An object holding the data, or false on failure
*/
function _getLatestVersion($force = false)
{
jpimport('helpers.utils', true);
JoomlapackHelperUtils::getJoomlaPackVersion();
if (substr(_JP_VERSION, 0, 3) == 'svn') {
$this->_update_url = $this->_update_svn;
} else {
$this->_update_url = $this->_update_stable;
}
// Make sure we ask the server at most every 24 hrs (unless $force is true)
$inidata = false;
jimport('joomla.utilities.date');
$curdate = new JDate();
$lastdate = $this->_lastUpdateCheck();
$difference = ($curdate->toUnix(false) - $lastdate->toUnix(false)) / 3600;
if ($difference < 24 && JoomlapackCUBETables::CountVar('updateini') >= 1 && !$force) {
$inidata = $this->_getUpdateINIcached();
}
// Prefer to use cURL if it exists and we don't have cached data
if ($inidata == false && $this->_hascURL()) {
$inidata = $this->_getUpdateINIcURL();
}
// If cURL doesn't exist, or if it returned an error, try URL fopen() wrappers
if ($inidata == false && $this->_hasURLfopen()) {
$inidata = $this->_getUpdateINIfopen();
}
// If we have a valid update.ini, update the cache and read the version information
if ($inidata != false) {
$this->_setUpdateINIcached($inidata);
$parsed = JoomlapackHelperUtils::_parse_ini_file($inidata, true, true);
foreach ($parsed as $version => $data) {
$status = isset($data['status']) ? $data['status'] : 'beta';
$reldate_text = isset($data['reldate']) ? $data['reldate'] : 'now';
$reldate = new JDate($reldate_text);
$free = $data['free'];
$special = $data['special'];
}
$ret = new JObject();
$ret->version = $version;
$ret->status = $status;
$ret->reldate = $reldate;
$ret->free = $free;
$ret->special = $special;
return $ret;
}
return false;
}