From 88f65184060e8d4e33c5bd8c5fadac8c1b271dfe Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Wed, 28 May 2014 07:42:50 +0700 Subject: [PATCH] Init VERSION and improve requirement checking --- VERSION | 1 + samples/Sample_Header.php | 4 ++-- samples/index.php | 36 +++++++++++++++++++++++------------- 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..142464bf --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.11.0 \ No newline at end of file diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index b752848d..f39bda16 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -6,13 +6,13 @@ use PhpOffice\PhpWord\Autoloader; use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\IOFactory; -error_reporting(E_ALL & ~E_DEPRECATED); +error_reporting(E_ALL); define('CLI', (PHP_SAPI == 'cli') ? true : false); define('EOL', CLI ? PHP_EOL : '
'); define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php')); define('IS_INDEX', SCRIPT_FILENAME == 'index'); -require_once '../src/PhpWord/Autoloader.php'; +require_once __DIR__ . '/../src/PhpWord/Autoloader.php'; Autoloader::register(); Settings::loadConfig(); diff --git a/samples/index.php b/samples/index.php index 94b98901..420c5420 100644 --- a/samples/index.php +++ b/samples/index.php @@ -1,5 +1,13 @@ array('PHP 5.3.0', version_compare(phpversion(), '5.3.0', '>=')), + 'xml' => array('PHP extension XML', extension_loaded('xml')), + 'zip' => array('PHP extension ZipArchive (optional)', extension_loaded('zip')), + 'gd' => array('PHP extension GD (optional)', extension_loaded('gd')), + 'xmlw' => array('PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')), + 'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')), +); if (!CLI) { ?>
@@ -11,20 +19,22 @@ if (!CLI) {

array('PHP 5.3.0', version_compare(phpversion(), '5.3.0', '>=')), - 'zip' => array('PHP extension ZipArchive', extension_loaded('zip')), - 'xml' => array('PHP extension XML', extension_loaded('xml')), - 'gd' => array('PHP extension GD (optional)', extension_loaded('gd')), -); -echo "

Requirements

"; -echo ""; } if (!CLI) { + echo "

Requirement check:

"; + echo ""; include_once 'Sample_Footer.php'; +} else { + echo 'Requirement check:' . PHP_EOL; + foreach ($requirements as $key => $value) { + list($label, $result) = $value; + $status = $result ? '32m passed' : '31m failed'; + echo "{$label} ... \033[{$status}\033[0m" . PHP_EOL; + } }