]> git.mxchange.org Git - mailer.git/blobdiff - inc/xml-functions.php
Extension ext-surfbar continued, fixes:
[mailer.git] / inc / xml-functions.php
index 04550bc6da6afa1f1901b1efb6bbd93ff1cdc5b4..8958bdb157f30000cfa7ccc8dfcd1ee7f2bb4701 100644 (file)
@@ -63,6 +63,13 @@ function showEntriesByXmlCallback ($template) {
                // Read it
                $templateContent = readFromFile($FQFN);
 
+               // Init main arrays
+               $GLOBALS['__XML_CALLBACKS'] = array(
+                       'callbacks' => array(),
+                       'functions' => array()
+               );
+               $GLOBALS['__XML_ARGUMENTS'] = array();
+
                // Handle it over to the parser
                parseXmlData($templateContent);
 
@@ -117,6 +124,15 @@ function doCallXmlCallbackFunction () {
                if ((isset($GLOBALS['__XML_CALLBACKS']['functions'][$callback])) && (isset($GLOBALS['__XML_ARGUMENTS'][$callback]))) {
                        // Run all function callbacks
                        foreach ($GLOBALS['__XML_CALLBACKS']['functions'][$callback] as $function) {
+                               // Trim all function names
+                               $function = trim($function);
+
+                               // If the function is empty, simply skip to the (maybe) next one
+                               if (empty($function)) {
+                                       // Skip this
+                                       continue;
+                               } // END - if
+
                                // Now construct the call-back function's name with 'Execute' at the end
                                $callbackName = $callback . 'Execute';
 
@@ -135,9 +151,9 @@ function doCallXmlCallbackFunction () {
        } // END - foreach
 }
 
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 //                     Call-back functions for XML parser
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 
 // Starts an element
 function startXmlElement ($resource, $element, $attributes) {
@@ -178,7 +194,7 @@ function isInvalidXmlType ($type) {
        $type = strtolower(trim($type));
 
        // Is it found?
-       return (in_array($type, array('string', 'array', 'bool')));
+       return (in_array($type, array('string', 'array', 'bool', 'int')));
 }
 
 // Checks if given value is valid/verifyable