From 4188f38ad56d7ba2ea46e94403f305243514f80c Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Jul 2014 15:49:36 +0200 Subject: add pdf and mobi libraries --- inc/3rdparty/libraries/mpdf/compress.php | 172 +++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 inc/3rdparty/libraries/mpdf/compress.php (limited to 'inc/3rdparty/libraries/mpdf/compress.php') diff --git a/inc/3rdparty/libraries/mpdf/compress.php b/inc/3rdparty/libraries/mpdf/compress.php new file mode 100644 index 00000000..85897cf5 --- /dev/null +++ b/inc/3rdparty/libraries/mpdf/compress.php @@ -0,0 +1,172 @@ + + + + + +

WARNING: This utility will OVERWRITE mpdf.php file in the current directory.

+

Select the functions you wish to INCLUDE in your mpdf.php program. When you click generate, a new mpdf.php file will be written to the current directory.

+
Notes + +
+ Select/Unselect All

+ +
+'; +foreach($excl AS $k=>$ex) { + echo ' 1 && $k < 5)) { + echo ' checked="checked"'; + } + echo ' /> '.$ex.'
'; +} + +echo '
+ +
+ +'; +exit; +} + +$inc = $_POST['inc']; +if (is_array($inc) && count($inc)>0 ) { + foreach($inc AS $i=>$v) { + $key = array_search($i, $excl); + unset($excl[$key]); + } +} + +if (!defined('PHP_VERSION_ID')) { + $version = explode('.', PHP_VERSION); + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); +} +if (PHP_VERSION_ID < 50300) { $mqr = @get_magic_quotes_runtime(); } + else { $mqr=0; } +if ($mqr) { set_magic_quotes_runtime(0); } + +$l = file('mpdf_source.php'); +if (!count($l)) { die("ERROR - Could not find mpdf_source.php file in current directory"); } +$exclflags = array(); +$x = ''; + + // Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS' +if ($excl[0]=='HTML-CSS') { + $excl[] = 'TABLES'; + $excl[] = 'LISTS'; + $excl[] = 'TABLES-ADVANCED-BORDERS'; + $excl[] = 'HTMLHEADERS-FOOTERS'; + $excl[] = 'FORMS'; + $excl[] = 'BACKGROUNDS'; + $excl[] = 'CSS-FLOAT'; + $excl[] = 'CSS-IMAGE-FLOAT'; + $excl[] = 'CSS-POSITION'; + $excl[] = 'CSS-PAGE'; + $excl[] = 'BORDER-RADIUS'; +} +$excl = array_unique($excl); + +foreach($l AS $k=>$ln) { + $exclude = false; + // *XXXXX* + preg_match_all("/\/\/ \*([A-Za-z\-]+)\*/", $ln, $m); + foreach($m[1] AS $mm) { + if (in_array($mm, $excl)) { + $exclude = true; + } + } + /*-- XXXXX --*/ + preg_match_all("/\/\*-- ([A-Za-z\-]+) --\*\//", $ln, $m); + foreach($m[1] AS $mm) { + if (in_array($mm, $excl)) { + $exclflags[$mm] = true; + } + $exclude = true; + } + $exclflags = array_unique($exclflags); + /*-- END XXXX --*/ + preg_match_all("/\/\*-- END ([A-Za-z\-]+) --\*\//", $ln, $m); + foreach($m[1] AS $mm) { + if (in_array($mm, $excl)) { + unset($exclflags[$mm]); + } + $exclude = true; + } + if (count($exclflags)==0 && !$exclude) { + $x .= $ln; + } +} +// mPDF 5.0 +if (function_exists('file_put_contents')) { + $check = file_put_contents('mpdf.php', $x); +} +else { + $f=fopen('mpdf.php', 'w'); + $check = fwrite($f, $x); + fclose($f); +} +if (!$check) { die("ERROR - Could not write to mpdf.php file. Are permissions correctly set?"); } +echo '

mPDF file generated successfully!

'; +echo '
mPDF file size '.number_format((strlen($x)/1024)).' kB
'; + +unset($l); +unset($x); + +include('mpdf.php'); +$mpdf = new mPDF(); + +echo '
Memory usage on loading mPDF class '.number_format((memory_get_usage(true)/(1024*1024)),2).' MB
'; + +exit; + +?> \ No newline at end of file -- cgit v1.2.3