mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Removing Helper::readConfigFile().
tags.ini.php will not be used as of 1.2 file should be changed to tags.php and use php arrays. $tags['tagname'] = 'value'; git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3893 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
056bda7e4b
commit
2ab7e5120d
1 changed files with 3 additions and 44 deletions
|
@ -87,9 +87,9 @@ class Helper extends Overloadable {
|
|||
* @return void
|
||||
*/
|
||||
function loadConfig() {
|
||||
if (file_exists(APP . 'config' . DS . 'tags.ini.php')) {
|
||||
$appConfig = $this->readConfigFile(APP . 'config' . DS . 'tags.ini.php');
|
||||
$this->tags = am($this->tags, $appConfig);
|
||||
if (file_exists(APP . 'config' . DS . 'tags.php')) {
|
||||
require(APP . 'config' . DS . 'tags.php');
|
||||
$this->tags = am($this->tags, $tags);
|
||||
}
|
||||
return $this->tags;
|
||||
}
|
||||
|
@ -337,47 +337,6 @@ class Helper extends Overloadable {
|
|||
function assign($keyName, $values) {
|
||||
return str_replace('%%' . array_keys($values) . '%%', array_values($values), $this->tags[$keyName]);
|
||||
}
|
||||
/**
|
||||
* Returns an array of settings in given INI file.
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return array
|
||||
*/
|
||||
function readConfigFile($fileName) {
|
||||
$fileLineArray = file($fileName);
|
||||
|
||||
foreach($fileLineArray as $fileLine) {
|
||||
$dataLine = trim($fileLine);
|
||||
$firstChar = substr($dataLine, 0, 1);
|
||||
|
||||
if ($firstChar != ';' && $dataLine != '') {
|
||||
if ($firstChar == '[' && substr($dataLine, -1, 1) == ']') {
|
||||
// [section block] we might use this later do not know for sure
|
||||
// this could be used to add a key with the section block name
|
||||
// but it adds another array level
|
||||
} else {
|
||||
$delimiter = strpos($dataLine, '=');
|
||||
|
||||
if ($delimiter > 0) {
|
||||
$key = strtolower(trim(substr($dataLine, 0, $delimiter)));
|
||||
$value = trim(stripcslashes(substr($dataLine, $delimiter + 1)));
|
||||
|
||||
if (substr($value, 0, 1) == '"' && substr($value, -1) == '"') {
|
||||
$value = substr($value, 1, -1);
|
||||
}
|
||||
|
||||
$iniSetting[$key] = $value;
|
||||
|
||||
} else {
|
||||
$iniSetting[strtolower(trim($dataLine))] = '';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
return $iniSetting;
|
||||
}
|
||||
/**
|
||||
* Before render callback. Overridden in subclasses.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue