]> git.mxchange.org Git - mailer.git/blobdiff - inc/callback-functions.php
Updated domain without a dash :(
[mailer.git] / inc / callback-functions.php
index ee0a38754b81a06286df01a0cad446d3b53a0799..0f800a2fd3dfadf5b1d73faa2be5a5a4d5f99319 100644 (file)
@@ -1290,7 +1290,7 @@ function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
        // There are three attributes, by default
        if (count($attributes) != 3) {
                // Not the right count
-               reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
+               reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
        } elseif (!isset($attributes['COLUMN'])) {
                // 'COLUMN' not found
                reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
@@ -1300,15 +1300,18 @@ function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
        } elseif (!isInvalidXmlType($attributes['TYPE'])) {
                // No valid type
                reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
-       } elseif (!isset($attributes['VALUE'])) {
+       } elseif ((!isset($attributes['VALUE'])) && (!isset($attributes['DATA']))) {
                // 'VALUE' not found
-               reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
-       } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
+               reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE/DATA not found.');
+       } elseif ((isset($attributes['VALUE'])) && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
                // 'VALUE' not valid/verifyable
                reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
        } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
-               // doXmlCallbackFunction is missing
+               // doXmlCallbackFunction/__EXTRA_PARAMETER is missing
                reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
+       } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
+               // doXmlCallbackFunction/data_column_list is missing
+               reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data_column_list not included around this node.');
        }
 
        // Add the entry to the array
@@ -1320,7 +1323,7 @@ function doXmlNoEntryFoundMessage ($resource, $attributes) {
        // There are two attributes, by default
        if (count($attributes) != 2) {
                // Not the right count
-               reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
+               reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
        } elseif (!isset($attributes['VALUE'])) {
                // 'VALUE' not found
                reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
@@ -1509,9 +1512,16 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '',
                );
                //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - TYPE-COLUMN! (COLUMN=' . $attributes['COLUMN'] . ')');
                $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
-       } elseif (isset($attributes['COLUMN'])) {
+       } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['VALUE']))) {
                // COLUMN/VALUE detected
-               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
+               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/VALUE!');
+               if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) {
+                       $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array();
+               } // END - if
+               $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE'];
+       } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['DATA']))) {
+               // COLUMN/DATA detected
+               //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',DATA[' . gettype($attributes['DATA']) . ']=' . $attributes['DATA'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/DATA!');
                if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) {
                        $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array();
                } // END - if
@@ -1530,10 +1540,13 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '',
        } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
                // Already created
                reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, TRUE) . '</pre>');
-       } else {
-               // Use from NAME
+       } elseif ((isset($attributes['NAME'])) && (isset($attributes['VALUE']))) {
+               // Use from NAME/VALUE
                //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
                $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
+       } else {
+               // Unknown stage
+               reportBug(__FUNCTION__, __LINE__, 'Unexpected stage detected. element=' . $element . ',attributes()=' . count($attributes));
        }
        //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
 }