Code style adjustments

This commit is contained in:
FrancescoUK
2018-04-14 14:40:02 +01:00
parent 5c1baf20b0
commit 4bab3fc4e3
31 changed files with 66 additions and 55 deletions

View File

@@ -22,7 +22,6 @@ class Token_lib
*/
public function render($tokened_text, $tokens = array())
{
// Apply the transformation for the "%" tokens if any are used
if(strpos($tokened_text, '%') !== FALSE)
{
@@ -58,20 +57,21 @@ class Token_lib
{
// Matches tokens with the following pattern: [$token:$length]
preg_match_all('/
\{ # [ - pattern start
([^\s\{\}:]+) # match $token not containing whitespace : { or }
(?:
: # : - separator
([^\s\{\}:]+) # match $length not containing whitespace : { or }
)?
\} # ] - pattern end
/x', $text, $matches);
\{ # [ - pattern start
([^\s\{\}:]+) # match $token not containing whitespace : { or }
(?:
: # : - separator
([^\s\{\}:]+) # match $length not containing whitespace : { or }
)?
\} # ] - pattern end
/x', $text, $matches);
$tokens = $matches[1];
$lengths = $matches[2];
$token_tree = array();
for($i = 0; $i < count($tokens); $i++) {
for($i = 0; $i < count($tokens); $i++)
{
$token_tree[$tokens[$i]][$lengths[$i]] = $matches[0][$i];
}