X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fxml-functions.php;h=0d487f4e5b42710f43ea0ab223f600acf98b3a8d;hb=a74f3172ce3aee358b460e6c3eb7f4c84180f0bc;hp=6c5e5812a4d7bdb88129ceac0a947fba4d69add8;hpb=596c8ab32594401ca84abfbfe35513ddfff31bec;p=mailer.git diff --git a/inc/xml-functions.php b/inc/xml-functions.php index 6c5e5812a4..0d487f4e5b 100644 --- a/inc/xml-functions.php +++ b/inc/xml-functions.php @@ -40,8 +40,26 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Init XML system +function initXml () { + // All conditions + $GLOBALS['__XML_CONDITIONS'] = array( + // Equals not + 'NOT-EQUALS' => ' != ', + // Is not + 'IS-NOT' => ' IS NOT ', + // Is + 'IS' => ' IS ', + // Equals + 'EQUALS' => ' = ', + ); +} + // Calls back a function based on given XML template data function showEntriesByXmlCallback ($template, $content = array(), $compileCode = TRUE) { + // Init XML system as sch calls will be only used once per run + initXml(); + // Generate FQFN for with special path $FQFN = sprintf("%stemplates/xml/%s%s.xml", getPath(), @@ -257,22 +275,13 @@ function isXmlValueValid ($type, $value) { // Converts given condition into a symbol function convertXmlContion ($condition) { - // Default is an invalid one - $return = '???'; - // Detect the condition again - switch ($condition) { - case 'EQUALS': // Equals - $return = '='; - break; - - default: // Unknown condition - reportBug(__FUNCTION__, __LINE__, 'Condition ' . $condition . ' is unknown/unsupported.'); - break; - } // END - switch + if (!isset($GLOBALS['__XML_CONDITIONS'][$condition])) { + reportBug(__FUNCTION__, __LINE__, 'Condition ' . $condition . ' is unknown/unsupported.'); + } // END - if // Return it - return $return; + return $GLOBALS['__XML_CONDITIONS'][$condition]; } // "Getter" for sql part back from given array