Closed changwuf31 closed 9 years ago
Updated README.md with:
Note: This tool has been written to obfuscate pure php sources.
it is not intended to be used with html and embeded php inside.
You can still embed html within php using the echo <<<END ... END; syntax!
Ah.. Thanks for the tip :+1:
Hello, I would like to know if you have any suggestion as to how we could hence convert these mixed html/php files to pure php files (I mean, not manually) before putting them through your tool, since many of the things we may want to obfuscate, as users of this tool, contains mixed html and php. I couldn't find any tool that does this, they all convert pure html to php. NB: Converting pure html blocks to php should be pretty easy using a small set of regexes.
EDIT: I ended up writing my own code for this, feel free to integrate it :)
$c = preg_replace_callback('/\?>(.*)<\?php/sU', function ($match) {
return '; echo \''.str_replace(array('\\', "'", "\n"), array('\\\\', "\\'", '\'."\\n".\''), $match[1]).'\';';
}, '<?php ?>'.$c.'<?php ?>');
(Note that as an alternate version where you don't need to preserve line breaks within the generated html source code you could use a single space ' '
instead of '\'."\\n".\''
, which would also result in a smaller final file, additionally getting rid of the .''
and ''.
kind of stuff.)
Particularlarly html template with inline php code inside