Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not play well with html template #1

Closed
changwuf31 opened this issue Jun 11, 2015 · 4 comments
Closed

Does not play well with html template #1

changwuf31 opened this issue Jun 11, 2015 · 4 comments

Comments

@changwuf31
Copy link

Particularlarly html template with inline php code inside

@pk-fr
Copy link
Owner

pk-fr commented Jun 11, 2015

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.

@pk-fr pk-fr closed this as completed Jun 11, 2015
@pk-fr
Copy link
Owner

pk-fr commented Jun 12, 2015

You can still embed html within php using the echo <<<END ... END; syntax!

@changwuf31
Copy link
Author

Ah.. Thanks for the tip 👍

@Ten0
Copy link

Ten0 commented Mar 22, 2018

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants