33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2025-01-12 01:45:39 +00:00

Merge pull request #15 from nonumber/patch-1

Fixed unnecessary GPL checks in php files with no code
This commit is contained in:
Daniel Dimitrov 2013-11-05 11:26:34 -08:00
commit 978b38a0b5

View File

@ -80,8 +80,21 @@ class jedcheckerRulesGpl extends JEDcheckerRule
$licenses = $this->params->get('constants'); $licenses = $this->params->get('constants');
$licenses = explode(',', $licenses); $licenses = explode(',', $licenses);
$hascode = 0;
foreach ($content AS $key => $line) foreach ($content AS $key => $line)
{ {
$tline = trim($line);
if ($tline == '' || $tline == '<?php' || $tline == '?>')
{
continue;
}
if ($tline['0'] != '/' && $tline['0'] != '*')
{
$hascode = 1;
}
// Search for GPL license // Search for GPL license
$gpl = stripos($line, 'GPL'); $gpl = stripos($line, 'GPL');
@ -120,6 +133,6 @@ class jedcheckerRulesGpl extends JEDcheckerRule
unset($content); unset($content);
return false; return $hascode ? false : true;
} }
} }