1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Update pdf plugin to use tcpdf V5.9.202. There's a lot that's new, so needs thorough testing. Plus new features we might make use of in some applications (e.g. QR-code generator).

This commit is contained in:
SteveD
2012-12-22 15:36:07 +00:00
parent 1f00110f71
commit 330a4ca3fb
10 changed files with 30300 additions and 16125 deletions

View File

@@ -322,7 +322,7 @@ if ($cal_totev > 0)
$ec_last_day = $thisevent_start_date['mday']; $ec_last_day = $thisevent_start_date['mday'];
} }
// Add footer // Add footer
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc); $cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc);
if ($ec_output_type == 'print') $cal_text .= "</form>\n"; if ($ec_output_type == 'print') $cal_text .= "</form>\n";
} }
@@ -344,11 +344,7 @@ switch($ec_output_type)
case 'pdf': case 'pdf':
//TODO find a way to pass initialisation options etc to PDF driver //TODO find a way to pass initialisation options etc to PDF driver
include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'.php'); //include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php'); - shouldn't be needed
// define('FPDF_FONTPATH', 'font/');
//require the ufpdf class
// require_once (e_PLUGIN.'pdf/ufpdf.php');
//require the e107pdf class
require_once (e_PLUGIN.'pdf/e107pdf.php'); require_once (e_PLUGIN.'pdf/e107pdf.php');
$pdf = new e107PDF(); $pdf = new e107PDF();
// $text = array($text, $creator, $author, $title, $subject, $keywords, $url); // $text = array($text, $creator, $author, $title, $subject, $keywords, $url);

View File

@@ -1,71 +1,59 @@
<?php <?php
//============================================================+ //============================================================+
// File name : 2dbarcodes.php // File name : 2dbarcodes.php
// Version : 1.0.014
// Begin : 2009-04-07 // Begin : 2009-04-07
// Last Update : 2009-08-17 // Last Update : 2012-04-30
// Version : 1.0.000 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// ---------------------------------------------------------------------------- // -------------------------------------------------------------------
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l. // Copyright (C) 2009-2012 Nicola Asuni - Tecnick.com LTD
// //
// This program is free software: you can redistribute it and/or modify // This file is part of TCPDF software library.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // TCPDF is free software: you can redistribute it and/or modify it
// but WITHOUT ANY WARRANTY; without even the implied warranty of // under the terms of the GNU Lesser General Public License as
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // published by the Free Software Foundation, either version 3 of the
// GNU Lesser General Public License for more details. // License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
// //
// See LICENSE.TXT file for more information. // See LICENSE.TXT file for more information.
// ---------------------------------------------------------------------------- // -------------------------------------------------------------------
// //
// Description : PHP class to creates array representations for // Description : PHP class to creates array representations for
// 2D barcodes to be used with TCPDF. // 2D barcodes to be used with TCPDF.
// //
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+ //============================================================+
/** /**
* @file
* PHP class to creates array representations for 2D barcodes to be used with TCPDF. * PHP class to creates array representations for 2D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @abstract Functions for generating string representation of 2D barcodes.
* @author Nicola Asuni * @author Nicola Asuni
* @copyright 2008-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @version 1.0.014
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 1.0.000
*/ */
/** /**
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).<br> * @class TCPDF2DBarcode
* @name TCPDFBarcode * PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 1.0.000 * @version 1.0.014
* @author Nicola Asuni * @author Nicola Asuni
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/ */
class TCPDF2DBarcode { class TCPDF2DBarcode {
/** /**
* @var array representation of barcode. * Array representation of barcode.
* @access protected * @protected
*/ */
protected $barcode_array; protected $barcode_array = false;
/** /**
* This is the class constructor. * This is the class constructor.
@@ -74,8 +62,8 @@ class TCPDF2DBarcode {
* <li>$arrcode['num_rows'] required number of rows</li> * <li>$arrcode['num_rows'] required number of rows</li>
* <li>$arrcode['num_cols'] required number of columns</li> * <li>$arrcode['num_cols'] required number of columns</li>
* <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul> * <li>$arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)</li></ul>
* @param string $code code to print * @param $code (string) code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul> * @param $type (string) type of barcode: <ul><li>DATAMATRIX : Datamatrix (ISO/IEC 16022)</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li><li>QRCODE : QRcode Low error correction</li><li>QRCODE,L : QRcode Low error correction</li><li>QRCODE,M : QRcode Medium error correction</li><li>QRCODE,Q : QRcode Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>TEST : Test matrix</li></ul>
*/ */
public function __construct($code, $type) { public function __construct($code, $type) {
$this->setBarcode($code, $type); $this->setBarcode($code, $type);
@@ -89,15 +77,237 @@ class TCPDF2DBarcode {
return $this->barcode_array; return $this->barcode_array;
} }
/**
* Send barcode as SVG image object to the standard output.
* @param $w (int) Width of a single rectangle element in user units.
* @param $h (int) Height of a single rectangle element in user units.
* @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
* @public
*/
public function getBarcodeSVG($w=3, $h=3, $color='black') {
// send headers
$code = $this->getBarcodeSVGcode($w, $h, $color);
header('Content-Type: application/svg+xml');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: inline; filename="'.md5($code).'.svg";');
//header('Content-Length: '.strlen($code));
echo $code;
}
/**
* Return a SVG string representation of barcode.
* @param $w (int) Width of a single rectangle element in user units.
* @param $h (int) Height of a single rectangle element in user units.
* @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
* @return string SVG code.
* @public
*/
public function getBarcodeSVGcode($w=3, $h=3, $color='black') {
// replace table for special characters
$repstr = array("\0" => '', '&' => '&amp;', '<' => '&lt;', '>' => '&gt;');
$svg = '<'.'?'.'xml version="1.0" standalone="no"'.'?'.'>'."\n";
$svg .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'."\n";
$svg .= '<svg width="'.round(($this->barcode_array['num_cols'] * $w), 3).'" height="'.round(($this->barcode_array['num_rows'] * $h), 3).'" version="1.1" xmlns="http://www.w3.org/2000/svg">'."\n";
$svg .= "\t".'<desc>'.strtr($this->barcode_array['code'], $repstr).'</desc>'."\n";
$svg .= "\t".'<g id="elements" fill="'.$color.'" stroke="none">'."\n";
// print barcode elements
$y = 0;
// for each row
for ($r = 0; $r < $this->barcode_array['num_rows']; ++$r) {
$x = 0;
// for each column
for ($c = 0; $c < $this->barcode_array['num_cols']; ++$c) {
if ($this->barcode_array['bcode'][$r][$c] == 1) {
// draw a single barcode cell
$svg .= "\t\t".'<rect x="'.$x.'" y="'.$y.'" width="'.$w.'" height="'.$h.'" />'."\n";
}
$x += $w;
}
$y += $h;
}
$svg .= "\t".'</g>'."\n";
$svg .= '</svg>'."\n";
return $svg;
}
/**
* Return an HTML representation of barcode.
* @param $w (int) Width of a single rectangle element in pixels.
* @param $h (int) Height of a single rectangle element in pixels.
* @param $color (string) Foreground color for bar elements (background is transparent).
* @return string HTML code.
* @public
*/
public function getBarcodeHTML($w=10, $h=10, $color='black') {
$html = '<div style="font-size:0;position:relative;width:'.($w * $this->barcode_array['num_cols']).'px;height:'.($h * $this->barcode_array['num_rows']).'px;">'."\n";
// print barcode elements
$y = 0;
// for each row
for ($r = 0; $r < $this->barcode_array['num_rows']; ++$r) {
$x = 0;
// for each column
for ($c = 0; $c < $this->barcode_array['num_cols']; ++$c) {
if ($this->barcode_array['bcode'][$r][$c] == 1) {
// draw a single barcode cell
$html .= '<div style="background-color:'.$color.';width:'.$w.'px;height:'.$h.'px;position:absolute;left:'.$x.'px;top:'.$y.'px;">&nbsp;</div>'."\n";
}
$x += $w;
}
$y += $h;
}
$html .= '</div>'."\n";
return $html;
}
/**
* Return a PNG image representation of barcode (requires GD or Imagick library).
* @param $w (int) Width of a single rectangle element in pixels.
* @param $h (int) Height of a single rectangle element in pixels.
* @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent).
* @return image or false in case of error.
* @public
*/
public function getBarcodePNG($w=3, $h=3, $color=array(0,0,0)) {
// calculate image size
$width = ($this->barcode_array['num_cols'] * $w);
$height = ($this->barcode_array['num_rows'] * $h);
if (function_exists('imagecreate')) {
// GD library
$imagick = false;
$png = imagecreate($width, $height);
$bgcol = imagecolorallocate($png, 255, 255, 255);
imagecolortransparent($png, $bgcol);
$fgcol = imagecolorallocate($png, $color[0], $color[1], $color[2]);
} elseif (extension_loaded('imagick')) {
$imagick = true;
$bgcol = new imagickpixel('rgb(255,255,255');
$fgcol = new imagickpixel('rgb('.$color[0].','.$color[1].','.$color[2].')');
$png = new Imagick();
$png->newImage($width, $height, 'none', 'png');
$bar = new imagickdraw();
$bar->setfillcolor($fgcol);
} else {
return false;
}
// print barcode elements
$y = 0;
// for each row
for ($r = 0; $r < $this->barcode_array['num_rows']; ++$r) {
$x = 0;
// for each column
for ($c = 0; $c < $this->barcode_array['num_cols']; ++$c) {
if ($this->barcode_array['bcode'][$r][$c] == 1) {
// draw a single barcode cell
if ($imagick) {
$bar->rectangle($x, $y, ($x + $w - 1), ($y + $h - 1));
} else {
imagefilledrectangle($png, $x, $y, ($x + $w - 1), ($y + $h - 1), $fgcol);
}
}
$x += $w;
}
$y += $h;
}
// send headers
header('Content-Type: image/png');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
if ($imagick) {
$png->drawimage($bar);
echo $png;
} else {
imagepng($png);
imagedestroy($png);
}
}
/** /**
* Set the barcode. * Set the barcode.
* @param string $code code to print * @param $code (string) code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul> * @param $type (string) type of barcode: <ul><li>DATAMATRIX : Datamatrix (ISO/IEC 16022)</li><li>PDF417 : PDF417 (ISO/IEC 15438:2006)</li><li>PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".</li><li>QRCODE : QRcode Low error correction</li><li>QRCODE,L : QRcode Low error correction</li><li>QRCODE,M : QRcode Medium error correction</li><li>QRCODE,Q : QRcode Better error correction</li><li>QRCODE,H : QR-CODE Best error correction</li><li>RAW: raw mode - comma-separad list of array rows</li><li>RAW2: raw mode - array rows are surrounded by square parenthesis.</li><li>TEST : Test matrix</li></ul>
* @return array * @return array
*/ */
public function setBarcode($code, $type) { public function setBarcode($code, $type) {
$mode = explode(',', $type); $mode = explode(',', $type);
switch (strtoupper($mode[0])) { $qrtype = strtoupper($mode[0]);
switch ($qrtype) {
case 'DATAMATRIX': { // DATAMATRIX (ISO/IEC 16022)
require_once(dirname(__FILE__).'/datamatrix.php');
$qrcode = new Datamatrix($code);
$this->barcode_array = $qrcode->getBarcodeArray();
$this->barcode_array['code'] = $code;
break;
}
case 'PDF417': { // PDF417 (ISO/IEC 15438:2006)
require_once(dirname(__FILE__).'/pdf417.php');
if (!isset($mode[1]) OR ($mode[1] === '')) {
$aspectratio = 2; // default aspect ratio (width / height)
} else {
$aspectratio = floatval($mode[1]);
}
if (!isset($mode[2]) OR ($mode[2] === '')) {
$ecl = -1; // default error correction level (auto)
} else {
$ecl = intval($mode[2]);
}
// set macro block
$macro = array();
if (isset($mode[3]) AND ($mode[3] !== '') AND isset($mode[4]) AND ($mode[4] !== '') AND isset($mode[5]) AND ($mode[5] !== '')) {
$macro['segment_total'] = intval($mode[3]);
$macro['segment_index'] = intval($mode[4]);
$macro['file_id'] = strtr($mode[5], "\xff", ',');
for ($i = 0; $i < 7; ++$i) {
$o = $i + 6;
if (isset($mode[$o]) AND ($mode[$o] !== '')) {
// add option
$macro['option_'.$i] = strtr($mode[$o], "\xff", ',');
}
}
}
$qrcode = new PDF417($code, $ecl, $aspectratio, $macro);
$this->barcode_array = $qrcode->getBarcodeArray();
$this->barcode_array['code'] = $code;
break;
}
case 'QRCODE': { // QR-CODE
require_once(dirname(__FILE__).'/qrcode.php');
if (!isset($mode[1]) OR (!in_array($mode[1],array('L','M','Q','H')))) {
$mode[1] = 'L'; // Ddefault: Low error correction
}
$qrcode = new QRcode($code, strtoupper($mode[1]));
$this->barcode_array = $qrcode->getBarcodeArray();
$this->barcode_array['code'] = $code;
break;
}
case 'RAW':
case 'RAW2': { // RAW MODE
// remove spaces
$code = preg_replace('/[\s]*/si', '', $code);
if (strlen($code) < 3) {
break;
}
if ($qrtype == 'RAW') {
// comma-separated rows
$rows = explode(',', $code);
} else { // RAW2
// rows enclosed in square parentheses
$code = substr($code, 1, -1);
$rows = explode('][', $code);
}
$this->barcode_array['num_rows'] = count($rows);
$this->barcode_array['num_cols'] = strlen($rows[0]);
$this->barcode_array['bcode'] = array();
foreach ($rows as $r) {
$this->barcode_array['bcode'][] = str_split($r, 1);
}
$this->barcode_array['code'] = $code;
break;
}
case 'TEST': { // TEST MODE case 'TEST': { // TEST MODE
$this->barcode_array['num_rows'] = 5; $this->barcode_array['num_rows'] = 5;
$this->barcode_array['num_cols'] = 15; $this->barcode_array['num_cols'] = 15;
@@ -106,13 +316,10 @@ class TCPDF2DBarcode {
array(0,1,0,0,1,0,0,0,1,0,0,0,0,1,0), array(0,1,0,0,1,0,0,0,1,0,0,0,0,1,0),
array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0), array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0),
array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0), array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0),
array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0) array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0));
); $this->barcode_array['code'] = $code;
break; break;
} }
// ... Add here real 2D barcodes ...
default: { default: {
$this->barcode_array = false; $this->barcode_array = false;
} }
@@ -123,4 +330,3 @@ class TCPDF2DBarcode {
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?>

View File

@@ -16,7 +16,7 @@
*/ */
require_once('../../class2.php'); require_once('../../class2.php');
if (!getperms("P") || !plugInstalled('pdf')) if (!getperms('P') || !plugInstalled('pdf'))
{ {
header('location:'.e_BASE.'index.php'); header('location:'.e_BASE.'index.php');
exit; exit;
@@ -24,37 +24,83 @@ if (!getperms("P") || !plugInstalled('pdf'))
require_once(e_ADMIN.'auth.php'); require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'form_handler.php');
$rs = new form; $rs = new form;
e107_require_once(e_HANDLER.'arraystorage_class.php');
$eArrayStorage = new ArrayData();
//e107_require_once(e_HANDLER.'arraystorage_class.php');
//$eArrayStorage = new ArrayData();
unset($text); unset($text);
include_lan(e_PLUGIN.'pdf/languages/English_admin_pdf.php'); include_lan(e_PLUGIN.'pdf/languages/English_admin_pdf.php');
if(isset($_POST['update_pdf']))
{
$message = updatePDFPrefs();
}
/**
function updatePDFPrefs() * Update prefs to new values.
*
* @param boolean $setDefaults = set all prefs to default values if TRUE
*/
function updatePDFPrefs(&$oldPrefs, $setDefaults = FALSE)
{ {
global $sql, $eArrayStorage, $tp, $admin_log; $tp = e107::getParser();
while(list($key, $value) = each($_POST)) $prefChanges = array();
$pdfNew = e107::getPlugConfig('pdf');
$mes = eMessage::getInstance();
$prefList = getDefaultPDFPrefs();
if ($setDefaults)
{ {
foreach($_POST as $k => $v) $oldPrefs = $prefList;
$adminEvent = 'PDF_02';
$adminMessage = PDF_LAN_33;
$prefChanges[] = 'all => defaults';
foreach($prefList as $k => $default)
{ {
if(strpos($k, 'pdf_') === 0) $pdfNew->set($k, $default);
}
}
else
{ {
$pdfpref[$k] = $tp->toDB($v); $adminEvent = 'PDF_01';
$adminMessage = PDF_LAN_18;
foreach($prefList as $k => $default)
{
if (isset($_POST[$k]))
{
$newVal = $tp->toDB($_POST[$k]);
if ($oldPrefs[$k] != $newVal)
{
$oldPrefs[$k] = $newVal;
$pdfNew->set($k, $newVal);
$prefChanges[] = $k.' => '.$newVal;
}
}
elseif (!isset($oldPrefs[$k]))
{
$oldPrefs[$k] = $default; // Restore any lost prefs
} }
} }
} }
//create new array of preferences if (count($prefChanges))
$tmp = $eArrayStorage->WriteArray($pdfpref); {
$sql -> db_Update("core", "e107_value='{$tmp}' WHERE e107_name='pdf' "); $result = $pdfNew->save();
$admin_log->logArrayAll('PDF_01',$pdfpref); if ($result === TRUE)
$message = PDF_LAN_18; {
return $message; // Do admin logging
$logString = implode('[!br!]', $prefChanges);
e107::getAdminLog()->log_event($adminEvent, $logString, E_LOG_INFORMATIVE, '');
$mes->add($adminMessage, E_MESSAGE_SUCCESS);
}
elseif ($result === FALSE)
{
$mes->add(PDF_LAN_32, E_MESSAGE_ERROR);
}
else
{ // Should never happen
$mes->add('PDF Unexpected result: '.$result, E_MESSAGE_INFO);
}
}
//$admin_log->logArrayAll('PDF_01',$pdfpref);
//return $message;
} }
@@ -80,38 +126,23 @@ function getDefaultPDFPrefs()
function getPDFPrefs() function getPDFPrefs()
{ {
global $eArrayStorage; $ans = e107::pref('pdf'); // retrieve pref array.
$sql = e107::getDb(); if (count($ans) == 0)
if(!is_object($sql)){ $sql = new db; }
$num_rows = $sql -> db_Select("core", "*", "e107_name='pdf' ");
if($num_rows == 0)
{ {
$tmp = getDefaultPDFPrefs(); $ans = getDefaultPDFPrefs();
$tmp2 = $eArrayStorage->WriteArray($tmp);
$sql -> db_Insert("core", "'pdf', '".$tmp2."' ");
$sql -> db_Select("core", "*", "e107_name='pdf' ");
} }
$row = $sql -> db_Fetch();
$pdfpref = $eArrayStorage->ReadArray($row['e107_value']); return $ans;
return $pdfpref;
} }
if(isset($message))
{
$caption = PDF_LAN_1;
$ns -> tablerender($caption, $message);
}
$pdfpref = getPDFPrefs();
if(!is_object($sql)){ $sql = new db; }
// Default list just in case // Default list just in case
$fontlist=array('times','courier','helvetica','symbol'); $fontlist=array('times','courier','helvetica','symbol');
function getFontInfo($fontName) function getFontInfo($fontName)
{ {
$type = 'empty'; // Preset the stuff we're going to read $type = 'empty'; // Preset the stuff we're going to read
@@ -121,7 +152,7 @@ function getFontInfo($fontName)
//$desc=array('Ascent'=>900,'Descent'=>-300,'CapHeight'=>-29,'Flags'=>96,'FontBBox'=>'[-879 -434 1673 900]','ItalicAngle'=>-16.5,'StemV'=>70,'MissingWidth'=>600); //$desc=array('Ascent'=>900,'Descent'=>-300,'CapHeight'=>-29,'Flags'=>96,'FontBBox'=>'[-879 -434 1673 900]','ItalicAngle'=>-16.5,'StemV'=>70,'MissingWidth'=>600);
//$up=-125; //$up=-125;
//$ut=50; //$ut=50;
include(e_PLUGIN.'pdf/font/'.$fontName); include(e_PLUGIN.'pdf/fonts/'.$fontName);
return array('type' => $type, 'weight' => $dw, 'codes' => count($cw), 'name' => $name); return array('type' => $type, 'weight' => $dw, 'codes' => count($cw), 'name' => $name);
} }
@@ -132,7 +163,7 @@ function getFontList($match = '')
require_once(e_HANDLER.'file_class.php'); require_once(e_HANDLER.'file_class.php');
$fl = new e_file(); $fl = new e_file();
if (!$match) $match = '~^uni2cid'; if (!$match) $match = '~^uni2cid';
$fileList = $fl->get_files(e_PLUGIN.'pdf/font/',$match, 'standard', 1); $fileList = $fl->get_files(e_PLUGIN.'pdf/fonts/',$match, 'standard', 1);
$fontList = array(); $fontList = array();
$intList = array(); $intList = array();
foreach ($fileList as $v) foreach ($fileList as $v)
@@ -173,6 +204,35 @@ function getFontList($match = '')
} }
$pdfpref = getPDFPrefs();
if(isset($_POST['update_pdf']))
{
// $message = updatePDFPrefs();
updatePDFPrefs($pdfpref, FALSE);
}
if(isset($_POST['default_pdf']))
{
updatePDFPrefs($pdfpref, TRUE);
}
e107::getRender()->tablerender(PDF_LAN_35, eMessage::getInstance()->render());
/*
if(isset($message))
{
$caption = PDF_LAN_1;
$ns -> tablerender($caption, $message);
}
*/
$fontList = getFontList(); $fontList = getFontList();
$coreList = array(); $coreList = array();
foreach ($fontList as $font => $info) foreach ($fontList as $font => $info)
@@ -267,7 +327,8 @@ $text .= "
</tr> </tr>
</table> </table>
<div class='buttons-bar center'> <div class='buttons-bar center'>
".$frm->admin_button('update_pdf', LAN_UPDATE, 'update')." ".$rs->form_button('submit', 'update_pdf', LAN_UPDATE)."&nbsp;&nbsp;&nbsp;&nbsp;
".$rs->form_button('submit', 'default_pdf', PDF_LAN_34)."
</div> </div>
".$rs -> form_close()." ".$rs -> form_close()."
"; ";
@@ -290,10 +351,10 @@ foreach ($fontList as $font => $info)
$text .= "<tr><td>{$font}</td><td>{$info['info']['type']}</td><td>{$variants}</td><td>{$info['info']['weight']}</td><td>{$info['info']['codes']}</td></tr>\n"; $text .= "<tr><td>{$font}</td><td>{$info['info']['type']}</td><td>{$variants}</td><td>{$info['info']['weight']}</td><td>{$info['info']['codes']}</td></tr>\n";
} }
$text .= "</table>"; $text .= '</table>';
$ns->tablerender(PDF_LAN_31, $text); $ns->tablerender(PDF_LAN_31, $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN.'footer.php');
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,14 @@ define ('PDF_DEBUG', FALSE);
define('K_PATH_MAIN', ''); define('K_PATH_MAIN', '');
define('K_PATH_URL', SITEURL); // Used with forms (TODO: check validity) define('K_PATH_URL', SITEURL); // Used with forms (TODO: check validity)
define('K_CELL_HEIGHT_RATIO', 1.25);
// Following may be used (among others)
//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
define ('K_PATH_CACHE', e_CACHE_CONTENT);
define ('K_PATH_URL_CACHE', K_PATH_URL.e_CACHE_CONTENT);
define ('K_PATH_IMAGES', K_PATH_MAIN.'images/');
define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
/* /*
The full tcpdf distribution includes a utility to generate new fonts, as well as lots of other fonts. The full tcpdf distribution includes a utility to generate new fonts, as well as lots of other fonts.
@@ -42,7 +49,7 @@ include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php');
//extend tcpdf class from package with custom functions //extend tcpdf class from package with custom functions
class e107PDF extends TCPDF class e107PDF extends TCPDF
{ {
protected $pdfPrefs = array(); // Prefs - loaded before creating a pdf protected $pdfPref = array(); // Prefs - loaded before creating a pdf
/** /**
* Constructor * Constructor
@@ -55,7 +62,8 @@ class e107PDF extends TCPDF
*/ */
public function __construct($orientation='P',$unit='mm',$format='A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false) public function __construct($orientation='P',$unit='mm',$format='A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false)
{ {
global $pdfpref; $this->getPDFPrefs();
//Call parent constructor //Call parent constructor
parent::__construct($orientation,$unit,$format, $unicode, $encoding, $diskcache); parent::__construct($orientation,$unit,$format, $unicode, $encoding, $diskcache);
//Initialization //Initialization
@@ -90,26 +98,13 @@ class e107PDF extends TCPDF
//get preferences from db //get preferences from db
function getPDFPrefs() function getPDFPrefs()
{ {
global $sql, $eArrayStorage; $this->pdfPref = e107::pref('pdf'); // retrieve pref array.
if (count($this->pdfPref) == 0)
if(!is_object($eArrayStorage))
{ {
e107_require_once(e_HANDLER.'arraystorage_class.php'); $this->pdfPref = $this->getDefaultPDFPrefs();
$eArrayStorage = new ArrayData();
} }
if(!is_object($sql)){ $sql = new db; } return $this->pdfPref;
$num_rows = $sql -> db_Select('core', '*', "e107_name='pdf' ");
if($num_rows == 0)
{
$tmp = $this->getDefaultPDFPrefs();
$tmp2 = $eArrayStorage->WriteArray($tmp);
$sql -> db_Insert('core', "'pdf', '".$tmp2."' ");
$sql -> db_Select('core', '*', "e107_name='pdf' ");
}
$row = $sql -> db_Fetch();
$pdfPref = $eArrayStorage->ReadArray($row['e107_value']);
return $pdfPref;
} }
@@ -153,8 +148,8 @@ class e107PDF extends TCPDF
{ {
$tp = e107::getParser(); $tp = e107::getParser();
//call get preferences // Make sure prefs up to date
$this->pdfPref = $this->getPDFPrefs(); $this->getPDFPrefs();
//define logo and source pageurl (before the parser!) //define logo and source pageurl (before the parser!)
if(is_readable(THEME.'images/logopdf.png')) if(is_readable(THEME.'images/logopdf.png'))
@@ -166,6 +161,10 @@ class e107PDF extends TCPDF
$logo = e_IMAGE.'logo.png'; $logo = e_IMAGE.'logo.png';
} }
define('PDFLOGO', $logo); //define logo to add in header define('PDFLOGO', $logo); //define logo to add in header
if (substr($text[6], -1) == '?')
{
$text[6] = substr($text[6], 0, -1);
}
define('PDFPAGEURL', $text[6]); //define page url to add in header define('PDFPAGEURL', $text[6]); //define page url to add in header
//parse the data //parse the data
@@ -176,15 +175,41 @@ class e107PDF extends TCPDF
$text[$k] = $tp->toHTML($v, TRUE, 'BODY'); $text[$k] = $tp->toHTML($v, TRUE, 'BODY');
} }
// In the code that follows, the commented out lines beginning $pdf-> are things which could potentially be set.
//set image scale factor
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$pdf->setLanguageArray($l);
//set some variables //set some variables
$this->SetMargins($this->pdfPref['pdf_margin_left'],$this->pdfPref['pdf_margin_top'],$this->pdfPref['pdf_margin_right']); $this->SetMargins($this->pdfPref['pdf_margin_left'],$this->pdfPref['pdf_margin_top'],$this->pdfPref['pdf_margin_right']);
//$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
//$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$this->SetAutoPageBreak(true,25); // Force new page break at 25mm from bottom $this->SetAutoPageBreak(true,25); // Force new page break at 25mm from bottom
$this->SetPrintHeader(TRUE); $this->SetPrintHeader(TRUE);
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
//$pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
// set default monospaced font
//$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//start creating the pdf and adding the data //start creating the pdf and adding the data
$this->DefOrientation=(varset($text[7], 'P') == 'L' ? 'L' : 'P'); // Page orientation - P=portrait, L=landscape $this->DefOrientation=(varset($text[7], 'P') == 'L' ? 'L' : 'P'); // Page orientation - P=portrait, L=landscape
$this->AliasNbPages(); //calculate current page + number of pages $this->AliasNbPages(); //calculate current page + number of pages
$this->AddPage(); //start page $this->AddPage(); //start page
//$pdf->setFontSubsetting(true);
$this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']); //set font $this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']); //set font
$this->SetHeaderFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size'])); $this->SetHeaderFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']));
$this->SetFooterFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size'])); $this->SetFooterFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']));
@@ -272,7 +297,8 @@ class e107PDF extends TCPDF
if($this->pdfPref['pdf_show_page_number']) if($this->pdfPref['pdf_show_page_number'])
{ {
$this->SetFont($this->pdfPref['pdf_font_family'],'I',$this->pdfPref['pdf_font_size_page_number']); $this->SetFont($this->pdfPref['pdf_font_family'],'I',$this->pdfPref['pdf_font_size_page_number']);
$this->Cell($cellwidth,5,PDF_LAN_19.' '.$this->PageNo().'/{nb}',0,1,$align); // {nb} is an alias for the total number of pages //$this->Cell($cellwidth,5,PDF_LAN_19.' '.$this->PageNo().'/{nb}',0,1,$align); // {nb} is an alias for the total number of pages
$this->Cell($cellwidth,5,PDF_LAN_19.' '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(),0,1,$align);
} }
$this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']); $this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']);
@@ -299,7 +325,8 @@ class e107PDF extends TCPDF
*/ */
protected function _getfontpath() protected function _getfontpath()
{ {
return str_replace(e_HTTP, e_ROOT, e_PLUGIN_ABS.'pdf/font/'); //return str_replace(e_HTTP, e_ROOT, e_PLUGIN_ABS.'pdf/fonts/');
return e_PLUGIN.'pdf/fonts/';
} }

View File

@@ -1,57 +1,47 @@
<?php <?php
//============================================================+ //============================================================+
// File name : htmlcolors.php // File name : htmlcolors.php
// Version : 1.0.008
// Begin : 2002-04-09 // Begin : 2002-04-09
// Last Update : 2009-09-06 // Last Update : 2010-12-16
// Version : 1.0.003 // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// ---------------------------------------------------------------------------- // -------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l. // Copyright (C) 2002-2012 Nicola Asuni - Tecnick.com LTD
// //
// This program is free software: you can redistribute it and/or modify // This file is part of TCPDF software library.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // TCPDF is free software: you can redistribute it and/or modify it
// but WITHOUT ANY WARRANTY; without even the implied warranty of // under the terms of the GNU Lesser General Public License as
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // published by the Free Software Foundation, either version 3 of the
// GNU Lesser General Public License for more details. // License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
// //
// See LICENSE.TXT file for more information. // See LICENSE.TXT file for more information.
// ---------------------------------------------------------------------------- // -------------------------------------------------------------------
// //
// Description : Array of WEB safe colors // Description : Array of WEB safe colors
// //
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+ //============================================================+
/** /**
* Array of WEB safe colors. * @file
* Array of WEB safe colors
* @author Nicola Asuni * @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2.9.000 (2008-03-26) * @since 2.9.000 (2008-03-26)
*/ */
/** /**
* Array of WEB safe colors * Array of WEB safe colors
*/ */
global $webcolor;
$webcolor = array ( $webcolor = array (
'aliceblue' => 'f0f8ff', 'aliceblue' => 'f0f8ff',
'antiquewhite' => 'faebd7', 'antiquewhite' => 'faebd7',
@@ -113,8 +103,8 @@ $webcolor = array (
'greenyellow' => 'adff2f', 'greenyellow' => 'adff2f',
'honeydew' => 'f0fff0', 'honeydew' => 'f0fff0',
'hotpink' => 'ff69b4', 'hotpink' => 'ff69b4',
'indianred ' => 'cd5c5c', 'indianred' => 'cd5c5c',
'indigo ' => '4b0082', 'indigo' => '4b0082',
'ivory' => 'fffff0', 'ivory' => 'fffff0',
'khaki' => 'f0e68c', 'khaki' => 'f0e68c',
'lavender' => 'e6e6fa', 'lavender' => 'e6e6fa',
@@ -207,4 +197,3 @@ $webcolor = array (
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?>

View File

@@ -32,7 +32,7 @@ define('PDF_LAN_14', 'show sitename on pdf?');
define('PDF_LAN_15', 'show creator page url on pdf?'); define('PDF_LAN_15', 'show creator page url on pdf?');
define('PDF_LAN_16', 'show page numbers on pdf?'); define('PDF_LAN_16', 'show page numbers on pdf?');
//define('PDF_LAN_17', 'update'); //define('PDF_LAN_17', 'update');
//define('PDF_LAN_18', 'PDF preferences successfully updated'); define('PDF_LAN_18', 'PDF preferences successfully updated');
define('PDF_LAN_19', 'Page'); define('PDF_LAN_19', 'Page');
define('PDF_LAN_20', 'error reporting'); define('PDF_LAN_20', 'error reporting');
define('PDF_LAN_21', 'Font name'); define('PDF_LAN_21', 'Font name');
@@ -46,7 +46,10 @@ define('PDF_LAN_28', 'bold'); // Bold font type
define('PDF_LAN_29', 'ital'); // Italic font type define('PDF_LAN_29', 'ital'); // Italic font type
define('PDF_LAN_30', 'boldital'); // Bold italic font type define('PDF_LAN_30', 'boldital'); // Bold italic font type
define('PDF_LAN_31', 'FONT LIST'); define('PDF_LAN_31', 'FONT LIST');
define('PDF_LAN_32', 'Error saving PDF plugin prefs');
define('PDF_LAN_33', 'Default prefs set');
define('PDF_LAN_34', 'Defaults');
define('PDF_LAN_35', 'PDF Plugin Preferences');
// Admin logging // Admin logging
//define('LAN_AL_PDF_01', 'PDF settings updated'); //define('LAN_AL_PDF_01', 'PDF settings updated');

View File

@@ -26,7 +26,6 @@ $parms = varset($qs[1],'');
//include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php'); //include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php');
//require_once(e_PLUGIN.'pdf/tcpdf.php'); //require the ufpdf class
require_once(e_PLUGIN.'pdf/e107pdf.php'); //require the e107pdf class require_once(e_PLUGIN.'pdf/e107pdf.php'); //require the e107pdf class
$pdf = new e107PDF(); $pdf = new e107PDF();

File diff suppressed because one or more lines are too long

View File

@@ -1,88 +1,103 @@
<?php <?php
//============================================================+ //============================================================+
// File name : unicode_data.php // File name : unicode_data.php
// Version : 1.0.009
// Begin : 2008-01-01 // Begin : 2008-01-01
// Last Update : 2009-08-17 // Last Update : 2011-10-01
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// ---------------------------------------------------------------------------- // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l. // -------------------------------------------------------------------
// Copyright (C) 2008-2012 Nicola Asuni - Tecnick.com LTD
// //
// This program is free software: you can redistribute it and/or modify // This file is part of TCPDF software library.
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // TCPDF is free software: you can redistribute it and/or modify it
// but WITHOUT ANY WARRANTY; without even the implied warranty of // under the terms of the GNU Lesser General Public License as
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // published by the Free Software Foundation, either version 3 of the
// GNU Lesser General Public License for more details. // License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
// //
// See LICENSE.TXT file for more information. // See LICENSE.TXT file for more information.
// ---------------------------------------------------------------------------- // -------------------------------------------------------------------
// //
// Description : Unicode Include file for TCPDF. // Description : Unicode data for TCPDF library.
// //
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com s.r.l.
// Via Della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//============================================================+ //============================================================+
// THANKS TO // THANKS TO
// Efthimios Mavrogeorgiadis // Efthimios Mavrogeorgiadis
// Saleh AlMatrafe // Saleh AlMatrafe
/** /**
* Unicode Include file for TCPDF. * @file
* Unicode data class for TCPDF library.
* @author Nicola Asuni * @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2.1.000 (2008-01-08) * @since 2.1.000 (2008-01-08)
*/
/**
* Left-to-Right Mark
*/
define('K_LRM', 8206);
/**
* Right-to-Left Mark
*/
define('K_RLM', 8207);
/**
* Left-to-Right Embedding
*/
define('K_LRE', 8234);
/**
* Right-to-Left Embedding
*/
define('K_RLE', 8235);
/**
* Pop Directional Format
*/
define('K_PDF', 8236);
/**
* Left-to-Right Override
*/
define('K_LRO', 8237);
/**
* Right-to-Left Override
*/
define('K_RLO', 8238);
/*
* Pattern to test RTL (Righ-To-Left) strings using regular expressions.
*/ */
define('K_RE_PATTERN_RTL', "/(
/**
* @class TCPDF_UNICODE_DATA
* This is a PHP class containing UnicOde data for TCPDF library.
* @package com.tecnick.tcpdf
* @version 1.0.009
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_UNICODE_DATA {
/**
* Unicode code for Left-to-Right Mark.
* @public
*/
public $uni_LRM = 8206;
/**
* Unicode code for Right-to-Left Mark.
* @public
*/
public $uni_RLM = 8207;
/**
* Unicode code for Left-to-Right Embedding.
* @public
*/
public $uni_LRE = 8234;
/**
* Unicode code for Right-to-Left Embedding.
* @public
*/
public $uni_RLE = 8235;
/**
* Unicode code for Pop Directional Format.
* @public
*/
public $uni_PDF = 8236;
/**
* Unicode code for Left-to-Right Override.
* @public
*/
public $uni_LRO = 8237;
/**
* Unicode code for Right-to-Left Override.
* @public
*/
public $uni_RLO = 8238;
/**
* Pattern to test RTL (Righ-To-Left) strings using regular expressions.
* @public
*/
public $uni_RE_PATTERN_RTL = "/(
\xD6\xBE # R \xD6\xBE # R
| \xD7[\x80\x83\x86\x90-\xAA\xB0-\xB4] # R | \xD7[\x80\x83\x86\x90-\xAA\xB0-\xB4] # R
| \xDF[\x80-\xAA\xB4\xB5\xBA] # R | \xDF[\x80-\xAA\xB4\xB5\xBA] # R
@@ -94,13 +109,13 @@ define('K_RE_PATTERN_RTL', "/(
| \xF0\x90\xA8[\x80\x90-\x93\x95-\x97\x99-\xB3] # R | \xF0\x90\xA8[\x80\x90-\x93\x95-\x97\x99-\xB3] # R
| \xF0\x90\xA9[\x80-\x87\x90-\x98] # R | \xF0\x90\xA9[\x80-\x87\x90-\x98] # R
| \xE2\x80[\xAB\xAE] # RLE & RLO | \xE2\x80[\xAB\xAE] # RLE & RLO
)/x"); )/x";
/* /**
* Pattern to test Arabic strings using regular expressions. * Pattern to test Arabic strings using regular expressions. Source: http://www.w3.org/International/questions/qa-forms-utf-8
* source: http://www.w3.org/International/questions/qa-forms-utf-8 * @public
*/ */
define("K_RE_PATTERN_ARABIC", "/( public $uni_RE_PATTERN_ARABIC = "/(
\xD8[\x80-\x83\x8B\x8D\x9B\x9E\x9F\xA1-\xBA] # AL \xD8[\x80-\x83\x8B\x8D\x9B\x9E\x9F\xA1-\xBA] # AL
| \xD9[\x80-\x8A\xAD-\xAF\xB1-\xBF] # AL | \xD9[\x80-\x8A\xAD-\xAF\xB1-\xBF] # AL
| \xDA[\x80-\xBF] # AL | \xDA[\x80-\xBF] # AL
@@ -120,13 +135,13 @@ define("K_RE_PATTERN_ARABIC", "/(
| \xEF\xBA[\x80-\xBF] # AL | \xEF\xBA[\x80-\xBF] # AL
| \xEF\xBB[\x80-\xBC] # AL | \xEF\xBB[\x80-\xBC] # AL
| \xD9[\xA0-\xA9\xAB\xAC] # AN | \xD9[\xA0-\xA9\xAB\xAC] # AN
)/x"); )/x";
/** /**
* Array of unicode types * Array of Unicode types.
* @public
*/ */
global $unicode; public $uni_type = array(
$unicode = array(
0=>'BN', 0=>'BN',
1=>'BN', 1=>'BN',
2=>'BN', 2=>'BN',
@@ -17850,12 +17865,10 @@ $unicode = array(
); );
/** /**
* Mirror unicode characters. * Mirror unicode characters. For information on bidi mirroring, see UAX #9: Bidirectional Algorithm, at http://www.unicode.org/unicode/reports/tr9/
* For information on bidi mirroring, see UAX #9: Bidirectional Algorithm, * @public
* at http://www.unicode.org/unicode/reports/tr9/
*/ */
global $unicode_mirror; public $uni_mirror = array (
$unicode_mirror = array (
0x0028=>0x0029, 0x0028=>0x0029,
0x0029=>0x0028, 0x0029=>0x0028,
0x003C=>0x003E, 0x003C=>0x003E,
@@ -18210,11 +18223,10 @@ $unicode_mirror = array (
0xFF63=>0xFF62); 0xFF63=>0xFF62);
/** /**
* Arabic shape subtitutions * Arabic shape substitutions: char code => (isolated, final, initial, medial).
* char code=>isolated, final, initial, medial * @public
*/ */
global $unicode_arlet; public $uni_arabicsubst = array(
$unicode_arlet = array(
1569=>array(65152), 1569=>array(65152),
1570=>array(65153, 65154, 65153, 65154), 1570=>array(65153, 65154, 65153, 65154),
1571=>array(65155, 65156, 65155, 65156), 1571=>array(65155, 65156, 65155, 65156),
@@ -18294,11 +18306,10 @@ $unicode_arlet = array(
); );
/** /**
* Arabic laa letter * Arabic laa letter: (char code => isolated, final, initial, medial).
* char code=>isolated, final, initial, medial * @public
*/ */
global $laa_array; public $uni_laa_array = array (
$laa_array = array (
1570 =>array(65269, 65270, 65269, 65270), 1570 =>array(65269, 65270, 65269, 65270),
1571 =>array(65271, 65272, 65271, 65272), 1571 =>array(65271, 65272, 65271, 65272),
1573 =>array(65273, 65274, 65273, 65274), 1573 =>array(65273, 65274, 65273, 65274),
@@ -18306,13 +18317,12 @@ $laa_array = array (
); );
/** /**
* Array of character substitutions for sequences of two diacritics symbols starting with SHADDA (0651 HEX, 1617 DEC). * Array of character substitutions for sequences of two diacritics symbols.
* Combining characters that can occur with Shadda (U0651) are placed in UE586-UE594. * Putting the combining mark and character in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner.
* Putting the combining mark and shadda in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner. * second NSM char code => substitution char
* second NSM char code=>substitution char * @public
*/ */
global $diacritics; public $uni_diacritics = array (
$diacritics = array (
1612=>64606, # Shadda + Dammatan 1612=>64606, # Shadda + Dammatan
1613=>64607, # Shadda + Kasratan 1613=>64607, # Shadda + Kasratan
1614=>64608, # Shadda + Fatha 1614=>64608, # Shadda + Fatha
@@ -18321,10 +18331,10 @@ $diacritics = array (
); );
/** /**
* Array of character substitutions from UTF-8 unicode to latin1 * Array of character substitutions from UTF-8 Unicode to Latin1.
* @public
*/ */
global $utf8tolatin; public $uni_utf8tolatin = array (
$utf8tolatin = array (
8364=>128, # Euro1 8364=>128, # Euro1
338=>140, # OE 338=>140, # OE
352=>138, # Scaron 352=>138, # Scaron
@@ -18354,7 +18364,8 @@ $utf8tolatin = array (
382=>158 # zcaron2 382=>158 # zcaron2
); );
} // --- END OF CLASS ---
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?>