Changeset 13869
- Timestamp:
- 12/09/08 10:52:42 (1 year ago)
- Files:
-
- branches/1.2/lib/util/sfToolkit.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/util/sfToolkit.class.php
r12169 r13869 186 186 } 187 187 188 $ignore = array(T_COMMENT => true, T_DOC_COMMENT => true); 188 189 $output = ''; 189 190 190 $tokens = token_get_all($source); 191 foreach ($tokens as $token) 192 { 193 if (is_string($token)) 194 { 191 foreach (token_get_all($source) as $token) { 192 // array 193 if (isset($token[1])) { 194 // no action on comments 195 if (!isset($ignore[$token[0]])) { 196 // anything else -> output "as is" 197 $output .= $token[1]; 198 } 199 } else { 195 200 // simple 1-character token 196 201 $output .= $token; 197 }198 else199 {200 // token array201 list($id, $text) = $token;202 203 switch ($id)204 {205 case T_COMMENT:206 case T_DOC_COMMENT:207 // no action on comments208 break;209 default:210 // anything else -> output "as is"211 $output .= $text;212 break;213 }214 202 } 215 203 }

