diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-17 22:38:52 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-17 22:38:52 +0000 |
commit | c92ef7aced82ba48549bada37b4dcd9091017fd6 (patch) | |
tree | 3d3a5b37a474fb611650d2bb2a3dabef75695138 /core | |
parent | 7cf0313e7b8672d9757f565fd72c8e7dcf1a8904 (diff) |
Fix for ticket #101
Diffstat (limited to 'core')
-rw-r--r-- | core/libraries/L10n_Scanner.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/core/libraries/L10n_Scanner.php b/core/libraries/L10n_Scanner.php index 515aeea0..30fe97c7 100644 --- a/core/libraries/L10n_Scanner.php +++ b/core/libraries/L10n_Scanner.php @@ -58,7 +58,11 @@ class L10n_Scanner_Core { new L10n_Scanner_Directory_Filter_Iterator( new RecursiveDirectoryIterator(DOCROOT)))); foreach ($dir as $file) { - $this->_scan_file($file, $this); + if (strtolower(substr(strrchr($file->getFilename(), '.'), 1)) == "php") { + $this->_scan_php_file($file, $this); + } else { + $this->_scan_info_file($file, $this); + } } } @@ -75,7 +79,7 @@ class L10n_Scanner_Core { } } - private function _scan_file($file, &$message_handler) { + private function _scan_php_file($file, &$message_handler) { $code = file_get_contents($file); $raw_tokens = token_get_all($code); unset($code); @@ -105,6 +109,15 @@ class L10n_Scanner_Core { } } + private function _scan_info_file($file, &$message_handler) { + $code = file_get_contents($file); + print $code . "\n"; + if (preg_match("#description\s*?=\s*(.*)\n#", $code, $matches)) { + print $matches[1] . "\n"; + $message_handler->process_message($matches[1]); + } + } + private function _parse_t_calls(&$tokens, &$call_list, &$message_handler) { foreach ($call_list as $index) { $function_name = $tokens[$index++]; @@ -188,6 +201,7 @@ class L10n_Scanner_File_Filter_Iterator extends FilterIterator { function accept() { // Skip anything that doesn't need to be localized. $filename = $this->getInnerIterator()->getFilename(); - return substr($filename, -4, 4) == ".php"; + $ext = strtolower(substr(strrchr($filename, '.'), 1)); + return in_array($ext, array("php", "info")); } -}
\ No newline at end of file +} |