@@ -111,12 +111,13 @@ public static function loadXML(DOMDocument $dom, $xml)
111111 * @param string|DOMDocument $xml The XML string or document which should be validated.
112112 * @param string $schema The schema filename which should be used.
113113 * @param bool $debug To disable/enable the debug mode
114+ * @param string $schemaPath Change schema path
114115 *
115116 * @return string|DOMDocument $dom string that explains the problem or the DOMDocument
116117 *
117118 * @throws Exception
118119 */
119- public static function validateXML ($ xml , $ schema , $ debug = false )
120+ public static function validateXML ($ xml , $ schema , $ debug = false , $ schemaPath = null )
120121 {
121122 assert (is_string ($ xml ) || $ xml instanceof DOMDocument);
122123 assert (is_string ($ schema ));
@@ -134,7 +135,12 @@ public static function validateXML($xml, $schema, $debug = false)
134135 }
135136 }
136137
137- $ schemaFile = __DIR__ . '/schemas/ ' . $ schema ;
138+ if (isset ($ schemaPath )) {
139+ $ schemaFile = $ schemaPath . $ schema ;
140+ } else {
141+ $ schemaFile = __DIR__ . '/schemas/ ' . $ schema ;
142+ }
143+
138144 $ oldEntityLoader = libxml_disable_entity_loader (false );
139145 $ res = $ dom ->schemaValidate ($ schemaFile );
140146 libxml_disable_entity_loader ($ oldEntityLoader );
@@ -622,7 +628,7 @@ public static function getSelfRoutedURLNoQuery()
622628 if (!empty ($ _SERVER ['REQUEST_URI ' ])) {
623629 $ route = $ _SERVER ['REQUEST_URI ' ];
624630 if (!empty ($ _SERVER ['QUERY_STRING ' ])) {
625- $ route = self ::str_lreplace ($ _SERVER ['QUERY_STRING ' ], '' , $ route );
631+ $ route = self ::strLreplace ($ _SERVER ['QUERY_STRING ' ], '' , $ route );
626632 if (substr ($ route , -1 ) == '? ' ) {
627633 $ route = substr ($ route , 0 , -1 );
628634 }
@@ -644,7 +650,7 @@ public static function getSelfRoutedURLNoQuery()
644650 return $ selfRoutedURLNoQuery ;
645651 }
646652
647- public static function str_lreplace ($ search , $ replace , $ subject )
653+ public static function strLreplace ($ search , $ replace , $ subject )
648654 {
649655 $ pos = strrpos ($ subject , $ search );
650656
0 commit comments