]> git.mxchange.org Git - mailer.git/blobdiff - inc/xml-functions.php
More fixes, debug lines commented out
[mailer.git] / inc / xml-functions.php
index 0d487f4e5b42710f43ea0ab223f600acf98b3a8d..ff62e48d5d128204f01abb83df4a700338e9fc99 100644 (file)
@@ -56,7 +56,7 @@ function initXml () {
 }
 
 // Calls back a function based on given XML template data
-function showEntriesByXmlCallback ($template, $content = array(), $compileCode = TRUE) {
+function doGenericXmlTemplateCallback ($template, $content = array(), $compileCode = TRUE) {
        // Init XML system as sch calls will be only used once per run
        initXml();
 
@@ -100,6 +100,7 @@ function showEntriesByXmlCallback ($template, $content = array(), $compileCode =
                );
                $GLOBALS['__XML_ARGUMENTS'] = array();
                $GLOBALS['__COLUMN_INDEX']  = array();
+               $GLOBALS['__XML_CONTENT']   = $content;
 
                // Handle it over to the parser
                parseXmlData($templateContent);
@@ -108,7 +109,7 @@ function showEntriesByXmlCallback ($template, $content = array(), $compileCode =
                addXmlSpecialElements($template);
 
                // Call the call-back function
-               doCallXmlCallbackFunction();
+               doCallXmlCallbackFunction($content);
        } else {
                // Template not found
                displayMessage('{%message,XML_TEMPLATE_404=' . $template . '%}');
@@ -188,11 +189,11 @@ function doCallXmlCallbackFunction () {
                                // Is it there?
                                if (!function_exists($callbackName)) {
                                        // No, then please add it
-                                       reportBug(__FUNCTION__, __LINE__, 'callback=' . $callback . ',function=' . $function . 'arguments()=' . count($GLOBALS['__XML_ARGUMENTS'][$callback]) . ' - execute call-back does not exist.');
+                                       reportBug(__FUNCTION__, __LINE__, 'callback=' . $callback . ',function=' . $function . ',arguments()=' . count($GLOBALS['__XML_ARGUMENTS'][$callback]) . ',content()=' . count($GLOBALS['__XML_CONTENT']) . ' - execute call-back does not exist.');
                                } // END - if
 
                                // Call it
-                               call_user_func_array($callbackName, array($function, $GLOBALS['__XML_ARGUMENTS'][$callback], $GLOBALS['__COLUMN_INDEX'][$callback]));
+                               call_user_func_array($callbackName, array($function, $GLOBALS['__XML_ARGUMENTS'][$callback], $GLOBALS['__COLUMN_INDEX'][$callback], $GLOBALS['__XML_CONTENT']));
                        } // END - foreach
                } else {
                        // Not found
@@ -328,7 +329,8 @@ function searchXmlArray ($value, $columns, $childKey) {
                assert(isset($columnArray[$childKey]));
 
                // Now is it what we are looking for?
-               if ($columnArray[$childKey] == $value) {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ',key=' . $key . ',childKey=' . $childKey . ',columnArray=' . $columnArray[$childKey]);
+               if ($columnArray[$childKey] === $value) {
                        // Remember this match
                        $return = $key;