basedir, '.php$', true, true); // Iterate through all files foreach($files as $file) { // Try to find the base64 use in the file if($this->find($file)) { // Add as error to the report if it was not found $this->report->addError($file, 'COM_JEDCHECKER_ERROR_ENCODING'); } } } /** * Reads a file and searches for any encoding function defined in the params * Not a very clever way of doing this, but it should be fine for now * * @param string $file The path to the file * @return boolean True if the statement was found, otherwise False. */ protected function find($file) { $content = (array) file($file); // Get the functions to look for $encodings = explode(',', $this->params->get('encodings')); foreach($encodings as $encoding) { $encoding = trim($encoding); foreach ($content AS $line) { // Search for "base64" $pos_1 = stripos($line, $encoding); if ($pos_1 !== false) { return true; } } } return false; } }