A configuration preset represents a set of obfuscation settings grouped together under a single name.
A preset offers more friendly usage when using script tags to include JavaScript files in the HTML pages through the obfuscator.
So, instead of:
<script src="jso.php?rjs=repository-name/my-js-code.js&doDecoy=true&doMinify=true&doLockDomain=true&doScrambleVars=true&encryptionLevel=2&expirationDate=2090-12-12" type="text/javascript"></script>
You can have:
<script src="jso.php?rjs=repository-name/my-js-code.js&cfg=my-configuration" type="text/javascript"></script>
Each of the samples above will lead to the same result if you make sure you have a configuration preset named "my-configuration".
Just create a new .php (ex. my-configuration.php) file under the /php-javascript-obfuscator/config directory and make it look like this:
<?php $config = new wlJSOConfig(); $config->DO_DECOY = true; $config->DO_MINIFY = true; $config->DO_LOCK_DOMAIN = true; $config->DO_SCRAMBLE_VARS = true; $config->ENCRYPTION_LEVEL = 1; $config->SHOW_JS_LOCK_ALERTS = false; $config->CACHE_LEVEL = 2; $config->EXPIRATION_DATE = null; $config->SHOW_WISELOOP_SIGNATURE = true; return $config;
Edit the file and tune the configuration settings according to your needs.
To include an obfuscated JavaScript file with those configuration preset settings, use the following snippet:
<script src="jso.php?rjs=my-app-repository/my-js-code.js&cfg=my-configuration" type="text/javascript"></script>
Each settings is quite self-explanatory but please refer to Protection Techniques and Features to find out more about each setting included in the configuration preset.
Also, you may refer to wlJSOConfig class to have a very closer look to each setting.
For your convenience, a few configuration presets exists already and they are ready to be used: default, minify, decent, hard, paranoid.
They should be enough for a large usage scenarios and you can just use them directly, or you can copy-rename-modify and use them as templates to create your own presets - just make sure the given pattern is followed.
Example:
<script src="jso.php?rjs=my-app-repository/my-js-code.js&cfg=minify" type="text/javascript"></script>
The example above will use the "minify" configuration preset and will do only minification on the "my-js-code.js" as all the other settings are tuned off (without encryption, no variable scrambling etc.).
If no configuration preset is specified when including JavaScript files, the default one is used by default. So, this:
<script src="jso.php?rjs=my-app-repository/my-js-code.js" type="text/javascript"></script>
is equivalent with this:
<script src="jso.php?rjs=my-app-repository/my-js-code.js&cfg=default" type="text/javascript"></script>
Obfuscate, scramble, minimize, domain lock, set an expiration date and encrypt your JavaScript code to protect it against theft!
This safe JavaScript anti-theft protection allows you to deliver live obfuscated encrypted JavaScript code by online processing the original source code directly on the server side, so no offline processing is needed. Just copy your original JavaScript source code to the server, and deliver it to the browser through the WiseLoop PHP Javascript Obfuscator and you will be protected against theft.