|
Revision 129, 1.2 kB
(checked in by mikey, 10 months ago)
|
renamed XJConfLoader to XJConf
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
require_once '../XJConf/XJConf.php'; |
|---|
| 9 |
use net::xjconf::DefinitionParser; |
|---|
| 10 |
use net::xjconf::XmlParser; |
|---|
| 11 |
use net::xjconf::ext::Extension; |
|---|
| 12 |
require 'MathExtension.php'; |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class ExampleExtension |
|---|
| 20 |
{ |
|---|
| 21 |
public static function main() |
|---|
| 22 |
{ |
|---|
| 23 |
$tagParser = new DefinitionParser(); |
|---|
| 24 |
$defs = $tagParser->parse(getcwd() . '/xml/defines-extension.xml'); |
|---|
| 25 |
|
|---|
| 26 |
$conf = new XmlParser(); |
|---|
| 27 |
$extension = new MathExtension(); |
|---|
| 28 |
$conf->addExtension($extension); |
|---|
| 29 |
try { |
|---|
| 30 |
$conf->setTagDefinitions($defs); |
|---|
| 31 |
|
|---|
| 32 |
$conf->parse(getcwd() . '/xml/test-extension.xml'); |
|---|
| 33 |
} catch (Exception $e) { |
|---|
| 34 |
echo $e->getTraceAsString(); |
|---|
| 35 |
exit(0); |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
$map = $conf->getConfigValue('map'); |
|---|
| 39 |
echo 'Map:'; |
|---|
| 40 |
var_dump($map); |
|---|
| 41 |
|
|---|
| 42 |
$array = $conf->getConfigValue('array'); |
|---|
| 43 |
echo 'Array:'; |
|---|
| 44 |
var_dump($array); |
|---|
| 45 |
} |
|---|
| 46 |
} |
|---|
| 47 |
ExampleExtension::main(); |
|---|
| 48 |
?> |
|---|