root/trunk/patXMLPretty/ConfigReader/patConfiguration.php

Revision 2, 1.0 kB (checked in by argh, 3 years ago)

Initial project checkin.

Line 
1 <?php
2
3 class patXMLPretty_ConfigReader_patConfiguration extends patXMLPretty_ConfigReader
4 {
5     function read()
6     {
7         // we need a patConfiguration object
8         $conf =& new patConfiguration();
9
10         // first we need to parse the syntax file
11         $success = $conf->parseConfigFile( dirname( __FILE__ ).'/patConfiguration.xml' );
12         if( patErrorManager::isError( $success ) ) {
13             return $success;
14         }
15
16         // then we parse the syntax definition file
17         $success = $conf->parseConfigFile( $this->options['syntaxFile'] );
18         if( patErrorManager::isError( $success ) ) {
19             return $success;
20         }
21
22         // set the values for each configuration item
23         $values = $conf->getConfigValue();
24         foreach( $values['syntax'] as $confName => $confValue ) {
25             if( $confName == 'colors' || $confName == 'tagColors' ) {
26                 $colors = array();
27                 foreach( $confValue as $color ) {
28                     $colors[$color['id']] = $color['value'];
29                 }
30
31                 $confValue = $colors;
32             }
33
34             $this->$confName = $confValue;
35         }
36
37         $result = true;
38         return $result;
39     }
40 }
41
42 ?>
Note: See TracBrowser for help on using the browser.