PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Vallo Reima  >  PHP Application Packer  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Application Packer
Create packages of project files for distribution
Author: By
Last change: Update example.php
Date: 2 years ago
Size: 1,302 bytes
 

 

Contents

Class file image Download
<?php

/**
 * PHP Application Packer (PackApp.php)
 *
 * The usage sample
 *
 * @package Packer
 * @author Vallo Reima
 * @copyright (C)2015
 */
$ver = '5.4'; /* 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.zip'; // source zipped
$new = 'tests_pkd'; // destination folder

/* 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
 
file_put_contents(pathinfo(__FILE__, PATHINFO_FILENAME) . '.txt', $rlt['string']); // save the protocol
}


For more information send a message to info at phpclasses dot org.