Rewrites/fixes for broken template cache, the actual value was rendered but instead...
authorRoland Häder <roland@mxchange.org>
Sat, 19 Jun 2010 22:14:09 +0000 (22:14 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 19 Jun 2010 22:14:09 +0000 (22:14 +0000)
DOCS/de/TODO.txt
inc/expression-functions.php
inc/filters.php
inc/functions.php
templates/de/html/admin/admin_welcome.tpl
templates/de/html/admin/admin_welcome_admins.tpl
templates/de/html/guest/guest_header.tpl
templates/de/html/member/member_header.tpl
templates/de/html/member/member_support_form.tpl
templates/de/html/show_timings.tpl
templates/en/html/admin/admin_welcome.tpl

index f107a994f91054d43ea62cb413239dd7c152860a..09d5c8f89ef09abd0094c533254c04163e049e96 100644 (file)
@@ -19,6 +19,9 @@
 - CSS-Klassen reduzieren und weiter vereinfachen
 - Von TABLE auf DIV-Container umstellen
 - AJAX einbinden
+- Klick-Smiley unterstuetzen:
+  + Dazu ist es noetig, dass alle vergueteten Klicks zentral gezaehlt werden
+  + Empfehlenswert ist hier ein Filter, der dies samt Gutschrift uebernimmt
 - Hoere auf, "unfreie" Software zu verwenden und trete meiner Community bei.
 - Kaempft gegen Softwarepatente! Das ist Teufelszeug!
 
index c3d1f57f8b9d015880d86593df7a0a472b1f01d1..eebeb6c0d961266befcbc21716c87dc9fb15f54a 100644 (file)
@@ -151,11 +151,8 @@ function doExpressionExt ($data) {
 // 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']]);
-
        // Default replacer is the config value itself
-       $replacer = $configValue;
+       $replacer = '{DQUOTE} . getConfig(' . "'" . $data['matches'][4][$data['key']] . "'" . ') . {DQUOTE}';
 
        // Is there a call-back function provided?
        if (!empty($data['callback'])) {
@@ -175,6 +172,12 @@ 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'];
 
+       // Is the extra_func empty and value set?
+       if ((empty($replacer)) && (isset($data['value']))) {
+               // Then use this
+               $replacer = $data['value'];
+       } // END - if
+
        // Do we have a call-back? Should always be there!
        if (!empty($data['callback'])) {
                // Parse it through this function
index fa28dba40068e882bdf918aab32727d3806a4327..1570488b12a1cc72cd6dd68a52421149052e3cb0 100644 (file)
@@ -436,7 +436,7 @@ function FILTER_COMPILE_CONFIG ($code, $compiled = false) {
        if ($compiled === true) {
                // Run the code
                $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . "\";";
-               //* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:<pre>' . str_replace('$', '&#36;', htmlentities($eval)) . '</pre>');
+               /* DEBUG: */ print(__FUNCTION__.'['.__LINE__.']:<pre>' . str_replace('$', '&#36;', htmlentities($eval)) . '</pre>');
                eval($eval);
        } // END - if
 
@@ -459,15 +459,29 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                // Replace all matches
                foreach ($matches[2] as $key => $cmd) {
                        // Init replacer/call-back variable
-                       $replacer = '';
-                       $callback = '';
+                       $replacer      = '';
+                       $callback      = '';
                        $extraFunction = '';
+                       $value         = '';
 
                        // Extract command and call-back
                        $cmdArray = explode(',', $cmd);
                        $cmd = $cmdArray[0];
-                       if (isset($cmdArray[1])) $callback      = $cmdArray[1];
-                       if (isset($cmdArray[2])) $extraFunction = $cmdArray[2];
+
+                       // Detect call-back function
+                       if (isset($cmdArray[1])) {
+                               // Call-back function detected
+                               $callback = $cmdArray[1];
+                       } // END - if
+
+                       // Detect extra function
+                       if (isset($cmdArray[2])) {
+                               // Also detected
+                               $extraFunction = $cmdArray[2];
+                       } elseif (isset($matches[4][$key])) {
+                               // Use this as value
+                               $value = $matches[4][$key];
+                       }
 
                        // Construct call-back function name for the command
                        $commandFunction = 'doExpression' . ucfirst(strtolower($cmd));
@@ -481,7 +495,8 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                                        'mode'       => $outputMode,
                                        'code'       => $code,
                                        'callback'   => $callback,
-                                       'extra_func' => $extraFunction
+                                       'extra_func' => $extraFunction,
+                                       'value'      => $value
                                );
 
                                // Call it
index 2edf08a02c0c6f72f466af45dc1048472f4f64b0..0a38bdf44108522f4896ade1a1f49c3f22d1dc43 100644 (file)
@@ -49,10 +49,6 @@ function outputHtml ($htmlCode, $newLine = true) {
                $GLOBALS['output'] = '';
        } // END - if
 
-       // Transfer username
-       $username = getMessage('USERNAME_UNKNOWN');
-       if (isset($GLOBALS['username'])) $username = getUsername();
-
        // Do we have HTML-Code here?
        if (!empty($htmlCode)) {
                // Yes, so we handle it as you have configured
@@ -266,9 +262,6 @@ function loadTemplate ($template, $return = false, $content = array()) {
                // Evaluate the cache
                eval(readTemplateCache($template));
        } elseif (!isset($GLOBALS['template_eval'][$template])) {
-               // Add more variables which you want to use in your template files
-               $username = getUsername();
-
                // Make all template names lowercase
                $template = strtolower($template);
 
@@ -1077,11 +1070,11 @@ function compileRawCode ($code, $simple = false, $constants = true, $full = true
        if ($constants === true) {
                // BEFORE 0.2.1 : Language and data constants
                // WITH 0.2.1+  : Only language constants
-               $code = str_replace('{--', "\" . getMessage('", str_replace('--}', "') . \"", $code));
+               $code = str_replace('{--', "{DQUOTE} . getMessage('", str_replace('--}', "') . {DQUOTE}", $code));
 
                // BEFORE 0.2.1 : Not used
                // WITH 0.2.1+  : Data constants
-               $code = str_replace('{!', "\" . constant('", str_replace('!}', "') . \"", $code));
+               $code = str_replace('{!', "{DQUOTE} . constant('", str_replace('!}', "') . {DQUOTE}", $code));
        } // END - if
 
        // Compile QUOT and other non-HTML codes
@@ -2426,7 +2419,7 @@ function displayParsingTime () {
        // Prepare output
        // @TODO This can be easily moved out after the merge from EL branch to this is complete
        $content = array(
-               'run_time' => translateComma($runTime),
+               'run_time' => $runTime,
                'sql_time' => translateComma(getConfig('sql_time') * 1000),
        );
 
@@ -3618,9 +3611,6 @@ function flushTemplateCache ($template, $eval) {
                // Generate FQFN
                $FQFN = generateCacheFqfn($template);
 
-               // Replace username with a call
-               $eval = str_replace('$username', '".getUsername()."', $eval);
-
                // And flush it
                writeToFile($FQFN, $eval, true);
        } // END - if
index 351e0f2d7e9ce063b6a23291c749f39c38ca363a..5c24091bbd9835e32f4df743e587dcebb6357ac2 100644 (file)
@@ -7,7 +7,7 @@
        <tr>
                <td>
                        <div align="left" class="tiny">
-                               Hallo $username!
+                               Hallo {%pipe,getUsername%}!
                        </div>
                </td>
                <td align="center" width="300" class="dashed tiny">
index 0e7078c96045909882ac3f2c6defe23044e7208a..afa73d449b0d1c8d64f6b3c7621b32e439bbd43a 100644 (file)
@@ -4,7 +4,7 @@
        <tr>
                <td>
                        <div align="left" class="medium">
-                               Hallo $username!
+                               Hallo {%pipe,getUsername%}!
                        </div>
                </td>
                <td align="center" width="300" class="dashed tiny">
index b3dcdedc4ebf7944cdaffa9ed1bad6243ec77981..f39efa08983b70ee5ab553839369ee8e678d78dc 100644 (file)
@@ -9,7 +9,7 @@
                        class="guest_header">{?MAIN_TITLE?}</a>&nbsp;-&nbsp;-&nbsp;-</big></strong>
                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
-                               <td width="200"><div class="guest_header">Hallo $username!</div></td>
+                               <td width="200"><div class="guest_header">Hallo {%pipe,getUsername%}!</div></td>
                                <td align="center"><div class="guest_header">{?SLOGAN?}</div></td>
                                <td width="200" align="right"><div class="guest_header">$content[date_time]</div></td>
                        </tr>
index 9b0ba9e4c407e84688c0c6e3fcca29598eb96fe2..ec61a8dcb484699cde641ec9aa58870f8535b4be 100644 (file)
@@ -14,7 +14,7 @@
                <tr>
                        <td width="200">
                                <div class="guest_header">
-                                       Hallo $username!
+                                       Hallo {%pipe,getUsername%}!
                                </div>
                        </td>
                        <td align="center">
index 2cb1543d2be1c9497ab4a9c19c0c0727a2f0374e..9194b7544f6e41e379decf3a707b27fe2e808ed4 100644 (file)
@@ -34,7 +34,7 @@
 <div class="bottom2">
        <div align="left" class="pre">
                Mit freundlichen Gr&uuml;&szlig;en,<br />
-               Ihr $username
+               Ihr {%pipe,getUsername%}
        </div>
 </div>
 
index e9fffa08802ef62af4bf3f5699bf1de900967362..cfa2d464daad64a0cadd009d1f4b233d735d7f8b 100644 (file)
@@ -2,7 +2,7 @@
 <ul class="show_timings_block">
        <li class="show_timings_column" style="margin-left: 2px"><span class="show_timings_column">
                {--SHOW_TIMINGS_RUNTIME--}
-               <span class="show_timings_data">$content[run_time] {--SHOW_TIMINGS_SECS--}</span>
+               <span class="show_timings_data">{%pipe,translateComma=$content[run_time]%} {--SHOW_TIMINGS_SECS--}</span>
        </span></li>
        <li class="show_timings_column" style="margin-left: 2px"><span class="show_timings_column">
                {--SHOW_TIMINGS_SQL_QUERIES--}
index 619da679f594b7ad374b868a773d47773e636479..dac7ad74f01d4266a41cf73c1ce950876646de74 100644 (file)
@@ -1,3 +1,3 @@
 <strong>: : : Welcome to the administration&#39;s area : : :</strong>
 <br />
-<div align="left" class="tiny">Hello $username !</div>
+<div align="left" class="tiny">Hello {%pipe,getUsername%} !</div>