protected static function conf_apply_values () { //NB: this is for sutiations, when modules or events are fetched when config file is not ready yet. //NB: for example, event to notify about fatal error, but if this error occured in config reading. if (is_null(self::$conf_xpath) || is_null(self::$conf_element)) throw new coren_exception_/*!!!*/("Configuration is not ready for parsing."); //!!!todo: make it so that extension is either loaded from config, or determined by coren's extension. //!!!todo: so it is not contstant, and used only internally in coren main class. //!!!todo: f.e., <load-class-extention='php'/> or <load-class-base='%s.php'/> if (!defined('COREN_EXTENSION')) define('COREN_EXTENSION', '.' . pathinfo(__FILE__, PATHINFO_EXTENSION));//!!!! /*rts*/ $query = "coren:rts-verbosity"; /*rts*/ $nodes = self::$conf_xpath->query($query, self::$conf_element); /*rts*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <rts-verbosity> element allowed."); /*rts*/ if ($nodes->length > 0) self::$rts_verbosity = trim($nodes->item(0)->nodeValue); /*rts*/ /*rts*/ $query = "coren:rts-prefix"; /*rts*/ $nodes = self::$conf_xpath->query($query, self::$conf_element); /*rts*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <rts-prefix> element allowed."); /*rts*/ if ($nodes->length > 0) self::$rts_prefix = $nodes->item(0)->nodeValue; /*rts*/ /*rts*/ $query = "coren:rts-suffix"; /*rts*/ $nodes = self::$conf_xpath->query($query, self::$conf_element); /*rts*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <rts-suffix> element allowed."); /*rts*/ if ($nodes->length > 0) self::$rts_suffix = $nodes->item(0)->nodeValue; $query = "coren:load-class-root"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*xcc*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Too many root dependecies. Only one must be."); if ($nodes->length > 0) self::$load_class_root = trim($nodes->item(0)->nodeValue); $query = "coren:load-class-path"; $nodes = self::$conf_xpath->query($query, self::$conf_element); foreach ($nodes as $node) { //!!!todo: check if it has children (it must not; throw if it has them). //!!!todo: trim, then skip empty(?) self::$load_class_path[] = trim($node->nodeValue); } $query = "coren:load-class-file"; $nodes = self::$conf_xpath->query($query, self::$conf_element); foreach ($nodes as $node) { $class = $node->getAttributeNS(self::conf_xml_ns_uri, 'class'); //!!!todo: check that class is not empty (i.e. is set); throw otherwise. //!!!todo: check if it has children (it must not; throw if it has them). //!!!todo: trim, then skip empty(?) self::$load_class_file[$class] = trim($node->nodeValue); } $query = "coren:default-database"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <database> element allowed."); if ($nodes->length > 0) self::$default_database = trim($nodes->item(0)->getAttributeNS(self::conf_xml_ns_uri, 'name')); $query = "coren:template-of-name"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <autoname> element allowed."); if ($nodes->length > 0) self::$template_of_name = trim($nodes->item(0)->getAttributeNS(self::conf_xml_ns_uri, 'name')); $query = "coren:response-at-top"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <response-at-top> element allowed."); if ($nodes->length > 0) self::$response_at_top = true; $query = "coren:response-prefix"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <response-prefix> element allowed."); if ($nodes->length > 0) self::$response_prefix = $nodes->item(0)->nodeValue;; $query = "coren:response-suffix"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <response-suffix> element allowed."); if ($nodes->length > 0) self::$response_suffix = $nodes->item(0)->nodeValue;; //!!!todo: <response-encoding>, <default-xslt-format> ? $query = "coren:prefetch-modules"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <prefetch-modules> element allowed."); if ($nodes->length > 0) self::$prefetch_modules = true; $query = "coren:prefetch-handlers"; $nodes = self::$conf_xpath->query($query, self::$conf_element); /*err*/ if ($nodes->length > 1) throw new coren_exception_config_/*!!!*/("Only one <prefetch-handlers> element allowed."); if ($nodes->length > 0) self::$prefetch_handlers = true; }