@@ -58,53 +58,53 @@ |
||
| 58 | 58 | $tokens = token_get_all($source); |
| 59 | 59 | |
| 60 | 60 | $translateTags = array_merge($this->gettextTags, $this->pgettextTags, $this->ngettextTags); |
| 61 | - $commentText=null; |
|
| 62 | - $commentLine=(-10); |
|
| 61 | + $commentText = null; |
|
| 62 | + $commentLine = (-10); |
|
| 63 | 63 | $tokenCount = count($tokens); |
| 64 | 64 | $i = 0; |
| 65 | - while ($i<$tokenCount) { |
|
| 65 | + while ($i < $tokenCount) { |
|
| 66 | 66 | $token = $tokens[$i]; |
| 67 | - if (is_array($token) && $token[0] == T_STRING && in_array($token[1], $translateTags)) { |
|
| 67 | + if (is_array($token) && $token[0]==T_STRING && in_array($token[1], $translateTags)) { |
|
| 68 | 68 | $entry = new PoEntry; |
| 69 | 69 | $gtt = array(); |
| 70 | 70 | list(, $text, $line) = $token; |
| 71 | - $entry->add(PoTokens::REFERENCE, $refname . ':' . $line); |
|
| 72 | - $gtt['line']=$line; |
|
| 73 | - $gtt['function']=$text; |
|
| 71 | + $entry->add(PoTokens::REFERENCE, $refname.':'.$line); |
|
| 72 | + $gtt['line'] = $line; |
|
| 73 | + $gtt['function'] = $text; |
|
| 74 | 74 | $gtt['args'] = array(); |
| 75 | 75 | $la = 1; |
| 76 | - while (is_array($tokens[$i + $la]) && $tokens[$i + $la][0] == T_WHITESPACE) { |
|
| 76 | + while (is_array($tokens[$i + $la]) && $tokens[$i + $la][0]==T_WHITESPACE) { |
|
| 77 | 77 | $la++; |
| 78 | 78 | } |
| 79 | - if ($tokens[$i + $la] == '(') { |
|
| 80 | - while ((')' != $token=$tokens[$i + $la]) && ($la < 10)) { |
|
| 79 | + if ($tokens[$i + $la]=='(') { |
|
| 80 | + while ((')'!=$token = $tokens[$i + $la]) && ($la < 10)) { |
|
| 81 | 81 | if (is_array($token) && ( |
| 82 | - $token[0] == T_CONSTANT_ENCAPSED_STRING |
|
| 83 | - || $token[0] == T_ENCAPSED_AND_WHITESPACE |
|
| 82 | + $token[0]==T_CONSTANT_ENCAPSED_STRING |
|
| 83 | + || $token[0]==T_ENCAPSED_AND_WHITESPACE |
|
| 84 | 84 | )) { |
| 85 | 85 | list(, $text, $line) = $token; |
| 86 | - $gtt['args'][]=$text; |
|
| 86 | + $gtt['args'][] = $text; |
|
| 87 | 87 | } |
| 88 | 88 | $la++; |
| 89 | 89 | } |
| 90 | 90 | if (count($gtt['args'])) { |
| 91 | 91 | if (in_array($gtt['function'], $this->gettextTags)) { |
| 92 | 92 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][0])); |
| 93 | - } elseif (count($gtt['args'])>1 && in_array($gtt['function'], $this->pgettextTags)) { |
|
| 93 | + } elseif (count($gtt['args']) > 1 && in_array($gtt['function'], $this->pgettextTags)) { |
|
| 94 | 94 | $entry->set(PoTokens::CONTEXT, $this->escapeForPo($gtt['args'][0])); |
| 95 | 95 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][1])); |
| 96 | - } elseif (count($gtt['args'])>1 && in_array($gtt['function'], $this->ngettextTags)) { |
|
| 96 | + } elseif (count($gtt['args']) > 1 && in_array($gtt['function'], $this->ngettextTags)) { |
|
| 97 | 97 | $entry->set(PoTokens::MESSAGE, $this->escapeForPo($gtt['args'][0])); |
| 98 | 98 | $entry->set(PoTokens::PLURAL, $this->escapeForPo($gtt['args'][1])); |
| 99 | 99 | } |
| 100 | 100 | $this->checkPhpFormatFlag($entry); |
| 101 | - if ($gtt['line']==($commentLine+1)) { |
|
| 101 | + if ($gtt['line']==($commentLine + 1)) { |
|
| 102 | 102 | $entry->set(PoTokens::EXTRACTED_COMMENTS, $this->stripComment($commentText)); |
| 103 | 103 | } |
| 104 | 104 | $this->poFile->mergeEntry($entry); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - } elseif (is_array($token) && $token[0] == T_COMMENT) { |
|
| 107 | + } elseif (is_array($token) && $token[0]==T_COMMENT) { |
|
| 108 | 108 | list(, $commentText, $commentLine) = $token; |
| 109 | 109 | } |
| 110 | 110 | $i++; |