コード例 #1
0
/* required PHP */
if (version_compare(PHP_VERSION, $ver, '<')) {
    die("PHP {$ver}+ version is required");
} else {
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', true);
    ini_set('log_errors', false);
}
require 'PackApp.php';
// main class, loads the others if needed
$old = 'tests';
// source folder
$new = 'tests.zip';
// destination zipped
/* js and php obfuscation; maximum replacement of the PHP identifiers except 'vv' identifier; defined constants can be case-insensitive */
$obj = new PackApp(3, ['ids' => 'VdHFTC', 'exi' => ['vv']]);
// instantiate
$rlt = $obj->Pack($old, $new, true);
// pack the source and get result data; replace existing data
header('Content-Type: text/html; charset=utf-8');
if (is_string($rlt['factor'])) {
    echo $rlt['factor'];
    // switch to setup
} else {
    $r = $rlt['code'] == 'ok' ? 'string' : 'prompt';
    // either protocol or message
    echo str_replace(["\t", "\n"], ['&nbsp;&nbsp;', '<br>'], $rlt[$r]);
    // display with html
}
if ($rlt['code'] == 'ok') {
    //success
コード例 #2
0
 /**
  * foreign action
  */
 public static function Packer()
 {
     $obj = new PackApp(-1);
     $rsp = str_replace("\n", '<br>', $obj->Request());
     // display in html
     header("Content-Type: text/html; charset=utf-8");
     return $rsp;
 }