1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +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,13 +322,13 @@ if ($cal_totev > 0)
$ec_last_day = $thisevent_start_date['mday'];
}
// Add footer
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc);
if ($ec_output_type == 'print') $cal_text .= "</form>\n";
// Add footer
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc);
if ($ec_output_type == 'print') $cal_text .= "</form>\n";
}
else
{
$cal_text.= EC_LAN_148;
$cal_text.= EC_LAN_148;
}
switch($ec_output_type)
@@ -344,11 +344,7 @@ switch($ec_output_type)
case 'pdf':
//TODO find a way to pass initialisation options etc to PDF driver
include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'.php');
// define('FPDF_FONTPATH', 'font/');
//require the ufpdf class
// require_once (e_PLUGIN.'pdf/ufpdf.php');
//require the e107pdf class
//include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php'); - shouldn't be needed
require_once (e_PLUGIN.'pdf/e107pdf.php');
$pdf = new e107PDF();
// $text = array($text, $creator, $author, $title, $subject, $keywords, $url);

View File

@@ -1,103 +1,313 @@
<?php
//============================================================+
// File name : 2dbarcodes.php
// Version : 1.0.014
// Begin : 2009-04-07
// Last Update : 2009-08-17
// Version : 1.0.000
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2008-2009 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// 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,
// 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
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
// Last Update : 2012-04-30
// 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) 2009-2012 Nicola Asuni - Tecnick.com LTD
//
// Description : PHP class to creates array representations for
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// 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
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : PHP class to creates array representations for
// 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.
* @package com.tecnick.tcpdf
* @abstract Functions for generating string representation of 2D barcodes.
* @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
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 1.0.000
* @version 1.0.014
*/
/**
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
* @name TCPDFBarcode
* @package com.tecnick.tcpdf
* @version 1.0.000
* @author Nicola Asuni
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*/
/**
* @class TCPDF2DBarcode
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
* @package com.tecnick.tcpdf
* @version 1.0.014
* @author Nicola Asuni
*/
class TCPDF2DBarcode {
/**
* @var array representation of barcode.
* @access protected
* Array representation of barcode.
* @protected
*/
protected $barcode_array;
protected $barcode_array = false;
/**
* This is the class constructor.
* This is the class constructor.
* Return an array representations for 2D barcodes:<ul>
* <li>$arrcode['code'] code to be printed on text label</li>
* <li>$arrcode['num_rows'] required number of rows</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>
* @param string $code code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul>
* @param $code (string) code to print
* @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) {
$this->setBarcode($code, $type);
}
/**
/**
* Return an array representations of barcode.
* @return array
*/
public function getBarcodeArray() {
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.
* @param string $code code to print
* @param string $type type of barcode: <ul><li>TEST</li><li>...TO BE IMPLEMENTED</li></ul>
* @param $code (string) code to print
* @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
*/
public function setBarcode($code, $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
$this->barcode_array['num_rows'] = 5;
$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,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,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;
}
// ... Add here real 2D barcodes ...
default: {
$this->barcode_array = false;
}
@@ -121,6 +328,5 @@ class TCPDF2DBarcode {
} // end of class
//============================================================+
// END OF FILE
// END OF FILE
//============================================================+
?>

View File

@@ -16,7 +16,7 @@
*/
require_once('../../class2.php');
if (!getperms("P") || !plugInstalled('pdf'))
if (!getperms('P') || !plugInstalled('pdf'))
{
header('location:'.e_BASE.'index.php');
exit;
@@ -24,37 +24,83 @@ if (!getperms("P") || !plugInstalled('pdf'))
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
$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);
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;
while(list($key, $value) = each($_POST))
$tp = e107::getParser();
$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
{
$adminEvent = 'PDF_01';
$adminMessage = PDF_LAN_18;
foreach($prefList as $k => $default)
{
if (isset($_POST[$k]))
{
$pdfpref[$k] = $tp->toDB($v);
$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
$tmp = $eArrayStorage->WriteArray($pdfpref);
$sql -> db_Update("core", "e107_value='{$tmp}' WHERE e107_name='pdf' ");
$admin_log->logArrayAll('PDF_01',$pdfpref);
$message = PDF_LAN_18;
return $message;
if (count($prefChanges))
{
$result = $pdfNew->save();
if ($result === TRUE)
{
// 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()
{
global $eArrayStorage;
$sql = e107::getDb();
if(!is_object($sql)){ $sql = new db; }
$num_rows = $sql -> db_Select("core", "*", "e107_name='pdf' ");
if($num_rows == 0)
$ans = e107::pref('pdf'); // retrieve pref array.
if (count($ans) == 0)
{
$tmp = getDefaultPDFPrefs();
$tmp2 = $eArrayStorage->WriteArray($tmp);
$sql -> db_Insert("core", "'pdf', '".$tmp2."' ");
$sql -> db_Select("core", "*", "e107_name='pdf' ");
$ans = getDefaultPDFPrefs();
}
$row = $sql -> db_Fetch();
$pdfpref = $eArrayStorage->ReadArray($row['e107_value']);
return $pdfpref;
return $ans;
}
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
$fontlist=array('times','courier','helvetica','symbol');
function getFontInfo($fontName)
{
$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);
//$up=-125;
//$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);
}
@@ -132,7 +163,7 @@ function getFontList($match = '')
require_once(e_HANDLER.'file_class.php');
$fl = new e_file();
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();
$intList = array();
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();
$coreList = array();
foreach ($fontList as $font => $info)
@@ -267,7 +327,8 @@ $text .= "
</tr>
</table>
<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>
".$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 .= "</table>";
$text .= '</table>';
$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

@@ -1,328 +1,355 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/e107pdf.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
/*
TODO:
1. Look at using disc cache
2. More detailed check on image paths
*/
// Debug option - adds entries to rolling log (only works in 0.8)
//define ('PDF_DEBUG', TRUE);
define ('PDF_DEBUG', FALSE);
define('K_PATH_MAIN', '');
define('K_PATH_URL', SITEURL); // Used with forms (TODO: check validity)
/*
The full tcpdf distribution includes a utility to generate new fonts, as well as lots of other fonts.
It can be downloaded from: http://sourceforge.net/projects/tcpdf/
*/
require_once(e_PLUGIN.'pdf/tcpdf.php'); //require the ufpdf class
include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php');
//extend tcpdf class from package with custom functions
class e107PDF extends TCPDF
{
protected $pdfPrefs = array(); // Prefs - loaded before creating a pdf
/**
* Constructor
* @param string $orientation page orientation. Possible values are (case insensitive):<ul><li>P or Portrait (default)</li><li>L or Landscape</li></ul>
* @param string $unit User measure unit. Possible values are:<ul><li>pt: point</li><li>mm: millimeter (default)</li><li>cm: centimeter</li><li>in: inch</li></ul><br />A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
* @param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).<ul><li>4A0</li><li>2A0</li><li>A0</li><li>A1</li><li>A2</li><li>A3</li><li>A4 (default)</li><li>A5</li><li>A6</li><li>A7</li><li>A8</li><li>A9</li><li>A10</li><li>B0</li><li>B1</li><li>B2</li><li>B3</li><li>B4</li><li>B5</li><li>B6</li><li>B7</li><li>B8</li><li>B9</li><li>B10</li><li>C0</li><li>C1</li><li>C2</li><li>C3</li><li>C4</li><li>C5</li><li>C6</li><li>C7</li><li>C8</li><li>C9</li><li>C10</li><li>RA0</li><li>RA1</li><li>RA2</li><li>RA3</li><li>RA4</li><li>SRA0</li><li>SRA1</li><li>SRA2</li><li>SRA3</li><li>SRA4</li><li>LETTER</li><li>LEGAL</li><li>EXECUTIVE</li><li>FOLIO</li></ul>
* @param boolean $unicode TRUE means that the input text is unicode (default = true)
* @param boolean $diskcache if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
* @param String $encoding charset encoding; default is UTF-8
*/
public function __construct($orientation='P',$unit='mm',$format='A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false)
{
global $pdfpref;
//Call parent constructor
parent::__construct($orientation,$unit,$format, $unicode, $encoding, $diskcache);
//Initialization
$this->setCellHeightRatio(1.25); // Should already be the default
}
//default preferences if none present
function getDefaultPDFPrefs()
{
$pdfpref['pdf_margin_left'] = '25';
$pdfpref['pdf_margin_right'] = '15';
$pdfpref['pdf_margin_top'] = '15';
$pdfpref['pdf_font_family'] = 'helvetica';
$pdfpref['pdf_font_size'] = '8';
$pdfpref['pdf_font_size_sitename'] = '14';
$pdfpref['pdf_font_size_page_url'] = '8';
$pdfpref['pdf_font_size_page_number'] = '8';
$pdfpref['pdf_show_logo'] = true;
$pdfpref['pdf_show_sitename'] = false;
$pdfpref['pdf_show_page_url'] = true;
$pdfpref['pdf_show_page_number'] = true;
$pdfpref['pdf_error_reporting'] = true;
return $pdfpref;
}
/**
* Set up the e107 PDF prefs - if can't be loaded from the DB, force some sensible defaults
*/
//get preferences from db
function getPDFPrefs()
{
global $sql, $eArrayStorage;
if(!is_object($eArrayStorage))
{
e107_require_once(e_HANDLER.'arraystorage_class.php');
$eArrayStorage = new ArrayData();
}
if(!is_object($sql)){ $sql = new db; }
$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;
}
/**
* Convert e107-encoded text to body text
* @param string $text
* @return string with various entities replaced with their equivalent characters
*/
function toPDF($text)
{
$search = array('&#39;', '&#039;', '&#036;', '&quot;');
$replace = array("'", "'", '$', '"');
$text = str_replace($search, $replace, $text);
return $text;
}
/**
* Convert e107-encoded text to title text
* @param string $text
* @return string with various characters replaced with '-' TODO: Why?
*/
function toPDFTitle($text)
{
$search = array(":", "*", "?", '"', '<', '>', '|');
$replace = array('-', '-', '-', '-', '-', '-', '-');
$text = str_replace($search, $replace, $text);
return $text;
}
/**
* The makePDF function does all the real parsing and composing
* @param array $text needs to be an array containing the following:
* $text = array($text, $creator, $author, $title, $subject, $keywords, $url[, $orientation]);
* @return - none (the PDF file is output, all being well)
*/
function makePDF($text)
{
$tp = e107::getParser();
//call get preferences
$this->pdfPref = $this->getPDFPrefs();
//define logo and source pageurl (before the parser!)
if(is_readable(THEME.'images/logopdf.png'))
{
$logo = THEME.'images/logopdf.png';
}
else
{
$logo = e_IMAGE.'logo.png';
}
define('PDFLOGO', $logo); //define logo to add in header
define('PDFPAGEURL', $text[6]); //define page url to add in header
//parse the data
$text[3] = $this->toPDF($text[3]); //replace some in the title
$text[3] = $this->toPDFTitle($text[3]); //replace some in the title
foreach($text as $k=>$v)
{
$text[$k] = $tp->toHTML($v, TRUE, 'BODY');
}
//set some variables
$this->SetMargins($this->pdfPref['pdf_margin_left'],$this->pdfPref['pdf_margin_top'],$this->pdfPref['pdf_margin_right']);
$this->SetAutoPageBreak(true,25); // Force new page break at 25mm from bottom
$this->SetPrintHeader(TRUE);
//start creating the pdf and adding the data
$this->DefOrientation=(varset($text[7], 'P') == 'L' ? 'L' : 'P'); // Page orientation - P=portrait, L=landscape
$this->AliasNbPages(); //calculate current page + number of pages
$this->AddPage(); //start page
$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->SetFooterFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']));
$this->WriteHTML($text[0], true); //write text TODO: possibly other parameters
$this->SetCreator($text[1]); //name of creator
$this->SetAuthor($text[2]); //name of author
$this->SetTitle($text[3]); //title
$this->SetSubject($text[4]); //subject
$this->SetKeywords($text[5]); //space/comma separated
$file = $text[3].'.pdf'; //name of the file
$this->Output($file, 'D'); //Save PDF to file (D = output to download window)
return;
}
/**
* Add e107-specific header to each page.
* Uses various prefs set in the admin page.
* Overrides the tcpdf default header function
*/
function Header()
{
$pageWidth = $this->getPageWidth(); // Will be 210 for A4 portrait
$ormargins = $this->getOriginalMargins();
$headerfont = $this->getHeaderFont();
$headerdata = $this->getHeaderData();
$topMargin = $this->pdfPref['pdf_margin_top'];
if($this->pdfPref['pdf_show_logo'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']);
$this->Image(PDFLOGO, $this->GetX(), $topMargin);
$imgx = $this->getImageRBX();
$imgy = $this->getImageRBY(); // Coordinates of bottom right of logo
$a=$this->GetStringWidth(SITENAME);
$b=$this->GetStringWidth(PDFPAGEURL);
$c = max($a, $b) + $this->rMargin;
if(($imgx + $c) > $pageWidth) // See if room for other text to right of logo
{ // No room - move to underneath
$this->SetX($this->lMargin);
$this->SetY($imgy+2);
}
else
{
$m = 0;
if($this->pdfPref['pdf_show_sitename'])
{
$m = 5;
}
if($this->pdfPref['pdf_show_page_url'])
{
$m += 5;
}
if($this->pdfPref['pdf_show_page_number'])
{
$m += 5;
}
$this->SetX($imgx); // May not be needed
$newY = max($topMargin, $imgy - $m);
$this->SetY($newY); //Room to right of logo - calculate space to line up bottom of text with bottom of logo
}
}
else
{
$this->SetY($topMargin);
}
// Now print text - 'cursor' positioned in correct start position
$cellwidth = $pageWidth - $this->GetX()-$this->rMargin;
$align = 'R';
// echo "imgx: {$imgx} imgy: {$imgy} cellwidth: {$cellwidth} m: {$m} <br />";
if($this->pdfPref['pdf_show_sitename'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'B',$this->pdfPref['pdf_font_size_sitename']);
$this->Cell($cellwidth,5,SITENAME,0,1,$align);
}
if($this->pdfPref['pdf_show_page_url'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'I',$this->pdfPref['pdf_font_size_page_url']);
$this->Cell($cellwidth,5,PDFPAGEURL,0,1,$align,'',PDFPAGEURL);
}
if($this->pdfPref['pdf_show_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->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']);
// Following cloned from tcpdf header function
$this->SetY((2.835 / $this->getScaleFactor()) + max($imgy, $this->GetY())); // 2.835 is number of pixels per mm
if ($this->getRTL())
{
$this->SetX($ormargins['right']);
}
else
{
$this->SetX($ormargins['left']);
}
$this->Cell(0, 0, '', 'T', 0, 'C'); // This puts a line between header and text
$this->SetTopMargin($this->GetY()+2); // FIXME: Bodge to force main body text to start below header
}
/**
* Override standard function to use our own font directory
*/
protected function _getfontpath()
{
return str_replace(e_HTTP, e_ROOT, e_PLUGIN_ABS.'pdf/font/');
}
/**
* Called by tcpdf when it encounters a file reference - e.g. source file name in 'img' tag - so we can tweak the source path
* (tcpdf modified to check for a class extension which adds this method)
* @param string $fileName - name of file as it appears in the 'src' parameter
* @param string $source - name of tag which provoked call (might be useful to affect encoding)
* @return string - file name adjusted to suit tcpdf
*/
function filePathModify($fileName, $source = '')
{
if (substr($fileName,0,1) == '/')
{ // Its an absolute file reference
return str_replace(e_HTTP,e_ROOT,$fileName);
}
else
{ // Its a relative link
return realpath($fileName);
}
}
}
?>
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/e107pdf.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
/*
TODO:
1. Look at using disc cache
2. More detailed check on image paths
*/
// Debug option - adds entries to rolling log (only works in 0.8)
//define ('PDF_DEBUG', TRUE);
define ('PDF_DEBUG', FALSE);
define('K_PATH_MAIN', '');
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.
It can be downloaded from: http://sourceforge.net/projects/tcpdf/
*/
require_once(e_PLUGIN.'pdf/tcpdf.php'); //require the ufpdf class
include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php');
//extend tcpdf class from package with custom functions
class e107PDF extends TCPDF
{
protected $pdfPref = array(); // Prefs - loaded before creating a pdf
/**
* Constructor
* @param string $orientation page orientation. Possible values are (case insensitive):<ul><li>P or Portrait (default)</li><li>L or Landscape</li></ul>
* @param string $unit User measure unit. Possible values are:<ul><li>pt: point</li><li>mm: millimeter (default)</li><li>cm: centimeter</li><li>in: inch</li></ul><br />A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
* @param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).<ul><li>4A0</li><li>2A0</li><li>A0</li><li>A1</li><li>A2</li><li>A3</li><li>A4 (default)</li><li>A5</li><li>A6</li><li>A7</li><li>A8</li><li>A9</li><li>A10</li><li>B0</li><li>B1</li><li>B2</li><li>B3</li><li>B4</li><li>B5</li><li>B6</li><li>B7</li><li>B8</li><li>B9</li><li>B10</li><li>C0</li><li>C1</li><li>C2</li><li>C3</li><li>C4</li><li>C5</li><li>C6</li><li>C7</li><li>C8</li><li>C9</li><li>C10</li><li>RA0</li><li>RA1</li><li>RA2</li><li>RA3</li><li>RA4</li><li>SRA0</li><li>SRA1</li><li>SRA2</li><li>SRA3</li><li>SRA4</li><li>LETTER</li><li>LEGAL</li><li>EXECUTIVE</li><li>FOLIO</li></ul>
* @param boolean $unicode TRUE means that the input text is unicode (default = true)
* @param boolean $diskcache if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
* @param String $encoding charset encoding; default is UTF-8
*/
public function __construct($orientation='P',$unit='mm',$format='A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false)
{
$this->getPDFPrefs();
//Call parent constructor
parent::__construct($orientation,$unit,$format, $unicode, $encoding, $diskcache);
//Initialization
$this->setCellHeightRatio(1.25); // Should already be the default
}
//default preferences if none present
function getDefaultPDFPrefs()
{
$pdfpref['pdf_margin_left'] = '25';
$pdfpref['pdf_margin_right'] = '15';
$pdfpref['pdf_margin_top'] = '15';
$pdfpref['pdf_font_family'] = 'helvetica';
$pdfpref['pdf_font_size'] = '8';
$pdfpref['pdf_font_size_sitename'] = '14';
$pdfpref['pdf_font_size_page_url'] = '8';
$pdfpref['pdf_font_size_page_number'] = '8';
$pdfpref['pdf_show_logo'] = true;
$pdfpref['pdf_show_sitename'] = false;
$pdfpref['pdf_show_page_url'] = true;
$pdfpref['pdf_show_page_number'] = true;
$pdfpref['pdf_error_reporting'] = true;
return $pdfpref;
}
/**
* Set up the e107 PDF prefs - if can't be loaded from the DB, force some sensible defaults
*/
//get preferences from db
function getPDFPrefs()
{
$this->pdfPref = e107::pref('pdf'); // retrieve pref array.
if (count($this->pdfPref) == 0)
{
$this->pdfPref = $this->getDefaultPDFPrefs();
}
return $this->pdfPref;
}
/**
* Convert e107-encoded text to body text
* @param string $text
* @return string with various entities replaced with their equivalent characters
*/
function toPDF($text)
{
$search = array('&#39;', '&#039;', '&#036;', '&quot;');
$replace = array("'", "'", '$', '"');
$text = str_replace($search, $replace, $text);
return $text;
}
/**
* Convert e107-encoded text to title text
* @param string $text
* @return string with various characters replaced with '-' TODO: Why?
*/
function toPDFTitle($text)
{
$search = array(":", "*", "?", '"', '<', '>', '|');
$replace = array('-', '-', '-', '-', '-', '-', '-');
$text = str_replace($search, $replace, $text);
return $text;
}
/**
* The makePDF function does all the real parsing and composing
* @param array $text needs to be an array containing the following:
* $text = array($text, $creator, $author, $title, $subject, $keywords, $url[, $orientation]);
* @return - none (the PDF file is output, all being well)
*/
function makePDF($text)
{
$tp = e107::getParser();
// Make sure prefs up to date
$this->getPDFPrefs();
//define logo and source pageurl (before the parser!)
if(is_readable(THEME.'images/logopdf.png'))
{
$logo = THEME.'images/logopdf.png';
}
else
{
$logo = e_IMAGE.'logo.png';
}
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
//parse the data
$text[3] = $this->toPDF($text[3]); //replace some in the title
$text[3] = $this->toPDFTitle($text[3]); //replace some in the title
foreach($text as $k=>$v)
{
$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
$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->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
$this->DefOrientation=(varset($text[7], 'P') == 'L' ? 'L' : 'P'); // Page orientation - P=portrait, L=landscape
$this->AliasNbPages(); //calculate current page + number of pages
$this->AddPage(); //start page
//$pdf->setFontSubsetting(true);
$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->SetFooterFont(array($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']));
$this->WriteHTML($text[0], true); //write text TODO: possibly other parameters
$this->SetCreator($text[1]); //name of creator
$this->SetAuthor($text[2]); //name of author
$this->SetTitle($text[3]); //title
$this->SetSubject($text[4]); //subject
$this->SetKeywords($text[5]); //space/comma separated
$file = $text[3].'.pdf'; //name of the file
$this->Output($file, 'D'); //Save PDF to file (D = output to download window)
return;
}
/**
* Add e107-specific header to each page.
* Uses various prefs set in the admin page.
* Overrides the tcpdf default header function
*/
function Header()
{
$pageWidth = $this->getPageWidth(); // Will be 210 for A4 portrait
$ormargins = $this->getOriginalMargins();
$headerfont = $this->getHeaderFont();
$headerdata = $this->getHeaderData();
$topMargin = $this->pdfPref['pdf_margin_top'];
if($this->pdfPref['pdf_show_logo'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']);
$this->Image(PDFLOGO, $this->GetX(), $topMargin);
$imgx = $this->getImageRBX();
$imgy = $this->getImageRBY(); // Coordinates of bottom right of logo
$a=$this->GetStringWidth(SITENAME);
$b=$this->GetStringWidth(PDFPAGEURL);
$c = max($a, $b) + $this->rMargin;
if(($imgx + $c) > $pageWidth) // See if room for other text to right of logo
{ // No room - move to underneath
$this->SetX($this->lMargin);
$this->SetY($imgy+2);
}
else
{
$m = 0;
if($this->pdfPref['pdf_show_sitename'])
{
$m = 5;
}
if($this->pdfPref['pdf_show_page_url'])
{
$m += 5;
}
if($this->pdfPref['pdf_show_page_number'])
{
$m += 5;
}
$this->SetX($imgx); // May not be needed
$newY = max($topMargin, $imgy - $m);
$this->SetY($newY); //Room to right of logo - calculate space to line up bottom of text with bottom of logo
}
}
else
{
$this->SetY($topMargin);
}
// Now print text - 'cursor' positioned in correct start position
$cellwidth = $pageWidth - $this->GetX()-$this->rMargin;
$align = 'R';
// echo "imgx: {$imgx} imgy: {$imgy} cellwidth: {$cellwidth} m: {$m} <br />";
if($this->pdfPref['pdf_show_sitename'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'B',$this->pdfPref['pdf_font_size_sitename']);
$this->Cell($cellwidth,5,SITENAME,0,1,$align);
}
if($this->pdfPref['pdf_show_page_url'])
{
$this->SetFont($this->pdfPref['pdf_font_family'],'I',$this->pdfPref['pdf_font_size_page_url']);
$this->Cell($cellwidth,5,PDFPAGEURL,0,1,$align,'',PDFPAGEURL);
}
if($this->pdfPref['pdf_show_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->getAliasNumPage().'/'.$this->getAliasNbPages(),0,1,$align);
}
$this->SetFont($this->pdfPref['pdf_font_family'],'',$this->pdfPref['pdf_font_size']);
// Following cloned from tcpdf header function
$this->SetY((2.835 / $this->getScaleFactor()) + max($imgy, $this->GetY())); // 2.835 is number of pixels per mm
if ($this->getRTL())
{
$this->SetX($ormargins['right']);
}
else
{
$this->SetX($ormargins['left']);
}
$this->Cell(0, 0, '', 'T', 0, 'C'); // This puts a line between header and text
$this->SetTopMargin($this->GetY()+2); // FIXME: Bodge to force main body text to start below header
}
/**
* Override standard function to use our own font directory
*/
protected function _getfontpath()
{
//return str_replace(e_HTTP, e_ROOT, e_PLUGIN_ABS.'pdf/fonts/');
return e_PLUGIN.'pdf/fonts/';
}
/**
* Called by tcpdf when it encounters a file reference - e.g. source file name in 'img' tag - so we can tweak the source path
* (tcpdf modified to check for a class extension which adds this method)
* @param string $fileName - name of file as it appears in the 'src' parameter
* @param string $source - name of tag which provoked call (might be useful to affect encoding)
* @return string - file name adjusted to suit tcpdf
*/
function filePathModify($fileName, $source = '')
{
if (substr($fileName,0,1) == '/')
{ // Its an absolute file reference
return str_replace(e_HTTP,e_ROOT,$fileName);
}
else
{ // Its a relative link
return realpath($fileName);
}
}
}
?>

View File

@@ -1,57 +1,47 @@
<?php
//============================================================+
// File name : htmlcolors.php
// Version : 1.0.008
// Begin : 2002-04-09
// Last Update : 2009-09-06
// Version : 1.0.003
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// 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,
// 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
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
// Last Update : 2010-12-16
// 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-2012 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// 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
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// 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
* @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
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @since 2.9.000 (2008-03-26)
*/
*/
/**
* Array of WEB safe colors
*/
global $webcolor;
$webcolor = array (
'aliceblue' => 'f0f8ff',
'antiquewhite' => 'faebd7',
@@ -113,8 +103,8 @@ $webcolor = array (
'greenyellow' => 'adff2f',
'honeydew' => 'f0fff0',
'hotpink' => 'ff69b4',
'indianred ' => 'cd5c5c',
'indigo ' => '4b0082',
'indianred' => 'cd5c5c',
'indigo' => '4b0082',
'ivory' => 'fffff0',
'khaki' => 'f0e68c',
'lavender' => 'e6e6fa',
@@ -205,6 +195,5 @@ $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_16', 'show page numbers on pdf?');
//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_20', 'error reporting');
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_30', 'boldital'); // Bold italic font type
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
//define('LAN_AL_PDF_01', 'PDF settings updated');

View File

@@ -1,123 +1,122 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF Generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
require_once('../../class2.php');
if(!e107::isInstalled('pdf') || !e_QUERY)
{
header('Location: '.e_BASE.'index.php');
}
$qs = explode('.', e_QUERY,2);
$source = $qs[0];
$parms = varset($qs[1],'');
//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
$pdf = new e107PDF();
if(strpos($source,'plugin:') !== FALSE)
{
$plugin = substr($source,7);
if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php'))
{
include_once(e_PLUGIN.$plugin.'/e_emailprint.php');
if (function_exists('print_item_pdf'))
{
$text = print_item_pdf($parms);
$pdf->makePDF($text);
}
else
{
echo 'PDF generation not supported in this section';
}
}
else
{
echo 'file missing: '.e_PLUGIN.$plugin.'/e_emailprint.php';
exit;
}
}
else
{
if($source == 'news')
{
$con = new convert;
$sql->db_Select('news', '*', 'news_id='.intval($parms));
$row = $sql->db_Fetch();
$news_body = $tp->toHTML($row['news_body'], TRUE);
$news_extended = $tp->toHTML($row['news_extended'], TRUE);
if ($row['news_author'] == 0)
{
$a_name = 'e107';
$category_name = 'e107 welcome message';
}
else
{
$sql->db_Select('news_category', 'category_id, category_name', 'category_id='.intval($row['news_category']));
list($category_id, $category_name) = $sql->db_Fetch();
$sql->db_Select('user', 'user_id, user_name', 'user_id='.intval($row['news_author']));
list($a_id, $a_name) = $sql->db_Fetch(MYSQL_NUM);
}
$row['news_datestamp'] = $con->convert_date($row['news_datestamp'], "long");
$row['news_title'] = $tp -> toHTML($row['news_title'], TRUE, 'parse_sc');
//remove existing links from news title
$search = array();
$replace = array();
$search[0] = "/\<a href=\"(.*?)\">(.*?)<\/a>/si";
$replace[0] = '\\2';
$search[1] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[1] = '\\2';
$search[2] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[2] = '\\2';
$search[3] = "/\<a href=&quot;(.*?)&quot;>(.*?)<\/a>/si";
$replace[3] = '\\2';
$search[4] = "/\<a href=&#39;(.*?)&#39;>(.*?)<\/a>/si";
$replace[4] = '\\2';
$row['news_title'] = preg_replace($search, $replace, $row['news_title']);
$text = "
<b>".$row['news_title']."</b><br />
".$row['category_name']."<br />
".$a_name.", ".$row['news_datestamp']."<br />
<br />
".$row['news_body']."<br />
";
if ($row['news_extended'] != ""){ $text .= "<br /><br />".$row['news_extended']; }
if ($row['news_source'] != ""){ $text .= "<br /><br />".$row['news_source']; }
if ($row['news_url'] != ""){ $text .= "<br />".$row['news_url']; }
$text = $text; //define text
$creator = SITENAME; //define creator
$author = $a_name; //define author
$title = $row['news_title']; //define title
$subject = $category_name; //define subject
$keywords = ''; //define keywords
//define url and logo to use in the header of the pdf file
$url = SITEURL.'news.php?item.'.$row['news_id'];
//always return an array with the following data:
$text = array($text, $creator, $author, $title, $subject, $keywords, $url);
$pdf->makePDF($text);
}
}
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF Generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
require_once('../../class2.php');
if(!e107::isInstalled('pdf') || !e_QUERY)
{
header('Location: '.e_BASE.'index.php');
}
$qs = explode('.', e_QUERY,2);
$source = $qs[0];
$parms = varset($qs[1],'');
//include_lan(e_PLUGIN.'pdf/languages/'.e_LANGUAGE.'_admin_pdf.php');
require_once(e_PLUGIN.'pdf/e107pdf.php'); //require the e107pdf class
$pdf = new e107PDF();
if(strpos($source,'plugin:') !== FALSE)
{
$plugin = substr($source,7);
if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php'))
{
include_once(e_PLUGIN.$plugin.'/e_emailprint.php');
if (function_exists('print_item_pdf'))
{
$text = print_item_pdf($parms);
$pdf->makePDF($text);
}
else
{
echo 'PDF generation not supported in this section';
}
}
else
{
echo 'file missing: '.e_PLUGIN.$plugin.'/e_emailprint.php';
exit;
}
}
else
{
if($source == 'news')
{
$con = new convert;
$sql->db_Select('news', '*', 'news_id='.intval($parms));
$row = $sql->db_Fetch();
$news_body = $tp->toHTML($row['news_body'], TRUE);
$news_extended = $tp->toHTML($row['news_extended'], TRUE);
if ($row['news_author'] == 0)
{
$a_name = 'e107';
$category_name = 'e107 welcome message';
}
else
{
$sql->db_Select('news_category', 'category_id, category_name', 'category_id='.intval($row['news_category']));
list($category_id, $category_name) = $sql->db_Fetch();
$sql->db_Select('user', 'user_id, user_name', 'user_id='.intval($row['news_author']));
list($a_id, $a_name) = $sql->db_Fetch(MYSQL_NUM);
}
$row['news_datestamp'] = $con->convert_date($row['news_datestamp'], "long");
$row['news_title'] = $tp -> toHTML($row['news_title'], TRUE, 'parse_sc');
//remove existing links from news title
$search = array();
$replace = array();
$search[0] = "/\<a href=\"(.*?)\">(.*?)<\/a>/si";
$replace[0] = '\\2';
$search[1] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[1] = '\\2';
$search[2] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
$replace[2] = '\\2';
$search[3] = "/\<a href=&quot;(.*?)&quot;>(.*?)<\/a>/si";
$replace[3] = '\\2';
$search[4] = "/\<a href=&#39;(.*?)&#39;>(.*?)<\/a>/si";
$replace[4] = '\\2';
$row['news_title'] = preg_replace($search, $replace, $row['news_title']);
$text = "
<b>".$row['news_title']."</b><br />
".$row['category_name']."<br />
".$a_name.", ".$row['news_datestamp']."<br />
<br />
".$row['news_body']."<br />
";
if ($row['news_extended'] != ""){ $text .= "<br /><br />".$row['news_extended']; }
if ($row['news_source'] != ""){ $text .= "<br /><br />".$row['news_source']; }
if ($row['news_url'] != ""){ $text .= "<br />".$row['news_url']; }
$text = $text; //define text
$creator = SITENAME; //define creator
$author = $a_name; //define author
$title = $row['news_title']; //define title
$subject = $category_name; //define subject
$keywords = ''; //define keywords
//define url and logo to use in the header of the pdf file
$url = SITEURL.'news.php?item.'.$row['news_id'];
//always return an array with the following data:
$text = array($text, $creator, $author, $title, $subject, $keywords, $url);
$pdf->makePDF($text);
}
}
?>

File diff suppressed because one or more lines are too long

View File

@@ -1,88 +1,103 @@
<?php
//============================================================+
// File name : unicode_data.php
// Version : 1.0.009
// Begin : 2008-01-01
// Last Update : 2009-08-17
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
//
// This program is free software: you can redistribute it and/or modify
// 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,
// 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
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// ----------------------------------------------------------------------------
// Last Update : 2011-10-01
// 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) 2008-2012 Nicola Asuni - Tecnick.com LTD
//
// Description : Unicode Include file for TCPDF.
// This file is part of TCPDF software library.
//
// Author: Nicola Asuni
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// 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
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description : Unicode data for TCPDF library.
//
// (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
// Efthimios Mavrogeorgiadis
// Saleh AlMatrafe
/**
* Unicode Include file for TCPDF.
* @file
* Unicode data class for TCPDF library.
* @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
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @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
| \xD7[\x80\x83\x86\x90-\xAA\xB0-\xB4] # 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\xA9[\x80-\x87\x90-\x98] # R
| \xE2\x80[\xAB\xAE] # RLE & RLO
)/x");
)/x";
/*
* Pattern to test Arabic strings using regular expressions.
* source: http://www.w3.org/International/questions/qa-forms-utf-8
/**
* Pattern to test Arabic strings using regular expressions. 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
| \xD9[\x80-\x8A\xAD-\xAF\xB1-\xBF] # AL
| \xDA[\x80-\xBF] # AL
@@ -120,13 +135,13 @@ define("K_RE_PATTERN_ARABIC", "/(
| \xEF\xBA[\x80-\xBF] # AL
| \xEF\xBB[\x80-\xBC] # AL
| \xD9[\xA0-\xA9\xAB\xAC] # AN
)/x");
)/x";
/**
* Array of unicode types
* Array of Unicode types.
* @public
*/
global $unicode;
$unicode = array(
public $uni_type = array(
0=>'BN',
1=>'BN',
2=>'BN',
@@ -17850,12 +17865,10 @@ $unicode = array(
);
/**
* Mirror unicode characters.
* For information on bidi mirroring, see UAX #9: Bidirectional Algorithm,
* at http://www.unicode.org/unicode/reports/tr9/
* Mirror unicode characters. For information on bidi mirroring, see UAX #9: Bidirectional Algorithm, at http://www.unicode.org/unicode/reports/tr9/
* @public
*/
global $unicode_mirror;
$unicode_mirror = array (
public $uni_mirror = array (
0x0028=>0x0029,
0x0029=>0x0028,
0x003C=>0x003E,
@@ -18210,11 +18223,10 @@ $unicode_mirror = array (
0xFF63=>0xFF62);
/**
* Arabic shape subtitutions
* char code=>isolated, final, initial, medial
* Arabic shape substitutions: char code => (isolated, final, initial, medial).
* @public
*/
global $unicode_arlet;
$unicode_arlet = array(
public $uni_arabicsubst = array(
1569=>array(65152),
1570=>array(65153, 65154, 65153, 65154),
1571=>array(65155, 65156, 65155, 65156),
@@ -18294,11 +18306,10 @@ $unicode_arlet = array(
);
/**
* Arabic laa letter
* char code=>isolated, final, initial, medial
* Arabic laa letter: (char code => isolated, final, initial, medial).
* @public
*/
global $laa_array;
$laa_array = array (
public $uni_laa_array = array (
1570 =>array(65269, 65270, 65269, 65270),
1571 =>array(65271, 65272, 65271, 65272),
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).
* Combining characters that can occur with Shadda (U0651) are placed in UE586-UE594.
* 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
* Array of character substitutions for sequences of two diacritics symbols.
* Putting the combining mark and character in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner.
* second NSM char code => substitution char
* @public
*/
global $diacritics;
$diacritics = array (
public $uni_diacritics = array (
1612=>64606, # Shadda + Dammatan
1613=>64607, # Shadda + Kasratan
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;
$utf8tolatin = array (
public $uni_utf8tolatin = array (
8364=>128, # Euro1
338=>140, # OE
352=>138, # Scaron
@@ -18354,7 +18364,8 @@ $utf8tolatin = array (
382=>158 # zcaron2
);
} // --- END OF CLASS ---
//============================================================+
// END OF FILE
//============================================================+
?>