]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
'guest' may come when e.g. ext-nickname is not installed but a template requested...
[mailer.git] / inc / template-functions.php
index db267b113768e33b7e34ef9cd580f6a2b3e7226c..29e3e092db01218a48b7830291dd3de344f83786 100644 (file)
@@ -217,6 +217,9 @@ function doFinalCompilation ($code, $insertComments = true, $enableCodes = true)
        // Init counter
        $count = 0;
 
+       // Compile the raw code
+       $code = compileRawCode($code);
+
        // Compile all out
        while (((strpos($code, '{--') !== false) || (strpos($code, '{DQUOTE}') !== false) || (strpos($code, '{?') !== false) || (strpos($code, '{%') !== false)) && ($count < 7)) {
                // Init common variables
@@ -426,6 +429,7 @@ function detectExtraTemplatePath ($template) {
 
 // Loads an email template and compiles it
 function loadEmailTemplate ($template, $content = array(), $userid = '0', $loadUserData = true) {
+       // @TODO $DATA is deprecated and should be avoided and replaced with $content
        global $DATA;
 
        // Make sure all template names are lowercase!
@@ -617,8 +621,8 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
        $code = str_replace($secChars['to'], $secChars['from'], $code);
 
        // Find $content[bla][blub] entries
-       // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
-       preg_match_all('/\$(content|GLOBALS|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
+       // @TODO Do only use $content and deprecate $DATA in templates
+       preg_match_all('/\$(content|DATA)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
 
        // Are some matches found?
        if ((count($matches) > 0) && (count($matches[0]) > 0)) {
@@ -644,7 +648,9 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
                        } // END - foreach
 
                        // Skip this entry?
-                       if ($fuzzyFound === true) continue;
+                       if ($fuzzyFound === true) {
+                               continue;
+                       } // END - if
 
                        // Take all string elements
                        if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key.'_' . $matches[4][$key]]))) {
@@ -1693,8 +1699,8 @@ function generateMetaDescriptionCode () {
                $GLOBALS['page_header'] .= '<meta name="description" content="' . $DESCR . '" />';
        } // END - if
 
-       // Remove depth
-       unset($GLOBALS['ref_level']);
+       // Initialize referal system
+       initReferalSystem();
 }
 
 // Generates an FQFN for template cache from the given template name