// Added comments in a function

This commit is contained in:
Damien Metzger committed 2013-01-29 10:16:02 +01:00
1 parent 734b227a7f
commit 6f7e8cb741
1 file changed
+10
@@ -604,22 +604,32 @@ class AdminTranslationsControllerCore extends AdminController
$global = false; $global = false;
foreach ($lines as $line) foreach ($lines as $line)
{ {
// PHP tags
if (in_array($line, array('<?php', '?>', ''))) if (in_array($line, array('<?php', '?>', '')))
continue; continue;
// Global variable declaration
if (!$global && preg_match('/^global\s+\$([a-z0-9-_]+)\s*;$/i', $line, $matches)) if (!$global && preg_match('/^global\s+\$([a-z0-9-_]+)\s*;$/i', $line, $matches))
{ {
$global = $matches[1]; $global = $matches[1];
continue; continue;
} }
// Global variable initialization
if ($global != false && preg_match('/^\$'.preg_quote($global, '/').'\s*=\s*array\(\s*\)\s*;$/i', $line)) if ($global != false && preg_match('/^\$'.preg_quote($global, '/').'\s*=\s*array\(\s*\)\s*;$/i', $line))
continue; continue;
// Global variable initialization without declaration
if (!$global && preg_match('/^\$([a-z0-9-_]+)\s*=\s*array\(\s*\)\s*;$/i', $line, $matches)) if (!$global && preg_match('/^\$([a-z0-9-_]+)\s*=\s*array\(\s*\)\s*;$/i', $line, $matches))
{ {
$global = $matches[1]; $global = $matches[1];
continue; continue;
} }
// Assignation
if (preg_match('/^\$'.preg_quote($global, '/').'\[\''._PS_TRANS_PATTERN_.'\'\]\s*=\s*\''._PS_TRANS_PATTERN_.'\'\s*;$/i', $line)) if (preg_match('/^\$'.preg_quote($global, '/').'\[\''._PS_TRANS_PATTERN_.'\'\]\s*=\s*\''._PS_TRANS_PATTERN_.'\'\s*;$/i', $line))
continue; continue;
// Sometimes the global variable is returned...
if (preg_match('/^return\s+\$'.preg_quote($global, '/').'\s*;$/i', $line, $matches)) if (preg_match('/^return\s+\$'.preg_quote($global, '/').'\s*;$/i', $line, $matches))
continue; continue;
return false; return false;