Source for file mvblog_iniparser.php
Documentation is available at mvblog_iniparser.php
* MvBlog -- An open source no-nosense blogtool
* Copyright (C) 2005-2007, Michiel van Baak
* Michiel van Baak <mvanbaak@users.sourceforge.net>
* See http://www.mvblog.org for more information on MvBlog.
* That page also provides Bugtrackers, Filereleases etc.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
* @copyright 2005-2007 Ferry Boender
public static $typeNames =
array(
mvblog_IniParser::TYPE_STRING =>
"String",
mvblog_IniParser::TYPE_BOOL =>
"Boolean",
mvblog_IniParser::TYPE_INT =>
"Integer",
protected function parse($contents) {
// Find and replace dos line endings
// Find and replace mac line endings
// Set section to nothing by default
$contents =
explode("\n", $contents);
for ($i =
0; $i <
count($contents); $i++
) {
if (preg_match('/^\[(.*?)\]*$/', $contents[$i], $match)) {
if (!preg_match("/^\s*[#;].*$/", $contents[$i]) &&
// Comment
preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $contents[$i], $match)) {
$values[$section][$key] =
$value; // FIXME: Strip
foreach($availSettings as $section =>
$data)
foreach ($data as $key =>
$value)
$this->setSetting($section, $key, $value["default"]);
protected function setSetting($section, $key, $value) {
$this->settings[$section][$key] = (string)
$value;
$this->settings[$section][$key] =
False;
case mvblog_IniParser::TYPE_INT:
$this->settings[$section][$key] = (int)
$value;
throw
new mvblog_IniParserException(3, $this->availSettings[$section][$key]);
return($this->settings[$section][$key]);
//if section is empty return the complete settings array
Documentation generated on Fri, 28 Dec 2007 13:17:40 +0100 by phpDocumentor 1.4.1