0) { // User data found $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", " . $data['callback'] . "')"; } } elseif ((!empty($data['callback'])) && (isUserDataValid())) { // "Call-back" alias column for current logged in user's data $functionName = "getUserData('" . $data['callback'] . "')"; } // Do we have another function to run (e.g. translations) if (!empty($data['extra_func'])) { // Surround the original function call with it $functionName = $data['extra_func'] . '(' . $functionName . ')'; } // END - if // Now replace the code $code = str_replace($data['matches'][0][$data['key']], "\" . " . $functionName . " . \"", $data['code']); // Return replaced code return $code; } // Expression call-back function for getting extension data function doExpressionExt ($data) { // Not installed is default $replacer = 'false'; // Is the extension installed? if (isExtensionInstalled($data['matches'][4][$data['key']])) { // Construct call-back function name $functionName = 'getExtension' . ucfirst(strtolower($data['callback'])); // Construct call of the function $replacer = "\" . call_user_func_array('" . $functionName . "', array('" . $data['matches'][4][$data['key']] . "', true)) . \""; } // END - if // Replace it and insert parameter for GET request $code = str_replace($data['matches'][0][$data['key']], sprintf("&ext=%s&ver=%s&rev=\" . getConfig('CURR_SVN_REVISION') . \"", $data['matches'][4][$data['key']], $replacer), $data['code']); // Return replaced code return $code; } // Expression call-back function for getting configuration data // @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again function doExpressionConfig ($data) { // Read configuration $configValue = getConfig($data['matches'][4][$data['key']]); // Construct a new expression $replacer = '{%pipe,' . $data['callback'] . ',' . $configValue . '%}'; // Replace the config entry $code = str_replace($data['matches'][0][$data['key']], $replacer, $data['code']); // Return replaced code return $code; } // Expression call-back function for piping data through functions function doExpressionPipe ($data) { // We need callback and extra_func: callback is really the call-back function, extra_func is our value $replacer = $data['extra_func']; // Do we have a call-back? Should always be there! if (!empty($data['callback'])) { // Parse it through this function $replacer = "\" . " . $data['callback'] . "('" . $replacer . "') . \""; } // END - if // Replace the config entry $code = str_replace($data['matches'][0][$data['key']], $replacer, $data['code']); // Return replaced code return $code; } // Expression call-back function for calling filters function doExpressionFilter ($data) { // Construct replacement $replacer = "\" . runFilterChain('" . $data['matches'][4][$data['key']] . "') . \""; // Run the filter and insert result $code = str_replace($data['matches'][0][$data['key']], $replacer, $data['code']); // Return replaced code return $code; } // Expression call-back function for validator links function doExpressionValidatorLinks ($data) { // Default is nothing $replacer = ''; // Get the code from data array for replacement/pipe-through $code = $data['code']; // Should we generally include validator links? if ((isExtensionInstalled('validator')) && (getConfig('enable_validator') == 'Y') && (!in_array(getModule(), array('admin', 'login')))) { // Load the validator template $replacer = escapeQuotes(loadTemplate('validator_links', true)); } // END - if // Replace the code $code = str_replace($data['matches'][0][$data['key']], $replacer, $code); // Return the (maybe) replaced code return $code; } // Expression call-back for dynamic messages function doExpressionMessage ($data) { // Message string replacement depends on if message is masked if (isMessageMasked($data['callback'])) { // Message should be masked $replacer = "\" . getMaskedMessage('" . $data['callback'] . "', '" . $data['extra_func'] . "') . \""; } else { // Regular message $replacer = "\" . getMessage('" . $data['callback'] . "') . \""; } // Replace the code // @TODO is escapeQuotes enougth for strings with single/double quotes? $code = str_replace($data['matches'][0][$data['key']], $replacer, escapeQuotes($data['code'])); // Return the (maybe) replaced code return $code; } // [EOF] ?>