<?php
 
 
/*
 
 
    Config
 
    Copyright (C) 2009-2013  Norbert Krzysztof Kiszka <norbert at linux dot pl>
 
 
    This program is free software; you can redistribute it and/or modify
 
    it under the terms of the GNU General Public License as published by
 
    the Free Software Foundation; either version 2 of the License, or
 
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License along
 
    with this program; if not, write to the Free Software Foundation, Inc.,
 
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
*/
 
 
error_reporting(-1);
 
ini_set('display_errors', 1);
 
 
function class_load($class)
 
{
 
    $file = 'lib/' . str_replace('_', '/', $class) . '.php';
 
    require_once($file);
 
}
 
 
spl_autoload_register('class_load');
 
 
$conf = new Conf('test.ini');
 
 
echo "-----------------------------------------TEST 1 (get some_var):-----------------------------------------\n";
 
 
var_dump($conf('section', 'subsection', 'other_subsection', 'some_var')); // invoke
 
 
echo "-----------------------------------------TEST 2 (use alias):-----------------------------------------\n";
 
 
var_dump($conf->get('section', 'subsection', 'other_subsection', 'some_var')); // alias (php 5.2)
 
 
echo "-----------------------------------------TEST 3 (get section):-----------------------------------------\n";
 
 
var_dump($conf('section', 'subsection', 'other_subsection'));
 
 
echo "-----------------------------------------TEST 4 (get all):-----------------------------------------\n";
 
 
var_dump($conf()); // invoke on php 5.3
 
 |