// Added comments in a function
This commit is contained in:
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;
|
||||||
|
|||||||
Reference in new issue
Block a user