} // END - if
// Calls back a function based on given XML template data
-function showEntriesByXmlCallback ($template) {
+function showEntriesByXmlCallback ($template, $content = array(), $compileCode = TRUE) {
// Generate FQFN for with special path
$FQFN = sprintf("%stemplates/xml/%s%s.xml",
getPath(),
- detectExtraTemplatePath($template),
+ detectExtraTemplatePath('xml', $template),
$template
);
// Is it again readable?
if (isFileReadable($FQFN)) {
- // Read it
- $templateContent = readFromFile($FQFN);
+ // Is there cache?
+ if ((!isDebuggingTemplateCache()) && (isTemplateCached('xml', $template))) {
+ // Evaluate the cache
+ eval(readTemplateCache('xml', $template));
+ } else {
+ // Read it
+ $templateContent = readFromFile($FQFN);
+
+ // Prepare it for finaly eval() command
+ $GLOBALS['template_eval']['xml'][$template] = '$templateContent = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($templateContent), FALSE, TRUE, TRUE, $compileCode) . '");';
+
+ // Eval the code, this does insert any array elements from $content
+ eval($GLOBALS['template_eval']['xml'][$template]);
+ }
// Init main arrays
$GLOBALS['__XML_CALLBACKS'] = array(
// Adds special elements by calling back another template-depending function
function addXmlSpecialElements ($template) {
- // Generate the FQCN (Full-Qualified CallbackName)
+ // Generate the FQCN (Full-Qualified Callback Name)
$FQCN = 'addXmlSpecial' . capitalizeUnderscoreString($template);
// Is it there?
if (function_exists($FQCN)) {
// Call it
call_user_func($FQCN);
- } else {
+ } elseif (isDebugModeEnabled()) {
// This callback function is only optional
logDebugMessage(__FUNCTION__, __LINE__, 'Call-back function ' . $FQCN . ' for template ' . $template . ' does not exist.');
}
// Parses the XML content
function parseXmlData ($content) {
- // Do we have recode?
+ // Is there recode?
if (!function_exists('recode')) {
// No fallback ATM
reportBug('PHP extension recode is missing. Please install it.');
$xmlParser = xml_parser_create();
// Force case-folding to on
- xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true);
+ xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, TRUE);
// Set UTF-8
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
function doCallXmlCallbackFunction () {
// Loop through all added entries
foreach ($GLOBALS['__XML_CALLBACKS']['callbacks'] as $callback) {
- // Do we have the entry?
+ // Is there the entry?
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 spaces away
$characters = trim($characters);
- // Do we have some to handle?
+ // Are there some to handle?
if (strlen($characters) == 0) {
// Nothing to handle
return;
// Init SQL part
$sqlPart = '';
- // Do we have a table/alias
+ // Is there a table/alias
if (!empty($columnArray['table'])) {
// Pre-add it
$sqlPart .= $columnArray['table'] . '.';
// Searches in given XML array for value and returns the parent index
function searchXmlArray ($value, $columns, $childKey) {
// Default is not found
- $return = false;
+ $return = FALSE;
// Walk through whole array
foreach ($columns as $key => $columnArray) {