openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 5a8ab9fe998742060dd691a097796447b3fa807f
parent c789ee01f0ea4894097e69c73feadbccb7a4902c
Author: Jan Dankert <devnull@localhost>
Date:   Sat, 16 Dec 2017 23:41:50 +0100

Der Wikiparser als eigenes Modul (ehem. 'textclasses').

Diffstat:
modules/wikiparser/AbstractElement.class.php | 18++++++++++++++++++
modules/wikiparser/CodeElement.class.php | 14++++++++++++++
modules/wikiparser/DefinitionItemElement.class.php | 14++++++++++++++
modules/wikiparser/DefinitionListElement.class.php | 14++++++++++++++
modules/wikiparser/DocumentElement.class.php | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/EmphaticElement.class.php | 23+++++++++++++++++++++++
modules/wikiparser/FootnoteElement.class.php | 14++++++++++++++
modules/wikiparser/HeadlineElement.class.php | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/ImageElement.class.php | 14++++++++++++++
modules/wikiparser/InsertedElement.class.php | 14++++++++++++++
modules/wikiparser/LineBreakElement.class.php | 14++++++++++++++
modules/wikiparser/LinkElement.class.php | 154+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/ListElement.class.php | 15+++++++++++++++
modules/wikiparser/ListEntryElement.class.php | 13+++++++++++++
modules/wikiparser/MacroElement.class.php | 18++++++++++++++++++
modules/wikiparser/NumberedListElement.class.php | 14++++++++++++++
modules/wikiparser/ParagraphElement.class.php | 14++++++++++++++
modules/wikiparser/QuoteElement.class.php | 13+++++++++++++
modules/wikiparser/RawElement.class.php | 19+++++++++++++++++++
modules/wikiparser/RemovedElement.class.php | 14++++++++++++++
modules/wikiparser/SpeechElement.class.php | 14++++++++++++++
modules/wikiparser/StrongElement.class.php | 28++++++++++++++++++++++++++++
modules/wikiparser/TableCellElement.class.php | 16++++++++++++++++
modules/wikiparser/TableElement.class.php | 23+++++++++++++++++++++++
modules/wikiparser/TableLineElement.class.php | 14++++++++++++++
modules/wikiparser/TableOfContentElement.class.php | 14++++++++++++++
modules/wikiparser/TeletypeElement.class.php | 14++++++++++++++
modules/wikiparser/TextElement.class.php | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/include.inc.php | 44++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/parser/WikiParser.class.php | 763+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/DocBookRenderer.class.php | 247+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/HtmlDomRenderer.class.php | 324+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/HtmlRenderer.class.php | 543+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/LatexRenderer.class.php | 202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/Pdf.class.php | 35+++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/PdfRenderer.class.php | 215+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/TextRenderer.class.php | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/XhtmlRenderer.class.php | 482+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/wikiparser/renderer/font/courier.php | 7+++++++
modules/wikiparser/renderer/font/helvetica.php | 15+++++++++++++++
modules/wikiparser/renderer/font/helveticab.php | 15+++++++++++++++
modules/wikiparser/renderer/font/helveticabi.php | 15+++++++++++++++
modules/wikiparser/renderer/font/helveticai.php | 15+++++++++++++++
modules/wikiparser/renderer/font/readme.txt | 2++
modules/wikiparser/renderer/font/symbol.php | 15+++++++++++++++
modules/wikiparser/renderer/font/times.php | 15+++++++++++++++
modules/wikiparser/renderer/font/timesb.php | 15+++++++++++++++
modules/wikiparser/renderer/font/timesbi.php | 15+++++++++++++++
modules/wikiparser/renderer/font/timesi.php | 15+++++++++++++++
modules/wikiparser/renderer/font/zapfdingbats.php | 15+++++++++++++++
modules/wikiparser/renderer/fpdf.php | 1725+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
textClasses/AbstractElement.class.php | 18------------------
textClasses/CodeElement.class.php | 14--------------
textClasses/DefinitionItemElement.class.php | 14--------------
textClasses/DefinitionListElement.class.php | 14--------------
textClasses/DocumentElement.class.php | 99-------------------------------------------------------------------------------
textClasses/EmphaticElement.class.php | 23-----------------------
textClasses/FootnoteElement.class.php | 14--------------
textClasses/HeadlineElement.class.php | 54------------------------------------------------------
textClasses/ImageElement.class.php | 14--------------
textClasses/InsertedElement.class.php | 14--------------
textClasses/LineBreakElement.class.php | 14--------------
textClasses/LinkElement.class.php | 154-------------------------------------------------------------------------------
textClasses/ListElement.class.php | 15---------------
textClasses/ListEntryElement.class.php | 13-------------
textClasses/MacroElement.class.php | 18------------------
textClasses/NumberedListElement.class.php | 14--------------
textClasses/ParagraphElement.class.php | 14--------------
textClasses/QuoteElement.class.php | 13-------------
textClasses/RawElement.class.php | 19-------------------
textClasses/RemovedElement.class.php | 14--------------
textClasses/SpeechElement.class.php | 14--------------
textClasses/StrongElement.class.php | 28----------------------------
textClasses/TableCellElement.class.php | 16----------------
textClasses/TableElement.class.php | 23-----------------------
textClasses/TableLineElement.class.php | 14--------------
textClasses/TableOfContentElement.class.php | 14--------------
textClasses/TeletypeElement.class.php | 14--------------
textClasses/TextElement.class.php | 63---------------------------------------------------------------
textClasses/include.inc.php | 44--------------------------------------------
textClasses/parser/WikiParser.class.php | 763-------------------------------------------------------------------------------
textClasses/renderer/DocBookRenderer.class.php | 247-------------------------------------------------------------------------------
textClasses/renderer/HtmlDomRenderer.class.php | 324-------------------------------------------------------------------------------
textClasses/renderer/HtmlRenderer.class.php | 543-------------------------------------------------------------------------------
textClasses/renderer/LatexRenderer.class.php | 202-------------------------------------------------------------------------------
textClasses/renderer/Pdf.class.php | 35-----------------------------------
textClasses/renderer/PdfRenderer.class.php | 215-------------------------------------------------------------------------------
textClasses/renderer/TextRenderer.class.php | 135-------------------------------------------------------------------------------
textClasses/renderer/XhtmlRenderer.class.php | 482-------------------------------------------------------------------------------
textClasses/renderer/font/courier.php | 7-------
textClasses/renderer/font/helvetica.php | 15---------------
textClasses/renderer/font/helveticab.php | 15---------------
textClasses/renderer/font/helveticabi.php | 15---------------
textClasses/renderer/font/helveticai.php | 15---------------
textClasses/renderer/font/readme.txt | 2--
textClasses/renderer/font/symbol.php | 15---------------
textClasses/renderer/font/times.php | 15---------------
textClasses/renderer/font/timesb.php | 15---------------
textClasses/renderer/font/timesbi.php | 15---------------
textClasses/renderer/font/timesi.php | 15---------------
textClasses/renderer/font/zapfdingbats.php | 15---------------
textClasses/renderer/fpdf.php | 1725-------------------------------------------------------------------------------
102 files changed, 5626 insertions(+), 5626 deletions(-)

diff --git a/modules/wikiparser/AbstractElement.class.php b/modules/wikiparser/AbstractElement.class.php @@ -0,0 +1,17 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class AbstractElement +{ + var $children = array(); + + var $style = ''; + var $class = ''; + var $title = ''; +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/CodeElement.class.php b/modules/wikiparser/CodeElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class CodeElement extends AbstractElement +{ + var $language; +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/DefinitionItemElement.class.php b/modules/wikiparser/DefinitionItemElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class DefinitionItemElement extends AbstractElement +{ + var $key = ''; +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/DefinitionListElement.class.php b/modules/wikiparser/DefinitionListElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class DefinitionListElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/DocumentElement.class.php b/modules/wikiparser/DocumentElement.class.php @@ -0,0 +1,98 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class DocumentElement extends AbstractElement +{ + var $linkedObjectIds = array(); + var $page; + + /** + * Fu�noten. + * + * @var Array + */ + var $footnotes = array(); + + var $encodeHtml = false; + + /** + * Ein Text wird geparst.<br> + * <br> + * Zerlegt den Text zeilenweise und erzeugt die Unterobjekte.<br> + * + * @param Ein- oder mehrzeiliger roher Text + * @param Art des Parsens, Default=Wiki + */ + function parse( $text, $type='wiki' ) + { + $parserClass = ucfirst(strtolower($type)).'Parser'; + $parser = new $parserClass(); + + $this->children = $parser->parse( $text ); + $this->linkedObjectIds = $parser->linkedObjectIds; + } + + + + + + /** + * Rendering des Dokumentes.<br> + * Die Art und Weise des Renderns ist in Abh�ngigkeit zum + * �bergebenen Mime-Type. + * + * @param String $mimeType Mime-Type, z.B. "text/html" + * @return String + */ + function render( $mimeType ) + { + + switch( $mimeType ) + { + case 'text/html': + $this->type = 'html'; + break; + case 'text/plain': + $this->type = 'text'; + break; + case 'application/pdf': + $this->type = 'pdf'; + break; + case 'application/html-dom': + $this->type = 'htmlDom'; + break; + case 'application/x-latex': + $this->type = 'latex'; + break; + case 'text/xhtml': + $this->type = 'xhtml'; + break; + case 'application/docbook+xml': + $this->type = 'docBook'; + break; + default: + $this->type = 'html'; + } + + $rendererClass = ucfirst($this->type).'Renderer'; + + $renderer = new $rendererClass(); + $renderer->children = $this->children; + $renderer->page = $this->page; + $renderer->linkedObjectIds = $this->linkedObjectIds; + $renderer->encodeHtml = $this->encodeHtml; + + return $renderer->render(); + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/EmphaticElement.class.php b/modules/wikiparser/EmphaticElement.class.php @@ -0,0 +1,22 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class EmphaticElement extends AbstractElement +{ + function render( $type ) + { + switch( $type ) + { + case 'html': + return '<p>'.$this->value.'</p>'; + default: + return $this->value; + } + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/FootnoteElement.class.php b/modules/wikiparser/FootnoteElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class FootnoteElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/HeadlineElement.class.php b/modules/wikiparser/HeadlineElement.class.php @@ -0,0 +1,53 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class HeadlineElement extends AbstractElement +{ + var $level = 1; + + + + /** + * Konstruktor. + */ + function HeadlineElement( $level=1 ) + { + $this->level = $level; + } + + + + function getText() + { + $name = ''; + foreach( $this->children as $child ) + { + if ( strtolower(get_class($child))=='textelement') + { + $name .= $child->text; + } + } + + return $name; + } + + + + function getName() + { + $name = strtolower( $this->getText() ); + +// return urlencode( $name ); + $gueltig = 'abcdefghijklmnopqrstuvwxyz0123456789.-_'; + $tmp = strtr($name, $gueltig, str_repeat('#', strlen($gueltig))); + $name = str_replace('.','',strtr($name, $tmp, str_repeat('.', strlen($tmp)))); + + return $name; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/ImageElement.class.php b/modules/wikiparser/ImageElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class ImageElement extends LinkElement +{ + var $description; +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/InsertedElement.class.php b/modules/wikiparser/InsertedElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class InsertedElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/LineBreakElement.class.php b/modules/wikiparser/LineBreakElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class LineBreakElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/LinkElement.class.php b/modules/wikiparser/LinkElement.class.php @@ -0,0 +1,153 @@ +<?php + +/** + * Darstellung eines Verweises auf eine URL.<br> + * <br> + * Es wird nur das Verweisziel gespeichert.<br> + * Der verweisende Text wird nicht hier, sondern in einem der Unterelemente gespeichert. + * + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class LinkElement extends AbstractElement +{ + var $target; + var $mail; + var $protocol = ''; + var $objectId = 0; + var $user = ''; + var $password = ''; + var $host = ''; + var $port = ''; + var $query = ''; + var $fragment = ''; + var $path = ''; + + var $name; + + /** + * Setzt das Ziel des Links.<br> + * Als Parameter wird eine URL erwartet. + * + * @param target Verweisziel + */ + function setTarget( $target ) + { + $this->target = $target; + + $url = parse_url( $target ); + + $this->protocol = @$url['scheme']; + $this->user = @$url['user' ]; + $this->password = @$url['pass' ]; + $this->host = @$url['host' ]; + $this->port = @$url['port' ]; + $this->path = @$url['path' ]; + $this->query = @$url['query' ]; + $this->fragment = @$url['fragment']; + + if ( $this->protocol == 'object' ) + $this->objectId = intval($url['host']); + + + if ( $this->protocol == '' ) + { + if ( strpos($target,'@') !== false ) + { + $this->protocol = 'mailto'; + $this->path = $this->target; + } + + // "..."->"123" + if ( intval($url['path']) > 0 ) + { + $this->protocol = 'object'; + $this->objectId = intval($url['path']); + } + } + } + + + /** + * Ermittelt die URL des Links. + */ + function getUrl() + { + $url = ''; + + // Protokollangabe im Format <protokoll>:// + if ( $this->protocol != '') + { + $url .= $this->protocol.':'; + + // Ausnahme: Das "mailto"-Protokoll darf keinen Doppelslash haben. + if ( $this->protocol != 'mailto' ) + $url.='//'; + } + + // Benutzer und Kennwort anh�ngen. + // Format: <benutzer>:<kennwort>@ + if ( $this->user != '' ) + { + $url .= $this->user; + if ( $this->password != '' ) + { + $url .= ':'.$this->password; + } + $url .= '@'; + } + + // Hostnamen anh�ngen. + $url .= $this->host; + + // Port anh�ngen + if ( $this->port != '' ) + $url .= ':'.$this->port; + + // Den Pfad anh�ngen. + $url .= $this->url_encode($this->path); + + // Den Query-Teil mit einem "?" getrennt anh�ngen. + if ( $this->query != '' ) + $url .= '?'.$this->url_encode($this->query); +// $url .= '?'.urlencode($this->query); + + // Fragment mit "#" getrennt anh�ngen. + if ( $this->fragment != '' ) + $url .= '#'.$this->url_encode($this->fragment); + + return $url; + } + + + + /** + * Hilfsfunktion f�r #url_encode(). + * Ein Ganzzahl-Wert wird in Hexadezimal umgewandelt. + */ + private function int2hex($intega) + { + $Ziffer = "0123456789ABCDEF"; + return @$Ziffer[($intega%256)/16].$Ziffer[$intega%16]; + } + + + + /** + * Kodiert eine URL.<br> + * Alle Zeichen mit dem Ordinalwert >=129 werden kodiert. + */ + private function url_encode( $text ) + { + for($i=129;$i<255;$i++) + { + $in = chr($i); + $out = "%C3%".$this->int2hex($i-64); + $text = str_replace($in,$out,$text); + } + return $text; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/ListElement.class.php b/modules/wikiparser/ListElement.class.php @@ -0,0 +1,14 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class ListElement extends AbstractElement +{ + + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/ListEntryElement.class.php b/modules/wikiparser/ListEntryElement.class.php @@ -0,0 +1,12 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class ListEntryElement extends AbstractElement +{ +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/MacroElement.class.php b/modules/wikiparser/MacroElement.class.php @@ -0,0 +1,17 @@ +<?php + +/** + * Darstellung eines Makros. + * + * Ein Makro hat einen Namen sowie n Attribute. + * + * @author Jan Dankert + * @package openrat.text + */ +class MacroElement extends AbstractElement +{ + var $name; + var $attributes = array(); +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/NumberedListElement.class.php b/modules/wikiparser/NumberedListElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class NumberedListElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/ParagraphElement.class.php b/modules/wikiparser/ParagraphElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class ParagraphElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/QuoteElement.class.php b/modules/wikiparser/QuoteElement.class.php @@ -0,0 +1,12 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class QuoteElement extends AbstractElement +{ +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/RawElement.class.php b/modules/wikiparser/RawElement.class.php @@ -0,0 +1,18 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class RawElement extends AbstractElement +{ + var $src = ''; + + function RawElement( $t='' ) + { + $this->src = $t; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/RemovedElement.class.php b/modules/wikiparser/RemovedElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class RemovedElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/SpeechElement.class.php b/modules/wikiparser/SpeechElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class SpeechElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/StrongElement.class.php b/modules/wikiparser/StrongElement.class.php @@ -0,0 +1,27 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class StrongElement extends AbstractElement +{ + function render( $type ) + { + switch( $type ) + { + case 'html': + return '<p>'.$this->value.'</p>'; + default: + return $this->value; + } + } + + + + var $markup = array( 'beginswith' =>'*' , + 'endswith'=>'*' ); +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TableCellElement.class.php b/modules/wikiparser/TableCellElement.class.php @@ -0,0 +1,15 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TableCellElement extends AbstractElement +{ + var $rowSpan = 1; + var $colSpan = 1; + var $isHeading = false; +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TableElement.class.php b/modules/wikiparser/TableElement.class.php @@ -0,0 +1,22 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TableElement extends AbstractElement +{ + function render( $type ) + { + switch( $type ) + { + case 'html': + return '<p>'.$this->value.'</p>'; + default: + return $this->value; + } + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TableLineElement.class.php b/modules/wikiparser/TableLineElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TableLineElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TableOfContentElement.class.php b/modules/wikiparser/TableOfContentElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TableOfContentElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TeletypeElement.class.php b/modules/wikiparser/TeletypeElement.class.php @@ -0,0 +1,13 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TeletypeElement extends AbstractElement +{ + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/TextElement.class.php b/modules/wikiparser/TextElement.class.php @@ -0,0 +1,62 @@ +<?php + +/** + * @author $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TextElement extends AbstractElement +{ + var $text = ''; + + function TextElement( $t='' ) + { + $this->text = $t; + + $this->parseStyleClass(); + $this->parseTitleText(); + } + + + function parseStyleClass() + { + $char1 = substr($this->text,0,1); + if ( $char1 == "(" ) + { + $pos2 = strpos($this->text,")",2); + if ( $pos2 !== false ) + { + $this->style = substr($this->text,1,$pos2-1); + $this->text = substr($this->text,$pos2+1); + + // Wenn kein Doppelpunkt in den Styleangaben vorkommt, dann + // handelt es sich um einen Klassennamen. + if ( strpos($this->style,':') === false ) + { + $this->class = $this->style; + $this->style = ''; + } + } + } + } + + + + function parseTitleText() + { + $char1 = substr($this->text,0,1); + if ( $char1 == "'" ) + { + $pos2 = strpos($this->text,"'",2); + if ( $pos2 !== false ) + { + $this->title = substr($this->text,1,$pos2-1); + $this->text = substr($this->text,$pos2+1); + } + } + } + + +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/include.inc.php b/modules/wikiparser/include.inc.php @@ -0,0 +1,43 @@ +<?php + +// Die DOM-Klassen sind nur bei der Erzeugung von Seiten notwendig. +//if ( !empty($REQ[REQ_PARAM_ACTION]) && in_array($REQ[REQ_PARAM_ACTION],array('pageelement','page','folder')) ) +{ + require_once( OR_TEXTCLASSES_DIR."parser/WikiParser.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/HtmlRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/XhtmlRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/HtmlDomRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/PdfRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/TextRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/DocBookRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."renderer/LatexRenderer.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."AbstractElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."QuoteElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."CodeElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."DocumentElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."EmphaticElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."FootnoteElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."HeadlineElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."LineBreakElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."LinkElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."ImageElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."MacroElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TeletypeElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."SpeechElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."ListElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."ListEntryElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."NumberedListElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."ParagraphElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."RawElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."StrongElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TableElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TableLineElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TableCellElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TableOfContentElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."TextElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."DefinitionListElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."DefinitionItemElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."InsertedElement.class.".PHP_EXT ); + require_once( OR_TEXTCLASSES_DIR."RemovedElement.class.".PHP_EXT ); +} +?>+ \ No newline at end of file diff --git a/modules/wikiparser/parser/WikiParser.class.php b/modules/wikiparser/parser/WikiParser.class.php @@ -0,0 +1,762 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class WikiParser +{ + var $linkedObjectIds = array(); + + /** + * Ein Text wird geparst.<br> + * <br> + * Zerlegt den Text zeilenweise und erzeugt die Unterobjekte.<br> + * + * @param Ein- oder mehrzeiliger roher Text + */ + function parse( $text ) + { +// set_time_limit(1); + $zeilen = array(); + $nr = 0; + + foreach( $text as $t ) + { +// $t = $this->fixLinks( $t ); // Verweise vervollstaendigen. + $zeilen[++$nr] = new Line( rtrim($t) ); + } + + // $zeilen enth�lt eine Liste von Zeilenobjekten. + // Der Index ist die Zeilennr. und beginnt bei 1. +// Html::debug($zeilen,"Zeilen"); + + return $this->parseMultiLineText( $zeilen ); + } + + + + /** + * Erzeugt aus einer Liste von Zeilenobjekten ein DOM in Form eines Objektbaumes. + * + * @param zeilen Liste von Zeilenobjekten. Array beginnt bei 1. + * @return Liste von Textobjekten + */ + function parseMultiLineText( $zeilen ) + { + global $conf; + + $children = array(); // Initiales Anlegen der Unterobjektliste. + $anzahlZeilen = count( $zeilen ); // Anzahl Zeilen + + // Erzwingt am Anfang und Ende eine leere Zeile, damit + // n�chste und vorige Zeile in der folgenden Schleife immer gef�llt ist. + $zeilen[0] = new Line(''); + $zeilen[$anzahlZeilen+1] = new Line(''); + + for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) + { + + $letzteZeile = $zeilen[$zeileNr-1]; + $dieseZeile = $zeilen[$zeileNr ]; + $naechsteZeile = $zeilen[$zeileNr+1]; + +// Html::debug($dieseZeile,"Zeile"); + + // Leerzeilen ignorieren + if ( $dieseZeile->isEmpty ) + { + continue; + } + + // Inhaltsverzeichnis + // Text nicht parsen + if ( $dieseZeile->isTableOfContent ) + { + $children[] = new TableOfContentElement(); + continue; + } + + + // Parser deaktiviert f�r diese Zeile + // Text nicht parsen + if ( $dieseZeile->isUnparsed ) + { + $children[] = new TextElement( $dieseZeile->value ); + continue; + } + + + // Ueberschriften Teil 1 + // Markierung in der Folgezeile mit "...", "---" oder "===" + if ( $naechsteZeile->isHeadlineUnderline ) + { + $headline = new HeadlineElement($naechsteZeile->level); + $headline->children = $this->parseSimple( $dieseZeile->value); + $children[] = $headline; + $zeileNr++; + continue; // Naechste Zeile + } + + + // Ueberschriften Teil 2 + // Markierung mit "+++..." am Zeilenbeginn. + if ( $dieseZeile->isHeadline ) + { + $headline = new HeadlineElement($dieseZeile->level); + $headline->children = $this->parseSimple( $dieseZeile->value); + $children[] = $headline; + continue; // Naechste Zeile + } + + // Zitate Teil 1 + // Zitat ist in separater Zeile angek�ndigt + if ( $dieseZeile->isQuote ) + { + $bisZeileNr = $zeileNr+1; + do + { + $bisZeileNr++; + } + while( !$zeilen[$bisZeileNr]->isQuote && $bisZeileNr<=$anzahlZeilen ); + + $quote = new QuoteElement(); + $zeilenAuszug = array(); + $nr=0; + for( $zn=$zeileNr+1;$zn<$bisZeileNr;$zn++) + { + $zeilenAuszug[++$nr] = $zeilen[$zn]; + } + $quote->children = $this->parseMultiLineText($zeilenAuszug); + $zeileNr = $bisZeileNr+1; + $children[] = $quote; + continue; + } + + + + // Zitate Teil 2 + // Markierung am Zeilenanfang + if ( $dieseZeile->isQuotePraefix ) + { + $bisZeileNr = $zeileNr; + while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isQuotePraefix ) + $bisZeileNr++; + $bisZeileNr--; +// Html::debug($bisZeileNr,"Bis-Zeile-Nr."); + $quote = new QuoteElement(); + + $zeilenAuszug = $this->getListenAuszug( $zeilen,$zeileNr,$bisZeileNr); +// Html::debug($zeilenAuszug,"Auszug"); +// die(); + $quote->children = $this->parseMultiLineText($zeilenAuszug); + $zeileNr = $bisZeileNr; + $children[] = $quote; + continue; + } + + + + // Definitionsliste + // Markierung am Zeilenanfang + if ( $dieseZeile->isDefinition ) + { + $bisZeileNr = $zeileNr; + while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isDefinition ) + $bisZeileNr++; + $bisZeileNr--; + + $defList = new DefinitionListElement(); + + $zeilenAuszug = $this->getListenAuszug( $zeilen,$zeileNr,$bisZeileNr); +// Html::debug($zeilenAuszug,"Auszug"); +// die(); + foreach( $zeilenAuszug as $zeile ) + { + $sep = $conf['editor']['text-markup']['definition-sep']; + list($defKey, $defValue) = explode($sep, $zeile->value); + + $defEntry = new DefinitionItemElement(); + $defEntry->key = $defKey; + $defEntry->children = $this->parseSimple($defValue); + $defList->children[] = $defEntry; + } + $zeileNr = $bisZeileNr; + $children[] = $defList; + continue; + } + + + + // Code + if ( $dieseZeile->isCode) + { + $bisZeileNr = $zeileNr+1; + while( $bisZeileNr<$anzahlZeilen && !$zeilen[$bisZeileNr]->isCode ) + $bisZeileNr++; + + $code = new CodeElement(); + $code->language = trim($dieseZeile->value); + + for( $zn=$zeileNr+1;$zn<$bisZeileNr;$zn++) + { + $code->children[] = new TextElement( $zeilen[$zn]->source ); + + if ( $zn < $bisZeileNr-1 ) + $code->children[] = new LineBreakElement(); + } + $zeileNr = $bisZeileNr; + $children[] = $code; + continue; + } + + + // Tabellen + if ( $dieseZeile->isTable ) + { + $bisZeileNr = $zeileNr; + while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isTable ) + $bisZeileNr++; + + $tabelle = new TableElement(); + $zeilenAuszug = array(); + for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) + { + $zeilenAuszug[$zn-$zeileNr+1] = $zeilen[$zn]; + } + $tabelle->children = $this->parseTable($zeilenAuszug); + $children[] = $tabelle; + $zeileNr = $bisZeileNr+1; + continue; + } + + + // Listen + if ( $dieseZeile->isList || $dieseZeile->isNumberedList ) + { + + $bisZeileNr = $zeileNr; + while( $bisZeileNr<=$anzahlZeilen && + ($zeilen[$bisZeileNr]->isList || $zeilen[$bisZeileNr]->isNumberedList) ) + $bisZeileNr++; + $bisZeileNr--; + + if ( $dieseZeile->isList ) + $liste = new ListElement(); + else + $liste = new NumberedListElement(); + + $zeilenAuszug = array(); + $nr=0; + + for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) + { + $zeilenAuszug[++$nr] = $zeilen[$zn]; + } + + $liste->children = $this->parseList($zeilenAuszug,1); + $children[] = $liste; + $zeileNr = $bisZeileNr; + continue; + } + + + + if ( $dieseZeile->isNormal ) + { +// Html::debug($dieseZeile,"normale Zeile"); + // Textabsaetze + $bisZeileNr = $zeileNr; + while( $bisZeileNr <= $anzahlZeilen && + $zeilen[$bisZeileNr ]->isNormal ) + { + $bisZeileNr++; + } + $bisZeileNr--; +// Html::debug($zeileNr,"Zeile"); +// Html::debug($bisZeileNr,"bisZeile-P"); +// die(); + + $para = new ParagraphElement(); + for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) + { + if ( !$zeilen[$zn]->isNormal ) + continue; + + if ( $zeilen[$zn]->isUnparsed ) + $para->children[] = new TextElement( $zeilen[$zn]->source ); + + foreach( $this->parseSimple($zeilen[$zn]->value) as $e ) + $para->children[] = $e; + + if ( $zn < $bisZeileNr ) + $para->children[] = new LineBreakElement(); + } + + $zeileNr = $bisZeileNr; + $children[] = $para; + + continue; + } + + Html::debug($dieseZeile,"Unbekannte Zeile"); + die( 'unknown line: '.$dieseZeile ); + } + + return $children; + } + + + + function getListenAuszug( $liste, $von, $bis ) + { + $auszug = array(); + $idx = 0; + + for( $j=$von;$j<=$bis;$j++) + { + $auszug[++$idx] = new Line($liste[$j]->value); + } + + return $auszug; + } + + + /** + * Parsen einer mehrzeiligen Liste + */ + function parseList( $zeilen,$tiefe ) + { + $children = array(); + $anzahlZeilen = count( $zeilen ); + $entry = null; + for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) + { + $dieseZeile = $zeilen[$zeileNr]; + + // Listen + if ( $dieseZeile->indent <= $tiefe ) + { + if ( $zeileNr > 1 ) + $children[] = $entry; + + $entry = new ListEntryElement(); + $entry->children = $this->parseSimple( $dieseZeile->value ); + } + else + { + // Weitere Schachtelung der Liste + if ( $dieseZeile->isList ) + $liste = new ListElement(); + else + $liste = new NumberedListElement(); + + $bisZeileNr = $zeileNr; + + while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->indent != $tiefe ) + $bisZeileNr++; + $bisZeileNr--; + +// echo "von $zeileNr bis $bisZeileNr (insges. $anzahlZeilen)"; + $zeilenAuszug = array(); + $nr=0; + for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) + { + $zeilenAuszug[++$nr] = $zeilen[$zn]; + } + $liste->children = $this->parseList($zeilenAuszug,$tiefe+1); + $entry->children[] = $liste; + $zeileNr = $bisZeileNr; + } + } + $children[] = $entry; + + return $children; + } + + + /** + * Parsen einer Tabelle. + */ + function parseTable( $zeilen ) + { + $children = array(); + $anzahlZeilen = count( $zeilen ); + for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) + { + $dieseZeile = $zeilen[$zeileNr]; + + $zeile = new TableLineElement(); + + // Listen + $zellen = explode('|',$dieseZeile->source); + $colSpan = 1; + + foreach( $zellen as $zellenInhalt ) + { + if ( $zellenInhalt=='') + { + $colSpan++; + continue; + } + + $zelle = new TableCellElement(); + $zelle->colSpan = $colSpan; + $colSpan = 1; + + if ( substr($zellenInhalt,0,1) == '!' ) + { + $zelle->isHeading = true; + $zellenInhalt = substr($zellenInhalt,1); + } + + $zelle->children = $this->parseSimple( $zellenInhalt); + + $zeile->children[] = $zelle; + } + + $children[] = $zeile; + } + + return $children; + } + + + + function parseLinks( $text ) + { + $conf = Session::getConfig(); + $text_markup = $conf['editor']['text-markup']; + + $posM = strpos($text,'"'.$text_markup['linkto'].'"'); + + if ( $posM === false ) + return false; + + $posL = strpos(substr($text,0,$posM-1),'"'); + + if ( $posL === false ) + return false; + + $posR = strpos($text,'"',$posM+4); + + if ( $posR === false ) + return false; + + $parts = array(); + $parts[] = substr($text,0 ,$posL ); // Anfang + $parts[] = substr($text,$posL+1,$posM-$posL-1); // Linktext + $parts[] = substr($text,$posM+4,$posR-$posM-4); // Verweisziel + $parts[] = substr($text,$posR+1 ); // Rest + + return $parts; + } + + + /** + * Erzeugt ein Bildobjekt + */ + function parseImages( $text ) + { + $posM = strpos($text,'image:'); + + if ( $posM === false ) + return false; + + $posL = strpos(substr($text,0,$posM-1),'"'); + + if ( $posL === false ) + return false; + + $posR = strpos($text,'"',$posM+4); + + if ( $posR === false ) + return false; + + $parts = array(); + $parts[] = substr($text,0 ,$posL ); // Anfang + $parts[] = substr($text,$posL+1,$posM-$posL-1); // Linktext + $parts[] = substr($text,$posM+4,$posR-$posM-4); // Verweisziel + $parts[] = substr($text,$posR+1 ); // Rest + + return $parts; + } + + + + /** + * Zerlegt einen einfachen Text in ein Array. + * + * @param String $text Eingabe-Test + * @param String $sepLinks Linke Begrenzung + * @param String $sepRechts Rechte Begrenzung + * @return Array + */ + function parseSimpleParts( $text,$sepLinks,$sepRechts ) + { + $posL = strpos($text,$sepLinks); + + if ( $posL === false ) + return false; + + $posR = strpos($text,$sepRechts,$posL+strlen($sepLinks)); + + if ( $posR === false ) + return false; + + $parts = array(); + $parts[] = substr($text,0 ,$posL ); + $parts[] = substr($text,$posL+strlen($sepLinks),$posR-$posL-strlen($sepLinks)); + $parts[] = substr($text,$posR+strlen($sepRechts) ); + + return $parts; + } + + + + /** + * + */ + function parseEscapes( $text ) + { + $posL = strpos($text,'\\'); + + if ( $posL === false ) + return false; + + $parts = array(); + $parts[] = substr($text,0 ,$posL ); + $parts[] = substr($text,$posL+1,1 ); + $parts[] = substr($text,$posL+2 ); + + return $parts; + } + + + + /** + * Parst einen einzeiligen Text und erzeugt daraus Elemente. + * + * @param String $text Zu parsender Text + * @param String $sepL Linke Begrenzung des Elementes + * @param String $sepR Rechte Begrenzung des Elementes + * @param String $className Klassenname des Elementes, welches es zu erzeugen gilt. + * @return Array + */ + function parseSimpleElement( $text,$sepL,$sepR,$className ) + { + $erg = $this->parseSimpleParts( $text,$sepL,$sepR ); + if ( is_array($erg) ) + { + $idx = -1; + $elements = array(); + + $davor = $this->parseSimple($erg[++$idx]); + foreach( $davor as $davorEl ) + $elements[] = $davorEl; + + $newEl = new $className(); + $newEl->children = $this->parseSimple($erg[++$idx]); + $elements[] = $newEl; + + $danach = $this->parseSimple($erg[++$idx]); + foreach( $danach as $danachEl ) + $elements[] = $danachEl; + return $elements; + } + + return false; + } + + + + /** + * Korrigiert kurze Links. + * + * @param String $text + * @return String + */ + function fixLinks( $text ) + { + // Text->... umsetzen nach "Text"->... (Anfuehrungszeichen ergaenzen) + $text = preg_replace( '/([A-Za-z0-9._-]+)\-\>/','"\\1"->',$text ); + + // ...->Link umsetzen nach ...->"Link" (Anfuehrungszeichen ergaenzen) + $text = preg_replace( '/\->([A-Za-z0-9\.\:\_\/\,\?\=\&-]+)/','->"\\1"',$text ); + + // alleinstehende externe Links + // Funktioniert nicht richtig, erstmal deaktiviert. +// $text = ereg_replace( '((https?|ftps?|news|gopher):\/\/([A-Za-z0-9._\/\,-]+))([^"])','"\\1"->"\\1"\\2',$text ); + + // alleinstehende E-Mail Adressen + $text = preg_replace( '/([A-Za-z0-9._-]+@[A-Za-z0-9\.\_\-]+)([^A-Za-z0-9\.\_\-\"])/','"\\1"->"mailto:\\1"\\2',$text ); + + // Bilder + $text = preg_replace( '/ima?ge?:\/?\/?([A-Za-z0-9\.\:\_\/\,\?\=\&-]+)/','{\\1}',$text ); + + return $text; + } + + + + /** + * Diese Methode parst einen einfachen, einzeiligen Text und zerlegt diesen in seine Bestandteile. + * + * @param String $text + * @return Array + */ + function parseSimple( $text ) + { + $conf = Session::getConfig(); + $text_markup = $conf['editor']['text-markup']; + + $text = $this->fixLinks($text); + $elements = array(); + + if ( trim($text) == '' ) + return $elements; + + $erg = $this->parseLinks( $text ); + if ( is_array($erg) ) + { + $idx = -1; + + $davor = $this->parseSimple($erg[++$idx]); + foreach( $davor as $davorEl ) + $elements[] = $davorEl; + + $link = new LinkElement(); + $link->children = $this->parseSimple($erg[++$idx]); + $link->setTarget( $erg[++$idx] ); + + if ( $link->objectId != 0 ) + $this->linkedObjectIds[] = $link->objectId; + $elements[] = $link; + + $danach = $this->parseSimple($erg[++$idx]); + foreach( $danach as $danachEl ) + $elements[] = $danachEl; + + return $elements; + } + + + $erg = $this->parseSimpleParts( $text,$text_markup['image-begin'],$text_markup['image-end'] ); + if ( is_array($erg) ) + { + $idx = -1; + + $davor = $this->parseSimple($erg[++$idx]); + foreach( $davor as $davorEl ) + $elements[] = $davorEl; + + $image = new ImageElement(); + $t = new TextElement($erg[++$idx]); + $image->setTarget( intval($t->text) ); + $t->text = ''; + $image->children[] = $t; + + if ( $image->objectId != 0 ) + $this->linkedObjectIds[] = $image->objectId; + $elements[] = $image; + + $danach = $this->parseSimple($erg[++$idx]); + foreach( $danach as $danachEl ) + $elements[] = $danachEl; + + return $elements; + } + + $erg = $this->parseSimpleParts( $text,$text_markup['macro-begin'],$text_markup['macro-end'] ); + if ( is_array($erg) ) + { + $idx = -1; + + $davor = $this->parseSimple($erg[++$idx]); + foreach( $davor as $davorEl ) + $elements[] = $davorEl; + + $macro = new MacroElement(); + $inh = explode(' ',$erg[++$idx]); + $macro->name = $inh[0]; + unset($inh[0]); + foreach( $inh as $attr ) + { + if ( empty($attr)) continue; + + list($attr_name,$attr_val) = explode($text_markup['macro-attribute-value-seperator'],$attr); + $attr_val = trim($attr_val,$text_markup['macro-attribute-quote']); + $macro->attributes[$attr_name] = $attr_val; + } + + $elements[] = $macro; + + $danach = $this->parseSimple($erg[++$idx]); + foreach( $danach as $danachEl ) + $elements[] = $danachEl; + + return $elements; + } + + + $erg = $this->parseEscapes( $text ); + if ( is_array($erg) ) + { + $idx = -1; + + $davor = $this->parseSimple($erg[++$idx]); + foreach( $davor as $davorEl ) + $elements[] = $davorEl; + + $t = new TextElement($erg[++$idx]); + $elements[] = $t; + + $danach = $this->parseSimple($erg[++$idx]); + foreach( $danach as $danachEl ) + $elements[] = $danachEl; + + return $elements; + } + + $erg = $this->parseSimpleElement( $text,$text_markup['footnote-begin'],$text_markup['footnote-end'],'FootnoteElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['strong-begin'],$text_markup['strong-end'],'StrongElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['emphatic-begin'],$text_markup['emphatic-end'],'EmphaticElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['code-begin'],$text_markup['code-end'],'TeletypeElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['insert-begin'],$text_markup['insert-end'],'InsertedElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['remove-begin'],$text_markup['remove-end'],'RemovedElement' ); + if ( is_array($erg) ) + return $erg; + + $erg = $this->parseSimpleElement( $text,$text_markup['speech-begin'],$text_markup['speech-end'],'SpeechElement' ); + if ( is_array($erg) ) + return $erg; + + $t = new TextElement($text); + $elements[] = $t; + + return $elements; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/DocBookRenderer.class.php b/modules/wikiparser/renderer/DocBookRenderer.class.php @@ -0,0 +1,246 @@ +<?php + +/** + * Renderer fuer das DOCBOOK-Format. + * + * Das Docbook-Format ist von der OASIS spezifiert und ermoeglicht die + * strukturierte Darstellung von Text-Dokumenten. + * + * Dieses Klasse erzeugt aus dem internen DOM-Baum ein DocBook-XML-Dokument. + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class DocBookRenderer +{ + var $linkedObjectIds = array(); + var $encodeHtml = false; + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $attr = array(); + $val = ''; + $praefix = ''; + $suffix = ''; + $empty = false; + + switch( strtolower(get_class($child)) ) + { + case 'macroelement': + $tag = ''; + break; + + case 'tableofcontentelement': + $tag = 'toc'; + break; + + case 'rawelement': + $tag = ''; + $val = $child->src; + + break; + + case 'textelement': + $tag = 'para'; + + $val = $child->text; + $val = Text::encodeHtml( $val ); + $val = Text::replaceHtmlChars( $val ); + break; + + case 'footnoteelement': + $tag = 'footnote'; + break; + + case 'codeelement': + + $tag = 'emphasis'; + $attr['role'] = 'code'; + break; + + case 'quoteelement': + $tag = 'blockquote'; + break; + + + case 'paragraphelement': + $tag = 'para'; + break; + + case 'speechelement': + $tag = 'citiation'; + break; + + case 'linebreakelement': + $tag = ''; + $val = "\n"; + break; + + case 'linkelement': + $tag = 'ulink'; + $attr['url'] = htmlspecialchars($child->getUrl()); + break; + + case 'imageelement': + $empty = true; + $tag = 'graphic'; + $attr['fileref'] = $child->getUrl(); + break; + + case 'strongelement': + $tag = 'emphasis'; + $attr['role'] = 'strong'; + break; + + case 'emphaticelement': + $tag = 'emphasis'; + $attr['role'] = 'italic'; + break; + + case 'insertedelement': + $tag = 'emphasis'; + $attr['role'] = 'inserted'; + break; + + case 'removedelement': + $tag = 'emphasis'; + $attr['role'] = 'removed'; + break; + + case 'headlineelement': + $tag = 'chapter'; // $child->level ? + + $l = new LinkElement(); + $l->name = $child->getName(); + $child->children[] = $l; + + break; + + case 'tableelement': + $tag = 'table'; + break; + + case 'tablelineelement': + $tag = 'row'; + break; + + case 'definitionlistelement': + $tag = 'variablelist'; + break; + + case 'definitionitemelement': + if ( !empty($child->key) ) + { + $tag = 'listitem'; + $val = $child->key; + } + else + { + $tag = 'term'; + } + break; + + case 'tablecellelement': + //if ( $child->isHeading ) + $tag = 'entry'; + break; + + case 'listelement': + $tag = 'itemizedlist'; + break; + + case 'teletypeelement': + $tag = 'emphasis'; + $attr['role'] = 'code'; + break; + + case 'numberedlistelement': + $tag = 'orderedlist'; + break; + + case 'listentryelement': + $tag = 'listitem'; + break; + + default: + + $tag = 'unknown-element'; + $attr['class'] = strtolower(get_class($child)); + break; + } + + $val .= $praefix; + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + + $val .= $suffix; + return $this->renderXmlElement($tag,$val,$empty,$attr); + + } + + + + /** + * Erzeugt ein XML-Element. + * + * @param String $tag Name des Tags + * @param String $value Inhalt + * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") + * @param Array $attr Attribute als Array<String,String> + * @return String + */ + function renderXmlElement( $tag,$value,$empty,$attr=array() ) + { + global $conf; + if ( $tag == '' ) + return $value; + + $val = '<'.$tag; + foreach( $attr as $attrName=>$attrInhalt ) + { + $val .= ' '.$attrName.'="'.$attrInhalt.'"'; + } + + if ( $value == '' && $empty ) + { + $val .= ' />'; + return $val; + } + + $val .= '>'.$value.'</'.$tag.'>'; + return $val; + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->renderedText .= '<?xml version="1.0" encoding="UTF-8" ?>'; + $this->renderedText .= '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">'; + + foreach( $this->children as $child ) + $this->renderedText .= $this->renderElement( $child ); + + return $this->renderedText; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/HtmlDomRenderer.class.php b/modules/wikiparser/renderer/HtmlDomRenderer.class.php @@ -0,0 +1,323 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class HtmlDomRenderer +{ + var $linkedObjectIds = array(); + + /** + * Fu�noten. + * + * @var Array + */ + var $footnotes = array(); + + var $encodeHtml = false; + + var $path = array(); + + var $domId = ''; + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $this->path[] = $child; + + $val = ''; +// $val = '<br/>'; +// foreach( $this->path as $p ) +// $val .= '&nbsp;&nbsp;&nbsp;&nbsp;'; + +// $val .= '<a href="#'.$this->getPathAsString().'">_</a>'; + + $attr = array(); + $praefix = ''; + $suffix = ''; + $empty = false; + + if ( count($child->children) > 0 ) + { + $subChild1 = $child->children[0]; + + if ( !empty($subChild1->class) ) + $attr['class'] = $subChild1->class; + + if ( !empty($subChild1->style) ) + $attr['style'] = $subChild1->style; + + if ( !empty($subChild1->title) ) + $attr['title'] = $subChild1->title; + } + + $praefix .= lang('TEXT_MARKUP_'.strtoupper(substr(get_class($child),0,-7))); + + switch( strtolower(get_class($child)) ) + { + case 'rawelement': + $tag = ''; + $val = $child->src; + + break; + + case 'textelement': + $tag = 'text'; + + $val .= $child->text; + + break; + + + case 'linkelement': + + $tag = 'a'; + if ( !empty($child->name) ) + $attr['name'] = $child->name; + else + $attr['href'] = htmlspecialchars($child->getUrl()); + + if ( Object::available( $child->objectId ) ) + { + $file = new File( $child->objectId ); + $file->load(); + $attr['title'] = $file->description; + unset( $file ); + } + + break; + + case 'imageelement': + $empty = true; + $attr['alt'] = ''; + + if ( ! Object::available( $child->objectId ) ) + { + $tag = ''; + } + elseif ( empty($attr['title']) ) + { + $tag = 'img'; + $attr['src'] = $child->getUrl(); + $attr['border'] = '0'; + + // Breite/H�he des Bildes bestimmen. + $image = new File( $child->objectId ); + + $image->load(); + $attr['alt' ] = $image->name; + $attr['title' ] = $image->description; + + $image->getImageSize(); + $attr['width' ] = $image->width; + $attr['height'] = $image->height; + unset($image); + } + else + { + $tag = 'dl'; + + if ( empty($attr['class']) ) + $attr['class'] = "image"; + + $child->children = array(); + $dt = new DefinitionListItemElement(); + $dt->children[] = new TextElement('(image)'); + $dt->children[] = $child; + $child->children[] = $dt; + + $dd = new DefinitionListEntryElement(); + $dd->children[] = new TextElement('(image)'); + $dd->children[] = new TextElement($attr['title']); + $child->children[] = $dd; + } + $suffix = '<img src="./themes/default/images/editor/image.png">'; + break; + + case 'strongelement': + $tag = 'strong'; + break; + + case 'macroelement': + $tag = 'macro'; + $val = ucfirst($child->name); + break; + + + case 'emphaticelement': + $tag = 'em'; + break; + + case 'insertedelement': + $tag = 'ins'; + break; + + case 'removedelement': + $tag = 'del'; + break; + + case 'headlineelement': + $tag = 'h'.$child->level; + + $l = new LinkElement(); + $l->name = $child->getName(); + $child->children[] = $l; + + break; + + case 'tableelement': + $tag = 'table'; + break; + + case 'tablelineelement': + $tag = 'tr'; + break; + + case 'definitionlistelement': + $items = $child->children; + $newChildren = array(); + foreach( $items as $item ) + { + $def = new DefinitionItemElement(); + $def->key = $item->key; + $item->key = ''; + $newChildren[] = $def; + $newChildren[] = $item; + } +// Html::debug($newChildren,'Children-neu'); + $child->children = $newChildren; + $tag = 'dl'; + break; + + case 'definitionitemelement': + if ( !empty($child->key) ) + { + $tag = 'dt'; + $val = $child->key; + } + else + { + $tag = 'dd'; + } + break; + + case 'tablecellelement': + if ( $child->isHeading ) + $tag = 'th'; else $tag = 'td'; + + if ( $child->rowSpan > 1 ) + $attr['rowspan'] = $child->rowSpan; + if ( $child->colSpan > 1 ) + $attr['colspan'] = $child->colSpan; + break; + + case 'listelement': + $tag = 'ul'; + break; + + case 'teletypeelement': + $tag = 'code'; + break; + + case 'numberedlistelement': + $tag = 'ol'; + break; + + case 'listentryelement': + $tag = 'li'; + break; + + default: + + } + + $val = $this->renderValue($val); + $val = '<div class="entry">'.$praefix.$val.$suffix.'</div>'; + + if ( count($child->children)>0 ) + { + $val .= '<ul class="tree">'; + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + $val .= '</ul>'; + } + +// echo "text:$val"; + + unset( $this->path[ count($this->path)-1 ] ); + return '<li><div class="tree" />'.$val.'</li>'; + } + + + + /** + * Rendert einen Inhalt. + * + * @param String $value Inhalt + * @return String + */ + function renderValue( $value ) + { + $val = '&nbsp;<em>'.$value.'</em>'; + return $val; + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->footnotes = array(); + + $this->renderedText = '<ul class="tree">'; + + foreach( $this->children as $child ) + $this->renderedText .= ''.$this->renderElement( $child ).''; + //$this->renderedText .= '<li><div class="tree" /><div class="entry" /><ul class="tree">'.$this->renderElement( $child ).'</ul></li>'; + + foreach( $this->footnotes as $child ) + $this->renderedText .= '<li><div class="tree" /><div class="entry" /><ul class="tree">'.$this->renderElement( $child ).'</ul></li>'; + $this->renderedText .= '</ul>'; + + return $this->renderedText; + } + + + /** + * + */ + function getPathAsString() + { + $path = array(); + foreach( $this->path as $p ) + { + $path[] = strtolower( substr(get_class($p),0,-7) ); + } + + return implode('_',$path); + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/HtmlRenderer.class.php b/modules/wikiparser/renderer/HtmlRenderer.class.php @@ -0,0 +1,542 @@ +<?php + +use cms\model\File; +use cms\model\Object; + +/** + * Dokument-Objekt.<br> + * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class HtmlRenderer +{ + public $linkedObjectIds = array(); + public $encodeHtml = false; + + /** + * Fu�noten. + * + * @var array + */ + public $footnotes = array(); + + /** + * @var string + */ + public $renderedText; + + /** + * @var \cms\model\Page + */ + public $page; + + /** + * @var array + */ + public $children; + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $attr = array(); + $val = ''; + $praefix = ''; + $suffix = ''; + $empty = false; + + if ( count($child->children) > 0 ) + { + $subChild1 = $child->children[0]; + + if ( !empty($subChild1->class) ) + $attr['class'] = $subChild1->class; + + if ( !empty($subChild1->style) ) + $attr['style'] = $subChild1->style; + + if ( !empty($subChild1->title) ) + $attr['title'] = $subChild1->title; + } + + switch( strtolower(get_class($child)) ) + { + case 'tableofcontentelement': + $tag = 'p'; + foreach( $this->children as $h) + { + if ( strtolower(get_class($h))=='headlineelement' ) + { + $child->children[] = new RawElement(str_repeat('&nbsp;&nbsp;',$h->level)); + $t = new TextElement( $h->getText() ); + $l = new LinkElement(); + $l->fragment=$h->getName(); + $l->children[] = $t; + $child->children[] = $l; + $child->children[] = new LineBreakElement(); + } + } + break; + + case 'rawelement': + $tag = ''; + $val = $child->src; + + break; + + case 'textelement': + $tag = ''; +// $tag = 'span'; + + $val = $child->text; + if ( $this->encodeHtml ) + $val = Text::encodeHtml( $val ); + $val = Text::replaceHtmlChars( $val ); + break; + + case 'footnoteelement': + $tag = 'a'; + $attr['href'] = '#footnote'; + + $title = ''; + foreach( $child->children as $c ) + $title .= $this->renderElement($c); + $attr['title'] = strip_tags($title); + + $nr = 1; + foreach( $this->footnotes as $fn ) + if ( strtolower(get_class($fn))=='linebreakelement') + $nr++; + + $val = $nr; + if ( @$conf['editor']['footnote']['bracket']) + $val = '('.$nr.')'; + if ( @$conf['editor']['footnote']['sup']) + $val = '<sup><small>'.$nr.'</small></sup>'; + + + if ( $nr == 1 ) + { + $this->footnotes[] = new RawElement('&mdash;'); + $le = new LinkElement(); + $le->name = "footnote"; + $this->footnotes[] = $le; + $this->footnotes[] = new RawElement('&mdash;'); + } + $this->footnotes[] = new LineBreakElement(); + $this->footnotes[] = new RawElement($val); + $this->footnotes[] = new RawElement(' '); + foreach( $child->children as $c ) + $this->footnotes[] = $c; + + $child->children = array(); + + break; + + case 'codeelement': + + if ( empty($child->language) ) + // Wenn keine Sprache verf�gbar, dann ein einfaches PRE-Element erzeugen. + $tag = 'pre'; + else + { + // Wenn Sprache verf�gbar, dann den GESHI-Parser bem�hen. + $tag = ''; + $source = ''; + foreach( $child->children as $c ) + if ( strtolower(get_class($c)) == 'textelement') + $source .= $c->text."\n"; + $child->children = array(); + require_once('./geshi/geshi.php'); + $geshi = new Geshi($source,$child->language); + $val = $geshi->parse_code(); + } + break; + + case 'quoteelement': + $tag = 'blockquote'; + break; + + + case 'paragraphelement': + $tag = 'p'; + break; + + case 'speechelement': + if ( isset($conf['editor']['html']['tag_speech']) ) + $tag = $conf['editor']['html']['tag_speech']; + else + $tag = 'cite'; + + // Danke an: http://www.apostroph.de/tueddelchen.php + //TODO: Abh�ngigkeit von Spracheinstellung implementieren. + $language = 'de'; + switch( $language ) + { + case 'de': // deutsche Notation + $praefix = '&bdquo;'; + $suffix = '&ldquo;'; + break; + case 'fr': + $praefix = '&laquo;'; + $suffix = '&raquo;'; + break; + default: // englische Notation + $praefix = '&ldquo;'; + $suffix = '&rdquo;'; + } + + if ( $conf['editor']['html']['override_speech'] ) + { + $praefix = $conf['editor']['html']['override_speech_open' ]; + $suffix = $conf['editor']['html']['override_speech_close']; + } + break; + + case 'macroelement': + + $tag = ''; + + if ( strtolower($child->name) == 'help' ) + { + $tag = 'tt'; + $macros = FileUtils::readDir('./macro'); + $val = 'Available macros: '.implode(',',$macros); + } + else + { + $className = ucfirst($child->name); + $fileName = './macro/'.$className.'.class.php'; + if ( is_file( $fileName ) ) + { + // Fuer den Fall, dass eine Dynamic-Klasse mehrmals pro Vorlage auftritt + if ( !class_exists($className) ) + require( $fileName ); + + if ( class_exists($className) ) + { + $macro = new $className; + /*@type $macro Makro */ + $macro->page = &$this->page; + + if ( method_exists( $macro,'execute' ) ) + { + $macro->objectid = $this->page->objectid; + $macro->page = &$this->page; + + foreach( $child->attributes as $param_name=>$param_value ) + { + if ( $param_name == 'help') + $val .= 'HELP: Available macro attributes in '.$className.': '.implode(',',array_keys(get_object_vars($macro))."\n"); + if ( isset( $macro->$param_name ) ) + { + // Die Parameter der Makro-Klasse typisiert setzen. + if ( is_int($macro->$param_name) ) + $macro->$param_name = intval($param_value); + elseif ( is_array($macro->$param_name) ) + $macro->$param_name = explode(',',$param_value); + else + $macro->$param_name = $param_value; + } + else + { + $val .= "WARNING: Unknown parameter '$param_name' in macro '$className'\n"; + } + + + + } + + $macro->execute(); + $val .= $macro->getOutput(); + } + else + { + Logger::warn('class:'.$className.', no method: execute()'); + if ( config('editor','macro','show_errors') ) + $val = 'Internal Macro error: method execute() not found'; + } + } + else + { + Logger::warn('class not found:'.$className); + if ( config('editor','macro','show_errors') ) + $val = 'Internal Macro error: class not found'; + } + } + else + { + Logger::warn('file not found:'.$fileName); + + if ( config('editor','macro','show_errors') ) + { + $tag = 'tt'; + $attr['style'] = 'color:red'; + $val = 'Unknown Macro: "'.$child->name.'", use macro "help" for a list of available macros'; + } + } + } + + break; + + case 'linebreakelement': + $tag = 'br'; + $empty = true; + break; + + case 'linkelement': + $tag = 'a'; + if ( !empty($child->name) ) + $attr['name'] = $child->name; + else + $attr['href'] = htmlspecialchars($child->getUrl()); + + if ( Object::available( $child->objectId ) ) + { + $file = new File( $child->objectId ); + $file->load(); + $attr['title'] = $file->description; + unset( $file ); + } + break; + + case 'imageelement': + $empty = true; + $attr['alt'] = ''; + + if ( ! Object::available( $child->objectId ) ) + { + $tag = ''; + } + elseif ( empty($attr['title']) ) + { + $tag = 'img'; + $attr['src'] = $child->getUrl(); + $attr['border'] = '0'; + + // Breite/H�he des Bildes bestimmen. + $image = new File( $child->objectId ); + + $image->load(); + $attr['alt' ] = $image->name; + $attr['title' ] = $image->description; + + $image->getImageSize(); + $attr['width' ] = $image->width; + $attr['height'] = $image->height; + unset($image); + } + else + { + $tag = 'dl'; + + if ( empty($attr['class']) ) + $attr['class'] = "image"; + + $child->children = array(); + $dt = new DefinitionListItemElement(); + $dt->children[] = new TextElement('(image)'); + $dt->children[] = $child; + $child->children[] = $dt; + + $dd = new DefinitionListEntryElement(); + $dd->children[] = new TextElement('(image)'); + $dd->children[] = new TextElement($attr['title']); + $child->children[] = $dd; + } + break; + + case 'strongelement': + if ( isset($conf['editor']['html']['tag_strong']) ) + $tag = $conf['editor']['html']['tag_strong']; + else + $tag = 'strong'; + break; + + case 'emphaticelement': + if ( isset($conf['editor']['html']['tag_emphatic']) ) + $tag = $conf['editor']['html']['tag_emphatic']; + else + $tag = 'em'; + break; + + case 'insertedelement': + $tag = 'ins'; + break; + + case 'removedelement': + $tag = 'del'; + break; + + case 'headlineelement': + $tag = 'h'.$child->level; + + $l = new LinkElement(); + $l->name = $child->getName(); + $child->children[] = $l; + + break; + + case 'tableelement': + $tag = 'table'; + break; + + case 'tablelineelement': + $tag = 'tr'; + break; + + case 'definitionlistelement': + $items = $child->children; + $newChildren = array(); + foreach( $items as $item ) + { + $def = new DefinitionItemElement(); + $def->key = $item->key; + $item->key = ''; + $newChildren[] = $def; + $newChildren[] = $item; + } +// Html::debug($newChildren,'Children-neu'); + $child->children = $newChildren; + $tag = 'dl'; + break; + + case 'definitionitemelement': + if ( !empty($child->key) ) + { + $tag = 'dt'; + $val = $child->key; + } + else + { + $tag = 'dd'; + } + break; + + case 'tablecellelement': + if ( $child->isHeading ) + $tag = 'th'; else $tag = 'td'; + + if ( $child->rowSpan > 1 ) + $attr['rowspan'] = $child->rowSpan; + if ( $child->colSpan > 1 ) + $attr['colspan'] = $child->colSpan; + break; + + case 'listelement': + $tag = 'ul'; + break; + + case 'teletypeelement': + if ( isset($conf['editor']['html']['tag_teletype']) ) + $tag = $conf['editor']['html']['tag_teletype']; + else + $tag = 'code'; + break; + + case 'numberedlistelement': + $tag = 'ol'; + break; + + case 'listentryelement': + $tag = 'li'; + break; + + default: + + $tag = 'unknown-element'; + $attr['class'] = strtolower(get_class($child)); + break; + } + + $val .= $praefix; + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + + $val .= $suffix; + return $this->renderHtmlElement($tag,$val,$empty,$attr); + + } + + + + /** + * Erzeugt ein HTML-Element. + * + * @param String $tag Name des Tags + * @param String $value Inhalt + * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") + * @param array $attr Attribute als Array<String,String> + * @return String + */ + function renderHtmlElement( $tag,$value,$empty,$attr=array() ) + { + global $conf; + if ( $tag == '' ) + return $value; + + $val = '<'.$tag; + foreach( $attr as $attrName=>$attrInhalt ) + { + $val .= ' '.$attrName.'="'.$attrInhalt.'"'; + } + + if ( $value == '' && $empty ) + { + // Inhalt ist leer, also Kurzform verwenden. + // Die Kurzform ist abh�ngig vom Rendermode. + // SGML=<tag> + // XML=<tag /> + if ( $conf['editor']['html']['rendermode'] == 'xml' ) + { + $val .= ' />'; + return $val; + } + else + { + $val .= '>'; + return $val; + } + } + + $val .= '>'.$value.'</'.$tag.'>'; + return $val; + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->footnotes = array(); + + foreach( $this->children as $child ) + $this->renderedText .= $this->renderElement( $child ); + + foreach( $this->footnotes as $child ) + $this->renderedText .= $this->renderElement( $child ); + + return $this->renderedText; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/LatexRenderer.class.php b/modules/wikiparser/renderer/LatexRenderer.class.php @@ -0,0 +1,201 @@ +<?php + +/** + * Renderer fuer das LaTex-Format. + * + * Diese Klasse erzeugt aus dem internen DOM-Baum ein LaTex-Dokument. + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class LatexRenderer +{ + var $linkedObjectIds = array(); + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $val = ''; + $before = ''; + $after = ''; + + switch( strtolower(get_class($child)) ) + { + case 'tableofcontentelement': + $before = '\tableofcontents'."\n"; + break; + + case 'rawelement': + $tag = ''; + $val = $child->src; + + break; + + case 'textelement': + $val = $child->text; + //$val = Text::encodeHtml( $val ); + $val = Text::replaceHtmlChars( $val ); + break; + + case 'footnoteelement': + $before = '\footnote{'; + $after = '}'; + break; + + case 'codeelement': + + break; + + case 'quoteelement': + break; + + + case 'paragraphelement': + $before = "\n"; + break; + + case 'speechelement': + + break; + + case 'linebreakelement': + $after = '\\'; + break; + + case 'linkelement': + // Ggf. Hyperref-Paket verwenden. + break; + + case 'imageelement': + break; + + case 'strongelement': + $before = '\textbf{'; + $after = '}'; + break; + + case 'emphaticelement': + $before = '\textit{'; + $after = '}'; + break; + + case 'insertedelement': + $before = ''; + $after = ''; + break; + + case 'removedelement': + $before = ''; + $after = ''; + break; + + case 'headlineelement': + + switch( $child->level ) + { + case 1: + $before = '\section'; + break; + case 2: + $before = '\subsection'; + break; + case 3: + default: + $before = '\subsubsection'; + break; + } + $before .= '{'; + $after = '}'; + break; + + case 'tableelement': + $before = '\begin{tabular}'."\n"; + $after = '\end{tabular}'."\n"; + break; + + case 'tablelineelement': + $before = ''; + $after = '\\'; + break; + + case 'definitionlistelement': + break; + + case 'definitionitemelement': + break; + + case 'macroelement': + break; + + case 'tablecellelement': + $before = ''; + $after = ' & '; + break; + + case 'listelement': + $before = '\begin{itemize}'."\n"; + $after = '\end{itemize}'."\n"; + break; + + case 'teletypeelement': + $before = '\texttt{'; + $after = '}'; + break; + + case 'numberedlistelement': + $before = '\begin{itemize}'."\n"; + $after = '\end{itemize}'."\n"; + break; + + case 'listentryelement': + $before = '\item '; + break; + + default: + + $tag = 'unknown-element'; + $attr['class'] = strtolower(get_class($child)); + break; + } + + $val .= $before; + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + $val .= $after; + + return $val; + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->renderedText .= '\documentclass{article}'."\n"; + $this->renderedText .= '\begin{document}'."\n"; + + foreach( $this->children as $child ) + $this->renderedText .= $this->renderElement( $child ); + + $this->renderedText .= '\end{document}'."\n"; + + return $this->renderedText; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/Pdf.class.php b/modules/wikiparser/renderer/Pdf.class.php @@ -0,0 +1,35 @@ +<?php + +/* + * + */ +class Pdf extends FPDF +{ + /* + * Ueberschreibt die FPDF-Methode, damit im Fehlerfall kein die() aufgerufen wird. + */ + function Error( $errorText ) + { + Logger::warn('PDF-Error:'.$errorText); + } + + /* + * Ueberschreibt die FPDF-Methode, damit im Fehlerfall kein die() aufgerufen wird. + */ + function Image( $file,$x=null,$y=null,$a=0,$b=0,$type='',$link='' ) + { + switch( $type ) + { + case 'png': + case 'jpeg': + case 'jpg': + parent::Image($file,$x,$y,$a,$b,$type,$link); + break; + default: + Logger::warn( 'Imagetype '.$type.' not available in PDF renderer'); + + } + } +} + +?> diff --git a/modules/wikiparser/renderer/PdfRenderer.class.php b/modules/wikiparser/renderer/PdfRenderer.class.php @@ -0,0 +1,214 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verkoerpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ + +require( OR_TEXTCLASSES_DIR.'renderer/fpdf.php'); +require(OR_TEXTCLASSES_DIR.'renderer/Pdf.class.php'); + +class PdfRenderer +{ + var $linkedObjectIds = array(); + + /** + * + * @var Array + */ + var $footnotes = array(); + + var $pdf; + + var $url; + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + switch( strtolower(get_class($child)) ) + { + case 'tableofcontentelement': + break; + + case 'rawelement': + $this->pdf->Write(5,$child->src); + + break; + + case 'textelement': + + $this->pdf->Write(5,$child->text,$this->url); + $this->url = ''; + break; + + case 'footnoteelement': + break; + + case 'macroelement': + break; + + case 'codeelement': + $this->pdf->ln(10); + $this->pdf->SetFont('Courier','',12); + break; + + case 'quoteelement': + $this->pdf->SetFont('Arial','I',12); + break; + + + case 'paragraphelement': + $this->pdf->ln(10); + break; + + case 'speechelement': + $this->pdf->SetFont('Arial','I',12); + break; + + case 'linebreakelement': + $this->pdf->ln(5); + break; + + case 'linkelement': + $this->url = $child->getUrl(); + $this->pdf->SetTextColor(0, 0, 255); // Blau. + break; + + case 'imageelement': + if ( Object::available( $child->objectId ) ) + { + $this->pdf->ln(5); + // Breite/oe�he des Bildes bestimmen. + $image = new File( $child->objectId ); + + $image->load(); + $image->write(); + $image->getImageSize(); + // $image->width; + // $image->height; + + $this->pdf->Image($image->tmpfile(),$this->pdf->GetX(),$this->pdf->GetY(),0,0,$image->extension()); + $this->pdf->ln($image->height/2.5); + $this->pdf->ln(5); + + unset($image); + } + break; + + case 'strongelement': + $this->pdf->SetFont('Arial','B',12); + + break; + + case 'emphaticelement': + $this->pdf->SetFont('Arial','I',12); + break; + + case 'insertedelement': + $this->pdf->SetTextColor(0,255,0); + break; + + case 'removedelement': + $this->pdf->SetTextColor(255,0,0); + break; + + case 'headlineelement': + $this->pdf->ln(20-(2*$child->level)); + $this->pdf->SetFontSize(20-(2*$child->level)); + + break; + + case 'tableelement': + $this->pdf->ln(20); + break; + + case 'tablelineelement': + $this->pdf->ln(20); + break; + + case 'definitionlistelement': + //$this->pdf->ln(10); + break; + + case 'definitionitemelement': + $this->pdf->ln(10); + if ( !empty($child->key) ) + { + $this->pdf->SetFont('','U'); + $this->pdf->Write(5,$child->key); + $this->pdf->SetFont('',''); } + $this->pdf->Write(5,': '); + + case 'tablecellelement': + break; + + case 'teletypeelement': + $this->pdf->SetFont('Courier','',12); + break; + + case 'listelement': + $this->pdf->ln(5); + break; + + case 'numberedlistelement': + $this->pdf->ln(5); + break; + + case 'listentryelement': + $this->pdf->ln(5); + $this->pdf->Write(5,'- '); + break; + + default: + break; + } + + foreach( $child->children as $c ) + { + $this->renderElement( $c ); + } + + $this->pdf->SetFont('Arial','',12); + $this->pdf->SetTextColor(0,0,0); + } + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->pdf = new Pdf(); + $this->pdf->AddPage(); + $this->pdf->SetCreator(OR_TITLE); + $this->pdf->SetFont('Arial','',12); + + #$this->footnotes = array(); + + foreach( $this->children as $child ) + $this->renderElement( $child ); + + #foreach( $this->footnotes as $child ) + # $this->renderElement( $child ); + + return $this->pdf->Output('','S'); + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/TextRenderer.class.php b/modules/wikiparser/renderer/TextRenderer.class.php @@ -0,0 +1,134 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verkörpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class TextRenderer +{ + var $linkedObjectIds = array(); + + /** + * Fußnoten. + * + * @var Array + */ + var $footnotes = array(); + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $className = strtolower(get_class($child)); + $val = ''; + + $length = @$conf['editor']['text']['linelength']; + if ( intval($length) == 0 ) + $length = 70; + + switch( $className ) + { + case 'footnoteelement': + + $nr = 1; + foreach( $this->footnotes as $fn ) + if ( strtolower(get_class($fn))=='linebreakelement') + $nr++; + + $val = $nr; + if ( @$conf['editor']['footnote']['bracket']) + $val = '('.$nr.')'; + + if ( $nr == 1 ) + { + $this->footnotes[] = new RawElement("\n\n---\n"); + } + $this->footnotes[] = new LineBreakElement(); + $this->footnotes[] = new RawElement($val); + $this->footnotes[] = new RawElement(' '); + foreach( $child->children as $c ) + $this->footnotes[] = $c; + + $child->children = array(); + + break; + + case 'headlineelement': + $val = "\n".wordwrap($child->text,$length); + $val .= str_repeat('-',min($length,strlen($val))); + break; + + case 'paragraphelement': + $val = "\n\n"; + break; + + case 'strongelement': + + foreach( $child->children as $c ) + $val .= $this->renderElement($c); + $val = strtoupper($val); + + $child->children = array(); + + break; + + case 'textelement': + $length = @$conf['editor']['text']['linelength']; + if ( intval($length) == 0 ) + $length = 70; + $val .= wordwrap($child->text,$length); + break; + + case 'linebreakelement': + $val .= "\n"; + break; + default: + } + + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + + return $val; + +// die( 'unknown document type: '.$this->type ); + + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->footnotes = array(); + + foreach( $this->children as $child ) + $this->renderedText .= $this->renderElement( $child ); + + foreach( $this->footnotes as $child ) + $this->renderedText .= $this->renderElement( $child ); + + return $this->renderedText; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/XhtmlRenderer.class.php b/modules/wikiparser/renderer/XhtmlRenderer.class.php @@ -0,0 +1,481 @@ +<?php + +/** + * Dokument-Objekt.<br> + * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> + * <br> + * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> + * + * @author Jan Dankert, $Author$ + * @version $Revision$ + * @package openrat.text + */ +class XhtmlRenderer +{ + var $linkedObjectIds = array(); + var $encodeHtml = false; + + /** + * Fu�noten. + * + * @var Array + */ + var $footnotes = array(); + + + /** + * Rendert ein Dokument-Element. + * + * @param Object $child Element + * @return String + */ + function renderElement( $child ) + { + global $conf; + + $attr = array(); + $val = ''; + $praefix = ''; + $suffix = ''; + $empty = false; + + if ( count($child->children) > 0 ) + { + $subChild1 = $child->children[0]; + + if ( !empty($subChild1->class) ) + $attr['class'] = $subChild1->class; + + if ( !empty($subChild1->style) ) + $attr['style'] = $subChild1->style; + + if ( !empty($subChild1->title) ) + $attr['title'] = $subChild1->title; + } + + switch( strtolower(get_class($child)) ) + { + case 'tableofcontentelement': + $tag = 'p'; + foreach( $this->children as $h) + { + if ( strtolower(get_class($h))=='headlineelement' ) + { + $child->children[] = new RawElement(str_repeat('&nbsp;&nbsp;',$h->level)); + $t = new TextElement( $h->getText() ); + $l = new LinkElement(); + $l->fragment=$h->getName(); + $l->children[] = $t; + $child->children[] = $l; + $child->children[] = new LineBreakElement(); + } + } + break; + + case 'rawelement': + $tag = ''; + $val = $child->src; + + break; + + case 'textelement': + $tag = ''; +// $tag = 'span'; + + $val = $child->text; + if ( $this->encodeHtml ) + $val = Text::encodeHtml( $val ); + $val = Text::replaceHtmlChars( $val ); + break; + + case 'footnoteelement': + $tag = 'a'; + $attr['href'] = '#footnote'; + + $title = ''; + foreach( $child->children as $c ) + $title .= $this->renderElement($c); + $attr['title'] = strip_tags($title); + + $nr = 1; + foreach( $this->footnotes as $fn ) + if ( strtolower(get_class($fn))=='linebreakelement') + $nr++; + + $val = $nr; + if ( @$conf['editor']['footnote']['bracket']) + $val = '('.$nr.')'; + if ( @$conf['editor']['footnote']['sup']) + $val = '<sup><small>'.$nr.'</small></sup>'; + + + if ( $nr == 1 ) + { + $this->footnotes[] = new RawElement('&mdash;'); + $le = new LinkElement(); + $le->name = "footnote"; + $this->footnotes[] = $le; + $this->footnotes[] = new RawElement('&mdash;'); + } + $this->footnotes[] = new LineBreakElement(); + $this->footnotes[] = new RawElement($val); + $this->footnotes[] = new RawElement(' '); + foreach( $child->children as $c ) + $this->footnotes[] = $c; + + $child->children = array(); + + break; + + case 'codeelement': + + if ( empty($child->language) ) + // Wenn keine Sprache verf�gbar, dann ein einfaches PRE-Element erzeugen. + $tag = 'pre'; + else + { + // Wenn Sprache verf�gbar, dann den GESHI-Parser bem�hen. + $tag = ''; + $source = ''; + foreach( $child->children as $c ) + if ( strtolower(get_class($c)) == 'textelement') + $source .= $c->text."\n"; + $child->children = array(); + require_once('./geshi/geshi.php'); + $geshi = new Geshi($source,$child->language); + $val = $geshi->parse_code(); + } + break; + + case 'quoteelement': + $tag = 'blockquote'; + break; + + + case 'paragraphelement': + $tag = 'p'; + break; + + case 'speechelement': + $tag = 'cite'; + + // Danke an: http://www.apostroph.de/tueddelchen.php + //TODO: Abh�ngigkeit von Spracheinstellung implementieren. + $language = 'de'; + switch( $language ) + { + case 'de': // deutsche Notation + $praefix = '&bdquo;'; + $suffix = '&ldquo;'; + break; + case 'fr': + $praefix = '&laquo;'; + $suffix = '&raquo;'; + break; + default: // englische Notation + $praefix = '&ldquo;'; + $suffix = '&rdquo;'; + } + + if ( $conf['editor']['html']['override_speech'] ) + { + $praefix = $conf['editor']['html']['override_speech_open' ]; + $suffix = $conf['editor']['html']['override_speech_close']; + } + break; + + case 'linebreakelement': + $tag = 'br'; + $empty = true; + break; + + case 'linkelement': + $tag = 'a'; + if ( !empty($child->name) ) + $attr['name'] = $child->name; + else + $attr['href'] = htmlspecialchars($child->getUrl()); + + if ( Object::available( $child->objectId ) ) + { + $file = new File( $child->objectId ); + $file->load(); + $attr['title'] = $file->description; + unset( $file ); + } + break; + + case 'imageelement': + $empty = true; + $attr['alt'] = ''; + + if ( ! Object::available( $child->objectId ) ) + { + $tag = ''; + } + elseif ( empty($attr['title']) ) + { + $tag = 'img'; + $attr['src'] = $child->getUrl(); + $attr['border'] = '0'; + + // Breite/H�he des Bildes bestimmen. + $image = new File( $child->objectId ); + + $image->load(); + $attr['alt' ] = $image->name; + $attr['title' ] = $image->description; + + $image->getImageSize(); + $attr['width' ] = $image->width; + $attr['height'] = $image->height; + unset($image); + } + else + { + $tag = 'dl'; + + if ( empty($attr['class']) ) + $attr['class'] = "image"; + + $child->children = array(); + $dt = new DefinitionListItemElement(); + $dt->children[] = new TextElement('(image)'); + $dt->children[] = $child; + $child->children[] = $dt; + + $dd = new DefinitionListEntryElement(); + $dd->children[] = new TextElement('(image)'); + $dd->children[] = new TextElement($attr['title']); + $child->children[] = $dd; + } + break; + + case 'strongelement': + $tag = 'strong'; + break; + + case 'emphaticelement': + $tag = 'em'; + break; + + case 'insertedelement': + $tag = 'ins'; + break; + + case 'removedelement': + $tag = 'del'; + break; + + case 'headlineelement': + $tag = 'h'.$child->level; + + $l = new LinkElement(); + $l->name = $child->getName(); + $child->children[] = $l; + + break; + + case 'tableelement': + $tag = 'table'; + break; + + case 'tablelineelement': + $tag = 'tr'; + break; + + case 'definitionlistelement': + $items = $child->children; + $newChildren = array(); + foreach( $items as $item ) + { + $def = new DefinitionItemElement(); + $def->key = $item->key; + $item->key = ''; + $newChildren[] = $def; + $newChildren[] = $item; + } +// Html::debug($newChildren,'Children-neu'); + $child->children = $newChildren; + $tag = 'dl'; + break; + + case 'definitionitemelement': + if ( !empty($child->key) ) + { + $tag = 'dt'; + $val = $child->key; + } + else + { + $tag = 'dd'; + } + break; + + case 'tablecellelement': + if ( $child->isHeading ) + $tag = 'th'; else $tag = 'td'; + + if ( $child->rowSpan > 1 ) + $attr['rowspan'] = $child->rowSpan; + if ( $child->colSpan > 1 ) + $attr['colspan'] = $child->colSpan; + break; + + case 'listelement': + $tag = 'ul'; + break; + + case 'teletypeelement': + $tag = 'code'; + break; + + case 'numberedlistelement': + $tag = 'ol'; + break; + + case 'listentryelement': + $tag = 'li'; + break; + + case 'macroelement': + + $className = ucfirst($child->name); + $fileName = './dynamicClasses/'.$className.'.class.php'; + if ( is_file( $fileName ) ) + { + // Fuer den Fall, dass eine Dynamic-Klasse mehrmals pro Vorlage auftritt + if ( !class_exists($className) ) + require( $fileName ); + + if ( class_exists($className) ) + { + $dynEl = new $className; + $dynEl->page = &$this->page; + + if ( method_exists( $dynEl,'execute' ) ) + { + $dynEl->objectid = $this->page->objectid; + $dynEl->page = &$this->page; + + foreach( $child->attributes as $param_name=>$param_value ) + { + if ( isset( $dynEl->$param_name ) ) + $dynEl->$param_name = $param_value; + } + + $dynEl->execute(); + $val = $dynEl->getOutput(); + } + else + { + Logger::warn('element:'.$this->element->name.', '. + 'class:'.$className.', no method: execute()'); + } + } + else + { + Logger::warn('element:'.$this->element->name.', '. + 'class not found:'.$className); + } + } + else + { + Logger::warn('element:'.$this->element->name.', '. + 'file not found:'.$fileName); + } + + // Wenn HTML-Ausgabe, dann Sonderzeichen in HTML �bersetzen + if ( $this->page->mimeType()=='text/html' ) + $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); + + break; + + + default: + + $tag = 'unknown-element'; + $attr['class'] = strtolower(get_class($child)); + break; + } + + $val .= $praefix; + foreach( $child->children as $c ) + { + $val .= $this->renderElement( $c ); + } + + $val .= $suffix; +// echo "text:$val"; + return $this->renderHtmlElement($tag,$val,$empty,$attr); + + } + + + + /** + * Erzeugt ein HTML-Element. + * + * @param String $tag Name des Tags + * @param String $value Inhalt + * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") + * @param Array $attr Attribute als Array<String,String> + * @return String + */ + function renderHtmlElement( $tag,$value,$empty,$attr=array() ) + { + global $conf; + if ( $tag == '' ) + return $value; + + $val = '<'.$tag; + foreach( $attr as $attrName=>$attrInhalt ) + { + $val .= ' '.$attrName.'="'.$attrInhalt.'"'; + } + + if ( $value == '' && $empty ) + { + // Inhalt ist leer, also Kurzform verwenden. + // Die Kurzform ist abh�ngig vom Rendermode. + // SGML=<tag> + // XML=<tag /> + if ( $conf['editor']['html']['rendermode'] == 'xml' ) + { + $val .= ' />'; + return $val; + } + else + { + $val .= '>'; + return $val; + } + } + + $val .= '>'.$value.'</'.$tag.'>'; + return $val; + } + + + + /** + * Rendering des Dokumentes.<br> + * + * @return String + */ + function render() + { + $this->renderedText = ''; + $this->footnotes = array(); + + foreach( $this->children as $child ) + $this->renderedText .= $this->renderElement( $child ); + + foreach( $this->footnotes as $child ) + $this->renderedText .= $this->renderElement( $child ); + + return $this->renderedText; + } +} + +?>+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/font/courier.php b/modules/wikiparser/renderer/font/courier.php @@ -0,0 +1,7 @@ +<?php +for($i=0;$i<=255;$i++) + $fpdf_charwidths['courier'][chr($i)]=600; +$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; +$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; +$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; +?> diff --git a/modules/wikiparser/renderer/font/helvetica.php b/modules/wikiparser/renderer/font/helvetica.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helvetica']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/modules/wikiparser/renderer/font/helveticab.php b/modules/wikiparser/renderer/font/helveticab.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaB']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/modules/wikiparser/renderer/font/helveticabi.php b/modules/wikiparser/renderer/font/helveticabi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaBI']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/modules/wikiparser/renderer/font/helveticai.php b/modules/wikiparser/renderer/font/helveticai.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['helveticaI']=array( + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/modules/wikiparser/renderer/font/readme.txt b/modules/wikiparser/renderer/font/readme.txt @@ -0,0 +1 @@ +Font-files for FPDF-Library+ \ No newline at end of file diff --git a/modules/wikiparser/renderer/font/symbol.php b/modules/wikiparser/renderer/font/symbol.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['symbol']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, + ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, + 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, + 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, + 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, + chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, + chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, + chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, + chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +?> diff --git a/modules/wikiparser/renderer/font/times.php b/modules/wikiparser/renderer/font/times.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['times']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +?> diff --git a/modules/wikiparser/renderer/font/timesb.php b/modules/wikiparser/renderer/font/timesb.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesB']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/modules/wikiparser/renderer/font/timesbi.php b/modules/wikiparser/renderer/font/timesbi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesBI']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, + 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, + 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/modules/wikiparser/renderer/font/timesi.php b/modules/wikiparser/renderer/font/timesi.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['timesI']=array( + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/modules/wikiparser/renderer/font/zapfdingbats.php b/modules/wikiparser/renderer/font/zapfdingbats.php @@ -0,0 +1,15 @@ +<?php +$fpdf_charwidths['zapfdingbats']=array( + chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +?> diff --git a/modules/wikiparser/renderer/fpdf.php b/modules/wikiparser/renderer/fpdf.php @@ -0,0 +1,1725 @@ +<?php +/******************************************************************************* + * FPDF * + * * + * Version: 1.6 * + * Date: 2008-08-03 * + * Author: Olivier PLATHEY * + *******************************************************************************/ + +define('FPDF_VERSION','1.6'); + +class FPDF +{ + var $page; //current page numberstrem + var $n; //current object number + var $offsets; //array of object offsets + var $buffer; //buffer holding in-memory PDF + var $pages; //array containing pages + var $state; //current document state + var $compress; //compression flag + var $k; //scale factor (number of points in user unit) + var $DefOrientation; //default orientation + var $CurOrientation; //current orientation + var $PageFormats; //available page formats + var $DefPageFormat; //default page format + var $CurPageFormat; //current page format + var $PageSizes; //array storing non-default page sizes + var $wPt,$hPt; //dimensions of current page in points + var $w,$h; //dimensions of current page in user unit + var $lMargin; //left margin + var $tMargin; //top margin + var $rMargin; //right margin + var $bMargin; //page break margin + var $cMargin; //cell margin + var $x,$y; //current position in user unit + var $lasth; //height of last printed cell + var $LineWidth; //line width in user unit + var $CoreFonts; //array of standard font names + var $fonts; //array of used fonts + var $FontFiles; //array of font files + var $diffs; //array of encoding differences + var $FontFamily; //current font family + var $FontStyle; //current font style + var $underline; //underlining flag + var $CurrentFont; //current font info + var $FontSizePt; //current font size in points + var $FontSize; //current font size in user unit + var $DrawColor; //commands for drawing color + var $FillColor; //commands for filling color + var $TextColor; //commands for text color + var $ColorFlag; //indicates whether fill and text colors are different + var $ws; //word spacing + var $images; //array of used images + var $PageLinks; //array of links in pages + var $links; //array of internal links + var $AutoPageBreak; //automatic page breaking + var $PageBreakTrigger; //threshold used to trigger page breaks + var $InHeader; //flag set when processing header + var $InFooter; //flag set when processing footer + var $ZoomMode; //zoom display mode + var $LayoutMode; //layout display mode + var $title; //title + var $subject; //subject + var $author; //author + var $keywords; //keywords + var $creator; //creator + var $AliasNbPages; //alias for total number of pages + var $PDFVersion; //PDF version number + + /******************************************************************************* + * * + * Public methods * + * * + *******************************************************************************/ + function FPDF($orientation='P', $unit='mm', $format='A4') + { + //Some checks + $this->_dochecks(); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->PageSizes=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InHeader=false; + $this->InFooter=false; + $this->lasth=0; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', + 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', + 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', + 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), + 'letter'=>array(612,792), 'legal'=>array(612,1008)); + if(is_string($format)) + $format=$this->_getpageformat($format); + $this->DefPageFormat=$format; + $this->CurPageFormat=$format; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->w=$this->DefPageFormat[0]; + $this->h=$this->DefPageFormat[1]; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->w=$this->DefPageFormat[1]; + $this->h=$this->DefPageFormat[0]; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Enable compression + $this->SetCompression(true); + //Set default PDF version number + $this->PDFVersion='1.3'; + } + + function SetMargins($left, $top, $right=null) + { + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right===null) + $right=$left; + $this->rMargin=$right; + } + + function SetLeftMargin($margin) + { + //Set left margin + $this->lMargin=$margin; + if($this->page>0 && $this->x<$margin) + $this->x=$margin; + } + + function SetTopMargin($margin) + { + //Set top margin + $this->tMargin=$margin; + } + + function SetRightMargin($margin) + { + //Set right margin + $this->rMargin=$margin; + } + + function SetAutoPageBreak($auto, $margin=0) + { + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; + } + + function SetDisplayMode($zoom, $layout='continuous') + { + //Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode=$zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode=$layout; + else + $this->Error('Incorrect layout display mode: '.$layout); + } + + function SetCompression($compress) + { + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; + } + + function SetTitle($title, $isUTF8=false) + { + //Title of document + if($isUTF8) + $title=$this->_UTF8toUTF16($title); + $this->title=$title; + } + + function SetSubject($subject, $isUTF8=false) + { + //Subject of document + if($isUTF8) + $subject=$this->_UTF8toUTF16($subject); + $this->subject=$subject; + } + + function SetAuthor($author, $isUTF8=false) + { + //Author of document + if($isUTF8) + $author=$this->_UTF8toUTF16($author); + $this->author=$author; + } + + function SetKeywords($keywords, $isUTF8=false) + { + //Keywords of document + if($isUTF8) + $keywords=$this->_UTF8toUTF16($keywords); + $this->keywords=$keywords; + } + + function SetCreator($creator, $isUTF8=false) + { + //Creator of document + if($isUTF8) + $creator=$this->_UTF8toUTF16($creator); + $this->creator=$creator; + } + + function AliasNbPages($alias='{nb}') + { + //Define an alias for total number of pages + $this->AliasNbPages=$alias; + } + + function Error($msg) + { + //Fatal error + die('<b>FPDF error:</b> '.$msg); + } + + function Open() + { + //Begin document + $this->state=1; + } + + function Close() + { + //Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); + } + + function AddPage($orientation='', $format='') + { + //Start a new page + if($this->state==0) + $this->Open(); + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation,$format); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->InHeader=true; + $this->Header(); + $this->InHeader=false; + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; + } + + function Header() + { + //To be implemented in your own inherited class + } + + function Footer() + { + //To be implemented in your own inherited class + } + + function PageNo() + { + //Get current page number + return $this->page; + } + + function SetDrawColor($r, $g=null, $b=null) + { + //Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->DrawColor=sprintf('%.3F G',$r/255); + else + $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); + } + + function SetFillColor($r, $g=null, $b=null) + { + //Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->FillColor=sprintf('%.3F g',$r/255); + else + $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); + } + + function SetTextColor($r, $g=null, $b=null) + { + //Set color for text + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->TextColor=sprintf('%.3F g',$r/255); + else + $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + } + + function GetStringWidth($s) + { + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s[$i]]; + return $w*$this->FontSize/1000; + } + + function SetLineWidth($width) + { + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2F w',$width*$this->k)); + } + + function Line($x1, $y1, $x2, $y2) + { + //Draw a line + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); + } + + function Rect($x, $y, $w, $h, $style='') + { + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); + } + + function AddFont($family, $style='', $file='') + { + //Add a TrueType or Type1 font + $family=strtolower($family); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + $fontkey=$family.$style; + if(isset($this->fonts[$fontkey])) + return; + include($this->_getfontpath().$file); + if(!isset($name)) + $this->Error('Could not include font definition file'); + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + { + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$fontkey]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); + } + } + + function SetFont($family, $style='', $size=0) + { + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' || $family=='helvetica') + $file.=strtolower($style); + include($this->_getfontpath().$file.'.php'); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $name=$this->CoreFonts[$fontkey]; + $cw=$fpdf_charwidths[$fontkey]; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); + } + + function SetFontSize($size) + { + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); + } + + function AddLink() + { + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0, 0); + return $n; + } + + function SetLink($link, $y=0, $page=-1) + { + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page, $y); + } + + function Link($x, $y, $w, $h, $link) + { + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); + } + + function Text($x, $y, $txt) + { + //Output a string + $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if($this->underline && $txt!='') + $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); + } + + function AcceptPageBreak() + { + //Accept automatic page break or not + return $this->AutoPageBreak; + } + + function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') + { + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3F Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill || $border==1) + { + if($fill) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; + } + + function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) + { + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(strpos($border,'L')!==false) + $b2.='L'; + if(strpos($border,'R')!==false) + $b2.='R'; + $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; + } + + function Write($h, $txt, $link='') + { + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep=$i; + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); + } + + function Ln($h=null) + { + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if($h===null) + $this->y+=$this->lasth; + else + $this->y+=$h; + } + + function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') + { + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of this image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + if($type=='jpeg') + $type='jpg'; + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + elseif($w==0) + $w=$h*$info['w']/$info['h']; + elseif($h==0) + $h=$w*$info['h']/$info['w']; + //Flowing mode + if($y===null) + { + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x2=$this->x; + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x2; + } + $y=$this->y; + $this->y+=$h; + } + if($x===null) + $x=$this->x; + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); + } + + function GetX() + { + //Get x position + return $this->x; + } + + function SetX($x) + { + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; + } + + function GetY() + { + //Get y position + return $this->y; + } + + function SetY($y) + { + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; + } + + function SetXY($x, $y) + { + //Set x and y positions + $this->SetY($y); + $this->SetX($x); + } + + function Output($name='', $dest='') + { + //Output PDF to some destination + if($this->state<3) + $this->Close(); + $dest=strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name='doc.pdf'; + $dest='I'; + } + else + $dest='F'; + } + switch($dest) + { + case 'I': + //Send to standard output + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(php_sapi_name()!='cli') + { + //We send to a browser + header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: inline; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + } + echo $this->buffer; + break; + case 'D': + //Download file + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Type: application/x-download'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: attachment; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + echo $this->buffer; + break; + case 'F': + //Save to local file + $f=fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + //Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; + } + + /******************************************************************************* + * * + * Protected methods * + * * + *******************************************************************************/ + function _dochecks() + { + //Check availability of %F + if(sprintf('%.1F',1.0)!='1.0') + $this->Error('This version of PHP is not supported'); + //Check mbstring overloading + if(ini_get('mbstring.func_overload') & 2) + $this->Error('mbstring overloading must be disabled'); + //Disable runtime magic quotes + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); + } + + function _getpageformat($format) + { + $format=strtolower($format); + if(!isset($this->PageFormats[$format])) + $this->Error('Unknown page format: '.$format); + $a=$this->PageFormats[$format]; + return array($a[0]/$this->k, $a[1]/$this->k); + } + + function _getfontpath() + { + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); + return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; + } + + function _beginpage($orientation, $format) + { + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->FontFamily=''; + //Check page size + if($orientation=='') + $orientation=$this->DefOrientation; + else + $orientation=strtoupper($orientation[0]); + if($format=='') + $format=$this->DefPageFormat; + else + { + if(is_string($format)) + $format=$this->_getpageformat($format); + } + if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) + { + //New size + if($orientation=='P') + { + $this->w=$format[0]; + $this->h=$format[1]; + } + else + { + $this->w=$format[1]; + $this->h=$format[0]; + } + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + $this->CurPageFormat=$format; + } + if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) + $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); + } + + function _endpage() + { + $this->state=1; + } + + function _escape($s) + { + //Escape special characters in strings + $s=str_replace('\\','\\\\',$s); + $s=str_replace('(','\\(',$s); + $s=str_replace(')','\\)',$s); + $s=str_replace("\r",'\\r',$s); + return $s; + } + + function _textstring($s) + { + //Format a text string + return '('.$this->_escape($s).')'; + } + + function _UTF8toUTF16($s) + { + //Convert UTF-8 to UTF-16BE with BOM + $res="\xFE\xFF"; + $nb=strlen($s); + $i=0; + while($i<$nb) + { + $c1=ord($s[$i++]); + if($c1>=224) + { + //3-byte character + $c2=ord($s[$i++]); + $c3=ord($s[$i++]); + $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); + $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); + } + elseif($c1>=192) + { + //2-byte character + $c2=ord($s[$i++]); + $res.=chr(($c1 & 0x1C)>>2); + $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); + } + else + { + //Single-byte character + $res.="\0".chr($c1); + } + } + return $res; + } + + function _dounderline($x, $y, $txt) + { + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); + } + + function _parsejpg($file) + { + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=''; + while(!feof($f)) + $data.=fread($f,8192); + fclose($f); + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); + } + + function _parsepng($file) + { + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + $this->_readstream($f,4); + if($this->_readstream($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_readint($f); + $h=$this->_readint($f); + $bpc=ord($this->_readstream($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord($this->_readstream($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + $this->_readstream($f,4); + $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_readint($f); + $type=$this->_readstream($f,4); + if($type=='PLTE') + { + //Read palette + $pal=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=$this->_readstream($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + $this->_readstream($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='IEND') + break; + else + $this->_readstream($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); + } + + function _readstream($f, $n) + { + //Read n bytes from stream + $res=''; + while($n>0 && !feof($f)) + { + $s=fread($f,$n); + if($s===false) + $this->Error('Error while reading stream'); + $n-=strlen($s); + $res.=$s; + } + if($n>0) + $this->Error('Unexpected end of stream'); + return $res; + } + + function _readint($f) + { + //Read a 4-byte integer from stream + $a=unpack('Ni',$this->_readstream($f,4)); + return $a['i']; + } + + function _parsegif($file) + { + //Extract info from a GIF file (via PNG conversion) + if(!function_exists('imagepng')) + $this->Error('GD extension is required for GIF support'); + if(!function_exists('imagecreatefromgif')) + $this->Error('GD has no GIF read support'); + $im=imagecreatefromgif($file); + if(!$im) + $this->Error('Missing or incorrect image file: '.$file); + imageinterlace($im,0); + $tmp=tempnam('.','gif'); + if(!$tmp) + $this->Error('Unable to create a temporary file'); + if(!imagepng($im,$tmp)) + $this->Error('Error while saving to temporary file'); + imagedestroy($im); + $info=$this->_parsepng($tmp); + unlink($tmp); + return $info; + } + + function _newobj() + { + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); + } + + function _putstream($s) + { + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); + } + + function _out($s) + { + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; + } + + function _putpages() + { + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->DefPageFormat[0]*$this->k; + $hPt=$this->DefPageFormat[1]*$this->k; + } + else + { + $wPt=$this->DefPageFormat[1]*$this->k; + $hPt=$this->DefPageFormat[0]*$this->k; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<</Type /Page'); + $this->_out('/Parent 1 0 R'); + if(isset($this->PageSizes[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; + if(is_string($pl[4])) + $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<</Type /Pages'); + $kids='/Kids ['; + for($i=0;$i<$nb;$i++) + $kids.=(3+2*$i).' 0 R '; + $this->_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); + } + + function _putfonts() + { + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); + $this->_out('endobj'); + } + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + $font=''; + $f=fopen($this->_getfontpath().$file,'rb',1); + if(!$f) + $this->Error('Font file not found'); + while(!feof($f)) + $font.=fread($f,8192); + fclose($f); + $compressed=(substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + { + $header=(ord($font[0])==128); + if($header) + { + //Strip first binary header + $font=substr($font,6); + } + if($header && ord($font[$info['length1']])==128) + { + //Strip second binary header + $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); + } + } + $this->_out('<</Length '.strlen($font)); + if($compressed) + $this->_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->fonts[$k]['n']=$this->n+1; + $type=$font['type']; + $name=$font['name']; + if($type=='core') + { + //Standard font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + //Additional Type1 or TrueType font + $this->_newobj(); + $this->_out('<</Type /Font'); + $this->_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + $this->_out('>>'); + $this->_out('endobj'); + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<</Type /FontDescriptor /FontName /'.$name; + foreach($font['desc'] as $k=>$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + //Allow for additional types + $mtd='_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } + } + + function _putimages() + { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<</Type /XObject'); + $this->_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i<count($info['trns']);$i++) + $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; + $this->_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } + } + + function _putxobjectdict() + { + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); + } + + function _putresourcedict() + { + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); + } + + function _putresources() + { + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); + } + + function _putinfo() + { + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); + } + + function _putcatalog() + { + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); + } + + function _putheader() + { + $this->_out('%PDF-'.$this->PDFVersion); + } + + function _puttrailer() + { + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); + } + + function _enddoc() + { + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; + } + //End of class +} + +?> diff --git a/textClasses/AbstractElement.class.php b/textClasses/AbstractElement.class.php @@ -1,17 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class AbstractElement -{ - var $children = array(); - - var $style = ''; - var $class = ''; - var $title = ''; -} - -?>- \ No newline at end of file diff --git a/textClasses/CodeElement.class.php b/textClasses/CodeElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class CodeElement extends AbstractElement -{ - var $language; -} - -?>- \ No newline at end of file diff --git a/textClasses/DefinitionItemElement.class.php b/textClasses/DefinitionItemElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class DefinitionItemElement extends AbstractElement -{ - var $key = ''; -} - -?>- \ No newline at end of file diff --git a/textClasses/DefinitionListElement.class.php b/textClasses/DefinitionListElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class DefinitionListElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/DocumentElement.class.php b/textClasses/DocumentElement.class.php @@ -1,98 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class DocumentElement extends AbstractElement -{ - var $linkedObjectIds = array(); - var $page; - - /** - * Fu�noten. - * - * @var Array - */ - var $footnotes = array(); - - var $encodeHtml = false; - - /** - * Ein Text wird geparst.<br> - * <br> - * Zerlegt den Text zeilenweise und erzeugt die Unterobjekte.<br> - * - * @param Ein- oder mehrzeiliger roher Text - * @param Art des Parsens, Default=Wiki - */ - function parse( $text, $type='wiki' ) - { - $parserClass = ucfirst(strtolower($type)).'Parser'; - $parser = new $parserClass(); - - $this->children = $parser->parse( $text ); - $this->linkedObjectIds = $parser->linkedObjectIds; - } - - - - - - /** - * Rendering des Dokumentes.<br> - * Die Art und Weise des Renderns ist in Abh�ngigkeit zum - * �bergebenen Mime-Type. - * - * @param String $mimeType Mime-Type, z.B. "text/html" - * @return String - */ - function render( $mimeType ) - { - - switch( $mimeType ) - { - case 'text/html': - $this->type = 'html'; - break; - case 'text/plain': - $this->type = 'text'; - break; - case 'application/pdf': - $this->type = 'pdf'; - break; - case 'application/html-dom': - $this->type = 'htmlDom'; - break; - case 'application/x-latex': - $this->type = 'latex'; - break; - case 'text/xhtml': - $this->type = 'xhtml'; - break; - case 'application/docbook+xml': - $this->type = 'docBook'; - break; - default: - $this->type = 'html'; - } - - $rendererClass = ucfirst($this->type).'Renderer'; - - $renderer = new $rendererClass(); - $renderer->children = $this->children; - $renderer->page = $this->page; - $renderer->linkedObjectIds = $this->linkedObjectIds; - $renderer->encodeHtml = $this->encodeHtml; - - return $renderer->render(); - } -} - -?>- \ No newline at end of file diff --git a/textClasses/EmphaticElement.class.php b/textClasses/EmphaticElement.class.php @@ -1,22 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class EmphaticElement extends AbstractElement -{ - function render( $type ) - { - switch( $type ) - { - case 'html': - return '<p>'.$this->value.'</p>'; - default: - return $this->value; - } - } -} - -?>- \ No newline at end of file diff --git a/textClasses/FootnoteElement.class.php b/textClasses/FootnoteElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class FootnoteElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/HeadlineElement.class.php b/textClasses/HeadlineElement.class.php @@ -1,53 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class HeadlineElement extends AbstractElement -{ - var $level = 1; - - - - /** - * Konstruktor. - */ - function HeadlineElement( $level=1 ) - { - $this->level = $level; - } - - - - function getText() - { - $name = ''; - foreach( $this->children as $child ) - { - if ( strtolower(get_class($child))=='textelement') - { - $name .= $child->text; - } - } - - return $name; - } - - - - function getName() - { - $name = strtolower( $this->getText() ); - -// return urlencode( $name ); - $gueltig = 'abcdefghijklmnopqrstuvwxyz0123456789.-_'; - $tmp = strtr($name, $gueltig, str_repeat('#', strlen($gueltig))); - $name = str_replace('.','',strtr($name, $tmp, str_repeat('.', strlen($tmp)))); - - return $name; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/ImageElement.class.php b/textClasses/ImageElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class ImageElement extends LinkElement -{ - var $description; -} - -?>- \ No newline at end of file diff --git a/textClasses/InsertedElement.class.php b/textClasses/InsertedElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class InsertedElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/LineBreakElement.class.php b/textClasses/LineBreakElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class LineBreakElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/LinkElement.class.php b/textClasses/LinkElement.class.php @@ -1,153 +0,0 @@ -<?php - -/** - * Darstellung eines Verweises auf eine URL.<br> - * <br> - * Es wird nur das Verweisziel gespeichert.<br> - * Der verweisende Text wird nicht hier, sondern in einem der Unterelemente gespeichert. - * - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class LinkElement extends AbstractElement -{ - var $target; - var $mail; - var $protocol = ''; - var $objectId = 0; - var $user = ''; - var $password = ''; - var $host = ''; - var $port = ''; - var $query = ''; - var $fragment = ''; - var $path = ''; - - var $name; - - /** - * Setzt das Ziel des Links.<br> - * Als Parameter wird eine URL erwartet. - * - * @param target Verweisziel - */ - function setTarget( $target ) - { - $this->target = $target; - - $url = parse_url( $target ); - - $this->protocol = @$url['scheme']; - $this->user = @$url['user' ]; - $this->password = @$url['pass' ]; - $this->host = @$url['host' ]; - $this->port = @$url['port' ]; - $this->path = @$url['path' ]; - $this->query = @$url['query' ]; - $this->fragment = @$url['fragment']; - - if ( $this->protocol == 'object' ) - $this->objectId = intval($url['host']); - - - if ( $this->protocol == '' ) - { - if ( strpos($target,'@') !== false ) - { - $this->protocol = 'mailto'; - $this->path = $this->target; - } - - // "..."->"123" - if ( intval($url['path']) > 0 ) - { - $this->protocol = 'object'; - $this->objectId = intval($url['path']); - } - } - } - - - /** - * Ermittelt die URL des Links. - */ - function getUrl() - { - $url = ''; - - // Protokollangabe im Format <protokoll>:// - if ( $this->protocol != '') - { - $url .= $this->protocol.':'; - - // Ausnahme: Das "mailto"-Protokoll darf keinen Doppelslash haben. - if ( $this->protocol != 'mailto' ) - $url.='//'; - } - - // Benutzer und Kennwort anh�ngen. - // Format: <benutzer>:<kennwort>@ - if ( $this->user != '' ) - { - $url .= $this->user; - if ( $this->password != '' ) - { - $url .= ':'.$this->password; - } - $url .= '@'; - } - - // Hostnamen anh�ngen. - $url .= $this->host; - - // Port anh�ngen - if ( $this->port != '' ) - $url .= ':'.$this->port; - - // Den Pfad anh�ngen. - $url .= $this->url_encode($this->path); - - // Den Query-Teil mit einem "?" getrennt anh�ngen. - if ( $this->query != '' ) - $url .= '?'.$this->url_encode($this->query); -// $url .= '?'.urlencode($this->query); - - // Fragment mit "#" getrennt anh�ngen. - if ( $this->fragment != '' ) - $url .= '#'.$this->url_encode($this->fragment); - - return $url; - } - - - - /** - * Hilfsfunktion f�r #url_encode(). - * Ein Ganzzahl-Wert wird in Hexadezimal umgewandelt. - */ - private function int2hex($intega) - { - $Ziffer = "0123456789ABCDEF"; - return @$Ziffer[($intega%256)/16].$Ziffer[$intega%16]; - } - - - - /** - * Kodiert eine URL.<br> - * Alle Zeichen mit dem Ordinalwert >=129 werden kodiert. - */ - private function url_encode( $text ) - { - for($i=129;$i<255;$i++) - { - $in = chr($i); - $out = "%C3%".$this->int2hex($i-64); - $text = str_replace($in,$out,$text); - } - return $text; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/ListElement.class.php b/textClasses/ListElement.class.php @@ -1,14 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class ListElement extends AbstractElement -{ - - -} - -?>- \ No newline at end of file diff --git a/textClasses/ListEntryElement.class.php b/textClasses/ListEntryElement.class.php @@ -1,12 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class ListEntryElement extends AbstractElement -{ -} - -?>- \ No newline at end of file diff --git a/textClasses/MacroElement.class.php b/textClasses/MacroElement.class.php @@ -1,17 +0,0 @@ -<?php - -/** - * Darstellung eines Makros. - * - * Ein Makro hat einen Namen sowie n Attribute. - * - * @author Jan Dankert - * @package openrat.text - */ -class MacroElement extends AbstractElement -{ - var $name; - var $attributes = array(); -} - -?>- \ No newline at end of file diff --git a/textClasses/NumberedListElement.class.php b/textClasses/NumberedListElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class NumberedListElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/ParagraphElement.class.php b/textClasses/ParagraphElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class ParagraphElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/QuoteElement.class.php b/textClasses/QuoteElement.class.php @@ -1,12 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class QuoteElement extends AbstractElement -{ -} - -?>- \ No newline at end of file diff --git a/textClasses/RawElement.class.php b/textClasses/RawElement.class.php @@ -1,18 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class RawElement extends AbstractElement -{ - var $src = ''; - - function RawElement( $t='' ) - { - $this->src = $t; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/RemovedElement.class.php b/textClasses/RemovedElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class RemovedElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/SpeechElement.class.php b/textClasses/SpeechElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class SpeechElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/StrongElement.class.php b/textClasses/StrongElement.class.php @@ -1,27 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class StrongElement extends AbstractElement -{ - function render( $type ) - { - switch( $type ) - { - case 'html': - return '<p>'.$this->value.'</p>'; - default: - return $this->value; - } - } - - - - var $markup = array( 'beginswith' =>'*' , - 'endswith'=>'*' ); -} - -?>- \ No newline at end of file diff --git a/textClasses/TableCellElement.class.php b/textClasses/TableCellElement.class.php @@ -1,15 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TableCellElement extends AbstractElement -{ - var $rowSpan = 1; - var $colSpan = 1; - var $isHeading = false; -} - -?>- \ No newline at end of file diff --git a/textClasses/TableElement.class.php b/textClasses/TableElement.class.php @@ -1,22 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TableElement extends AbstractElement -{ - function render( $type ) - { - switch( $type ) - { - case 'html': - return '<p>'.$this->value.'</p>'; - default: - return $this->value; - } - } -} - -?>- \ No newline at end of file diff --git a/textClasses/TableLineElement.class.php b/textClasses/TableLineElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TableLineElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/TableOfContentElement.class.php b/textClasses/TableOfContentElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TableOfContentElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/TeletypeElement.class.php b/textClasses/TeletypeElement.class.php @@ -1,13 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TeletypeElement extends AbstractElement -{ - -} - -?>- \ No newline at end of file diff --git a/textClasses/TextElement.class.php b/textClasses/TextElement.class.php @@ -1,62 +0,0 @@ -<?php - -/** - * @author $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TextElement extends AbstractElement -{ - var $text = ''; - - function TextElement( $t='' ) - { - $this->text = $t; - - $this->parseStyleClass(); - $this->parseTitleText(); - } - - - function parseStyleClass() - { - $char1 = substr($this->text,0,1); - if ( $char1 == "(" ) - { - $pos2 = strpos($this->text,")",2); - if ( $pos2 !== false ) - { - $this->style = substr($this->text,1,$pos2-1); - $this->text = substr($this->text,$pos2+1); - - // Wenn kein Doppelpunkt in den Styleangaben vorkommt, dann - // handelt es sich um einen Klassennamen. - if ( strpos($this->style,':') === false ) - { - $this->class = $this->style; - $this->style = ''; - } - } - } - } - - - - function parseTitleText() - { - $char1 = substr($this->text,0,1); - if ( $char1 == "'" ) - { - $pos2 = strpos($this->text,"'",2); - if ( $pos2 !== false ) - { - $this->title = substr($this->text,1,$pos2-1); - $this->text = substr($this->text,$pos2+1); - } - } - } - - -} - -?>- \ No newline at end of file diff --git a/textClasses/include.inc.php b/textClasses/include.inc.php @@ -1,43 +0,0 @@ -<?php - -// Die DOM-Klassen sind nur bei der Erzeugung von Seiten notwendig. -//if ( !empty($REQ[REQ_PARAM_ACTION]) && in_array($REQ[REQ_PARAM_ACTION],array('pageelement','page','folder')) ) -{ - require_once( OR_TEXTCLASSES_DIR."parser/WikiParser.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/HtmlRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/XhtmlRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/HtmlDomRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/PdfRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/TextRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/DocBookRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."renderer/LatexRenderer.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."AbstractElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."QuoteElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."CodeElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."DocumentElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."EmphaticElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."FootnoteElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."HeadlineElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."LineBreakElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."LinkElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."ImageElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."MacroElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TeletypeElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."SpeechElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."ListElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."ListEntryElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."NumberedListElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."ParagraphElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."RawElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."StrongElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TableElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TableLineElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TableCellElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TableOfContentElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."TextElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."DefinitionListElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."DefinitionItemElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."InsertedElement.class.".PHP_EXT ); - require_once( OR_TEXTCLASSES_DIR."RemovedElement.class.".PHP_EXT ); -} -?>- \ No newline at end of file diff --git a/textClasses/parser/WikiParser.class.php b/textClasses/parser/WikiParser.class.php @@ -1,762 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class WikiParser -{ - var $linkedObjectIds = array(); - - /** - * Ein Text wird geparst.<br> - * <br> - * Zerlegt den Text zeilenweise und erzeugt die Unterobjekte.<br> - * - * @param Ein- oder mehrzeiliger roher Text - */ - function parse( $text ) - { -// set_time_limit(1); - $zeilen = array(); - $nr = 0; - - foreach( $text as $t ) - { -// $t = $this->fixLinks( $t ); // Verweise vervollstaendigen. - $zeilen[++$nr] = new Line( rtrim($t) ); - } - - // $zeilen enth�lt eine Liste von Zeilenobjekten. - // Der Index ist die Zeilennr. und beginnt bei 1. -// Html::debug($zeilen,"Zeilen"); - - return $this->parseMultiLineText( $zeilen ); - } - - - - /** - * Erzeugt aus einer Liste von Zeilenobjekten ein DOM in Form eines Objektbaumes. - * - * @param zeilen Liste von Zeilenobjekten. Array beginnt bei 1. - * @return Liste von Textobjekten - */ - function parseMultiLineText( $zeilen ) - { - global $conf; - - $children = array(); // Initiales Anlegen der Unterobjektliste. - $anzahlZeilen = count( $zeilen ); // Anzahl Zeilen - - // Erzwingt am Anfang und Ende eine leere Zeile, damit - // n�chste und vorige Zeile in der folgenden Schleife immer gef�llt ist. - $zeilen[0] = new Line(''); - $zeilen[$anzahlZeilen+1] = new Line(''); - - for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) - { - - $letzteZeile = $zeilen[$zeileNr-1]; - $dieseZeile = $zeilen[$zeileNr ]; - $naechsteZeile = $zeilen[$zeileNr+1]; - -// Html::debug($dieseZeile,"Zeile"); - - // Leerzeilen ignorieren - if ( $dieseZeile->isEmpty ) - { - continue; - } - - // Inhaltsverzeichnis - // Text nicht parsen - if ( $dieseZeile->isTableOfContent ) - { - $children[] = new TableOfContentElement(); - continue; - } - - - // Parser deaktiviert f�r diese Zeile - // Text nicht parsen - if ( $dieseZeile->isUnparsed ) - { - $children[] = new TextElement( $dieseZeile->value ); - continue; - } - - - // Ueberschriften Teil 1 - // Markierung in der Folgezeile mit "...", "---" oder "===" - if ( $naechsteZeile->isHeadlineUnderline ) - { - $headline = new HeadlineElement($naechsteZeile->level); - $headline->children = $this->parseSimple( $dieseZeile->value); - $children[] = $headline; - $zeileNr++; - continue; // Naechste Zeile - } - - - // Ueberschriften Teil 2 - // Markierung mit "+++..." am Zeilenbeginn. - if ( $dieseZeile->isHeadline ) - { - $headline = new HeadlineElement($dieseZeile->level); - $headline->children = $this->parseSimple( $dieseZeile->value); - $children[] = $headline; - continue; // Naechste Zeile - } - - // Zitate Teil 1 - // Zitat ist in separater Zeile angek�ndigt - if ( $dieseZeile->isQuote ) - { - $bisZeileNr = $zeileNr+1; - do - { - $bisZeileNr++; - } - while( !$zeilen[$bisZeileNr]->isQuote && $bisZeileNr<=$anzahlZeilen ); - - $quote = new QuoteElement(); - $zeilenAuszug = array(); - $nr=0; - for( $zn=$zeileNr+1;$zn<$bisZeileNr;$zn++) - { - $zeilenAuszug[++$nr] = $zeilen[$zn]; - } - $quote->children = $this->parseMultiLineText($zeilenAuszug); - $zeileNr = $bisZeileNr+1; - $children[] = $quote; - continue; - } - - - - // Zitate Teil 2 - // Markierung am Zeilenanfang - if ( $dieseZeile->isQuotePraefix ) - { - $bisZeileNr = $zeileNr; - while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isQuotePraefix ) - $bisZeileNr++; - $bisZeileNr--; -// Html::debug($bisZeileNr,"Bis-Zeile-Nr."); - $quote = new QuoteElement(); - - $zeilenAuszug = $this->getListenAuszug( $zeilen,$zeileNr,$bisZeileNr); -// Html::debug($zeilenAuszug,"Auszug"); -// die(); - $quote->children = $this->parseMultiLineText($zeilenAuszug); - $zeileNr = $bisZeileNr; - $children[] = $quote; - continue; - } - - - - // Definitionsliste - // Markierung am Zeilenanfang - if ( $dieseZeile->isDefinition ) - { - $bisZeileNr = $zeileNr; - while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isDefinition ) - $bisZeileNr++; - $bisZeileNr--; - - $defList = new DefinitionListElement(); - - $zeilenAuszug = $this->getListenAuszug( $zeilen,$zeileNr,$bisZeileNr); -// Html::debug($zeilenAuszug,"Auszug"); -// die(); - foreach( $zeilenAuszug as $zeile ) - { - $sep = $conf['editor']['text-markup']['definition-sep']; - list($defKey, $defValue) = explode($sep, $zeile->value); - - $defEntry = new DefinitionItemElement(); - $defEntry->key = $defKey; - $defEntry->children = $this->parseSimple($defValue); - $defList->children[] = $defEntry; - } - $zeileNr = $bisZeileNr; - $children[] = $defList; - continue; - } - - - - // Code - if ( $dieseZeile->isCode) - { - $bisZeileNr = $zeileNr+1; - while( $bisZeileNr<$anzahlZeilen && !$zeilen[$bisZeileNr]->isCode ) - $bisZeileNr++; - - $code = new CodeElement(); - $code->language = trim($dieseZeile->value); - - for( $zn=$zeileNr+1;$zn<$bisZeileNr;$zn++) - { - $code->children[] = new TextElement( $zeilen[$zn]->source ); - - if ( $zn < $bisZeileNr-1 ) - $code->children[] = new LineBreakElement(); - } - $zeileNr = $bisZeileNr; - $children[] = $code; - continue; - } - - - // Tabellen - if ( $dieseZeile->isTable ) - { - $bisZeileNr = $zeileNr; - while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->isTable ) - $bisZeileNr++; - - $tabelle = new TableElement(); - $zeilenAuszug = array(); - for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) - { - $zeilenAuszug[$zn-$zeileNr+1] = $zeilen[$zn]; - } - $tabelle->children = $this->parseTable($zeilenAuszug); - $children[] = $tabelle; - $zeileNr = $bisZeileNr+1; - continue; - } - - - // Listen - if ( $dieseZeile->isList || $dieseZeile->isNumberedList ) - { - - $bisZeileNr = $zeileNr; - while( $bisZeileNr<=$anzahlZeilen && - ($zeilen[$bisZeileNr]->isList || $zeilen[$bisZeileNr]->isNumberedList) ) - $bisZeileNr++; - $bisZeileNr--; - - if ( $dieseZeile->isList ) - $liste = new ListElement(); - else - $liste = new NumberedListElement(); - - $zeilenAuszug = array(); - $nr=0; - - for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) - { - $zeilenAuszug[++$nr] = $zeilen[$zn]; - } - - $liste->children = $this->parseList($zeilenAuszug,1); - $children[] = $liste; - $zeileNr = $bisZeileNr; - continue; - } - - - - if ( $dieseZeile->isNormal ) - { -// Html::debug($dieseZeile,"normale Zeile"); - // Textabsaetze - $bisZeileNr = $zeileNr; - while( $bisZeileNr <= $anzahlZeilen && - $zeilen[$bisZeileNr ]->isNormal ) - { - $bisZeileNr++; - } - $bisZeileNr--; -// Html::debug($zeileNr,"Zeile"); -// Html::debug($bisZeileNr,"bisZeile-P"); -// die(); - - $para = new ParagraphElement(); - for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) - { - if ( !$zeilen[$zn]->isNormal ) - continue; - - if ( $zeilen[$zn]->isUnparsed ) - $para->children[] = new TextElement( $zeilen[$zn]->source ); - - foreach( $this->parseSimple($zeilen[$zn]->value) as $e ) - $para->children[] = $e; - - if ( $zn < $bisZeileNr ) - $para->children[] = new LineBreakElement(); - } - - $zeileNr = $bisZeileNr; - $children[] = $para; - - continue; - } - - Html::debug($dieseZeile,"Unbekannte Zeile"); - die( 'unknown line: '.$dieseZeile ); - } - - return $children; - } - - - - function getListenAuszug( $liste, $von, $bis ) - { - $auszug = array(); - $idx = 0; - - for( $j=$von;$j<=$bis;$j++) - { - $auszug[++$idx] = new Line($liste[$j]->value); - } - - return $auszug; - } - - - /** - * Parsen einer mehrzeiligen Liste - */ - function parseList( $zeilen,$tiefe ) - { - $children = array(); - $anzahlZeilen = count( $zeilen ); - $entry = null; - for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) - { - $dieseZeile = $zeilen[$zeileNr]; - - // Listen - if ( $dieseZeile->indent <= $tiefe ) - { - if ( $zeileNr > 1 ) - $children[] = $entry; - - $entry = new ListEntryElement(); - $entry->children = $this->parseSimple( $dieseZeile->value ); - } - else - { - // Weitere Schachtelung der Liste - if ( $dieseZeile->isList ) - $liste = new ListElement(); - else - $liste = new NumberedListElement(); - - $bisZeileNr = $zeileNr; - - while( $bisZeileNr<=$anzahlZeilen && $zeilen[$bisZeileNr]->indent != $tiefe ) - $bisZeileNr++; - $bisZeileNr--; - -// echo "von $zeileNr bis $bisZeileNr (insges. $anzahlZeilen)"; - $zeilenAuszug = array(); - $nr=0; - for( $zn=$zeileNr;$zn<=$bisZeileNr;$zn++) - { - $zeilenAuszug[++$nr] = $zeilen[$zn]; - } - $liste->children = $this->parseList($zeilenAuszug,$tiefe+1); - $entry->children[] = $liste; - $zeileNr = $bisZeileNr; - } - } - $children[] = $entry; - - return $children; - } - - - /** - * Parsen einer Tabelle. - */ - function parseTable( $zeilen ) - { - $children = array(); - $anzahlZeilen = count( $zeilen ); - for ( $zeileNr=1; $zeileNr<=$anzahlZeilen; $zeileNr++ ) - { - $dieseZeile = $zeilen[$zeileNr]; - - $zeile = new TableLineElement(); - - // Listen - $zellen = explode('|',$dieseZeile->source); - $colSpan = 1; - - foreach( $zellen as $zellenInhalt ) - { - if ( $zellenInhalt=='') - { - $colSpan++; - continue; - } - - $zelle = new TableCellElement(); - $zelle->colSpan = $colSpan; - $colSpan = 1; - - if ( substr($zellenInhalt,0,1) == '!' ) - { - $zelle->isHeading = true; - $zellenInhalt = substr($zellenInhalt,1); - } - - $zelle->children = $this->parseSimple( $zellenInhalt); - - $zeile->children[] = $zelle; - } - - $children[] = $zeile; - } - - return $children; - } - - - - function parseLinks( $text ) - { - $conf = Session::getConfig(); - $text_markup = $conf['editor']['text-markup']; - - $posM = strpos($text,'"'.$text_markup['linkto'].'"'); - - if ( $posM === false ) - return false; - - $posL = strpos(substr($text,0,$posM-1),'"'); - - if ( $posL === false ) - return false; - - $posR = strpos($text,'"',$posM+4); - - if ( $posR === false ) - return false; - - $parts = array(); - $parts[] = substr($text,0 ,$posL ); // Anfang - $parts[] = substr($text,$posL+1,$posM-$posL-1); // Linktext - $parts[] = substr($text,$posM+4,$posR-$posM-4); // Verweisziel - $parts[] = substr($text,$posR+1 ); // Rest - - return $parts; - } - - - /** - * Erzeugt ein Bildobjekt - */ - function parseImages( $text ) - { - $posM = strpos($text,'image:'); - - if ( $posM === false ) - return false; - - $posL = strpos(substr($text,0,$posM-1),'"'); - - if ( $posL === false ) - return false; - - $posR = strpos($text,'"',$posM+4); - - if ( $posR === false ) - return false; - - $parts = array(); - $parts[] = substr($text,0 ,$posL ); // Anfang - $parts[] = substr($text,$posL+1,$posM-$posL-1); // Linktext - $parts[] = substr($text,$posM+4,$posR-$posM-4); // Verweisziel - $parts[] = substr($text,$posR+1 ); // Rest - - return $parts; - } - - - - /** - * Zerlegt einen einfachen Text in ein Array. - * - * @param String $text Eingabe-Test - * @param String $sepLinks Linke Begrenzung - * @param String $sepRechts Rechte Begrenzung - * @return Array - */ - function parseSimpleParts( $text,$sepLinks,$sepRechts ) - { - $posL = strpos($text,$sepLinks); - - if ( $posL === false ) - return false; - - $posR = strpos($text,$sepRechts,$posL+strlen($sepLinks)); - - if ( $posR === false ) - return false; - - $parts = array(); - $parts[] = substr($text,0 ,$posL ); - $parts[] = substr($text,$posL+strlen($sepLinks),$posR-$posL-strlen($sepLinks)); - $parts[] = substr($text,$posR+strlen($sepRechts) ); - - return $parts; - } - - - - /** - * - */ - function parseEscapes( $text ) - { - $posL = strpos($text,'\\'); - - if ( $posL === false ) - return false; - - $parts = array(); - $parts[] = substr($text,0 ,$posL ); - $parts[] = substr($text,$posL+1,1 ); - $parts[] = substr($text,$posL+2 ); - - return $parts; - } - - - - /** - * Parst einen einzeiligen Text und erzeugt daraus Elemente. - * - * @param String $text Zu parsender Text - * @param String $sepL Linke Begrenzung des Elementes - * @param String $sepR Rechte Begrenzung des Elementes - * @param String $className Klassenname des Elementes, welches es zu erzeugen gilt. - * @return Array - */ - function parseSimpleElement( $text,$sepL,$sepR,$className ) - { - $erg = $this->parseSimpleParts( $text,$sepL,$sepR ); - if ( is_array($erg) ) - { - $idx = -1; - $elements = array(); - - $davor = $this->parseSimple($erg[++$idx]); - foreach( $davor as $davorEl ) - $elements[] = $davorEl; - - $newEl = new $className(); - $newEl->children = $this->parseSimple($erg[++$idx]); - $elements[] = $newEl; - - $danach = $this->parseSimple($erg[++$idx]); - foreach( $danach as $danachEl ) - $elements[] = $danachEl; - return $elements; - } - - return false; - } - - - - /** - * Korrigiert kurze Links. - * - * @param String $text - * @return String - */ - function fixLinks( $text ) - { - // Text->... umsetzen nach "Text"->... (Anfuehrungszeichen ergaenzen) - $text = preg_replace( '/([A-Za-z0-9._-]+)\-\>/','"\\1"->',$text ); - - // ...->Link umsetzen nach ...->"Link" (Anfuehrungszeichen ergaenzen) - $text = preg_replace( '/\->([A-Za-z0-9\.\:\_\/\,\?\=\&-]+)/','->"\\1"',$text ); - - // alleinstehende externe Links - // Funktioniert nicht richtig, erstmal deaktiviert. -// $text = ereg_replace( '((https?|ftps?|news|gopher):\/\/([A-Za-z0-9._\/\,-]+))([^"])','"\\1"->"\\1"\\2',$text ); - - // alleinstehende E-Mail Adressen - $text = preg_replace( '/([A-Za-z0-9._-]+@[A-Za-z0-9\.\_\-]+)([^A-Za-z0-9\.\_\-\"])/','"\\1"->"mailto:\\1"\\2',$text ); - - // Bilder - $text = preg_replace( '/ima?ge?:\/?\/?([A-Za-z0-9\.\:\_\/\,\?\=\&-]+)/','{\\1}',$text ); - - return $text; - } - - - - /** - * Diese Methode parst einen einfachen, einzeiligen Text und zerlegt diesen in seine Bestandteile. - * - * @param String $text - * @return Array - */ - function parseSimple( $text ) - { - $conf = Session::getConfig(); - $text_markup = $conf['editor']['text-markup']; - - $text = $this->fixLinks($text); - $elements = array(); - - if ( trim($text) == '' ) - return $elements; - - $erg = $this->parseLinks( $text ); - if ( is_array($erg) ) - { - $idx = -1; - - $davor = $this->parseSimple($erg[++$idx]); - foreach( $davor as $davorEl ) - $elements[] = $davorEl; - - $link = new LinkElement(); - $link->children = $this->parseSimple($erg[++$idx]); - $link->setTarget( $erg[++$idx] ); - - if ( $link->objectId != 0 ) - $this->linkedObjectIds[] = $link->objectId; - $elements[] = $link; - - $danach = $this->parseSimple($erg[++$idx]); - foreach( $danach as $danachEl ) - $elements[] = $danachEl; - - return $elements; - } - - - $erg = $this->parseSimpleParts( $text,$text_markup['image-begin'],$text_markup['image-end'] ); - if ( is_array($erg) ) - { - $idx = -1; - - $davor = $this->parseSimple($erg[++$idx]); - foreach( $davor as $davorEl ) - $elements[] = $davorEl; - - $image = new ImageElement(); - $t = new TextElement($erg[++$idx]); - $image->setTarget( intval($t->text) ); - $t->text = ''; - $image->children[] = $t; - - if ( $image->objectId != 0 ) - $this->linkedObjectIds[] = $image->objectId; - $elements[] = $image; - - $danach = $this->parseSimple($erg[++$idx]); - foreach( $danach as $danachEl ) - $elements[] = $danachEl; - - return $elements; - } - - $erg = $this->parseSimpleParts( $text,$text_markup['macro-begin'],$text_markup['macro-end'] ); - if ( is_array($erg) ) - { - $idx = -1; - - $davor = $this->parseSimple($erg[++$idx]); - foreach( $davor as $davorEl ) - $elements[] = $davorEl; - - $macro = new MacroElement(); - $inh = explode(' ',$erg[++$idx]); - $macro->name = $inh[0]; - unset($inh[0]); - foreach( $inh as $attr ) - { - if ( empty($attr)) continue; - - list($attr_name,$attr_val) = explode($text_markup['macro-attribute-value-seperator'],$attr); - $attr_val = trim($attr_val,$text_markup['macro-attribute-quote']); - $macro->attributes[$attr_name] = $attr_val; - } - - $elements[] = $macro; - - $danach = $this->parseSimple($erg[++$idx]); - foreach( $danach as $danachEl ) - $elements[] = $danachEl; - - return $elements; - } - - - $erg = $this->parseEscapes( $text ); - if ( is_array($erg) ) - { - $idx = -1; - - $davor = $this->parseSimple($erg[++$idx]); - foreach( $davor as $davorEl ) - $elements[] = $davorEl; - - $t = new TextElement($erg[++$idx]); - $elements[] = $t; - - $danach = $this->parseSimple($erg[++$idx]); - foreach( $danach as $danachEl ) - $elements[] = $danachEl; - - return $elements; - } - - $erg = $this->parseSimpleElement( $text,$text_markup['footnote-begin'],$text_markup['footnote-end'],'FootnoteElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['strong-begin'],$text_markup['strong-end'],'StrongElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['emphatic-begin'],$text_markup['emphatic-end'],'EmphaticElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['code-begin'],$text_markup['code-end'],'TeletypeElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['insert-begin'],$text_markup['insert-end'],'InsertedElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['remove-begin'],$text_markup['remove-end'],'RemovedElement' ); - if ( is_array($erg) ) - return $erg; - - $erg = $this->parseSimpleElement( $text,$text_markup['speech-begin'],$text_markup['speech-end'],'SpeechElement' ); - if ( is_array($erg) ) - return $erg; - - $t = new TextElement($text); - $elements[] = $t; - - return $elements; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/DocBookRenderer.class.php b/textClasses/renderer/DocBookRenderer.class.php @@ -1,246 +0,0 @@ -<?php - -/** - * Renderer fuer das DOCBOOK-Format. - * - * Das Docbook-Format ist von der OASIS spezifiert und ermoeglicht die - * strukturierte Darstellung von Text-Dokumenten. - * - * Dieses Klasse erzeugt aus dem internen DOM-Baum ein DocBook-XML-Dokument. - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class DocBookRenderer -{ - var $linkedObjectIds = array(); - var $encodeHtml = false; - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $attr = array(); - $val = ''; - $praefix = ''; - $suffix = ''; - $empty = false; - - switch( strtolower(get_class($child)) ) - { - case 'macroelement': - $tag = ''; - break; - - case 'tableofcontentelement': - $tag = 'toc'; - break; - - case 'rawelement': - $tag = ''; - $val = $child->src; - - break; - - case 'textelement': - $tag = 'para'; - - $val = $child->text; - $val = Text::encodeHtml( $val ); - $val = Text::replaceHtmlChars( $val ); - break; - - case 'footnoteelement': - $tag = 'footnote'; - break; - - case 'codeelement': - - $tag = 'emphasis'; - $attr['role'] = 'code'; - break; - - case 'quoteelement': - $tag = 'blockquote'; - break; - - - case 'paragraphelement': - $tag = 'para'; - break; - - case 'speechelement': - $tag = 'citiation'; - break; - - case 'linebreakelement': - $tag = ''; - $val = "\n"; - break; - - case 'linkelement': - $tag = 'ulink'; - $attr['url'] = htmlspecialchars($child->getUrl()); - break; - - case 'imageelement': - $empty = true; - $tag = 'graphic'; - $attr['fileref'] = $child->getUrl(); - break; - - case 'strongelement': - $tag = 'emphasis'; - $attr['role'] = 'strong'; - break; - - case 'emphaticelement': - $tag = 'emphasis'; - $attr['role'] = 'italic'; - break; - - case 'insertedelement': - $tag = 'emphasis'; - $attr['role'] = 'inserted'; - break; - - case 'removedelement': - $tag = 'emphasis'; - $attr['role'] = 'removed'; - break; - - case 'headlineelement': - $tag = 'chapter'; // $child->level ? - - $l = new LinkElement(); - $l->name = $child->getName(); - $child->children[] = $l; - - break; - - case 'tableelement': - $tag = 'table'; - break; - - case 'tablelineelement': - $tag = 'row'; - break; - - case 'definitionlistelement': - $tag = 'variablelist'; - break; - - case 'definitionitemelement': - if ( !empty($child->key) ) - { - $tag = 'listitem'; - $val = $child->key; - } - else - { - $tag = 'term'; - } - break; - - case 'tablecellelement': - //if ( $child->isHeading ) - $tag = 'entry'; - break; - - case 'listelement': - $tag = 'itemizedlist'; - break; - - case 'teletypeelement': - $tag = 'emphasis'; - $attr['role'] = 'code'; - break; - - case 'numberedlistelement': - $tag = 'orderedlist'; - break; - - case 'listentryelement': - $tag = 'listitem'; - break; - - default: - - $tag = 'unknown-element'; - $attr['class'] = strtolower(get_class($child)); - break; - } - - $val .= $praefix; - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - - $val .= $suffix; - return $this->renderXmlElement($tag,$val,$empty,$attr); - - } - - - - /** - * Erzeugt ein XML-Element. - * - * @param String $tag Name des Tags - * @param String $value Inhalt - * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") - * @param Array $attr Attribute als Array<String,String> - * @return String - */ - function renderXmlElement( $tag,$value,$empty,$attr=array() ) - { - global $conf; - if ( $tag == '' ) - return $value; - - $val = '<'.$tag; - foreach( $attr as $attrName=>$attrInhalt ) - { - $val .= ' '.$attrName.'="'.$attrInhalt.'"'; - } - - if ( $value == '' && $empty ) - { - $val .= ' />'; - return $val; - } - - $val .= '>'.$value.'</'.$tag.'>'; - return $val; - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->renderedText .= '<?xml version="1.0" encoding="UTF-8" ?>'; - $this->renderedText .= '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">'; - - foreach( $this->children as $child ) - $this->renderedText .= $this->renderElement( $child ); - - return $this->renderedText; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/HtmlDomRenderer.class.php b/textClasses/renderer/HtmlDomRenderer.class.php @@ -1,323 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class HtmlDomRenderer -{ - var $linkedObjectIds = array(); - - /** - * Fu�noten. - * - * @var Array - */ - var $footnotes = array(); - - var $encodeHtml = false; - - var $path = array(); - - var $domId = ''; - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $this->path[] = $child; - - $val = ''; -// $val = '<br/>'; -// foreach( $this->path as $p ) -// $val .= '&nbsp;&nbsp;&nbsp;&nbsp;'; - -// $val .= '<a href="#'.$this->getPathAsString().'">_</a>'; - - $attr = array(); - $praefix = ''; - $suffix = ''; - $empty = false; - - if ( count($child->children) > 0 ) - { - $subChild1 = $child->children[0]; - - if ( !empty($subChild1->class) ) - $attr['class'] = $subChild1->class; - - if ( !empty($subChild1->style) ) - $attr['style'] = $subChild1->style; - - if ( !empty($subChild1->title) ) - $attr['title'] = $subChild1->title; - } - - $praefix .= lang('TEXT_MARKUP_'.strtoupper(substr(get_class($child),0,-7))); - - switch( strtolower(get_class($child)) ) - { - case 'rawelement': - $tag = ''; - $val = $child->src; - - break; - - case 'textelement': - $tag = 'text'; - - $val .= $child->text; - - break; - - - case 'linkelement': - - $tag = 'a'; - if ( !empty($child->name) ) - $attr['name'] = $child->name; - else - $attr['href'] = htmlspecialchars($child->getUrl()); - - if ( Object::available( $child->objectId ) ) - { - $file = new File( $child->objectId ); - $file->load(); - $attr['title'] = $file->description; - unset( $file ); - } - - break; - - case 'imageelement': - $empty = true; - $attr['alt'] = ''; - - if ( ! Object::available( $child->objectId ) ) - { - $tag = ''; - } - elseif ( empty($attr['title']) ) - { - $tag = 'img'; - $attr['src'] = $child->getUrl(); - $attr['border'] = '0'; - - // Breite/H�he des Bildes bestimmen. - $image = new File( $child->objectId ); - - $image->load(); - $attr['alt' ] = $image->name; - $attr['title' ] = $image->description; - - $image->getImageSize(); - $attr['width' ] = $image->width; - $attr['height'] = $image->height; - unset($image); - } - else - { - $tag = 'dl'; - - if ( empty($attr['class']) ) - $attr['class'] = "image"; - - $child->children = array(); - $dt = new DefinitionListItemElement(); - $dt->children[] = new TextElement('(image)'); - $dt->children[] = $child; - $child->children[] = $dt; - - $dd = new DefinitionListEntryElement(); - $dd->children[] = new TextElement('(image)'); - $dd->children[] = new TextElement($attr['title']); - $child->children[] = $dd; - } - $suffix = '<img src="./themes/default/images/editor/image.png">'; - break; - - case 'strongelement': - $tag = 'strong'; - break; - - case 'macroelement': - $tag = 'macro'; - $val = ucfirst($child->name); - break; - - - case 'emphaticelement': - $tag = 'em'; - break; - - case 'insertedelement': - $tag = 'ins'; - break; - - case 'removedelement': - $tag = 'del'; - break; - - case 'headlineelement': - $tag = 'h'.$child->level; - - $l = new LinkElement(); - $l->name = $child->getName(); - $child->children[] = $l; - - break; - - case 'tableelement': - $tag = 'table'; - break; - - case 'tablelineelement': - $tag = 'tr'; - break; - - case 'definitionlistelement': - $items = $child->children; - $newChildren = array(); - foreach( $items as $item ) - { - $def = new DefinitionItemElement(); - $def->key = $item->key; - $item->key = ''; - $newChildren[] = $def; - $newChildren[] = $item; - } -// Html::debug($newChildren,'Children-neu'); - $child->children = $newChildren; - $tag = 'dl'; - break; - - case 'definitionitemelement': - if ( !empty($child->key) ) - { - $tag = 'dt'; - $val = $child->key; - } - else - { - $tag = 'dd'; - } - break; - - case 'tablecellelement': - if ( $child->isHeading ) - $tag = 'th'; else $tag = 'td'; - - if ( $child->rowSpan > 1 ) - $attr['rowspan'] = $child->rowSpan; - if ( $child->colSpan > 1 ) - $attr['colspan'] = $child->colSpan; - break; - - case 'listelement': - $tag = 'ul'; - break; - - case 'teletypeelement': - $tag = 'code'; - break; - - case 'numberedlistelement': - $tag = 'ol'; - break; - - case 'listentryelement': - $tag = 'li'; - break; - - default: - - } - - $val = $this->renderValue($val); - $val = '<div class="entry">'.$praefix.$val.$suffix.'</div>'; - - if ( count($child->children)>0 ) - { - $val .= '<ul class="tree">'; - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - $val .= '</ul>'; - } - -// echo "text:$val"; - - unset( $this->path[ count($this->path)-1 ] ); - return '<li><div class="tree" />'.$val.'</li>'; - } - - - - /** - * Rendert einen Inhalt. - * - * @param String $value Inhalt - * @return String - */ - function renderValue( $value ) - { - $val = '&nbsp;<em>'.$value.'</em>'; - return $val; - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->footnotes = array(); - - $this->renderedText = '<ul class="tree">'; - - foreach( $this->children as $child ) - $this->renderedText .= ''.$this->renderElement( $child ).''; - //$this->renderedText .= '<li><div class="tree" /><div class="entry" /><ul class="tree">'.$this->renderElement( $child ).'</ul></li>'; - - foreach( $this->footnotes as $child ) - $this->renderedText .= '<li><div class="tree" /><div class="entry" /><ul class="tree">'.$this->renderElement( $child ).'</ul></li>'; - $this->renderedText .= '</ul>'; - - return $this->renderedText; - } - - - /** - * - */ - function getPathAsString() - { - $path = array(); - foreach( $this->path as $p ) - { - $path[] = strtolower( substr(get_class($p),0,-7) ); - } - - return implode('_',$path); - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/HtmlRenderer.class.php b/textClasses/renderer/HtmlRenderer.class.php @@ -1,542 +0,0 @@ -<?php - -use cms\model\File; -use cms\model\Object; - -/** - * Dokument-Objekt.<br> - * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class HtmlRenderer -{ - public $linkedObjectIds = array(); - public $encodeHtml = false; - - /** - * Fu�noten. - * - * @var array - */ - public $footnotes = array(); - - /** - * @var string - */ - public $renderedText; - - /** - * @var \cms\model\Page - */ - public $page; - - /** - * @var array - */ - public $children; - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $attr = array(); - $val = ''; - $praefix = ''; - $suffix = ''; - $empty = false; - - if ( count($child->children) > 0 ) - { - $subChild1 = $child->children[0]; - - if ( !empty($subChild1->class) ) - $attr['class'] = $subChild1->class; - - if ( !empty($subChild1->style) ) - $attr['style'] = $subChild1->style; - - if ( !empty($subChild1->title) ) - $attr['title'] = $subChild1->title; - } - - switch( strtolower(get_class($child)) ) - { - case 'tableofcontentelement': - $tag = 'p'; - foreach( $this->children as $h) - { - if ( strtolower(get_class($h))=='headlineelement' ) - { - $child->children[] = new RawElement(str_repeat('&nbsp;&nbsp;',$h->level)); - $t = new TextElement( $h->getText() ); - $l = new LinkElement(); - $l->fragment=$h->getName(); - $l->children[] = $t; - $child->children[] = $l; - $child->children[] = new LineBreakElement(); - } - } - break; - - case 'rawelement': - $tag = ''; - $val = $child->src; - - break; - - case 'textelement': - $tag = ''; -// $tag = 'span'; - - $val = $child->text; - if ( $this->encodeHtml ) - $val = Text::encodeHtml( $val ); - $val = Text::replaceHtmlChars( $val ); - break; - - case 'footnoteelement': - $tag = 'a'; - $attr['href'] = '#footnote'; - - $title = ''; - foreach( $child->children as $c ) - $title .= $this->renderElement($c); - $attr['title'] = strip_tags($title); - - $nr = 1; - foreach( $this->footnotes as $fn ) - if ( strtolower(get_class($fn))=='linebreakelement') - $nr++; - - $val = $nr; - if ( @$conf['editor']['footnote']['bracket']) - $val = '('.$nr.')'; - if ( @$conf['editor']['footnote']['sup']) - $val = '<sup><small>'.$nr.'</small></sup>'; - - - if ( $nr == 1 ) - { - $this->footnotes[] = new RawElement('&mdash;'); - $le = new LinkElement(); - $le->name = "footnote"; - $this->footnotes[] = $le; - $this->footnotes[] = new RawElement('&mdash;'); - } - $this->footnotes[] = new LineBreakElement(); - $this->footnotes[] = new RawElement($val); - $this->footnotes[] = new RawElement(' '); - foreach( $child->children as $c ) - $this->footnotes[] = $c; - - $child->children = array(); - - break; - - case 'codeelement': - - if ( empty($child->language) ) - // Wenn keine Sprache verf�gbar, dann ein einfaches PRE-Element erzeugen. - $tag = 'pre'; - else - { - // Wenn Sprache verf�gbar, dann den GESHI-Parser bem�hen. - $tag = ''; - $source = ''; - foreach( $child->children as $c ) - if ( strtolower(get_class($c)) == 'textelement') - $source .= $c->text."\n"; - $child->children = array(); - require_once('./geshi/geshi.php'); - $geshi = new Geshi($source,$child->language); - $val = $geshi->parse_code(); - } - break; - - case 'quoteelement': - $tag = 'blockquote'; - break; - - - case 'paragraphelement': - $tag = 'p'; - break; - - case 'speechelement': - if ( isset($conf['editor']['html']['tag_speech']) ) - $tag = $conf['editor']['html']['tag_speech']; - else - $tag = 'cite'; - - // Danke an: http://www.apostroph.de/tueddelchen.php - //TODO: Abh�ngigkeit von Spracheinstellung implementieren. - $language = 'de'; - switch( $language ) - { - case 'de': // deutsche Notation - $praefix = '&bdquo;'; - $suffix = '&ldquo;'; - break; - case 'fr': - $praefix = '&laquo;'; - $suffix = '&raquo;'; - break; - default: // englische Notation - $praefix = '&ldquo;'; - $suffix = '&rdquo;'; - } - - if ( $conf['editor']['html']['override_speech'] ) - { - $praefix = $conf['editor']['html']['override_speech_open' ]; - $suffix = $conf['editor']['html']['override_speech_close']; - } - break; - - case 'macroelement': - - $tag = ''; - - if ( strtolower($child->name) == 'help' ) - { - $tag = 'tt'; - $macros = FileUtils::readDir('./macro'); - $val = 'Available macros: '.implode(',',$macros); - } - else - { - $className = ucfirst($child->name); - $fileName = './macro/'.$className.'.class.php'; - if ( is_file( $fileName ) ) - { - // Fuer den Fall, dass eine Dynamic-Klasse mehrmals pro Vorlage auftritt - if ( !class_exists($className) ) - require( $fileName ); - - if ( class_exists($className) ) - { - $macro = new $className; - /*@type $macro Makro */ - $macro->page = &$this->page; - - if ( method_exists( $macro,'execute' ) ) - { - $macro->objectid = $this->page->objectid; - $macro->page = &$this->page; - - foreach( $child->attributes as $param_name=>$param_value ) - { - if ( $param_name == 'help') - $val .= 'HELP: Available macro attributes in '.$className.': '.implode(',',array_keys(get_object_vars($macro))."\n"); - if ( isset( $macro->$param_name ) ) - { - // Die Parameter der Makro-Klasse typisiert setzen. - if ( is_int($macro->$param_name) ) - $macro->$param_name = intval($param_value); - elseif ( is_array($macro->$param_name) ) - $macro->$param_name = explode(',',$param_value); - else - $macro->$param_name = $param_value; - } - else - { - $val .= "WARNING: Unknown parameter '$param_name' in macro '$className'\n"; - } - - - - } - - $macro->execute(); - $val .= $macro->getOutput(); - } - else - { - Logger::warn('class:'.$className.', no method: execute()'); - if ( config('editor','macro','show_errors') ) - $val = 'Internal Macro error: method execute() not found'; - } - } - else - { - Logger::warn('class not found:'.$className); - if ( config('editor','macro','show_errors') ) - $val = 'Internal Macro error: class not found'; - } - } - else - { - Logger::warn('file not found:'.$fileName); - - if ( config('editor','macro','show_errors') ) - { - $tag = 'tt'; - $attr['style'] = 'color:red'; - $val = 'Unknown Macro: "'.$child->name.'", use macro "help" for a list of available macros'; - } - } - } - - break; - - case 'linebreakelement': - $tag = 'br'; - $empty = true; - break; - - case 'linkelement': - $tag = 'a'; - if ( !empty($child->name) ) - $attr['name'] = $child->name; - else - $attr['href'] = htmlspecialchars($child->getUrl()); - - if ( Object::available( $child->objectId ) ) - { - $file = new File( $child->objectId ); - $file->load(); - $attr['title'] = $file->description; - unset( $file ); - } - break; - - case 'imageelement': - $empty = true; - $attr['alt'] = ''; - - if ( ! Object::available( $child->objectId ) ) - { - $tag = ''; - } - elseif ( empty($attr['title']) ) - { - $tag = 'img'; - $attr['src'] = $child->getUrl(); - $attr['border'] = '0'; - - // Breite/H�he des Bildes bestimmen. - $image = new File( $child->objectId ); - - $image->load(); - $attr['alt' ] = $image->name; - $attr['title' ] = $image->description; - - $image->getImageSize(); - $attr['width' ] = $image->width; - $attr['height'] = $image->height; - unset($image); - } - else - { - $tag = 'dl'; - - if ( empty($attr['class']) ) - $attr['class'] = "image"; - - $child->children = array(); - $dt = new DefinitionListItemElement(); - $dt->children[] = new TextElement('(image)'); - $dt->children[] = $child; - $child->children[] = $dt; - - $dd = new DefinitionListEntryElement(); - $dd->children[] = new TextElement('(image)'); - $dd->children[] = new TextElement($attr['title']); - $child->children[] = $dd; - } - break; - - case 'strongelement': - if ( isset($conf['editor']['html']['tag_strong']) ) - $tag = $conf['editor']['html']['tag_strong']; - else - $tag = 'strong'; - break; - - case 'emphaticelement': - if ( isset($conf['editor']['html']['tag_emphatic']) ) - $tag = $conf['editor']['html']['tag_emphatic']; - else - $tag = 'em'; - break; - - case 'insertedelement': - $tag = 'ins'; - break; - - case 'removedelement': - $tag = 'del'; - break; - - case 'headlineelement': - $tag = 'h'.$child->level; - - $l = new LinkElement(); - $l->name = $child->getName(); - $child->children[] = $l; - - break; - - case 'tableelement': - $tag = 'table'; - break; - - case 'tablelineelement': - $tag = 'tr'; - break; - - case 'definitionlistelement': - $items = $child->children; - $newChildren = array(); - foreach( $items as $item ) - { - $def = new DefinitionItemElement(); - $def->key = $item->key; - $item->key = ''; - $newChildren[] = $def; - $newChildren[] = $item; - } -// Html::debug($newChildren,'Children-neu'); - $child->children = $newChildren; - $tag = 'dl'; - break; - - case 'definitionitemelement': - if ( !empty($child->key) ) - { - $tag = 'dt'; - $val = $child->key; - } - else - { - $tag = 'dd'; - } - break; - - case 'tablecellelement': - if ( $child->isHeading ) - $tag = 'th'; else $tag = 'td'; - - if ( $child->rowSpan > 1 ) - $attr['rowspan'] = $child->rowSpan; - if ( $child->colSpan > 1 ) - $attr['colspan'] = $child->colSpan; - break; - - case 'listelement': - $tag = 'ul'; - break; - - case 'teletypeelement': - if ( isset($conf['editor']['html']['tag_teletype']) ) - $tag = $conf['editor']['html']['tag_teletype']; - else - $tag = 'code'; - break; - - case 'numberedlistelement': - $tag = 'ol'; - break; - - case 'listentryelement': - $tag = 'li'; - break; - - default: - - $tag = 'unknown-element'; - $attr['class'] = strtolower(get_class($child)); - break; - } - - $val .= $praefix; - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - - $val .= $suffix; - return $this->renderHtmlElement($tag,$val,$empty,$attr); - - } - - - - /** - * Erzeugt ein HTML-Element. - * - * @param String $tag Name des Tags - * @param String $value Inhalt - * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") - * @param array $attr Attribute als Array<String,String> - * @return String - */ - function renderHtmlElement( $tag,$value,$empty,$attr=array() ) - { - global $conf; - if ( $tag == '' ) - return $value; - - $val = '<'.$tag; - foreach( $attr as $attrName=>$attrInhalt ) - { - $val .= ' '.$attrName.'="'.$attrInhalt.'"'; - } - - if ( $value == '' && $empty ) - { - // Inhalt ist leer, also Kurzform verwenden. - // Die Kurzform ist abh�ngig vom Rendermode. - // SGML=<tag> - // XML=<tag /> - if ( $conf['editor']['html']['rendermode'] == 'xml' ) - { - $val .= ' />'; - return $val; - } - else - { - $val .= '>'; - return $val; - } - } - - $val .= '>'.$value.'</'.$tag.'>'; - return $val; - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->footnotes = array(); - - foreach( $this->children as $child ) - $this->renderedText .= $this->renderElement( $child ); - - foreach( $this->footnotes as $child ) - $this->renderedText .= $this->renderElement( $child ); - - return $this->renderedText; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/LatexRenderer.class.php b/textClasses/renderer/LatexRenderer.class.php @@ -1,201 +0,0 @@ -<?php - -/** - * Renderer fuer das LaTex-Format. - * - * Diese Klasse erzeugt aus dem internen DOM-Baum ein LaTex-Dokument. - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class LatexRenderer -{ - var $linkedObjectIds = array(); - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $val = ''; - $before = ''; - $after = ''; - - switch( strtolower(get_class($child)) ) - { - case 'tableofcontentelement': - $before = '\tableofcontents'."\n"; - break; - - case 'rawelement': - $tag = ''; - $val = $child->src; - - break; - - case 'textelement': - $val = $child->text; - //$val = Text::encodeHtml( $val ); - $val = Text::replaceHtmlChars( $val ); - break; - - case 'footnoteelement': - $before = '\footnote{'; - $after = '}'; - break; - - case 'codeelement': - - break; - - case 'quoteelement': - break; - - - case 'paragraphelement': - $before = "\n"; - break; - - case 'speechelement': - - break; - - case 'linebreakelement': - $after = '\\'; - break; - - case 'linkelement': - // Ggf. Hyperref-Paket verwenden. - break; - - case 'imageelement': - break; - - case 'strongelement': - $before = '\textbf{'; - $after = '}'; - break; - - case 'emphaticelement': - $before = '\textit{'; - $after = '}'; - break; - - case 'insertedelement': - $before = ''; - $after = ''; - break; - - case 'removedelement': - $before = ''; - $after = ''; - break; - - case 'headlineelement': - - switch( $child->level ) - { - case 1: - $before = '\section'; - break; - case 2: - $before = '\subsection'; - break; - case 3: - default: - $before = '\subsubsection'; - break; - } - $before .= '{'; - $after = '}'; - break; - - case 'tableelement': - $before = '\begin{tabular}'."\n"; - $after = '\end{tabular}'."\n"; - break; - - case 'tablelineelement': - $before = ''; - $after = '\\'; - break; - - case 'definitionlistelement': - break; - - case 'definitionitemelement': - break; - - case 'macroelement': - break; - - case 'tablecellelement': - $before = ''; - $after = ' & '; - break; - - case 'listelement': - $before = '\begin{itemize}'."\n"; - $after = '\end{itemize}'."\n"; - break; - - case 'teletypeelement': - $before = '\texttt{'; - $after = '}'; - break; - - case 'numberedlistelement': - $before = '\begin{itemize}'."\n"; - $after = '\end{itemize}'."\n"; - break; - - case 'listentryelement': - $before = '\item '; - break; - - default: - - $tag = 'unknown-element'; - $attr['class'] = strtolower(get_class($child)); - break; - } - - $val .= $before; - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - $val .= $after; - - return $val; - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->renderedText .= '\documentclass{article}'."\n"; - $this->renderedText .= '\begin{document}'."\n"; - - foreach( $this->children as $child ) - $this->renderedText .= $this->renderElement( $child ); - - $this->renderedText .= '\end{document}'."\n"; - - return $this->renderedText; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/Pdf.class.php b/textClasses/renderer/Pdf.class.php @@ -1,35 +0,0 @@ -<?php - -/* - * - */ -class Pdf extends FPDF -{ - /* - * Ueberschreibt die FPDF-Methode, damit im Fehlerfall kein die() aufgerufen wird. - */ - function Error( $errorText ) - { - Logger::warn('PDF-Error:'.$errorText); - } - - /* - * Ueberschreibt die FPDF-Methode, damit im Fehlerfall kein die() aufgerufen wird. - */ - function Image( $file,$x=null,$y=null,$a=0,$b=0,$type='',$link='' ) - { - switch( $type ) - { - case 'png': - case 'jpeg': - case 'jpg': - parent::Image($file,$x,$y,$a,$b,$type,$link); - break; - default: - Logger::warn( 'Imagetype '.$type.' not available in PDF renderer'); - - } - } -} - -?> diff --git a/textClasses/renderer/PdfRenderer.class.php b/textClasses/renderer/PdfRenderer.class.php @@ -1,214 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verkoerpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ - -require('textClasses/renderer/fpdf.php'); -require('textClasses/renderer/Pdf.class.php'); - -class PdfRenderer -{ - var $linkedObjectIds = array(); - - /** - * - * @var Array - */ - var $footnotes = array(); - - var $pdf; - - var $url; - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - switch( strtolower(get_class($child)) ) - { - case 'tableofcontentelement': - break; - - case 'rawelement': - $this->pdf->Write(5,$child->src); - - break; - - case 'textelement': - - $this->pdf->Write(5,$child->text,$this->url); - $this->url = ''; - break; - - case 'footnoteelement': - break; - - case 'macroelement': - break; - - case 'codeelement': - $this->pdf->ln(10); - $this->pdf->SetFont('Courier','',12); - break; - - case 'quoteelement': - $this->pdf->SetFont('Arial','I',12); - break; - - - case 'paragraphelement': - $this->pdf->ln(10); - break; - - case 'speechelement': - $this->pdf->SetFont('Arial','I',12); - break; - - case 'linebreakelement': - $this->pdf->ln(5); - break; - - case 'linkelement': - $this->url = $child->getUrl(); - $this->pdf->SetTextColor(0, 0, 255); // Blau. - break; - - case 'imageelement': - if ( Object::available( $child->objectId ) ) - { - $this->pdf->ln(5); - // Breite/oe�he des Bildes bestimmen. - $image = new File( $child->objectId ); - - $image->load(); - $image->write(); - $image->getImageSize(); - // $image->width; - // $image->height; - - $this->pdf->Image($image->tmpfile(),$this->pdf->GetX(),$this->pdf->GetY(),0,0,$image->extension()); - $this->pdf->ln($image->height/2.5); - $this->pdf->ln(5); - - unset($image); - } - break; - - case 'strongelement': - $this->pdf->SetFont('Arial','B',12); - - break; - - case 'emphaticelement': - $this->pdf->SetFont('Arial','I',12); - break; - - case 'insertedelement': - $this->pdf->SetTextColor(0,255,0); - break; - - case 'removedelement': - $this->pdf->SetTextColor(255,0,0); - break; - - case 'headlineelement': - $this->pdf->ln(20-(2*$child->level)); - $this->pdf->SetFontSize(20-(2*$child->level)); - - break; - - case 'tableelement': - $this->pdf->ln(20); - break; - - case 'tablelineelement': - $this->pdf->ln(20); - break; - - case 'definitionlistelement': - //$this->pdf->ln(10); - break; - - case 'definitionitemelement': - $this->pdf->ln(10); - if ( !empty($child->key) ) - { - $this->pdf->SetFont('','U'); - $this->pdf->Write(5,$child->key); - $this->pdf->SetFont('',''); } - $this->pdf->Write(5,': '); - - case 'tablecellelement': - break; - - case 'teletypeelement': - $this->pdf->SetFont('Courier','',12); - break; - - case 'listelement': - $this->pdf->ln(5); - break; - - case 'numberedlistelement': - $this->pdf->ln(5); - break; - - case 'listentryelement': - $this->pdf->ln(5); - $this->pdf->Write(5,'- '); - break; - - default: - break; - } - - foreach( $child->children as $c ) - { - $this->renderElement( $c ); - } - - $this->pdf->SetFont('Arial','',12); - $this->pdf->SetTextColor(0,0,0); - } - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->pdf = new Pdf(); - $this->pdf->AddPage(); - $this->pdf->SetCreator(OR_TITLE); - $this->pdf->SetFont('Arial','',12); - - #$this->footnotes = array(); - - foreach( $this->children as $child ) - $this->renderElement( $child ); - - #foreach( $this->footnotes as $child ) - # $this->renderElement( $child ); - - return $this->pdf->Output('','S'); - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/TextRenderer.class.php b/textClasses/renderer/TextRenderer.class.php @@ -1,134 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verkörpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class TextRenderer -{ - var $linkedObjectIds = array(); - - /** - * Fußnoten. - * - * @var Array - */ - var $footnotes = array(); - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $className = strtolower(get_class($child)); - $val = ''; - - $length = @$conf['editor']['text']['linelength']; - if ( intval($length) == 0 ) - $length = 70; - - switch( $className ) - { - case 'footnoteelement': - - $nr = 1; - foreach( $this->footnotes as $fn ) - if ( strtolower(get_class($fn))=='linebreakelement') - $nr++; - - $val = $nr; - if ( @$conf['editor']['footnote']['bracket']) - $val = '('.$nr.')'; - - if ( $nr == 1 ) - { - $this->footnotes[] = new RawElement("\n\n---\n"); - } - $this->footnotes[] = new LineBreakElement(); - $this->footnotes[] = new RawElement($val); - $this->footnotes[] = new RawElement(' '); - foreach( $child->children as $c ) - $this->footnotes[] = $c; - - $child->children = array(); - - break; - - case 'headlineelement': - $val = "\n".wordwrap($child->text,$length); - $val .= str_repeat('-',min($length,strlen($val))); - break; - - case 'paragraphelement': - $val = "\n\n"; - break; - - case 'strongelement': - - foreach( $child->children as $c ) - $val .= $this->renderElement($c); - $val = strtoupper($val); - - $child->children = array(); - - break; - - case 'textelement': - $length = @$conf['editor']['text']['linelength']; - if ( intval($length) == 0 ) - $length = 70; - $val .= wordwrap($child->text,$length); - break; - - case 'linebreakelement': - $val .= "\n"; - break; - default: - } - - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - - return $val; - -// die( 'unknown document type: '.$this->type ); - - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->footnotes = array(); - - foreach( $this->children as $child ) - $this->renderedText .= $this->renderElement( $child ); - - foreach( $this->footnotes as $child ) - $this->renderedText .= $this->renderElement( $child ); - - return $this->renderedText; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/XhtmlRenderer.class.php b/textClasses/renderer/XhtmlRenderer.class.php @@ -1,481 +0,0 @@ -<?php - -/** - * Dokument-Objekt.<br> - * Diese Objekt verk�rpert das Root-Objekt in einem DOM-Baum.<br> - * <br> - * Dieses Objekt kann Text parsen und seine Unterobjekte selbst erzeugen.<br> - * - * @author Jan Dankert, $Author$ - * @version $Revision$ - * @package openrat.text - */ -class XhtmlRenderer -{ - var $linkedObjectIds = array(); - var $encodeHtml = false; - - /** - * Fu�noten. - * - * @var Array - */ - var $footnotes = array(); - - - /** - * Rendert ein Dokument-Element. - * - * @param Object $child Element - * @return String - */ - function renderElement( $child ) - { - global $conf; - - $attr = array(); - $val = ''; - $praefix = ''; - $suffix = ''; - $empty = false; - - if ( count($child->children) > 0 ) - { - $subChild1 = $child->children[0]; - - if ( !empty($subChild1->class) ) - $attr['class'] = $subChild1->class; - - if ( !empty($subChild1->style) ) - $attr['style'] = $subChild1->style; - - if ( !empty($subChild1->title) ) - $attr['title'] = $subChild1->title; - } - - switch( strtolower(get_class($child)) ) - { - case 'tableofcontentelement': - $tag = 'p'; - foreach( $this->children as $h) - { - if ( strtolower(get_class($h))=='headlineelement' ) - { - $child->children[] = new RawElement(str_repeat('&nbsp;&nbsp;',$h->level)); - $t = new TextElement( $h->getText() ); - $l = new LinkElement(); - $l->fragment=$h->getName(); - $l->children[] = $t; - $child->children[] = $l; - $child->children[] = new LineBreakElement(); - } - } - break; - - case 'rawelement': - $tag = ''; - $val = $child->src; - - break; - - case 'textelement': - $tag = ''; -// $tag = 'span'; - - $val = $child->text; - if ( $this->encodeHtml ) - $val = Text::encodeHtml( $val ); - $val = Text::replaceHtmlChars( $val ); - break; - - case 'footnoteelement': - $tag = 'a'; - $attr['href'] = '#footnote'; - - $title = ''; - foreach( $child->children as $c ) - $title .= $this->renderElement($c); - $attr['title'] = strip_tags($title); - - $nr = 1; - foreach( $this->footnotes as $fn ) - if ( strtolower(get_class($fn))=='linebreakelement') - $nr++; - - $val = $nr; - if ( @$conf['editor']['footnote']['bracket']) - $val = '('.$nr.')'; - if ( @$conf['editor']['footnote']['sup']) - $val = '<sup><small>'.$nr.'</small></sup>'; - - - if ( $nr == 1 ) - { - $this->footnotes[] = new RawElement('&mdash;'); - $le = new LinkElement(); - $le->name = "footnote"; - $this->footnotes[] = $le; - $this->footnotes[] = new RawElement('&mdash;'); - } - $this->footnotes[] = new LineBreakElement(); - $this->footnotes[] = new RawElement($val); - $this->footnotes[] = new RawElement(' '); - foreach( $child->children as $c ) - $this->footnotes[] = $c; - - $child->children = array(); - - break; - - case 'codeelement': - - if ( empty($child->language) ) - // Wenn keine Sprache verf�gbar, dann ein einfaches PRE-Element erzeugen. - $tag = 'pre'; - else - { - // Wenn Sprache verf�gbar, dann den GESHI-Parser bem�hen. - $tag = ''; - $source = ''; - foreach( $child->children as $c ) - if ( strtolower(get_class($c)) == 'textelement') - $source .= $c->text."\n"; - $child->children = array(); - require_once('./geshi/geshi.php'); - $geshi = new Geshi($source,$child->language); - $val = $geshi->parse_code(); - } - break; - - case 'quoteelement': - $tag = 'blockquote'; - break; - - - case 'paragraphelement': - $tag = 'p'; - break; - - case 'speechelement': - $tag = 'cite'; - - // Danke an: http://www.apostroph.de/tueddelchen.php - //TODO: Abh�ngigkeit von Spracheinstellung implementieren. - $language = 'de'; - switch( $language ) - { - case 'de': // deutsche Notation - $praefix = '&bdquo;'; - $suffix = '&ldquo;'; - break; - case 'fr': - $praefix = '&laquo;'; - $suffix = '&raquo;'; - break; - default: // englische Notation - $praefix = '&ldquo;'; - $suffix = '&rdquo;'; - } - - if ( $conf['editor']['html']['override_speech'] ) - { - $praefix = $conf['editor']['html']['override_speech_open' ]; - $suffix = $conf['editor']['html']['override_speech_close']; - } - break; - - case 'linebreakelement': - $tag = 'br'; - $empty = true; - break; - - case 'linkelement': - $tag = 'a'; - if ( !empty($child->name) ) - $attr['name'] = $child->name; - else - $attr['href'] = htmlspecialchars($child->getUrl()); - - if ( Object::available( $child->objectId ) ) - { - $file = new File( $child->objectId ); - $file->load(); - $attr['title'] = $file->description; - unset( $file ); - } - break; - - case 'imageelement': - $empty = true; - $attr['alt'] = ''; - - if ( ! Object::available( $child->objectId ) ) - { - $tag = ''; - } - elseif ( empty($attr['title']) ) - { - $tag = 'img'; - $attr['src'] = $child->getUrl(); - $attr['border'] = '0'; - - // Breite/H�he des Bildes bestimmen. - $image = new File( $child->objectId ); - - $image->load(); - $attr['alt' ] = $image->name; - $attr['title' ] = $image->description; - - $image->getImageSize(); - $attr['width' ] = $image->width; - $attr['height'] = $image->height; - unset($image); - } - else - { - $tag = 'dl'; - - if ( empty($attr['class']) ) - $attr['class'] = "image"; - - $child->children = array(); - $dt = new DefinitionListItemElement(); - $dt->children[] = new TextElement('(image)'); - $dt->children[] = $child; - $child->children[] = $dt; - - $dd = new DefinitionListEntryElement(); - $dd->children[] = new TextElement('(image)'); - $dd->children[] = new TextElement($attr['title']); - $child->children[] = $dd; - } - break; - - case 'strongelement': - $tag = 'strong'; - break; - - case 'emphaticelement': - $tag = 'em'; - break; - - case 'insertedelement': - $tag = 'ins'; - break; - - case 'removedelement': - $tag = 'del'; - break; - - case 'headlineelement': - $tag = 'h'.$child->level; - - $l = new LinkElement(); - $l->name = $child->getName(); - $child->children[] = $l; - - break; - - case 'tableelement': - $tag = 'table'; - break; - - case 'tablelineelement': - $tag = 'tr'; - break; - - case 'definitionlistelement': - $items = $child->children; - $newChildren = array(); - foreach( $items as $item ) - { - $def = new DefinitionItemElement(); - $def->key = $item->key; - $item->key = ''; - $newChildren[] = $def; - $newChildren[] = $item; - } -// Html::debug($newChildren,'Children-neu'); - $child->children = $newChildren; - $tag = 'dl'; - break; - - case 'definitionitemelement': - if ( !empty($child->key) ) - { - $tag = 'dt'; - $val = $child->key; - } - else - { - $tag = 'dd'; - } - break; - - case 'tablecellelement': - if ( $child->isHeading ) - $tag = 'th'; else $tag = 'td'; - - if ( $child->rowSpan > 1 ) - $attr['rowspan'] = $child->rowSpan; - if ( $child->colSpan > 1 ) - $attr['colspan'] = $child->colSpan; - break; - - case 'listelement': - $tag = 'ul'; - break; - - case 'teletypeelement': - $tag = 'code'; - break; - - case 'numberedlistelement': - $tag = 'ol'; - break; - - case 'listentryelement': - $tag = 'li'; - break; - - case 'macroelement': - - $className = ucfirst($child->name); - $fileName = './dynamicClasses/'.$className.'.class.php'; - if ( is_file( $fileName ) ) - { - // Fuer den Fall, dass eine Dynamic-Klasse mehrmals pro Vorlage auftritt - if ( !class_exists($className) ) - require( $fileName ); - - if ( class_exists($className) ) - { - $dynEl = new $className; - $dynEl->page = &$this->page; - - if ( method_exists( $dynEl,'execute' ) ) - { - $dynEl->objectid = $this->page->objectid; - $dynEl->page = &$this->page; - - foreach( $child->attributes as $param_name=>$param_value ) - { - if ( isset( $dynEl->$param_name ) ) - $dynEl->$param_name = $param_value; - } - - $dynEl->execute(); - $val = $dynEl->getOutput(); - } - else - { - Logger::warn('element:'.$this->element->name.', '. - 'class:'.$className.', no method: execute()'); - } - } - else - { - Logger::warn('element:'.$this->element->name.', '. - 'class not found:'.$className); - } - } - else - { - Logger::warn('element:'.$this->element->name.', '. - 'file not found:'.$fileName); - } - - // Wenn HTML-Ausgabe, dann Sonderzeichen in HTML �bersetzen - if ( $this->page->mimeType()=='text/html' ) - $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); - - break; - - - default: - - $tag = 'unknown-element'; - $attr['class'] = strtolower(get_class($child)); - break; - } - - $val .= $praefix; - foreach( $child->children as $c ) - { - $val .= $this->renderElement( $c ); - } - - $val .= $suffix; -// echo "text:$val"; - return $this->renderHtmlElement($tag,$val,$empty,$attr); - - } - - - - /** - * Erzeugt ein HTML-Element. - * - * @param String $tag Name des Tags - * @param String $value Inhalt - * @param boolean $empty abk�rzen, wenn Inhalt leer ("<... />") - * @param Array $attr Attribute als Array<String,String> - * @return String - */ - function renderHtmlElement( $tag,$value,$empty,$attr=array() ) - { - global $conf; - if ( $tag == '' ) - return $value; - - $val = '<'.$tag; - foreach( $attr as $attrName=>$attrInhalt ) - { - $val .= ' '.$attrName.'="'.$attrInhalt.'"'; - } - - if ( $value == '' && $empty ) - { - // Inhalt ist leer, also Kurzform verwenden. - // Die Kurzform ist abh�ngig vom Rendermode. - // SGML=<tag> - // XML=<tag /> - if ( $conf['editor']['html']['rendermode'] == 'xml' ) - { - $val .= ' />'; - return $val; - } - else - { - $val .= '>'; - return $val; - } - } - - $val .= '>'.$value.'</'.$tag.'>'; - return $val; - } - - - - /** - * Rendering des Dokumentes.<br> - * - * @return String - */ - function render() - { - $this->renderedText = ''; - $this->footnotes = array(); - - foreach( $this->children as $child ) - $this->renderedText .= $this->renderElement( $child ); - - foreach( $this->footnotes as $child ) - $this->renderedText .= $this->renderElement( $child ); - - return $this->renderedText; - } -} - -?>- \ No newline at end of file diff --git a/textClasses/renderer/font/courier.php b/textClasses/renderer/font/courier.php @@ -1,7 +0,0 @@ -<?php -for($i=0;$i<=255;$i++) - $fpdf_charwidths['courier'][chr($i)]=600; -$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; -$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; -$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; -?> diff --git a/textClasses/renderer/font/helvetica.php b/textClasses/renderer/font/helvetica.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['helvetica']=array( - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> diff --git a/textClasses/renderer/font/helveticab.php b/textClasses/renderer/font/helveticab.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['helveticaB']=array( - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); -?> diff --git a/textClasses/renderer/font/helveticabi.php b/textClasses/renderer/font/helveticabi.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['helveticaBI']=array( - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); -?> diff --git a/textClasses/renderer/font/helveticai.php b/textClasses/renderer/font/helveticai.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['helveticaI']=array( - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> diff --git a/textClasses/renderer/font/readme.txt b/textClasses/renderer/font/readme.txt @@ -1 +0,0 @@ -Font-files for FPDF-Library- \ No newline at end of file diff --git a/textClasses/renderer/font/symbol.php b/textClasses/renderer/font/symbol.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['symbol']=array( - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, - ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, - 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, - 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, - 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, - chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, - chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, - chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, - chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, - chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); -?> diff --git a/textClasses/renderer/font/times.php b/textClasses/renderer/font/times.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['times']=array( - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); -?> diff --git a/textClasses/renderer/font/timesb.php b/textClasses/renderer/font/timesb.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['timesB']=array( - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> diff --git a/textClasses/renderer/font/timesbi.php b/textClasses/renderer/font/timesbi.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['timesBI']=array( - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, - 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, - 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, - 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); -?> diff --git a/textClasses/renderer/font/timesi.php b/textClasses/renderer/font/timesi.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['timesI']=array( - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); -?> diff --git a/textClasses/renderer/font/zapfdingbats.php b/textClasses/renderer/font/zapfdingbats.php @@ -1,15 +0,0 @@ -<?php -$fpdf_charwidths['zapfdingbats']=array( - chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, - chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, - ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, - 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, - 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, - 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, - chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, - chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, - chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, - chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, - chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); -?> diff --git a/textClasses/renderer/fpdf.php b/textClasses/renderer/fpdf.php @@ -1,1725 +0,0 @@ -<?php -/******************************************************************************* - * FPDF * - * * - * Version: 1.6 * - * Date: 2008-08-03 * - * Author: Olivier PLATHEY * - *******************************************************************************/ - -define('FPDF_VERSION','1.6'); - -class FPDF -{ - var $page; //current page numberstrem - var $n; //current object number - var $offsets; //array of object offsets - var $buffer; //buffer holding in-memory PDF - var $pages; //array containing pages - var $state; //current document state - var $compress; //compression flag - var $k; //scale factor (number of points in user unit) - var $DefOrientation; //default orientation - var $CurOrientation; //current orientation - var $PageFormats; //available page formats - var $DefPageFormat; //default page format - var $CurPageFormat; //current page format - var $PageSizes; //array storing non-default page sizes - var $wPt,$hPt; //dimensions of current page in points - var $w,$h; //dimensions of current page in user unit - var $lMargin; //left margin - var $tMargin; //top margin - var $rMargin; //right margin - var $bMargin; //page break margin - var $cMargin; //cell margin - var $x,$y; //current position in user unit - var $lasth; //height of last printed cell - var $LineWidth; //line width in user unit - var $CoreFonts; //array of standard font names - var $fonts; //array of used fonts - var $FontFiles; //array of font files - var $diffs; //array of encoding differences - var $FontFamily; //current font family - var $FontStyle; //current font style - var $underline; //underlining flag - var $CurrentFont; //current font info - var $FontSizePt; //current font size in points - var $FontSize; //current font size in user unit - var $DrawColor; //commands for drawing color - var $FillColor; //commands for filling color - var $TextColor; //commands for text color - var $ColorFlag; //indicates whether fill and text colors are different - var $ws; //word spacing - var $images; //array of used images - var $PageLinks; //array of links in pages - var $links; //array of internal links - var $AutoPageBreak; //automatic page breaking - var $PageBreakTrigger; //threshold used to trigger page breaks - var $InHeader; //flag set when processing header - var $InFooter; //flag set when processing footer - var $ZoomMode; //zoom display mode - var $LayoutMode; //layout display mode - var $title; //title - var $subject; //subject - var $author; //author - var $keywords; //keywords - var $creator; //creator - var $AliasNbPages; //alias for total number of pages - var $PDFVersion; //PDF version number - - /******************************************************************************* - * * - * Public methods * - * * - *******************************************************************************/ - function FPDF($orientation='P', $unit='mm', $format='A4') - { - //Some checks - $this->_dochecks(); - //Initialization of properties - $this->page=0; - $this->n=2; - $this->buffer=''; - $this->pages=array(); - $this->PageSizes=array(); - $this->state=0; - $this->fonts=array(); - $this->FontFiles=array(); - $this->diffs=array(); - $this->images=array(); - $this->links=array(); - $this->InHeader=false; - $this->InFooter=false; - $this->lasth=0; - $this->FontFamily=''; - $this->FontStyle=''; - $this->FontSizePt=12; - $this->underline=false; - $this->DrawColor='0 G'; - $this->FillColor='0 g'; - $this->TextColor='0 g'; - $this->ColorFlag=false; - $this->ws=0; - //Standard fonts - $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', - 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', - 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', - 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); - //Scale factor - if($unit=='pt') - $this->k=1; - elseif($unit=='mm') - $this->k=72/25.4; - elseif($unit=='cm') - $this->k=72/2.54; - elseif($unit=='in') - $this->k=72; - else - $this->Error('Incorrect unit: '.$unit); - //Page format - $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), - 'letter'=>array(612,792), 'legal'=>array(612,1008)); - if(is_string($format)) - $format=$this->_getpageformat($format); - $this->DefPageFormat=$format; - $this->CurPageFormat=$format; - //Page orientation - $orientation=strtolower($orientation); - if($orientation=='p' || $orientation=='portrait') - { - $this->DefOrientation='P'; - $this->w=$this->DefPageFormat[0]; - $this->h=$this->DefPageFormat[1]; - } - elseif($orientation=='l' || $orientation=='landscape') - { - $this->DefOrientation='L'; - $this->w=$this->DefPageFormat[1]; - $this->h=$this->DefPageFormat[0]; - } - else - $this->Error('Incorrect orientation: '.$orientation); - $this->CurOrientation=$this->DefOrientation; - $this->wPt=$this->w*$this->k; - $this->hPt=$this->h*$this->k; - //Page margins (1 cm) - $margin=28.35/$this->k; - $this->SetMargins($margin,$margin); - //Interior cell margin (1 mm) - $this->cMargin=$margin/10; - //Line width (0.2 mm) - $this->LineWidth=.567/$this->k; - //Automatic page break - $this->SetAutoPageBreak(true,2*$margin); - //Full width display mode - $this->SetDisplayMode('fullwidth'); - //Enable compression - $this->SetCompression(true); - //Set default PDF version number - $this->PDFVersion='1.3'; - } - - function SetMargins($left, $top, $right=null) - { - //Set left, top and right margins - $this->lMargin=$left; - $this->tMargin=$top; - if($right===null) - $right=$left; - $this->rMargin=$right; - } - - function SetLeftMargin($margin) - { - //Set left margin - $this->lMargin=$margin; - if($this->page>0 && $this->x<$margin) - $this->x=$margin; - } - - function SetTopMargin($margin) - { - //Set top margin - $this->tMargin=$margin; - } - - function SetRightMargin($margin) - { - //Set right margin - $this->rMargin=$margin; - } - - function SetAutoPageBreak($auto, $margin=0) - { - //Set auto page break mode and triggering margin - $this->AutoPageBreak=$auto; - $this->bMargin=$margin; - $this->PageBreakTrigger=$this->h-$margin; - } - - function SetDisplayMode($zoom, $layout='continuous') - { - //Set display mode in viewer - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) - $this->ZoomMode=$zoom; - else - $this->Error('Incorrect zoom display mode: '.$zoom); - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') - $this->LayoutMode=$layout; - else - $this->Error('Incorrect layout display mode: '.$layout); - } - - function SetCompression($compress) - { - //Set page compression - if(function_exists('gzcompress')) - $this->compress=$compress; - else - $this->compress=false; - } - - function SetTitle($title, $isUTF8=false) - { - //Title of document - if($isUTF8) - $title=$this->_UTF8toUTF16($title); - $this->title=$title; - } - - function SetSubject($subject, $isUTF8=false) - { - //Subject of document - if($isUTF8) - $subject=$this->_UTF8toUTF16($subject); - $this->subject=$subject; - } - - function SetAuthor($author, $isUTF8=false) - { - //Author of document - if($isUTF8) - $author=$this->_UTF8toUTF16($author); - $this->author=$author; - } - - function SetKeywords($keywords, $isUTF8=false) - { - //Keywords of document - if($isUTF8) - $keywords=$this->_UTF8toUTF16($keywords); - $this->keywords=$keywords; - } - - function SetCreator($creator, $isUTF8=false) - { - //Creator of document - if($isUTF8) - $creator=$this->_UTF8toUTF16($creator); - $this->creator=$creator; - } - - function AliasNbPages($alias='{nb}') - { - //Define an alias for total number of pages - $this->AliasNbPages=$alias; - } - - function Error($msg) - { - //Fatal error - die('<b>FPDF error:</b> '.$msg); - } - - function Open() - { - //Begin document - $this->state=1; - } - - function Close() - { - //Terminate document - if($this->state==3) - return; - if($this->page==0) - $this->AddPage(); - //Page footer - $this->InFooter=true; - $this->Footer(); - $this->InFooter=false; - //Close page - $this->_endpage(); - //Close document - $this->_enddoc(); - } - - function AddPage($orientation='', $format='') - { - //Start a new page - if($this->state==0) - $this->Open(); - $family=$this->FontFamily; - $style=$this->FontStyle.($this->underline ? 'U' : ''); - $size=$this->FontSizePt; - $lw=$this->LineWidth; - $dc=$this->DrawColor; - $fc=$this->FillColor; - $tc=$this->TextColor; - $cf=$this->ColorFlag; - if($this->page>0) - { - //Page footer - $this->InFooter=true; - $this->Footer(); - $this->InFooter=false; - //Close page - $this->_endpage(); - } - //Start new page - $this->_beginpage($orientation,$format); - //Set line cap style to square - $this->_out('2 J'); - //Set line width - $this->LineWidth=$lw; - $this->_out(sprintf('%.2F w',$lw*$this->k)); - //Set font - if($family) - $this->SetFont($family,$style,$size); - //Set colors - $this->DrawColor=$dc; - if($dc!='0 G') - $this->_out($dc); - $this->FillColor=$fc; - if($fc!='0 g') - $this->_out($fc); - $this->TextColor=$tc; - $this->ColorFlag=$cf; - //Page header - $this->InHeader=true; - $this->Header(); - $this->InHeader=false; - //Restore line width - if($this->LineWidth!=$lw) - { - $this->LineWidth=$lw; - $this->_out(sprintf('%.2F w',$lw*$this->k)); - } - //Restore font - if($family) - $this->SetFont($family,$style,$size); - //Restore colors - if($this->DrawColor!=$dc) - { - $this->DrawColor=$dc; - $this->_out($dc); - } - if($this->FillColor!=$fc) - { - $this->FillColor=$fc; - $this->_out($fc); - } - $this->TextColor=$tc; - $this->ColorFlag=$cf; - } - - function Header() - { - //To be implemented in your own inherited class - } - - function Footer() - { - //To be implemented in your own inherited class - } - - function PageNo() - { - //Get current page number - return $this->page; - } - - function SetDrawColor($r, $g=null, $b=null) - { - //Set color for all stroking operations - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->DrawColor=sprintf('%.3F G',$r/255); - else - $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); - if($this->page>0) - $this->_out($this->DrawColor); - } - - function SetFillColor($r, $g=null, $b=null) - { - //Set color for all filling operations - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->FillColor=sprintf('%.3F g',$r/255); - else - $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); - $this->ColorFlag=($this->FillColor!=$this->TextColor); - if($this->page>0) - $this->_out($this->FillColor); - } - - function SetTextColor($r, $g=null, $b=null) - { - //Set color for text - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->TextColor=sprintf('%.3F g',$r/255); - else - $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); - $this->ColorFlag=($this->FillColor!=$this->TextColor); - } - - function GetStringWidth($s) - { - //Get width of a string in the current font - $s=(string)$s; - $cw=&$this->CurrentFont['cw']; - $w=0; - $l=strlen($s); - for($i=0;$i<$l;$i++) - $w+=$cw[$s[$i]]; - return $w*$this->FontSize/1000; - } - - function SetLineWidth($width) - { - //Set line width - $this->LineWidth=$width; - if($this->page>0) - $this->_out(sprintf('%.2F w',$width*$this->k)); - } - - function Line($x1, $y1, $x2, $y2) - { - //Draw a line - $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); - } - - function Rect($x, $y, $w, $h, $style='') - { - //Draw a rectangle - if($style=='F') - $op='f'; - elseif($style=='FD' || $style=='DF') - $op='B'; - else - $op='S'; - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); - } - - function AddFont($family, $style='', $file='') - { - //Add a TrueType or Type1 font - $family=strtolower($family); - if($file=='') - $file=str_replace(' ','',$family).strtolower($style).'.php'; - if($family=='arial') - $family='helvetica'; - $style=strtoupper($style); - if($style=='IB') - $style='BI'; - $fontkey=$family.$style; - if(isset($this->fonts[$fontkey])) - return; - include($this->_getfontpath().$file); - if(!isset($name)) - $this->Error('Could not include font definition file'); - $i=count($this->fonts)+1; - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); - if($diff) - { - //Search existing encodings - $d=0; - $nb=count($this->diffs); - for($i=1;$i<=$nb;$i++) - { - if($this->diffs[$i]==$diff) - { - $d=$i; - break; - } - } - if($d==0) - { - $d=$nb+1; - $this->diffs[$d]=$diff; - } - $this->fonts[$fontkey]['diff']=$d; - } - if($file) - { - if($type=='TrueType') - $this->FontFiles[$file]=array('length1'=>$originalsize); - else - $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); - } - } - - function SetFont($family, $style='', $size=0) - { - //Select a font; size given in points - global $fpdf_charwidths; - - $family=strtolower($family); - if($family=='') - $family=$this->FontFamily; - if($family=='arial') - $family='helvetica'; - elseif($family=='symbol' || $family=='zapfdingbats') - $style=''; - $style=strtoupper($style); - if(strpos($style,'U')!==false) - { - $this->underline=true; - $style=str_replace('U','',$style); - } - else - $this->underline=false; - if($style=='IB') - $style='BI'; - if($size==0) - $size=$this->FontSizePt; - //Test if font is already selected - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) - return; - //Test if used for the first time - $fontkey=$family.$style; - if(!isset($this->fonts[$fontkey])) - { - //Check if one of the standard fonts - if(isset($this->CoreFonts[$fontkey])) - { - if(!isset($fpdf_charwidths[$fontkey])) - { - //Load metric file - $file=$family; - if($family=='times' || $family=='helvetica') - $file.=strtolower($style); - include($this->_getfontpath().$file.'.php'); - if(!isset($fpdf_charwidths[$fontkey])) - $this->Error('Could not include font metric file'); - } - $i=count($this->fonts)+1; - $name=$this->CoreFonts[$fontkey]; - $cw=$fpdf_charwidths[$fontkey]; - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); - } - else - $this->Error('Undefined font: '.$family.' '.$style); - } - //Select it - $this->FontFamily=$family; - $this->FontStyle=$style; - $this->FontSizePt=$size; - $this->FontSize=$size/$this->k; - $this->CurrentFont=&$this->fonts[$fontkey]; - if($this->page>0) - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); - } - - function SetFontSize($size) - { - //Set font size in points - if($this->FontSizePt==$size) - return; - $this->FontSizePt=$size; - $this->FontSize=$size/$this->k; - if($this->page>0) - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); - } - - function AddLink() - { - //Create a new internal link - $n=count($this->links)+1; - $this->links[$n]=array(0, 0); - return $n; - } - - function SetLink($link, $y=0, $page=-1) - { - //Set destination of internal link - if($y==-1) - $y=$this->y; - if($page==-1) - $page=$this->page; - $this->links[$link]=array($page, $y); - } - - function Link($x, $y, $w, $h, $link) - { - //Put a link on the page - $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); - } - - function Text($x, $y, $txt) - { - //Output a string - $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); - if($this->underline && $txt!='') - $s.=' '.$this->_dounderline($x,$y,$txt); - if($this->ColorFlag) - $s='q '.$this->TextColor.' '.$s.' Q'; - $this->_out($s); - } - - function AcceptPageBreak() - { - //Accept automatic page break or not - return $this->AutoPageBreak; - } - - function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') - { - //Output a cell - $k=$this->k; - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x=$this->x; - $ws=$this->ws; - if($ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x; - if($ws>0) - { - $this->ws=$ws; - $this->_out(sprintf('%.3F Tw',$ws*$k)); - } - } - if($w==0) - $w=$this->w-$this->rMargin-$this->x; - $s=''; - if($fill || $border==1) - { - if($fill) - $op=($border==1) ? 'B' : 'f'; - else - $op='S'; - $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); - } - if(is_string($border)) - { - $x=$this->x; - $y=$this->y; - if(strpos($border,'L')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); - if(strpos($border,'T')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); - if(strpos($border,'R')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - if(strpos($border,'B')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - } - if($txt!=='') - { - if($align=='R') - $dx=$w-$this->cMargin-$this->GetStringWidth($txt); - elseif($align=='C') - $dx=($w-$this->GetStringWidth($txt))/2; - else - $dx=$this->cMargin; - if($this->ColorFlag) - $s.='q '.$this->TextColor.' '; - $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); - $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); - if($this->underline) - $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); - if($this->ColorFlag) - $s.=' Q'; - if($link) - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); - } - if($s) - $this->_out($s); - $this->lasth=$h; - if($ln>0) - { - //Go to next line - $this->y+=$h; - if($ln==1) - $this->x=$this->lMargin; - } - else - $this->x+=$w; - } - - function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) - { - //Output text with automatic or explicit line breaks - $cw=&$this->CurrentFont['cw']; - if($w==0) - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); - $nb=strlen($s); - if($nb>0 && $s[$nb-1]=="\n") - $nb--; - $b=0; - if($border) - { - if($border==1) - { - $border='LTRB'; - $b='LRT'; - $b2='LR'; - } - else - { - $b2=''; - if(strpos($border,'L')!==false) - $b2.='L'; - if(strpos($border,'R')!==false) - $b2.='R'; - $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; - } - } - $sep=-1; - $i=0; - $j=0; - $l=0; - $ns=0; - $nl=1; - while($i<$nb) - { - //Get next character - $c=$s[$i]; - if($c=="\n") - { - //Explicit line break - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - $i++; - $sep=-1; - $j=$i; - $l=0; - $ns=0; - $nl++; - if($border && $nl==2) - $b=$b2; - continue; - } - if($c==' ') - { - $sep=$i; - $ls=$l; - $ns++; - } - $l+=$cw[$c]; - if($l>$wmax) - { - //Automatic line break - if($sep==-1) - { - if($i==$j) - $i++; - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - } - else - { - if($align=='J') - { - $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; - $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); - } - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); - $i=$sep+1; - } - $sep=-1; - $j=$i; - $l=0; - $ns=0; - $nl++; - if($border && $nl==2) - $b=$b2; - } - else - $i++; - } - //Last chunk - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - if($border && strpos($border,'B')!==false) - $b.='B'; - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - $this->x=$this->lMargin; - } - - function Write($h, $txt, $link='') - { - //Output text in flowing mode - $cw=&$this->CurrentFont['cw']; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); - $nb=strlen($s); - $sep=-1; - $i=0; - $j=0; - $l=0; - $nl=1; - while($i<$nb) - { - //Get next character - $c=$s[$i]; - if($c=="\n") - { - //Explicit line break - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); - $i++; - $sep=-1; - $j=$i; - $l=0; - if($nl==1) - { - $this->x=$this->lMargin; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - } - $nl++; - continue; - } - if($c==' ') - $sep=$i; - $l+=$cw[$c]; - if($l>$wmax) - { - //Automatic line break - if($sep==-1) - { - if($this->x>$this->lMargin) - { - //Move to next line - $this->x=$this->lMargin; - $this->y+=$h; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $i++; - $nl++; - continue; - } - if($i==$j) - $i++; - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); - } - else - { - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); - $i=$sep+1; - } - $sep=-1; - $j=$i; - $l=0; - if($nl==1) - { - $this->x=$this->lMargin; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - } - $nl++; - } - else - $i++; - } - //Last chunk - if($i!=$j) - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); - } - - function Ln($h=null) - { - //Line feed; default value is last cell height - $this->x=$this->lMargin; - if($h===null) - $this->y+=$this->lasth; - else - $this->y+=$h; - } - - function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') - { - //Put an image on the page - if(!isset($this->images[$file])) - { - //First use of this image, get info - if($type=='') - { - $pos=strrpos($file,'.'); - if(!$pos) - $this->Error('Image file has no extension and no type was specified: '.$file); - $type=substr($file,$pos+1); - } - $type=strtolower($type); - if($type=='jpeg') - $type='jpg'; - $mtd='_parse'.$type; - if(!method_exists($this,$mtd)) - $this->Error('Unsupported image type: '.$type); - $info=$this->$mtd($file); - $info['i']=count($this->images)+1; - $this->images[$file]=$info; - } - else - $info=$this->images[$file]; - //Automatic width and height calculation if needed - if($w==0 && $h==0) - { - //Put image at 72 dpi - $w=$info['w']/$this->k; - $h=$info['h']/$this->k; - } - elseif($w==0) - $w=$h*$info['w']/$info['h']; - elseif($h==0) - $h=$w*$info['h']/$info['w']; - //Flowing mode - if($y===null) - { - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x2=$this->x; - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x2; - } - $y=$this->y; - $this->y+=$h; - } - if($x===null) - $x=$this->x; - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); - if($link) - $this->Link($x,$y,$w,$h,$link); - } - - function GetX() - { - //Get x position - return $this->x; - } - - function SetX($x) - { - //Set x position - if($x>=0) - $this->x=$x; - else - $this->x=$this->w+$x; - } - - function GetY() - { - //Get y position - return $this->y; - } - - function SetY($y) - { - //Set y position and reset x - $this->x=$this->lMargin; - if($y>=0) - $this->y=$y; - else - $this->y=$this->h+$y; - } - - function SetXY($x, $y) - { - //Set x and y positions - $this->SetY($y); - $this->SetX($x); - } - - function Output($name='', $dest='') - { - //Output PDF to some destination - if($this->state<3) - $this->Close(); - $dest=strtoupper($dest); - if($dest=='') - { - if($name=='') - { - $name='doc.pdf'; - $dest='I'; - } - else - $dest='F'; - } - switch($dest) - { - case 'I': - //Send to standard output - if(ob_get_length()) - $this->Error('Some data has already been output, can\'t send PDF file'); - if(php_sapi_name()!='cli') - { - //We send to a browser - header('Content-Type: application/pdf'); - if(headers_sent()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Length: '.strlen($this->buffer)); - header('Content-Disposition: inline; filename="'.$name.'"'); - header('Cache-Control: private, max-age=0, must-revalidate'); - header('Pragma: public'); - ini_set('zlib.output_compression','0'); - } - echo $this->buffer; - break; - case 'D': - //Download file - if(ob_get_length()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Type: application/x-download'); - if(headers_sent()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Length: '.strlen($this->buffer)); - header('Content-Disposition: attachment; filename="'.$name.'"'); - header('Cache-Control: private, max-age=0, must-revalidate'); - header('Pragma: public'); - ini_set('zlib.output_compression','0'); - echo $this->buffer; - break; - case 'F': - //Save to local file - $f=fopen($name,'wb'); - if(!$f) - $this->Error('Unable to create output file: '.$name); - fwrite($f,$this->buffer,strlen($this->buffer)); - fclose($f); - break; - case 'S': - //Return as a string - return $this->buffer; - default: - $this->Error('Incorrect output destination: '.$dest); - } - return ''; - } - - /******************************************************************************* - * * - * Protected methods * - * * - *******************************************************************************/ - function _dochecks() - { - //Check availability of %F - if(sprintf('%.1F',1.0)!='1.0') - $this->Error('This version of PHP is not supported'); - //Check mbstring overloading - if(ini_get('mbstring.func_overload') & 2) - $this->Error('mbstring overloading must be disabled'); - //Disable runtime magic quotes - if(get_magic_quotes_runtime()) - @set_magic_quotes_runtime(0); - } - - function _getpageformat($format) - { - $format=strtolower($format); - if(!isset($this->PageFormats[$format])) - $this->Error('Unknown page format: '.$format); - $a=$this->PageFormats[$format]; - return array($a[0]/$this->k, $a[1]/$this->k); - } - - function _getfontpath() - { - if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) - define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); - return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; - } - - function _beginpage($orientation, $format) - { - $this->page++; - $this->pages[$this->page]=''; - $this->state=2; - $this->x=$this->lMargin; - $this->y=$this->tMargin; - $this->FontFamily=''; - //Check page size - if($orientation=='') - $orientation=$this->DefOrientation; - else - $orientation=strtoupper($orientation[0]); - if($format=='') - $format=$this->DefPageFormat; - else - { - if(is_string($format)) - $format=$this->_getpageformat($format); - } - if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) - { - //New size - if($orientation=='P') - { - $this->w=$format[0]; - $this->h=$format[1]; - } - else - { - $this->w=$format[1]; - $this->h=$format[0]; - } - $this->wPt=$this->w*$this->k; - $this->hPt=$this->h*$this->k; - $this->PageBreakTrigger=$this->h-$this->bMargin; - $this->CurOrientation=$orientation; - $this->CurPageFormat=$format; - } - if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) - $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); - } - - function _endpage() - { - $this->state=1; - } - - function _escape($s) - { - //Escape special characters in strings - $s=str_replace('\\','\\\\',$s); - $s=str_replace('(','\\(',$s); - $s=str_replace(')','\\)',$s); - $s=str_replace("\r",'\\r',$s); - return $s; - } - - function _textstring($s) - { - //Format a text string - return '('.$this->_escape($s).')'; - } - - function _UTF8toUTF16($s) - { - //Convert UTF-8 to UTF-16BE with BOM - $res="\xFE\xFF"; - $nb=strlen($s); - $i=0; - while($i<$nb) - { - $c1=ord($s[$i++]); - if($c1>=224) - { - //3-byte character - $c2=ord($s[$i++]); - $c3=ord($s[$i++]); - $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); - $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); - } - elseif($c1>=192) - { - //2-byte character - $c2=ord($s[$i++]); - $res.=chr(($c1 & 0x1C)>>2); - $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); - } - else - { - //Single-byte character - $res.="\0".chr($c1); - } - } - return $res; - } - - function _dounderline($x, $y, $txt) - { - //Underline text - $up=$this->CurrentFont['up']; - $ut=$this->CurrentFont['ut']; - $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); - return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); - } - - function _parsejpg($file) - { - //Extract info from a JPEG file - $a=GetImageSize($file); - if(!$a) - $this->Error('Missing or incorrect image file: '.$file); - if($a[2]!=2) - $this->Error('Not a JPEG file: '.$file); - if(!isset($a['channels']) || $a['channels']==3) - $colspace='DeviceRGB'; - elseif($a['channels']==4) - $colspace='DeviceCMYK'; - else - $colspace='DeviceGray'; - $bpc=isset($a['bits']) ? $a['bits'] : 8; - //Read whole file - $f=fopen($file,'rb'); - $data=''; - while(!feof($f)) - $data.=fread($f,8192); - fclose($f); - return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); - } - - function _parsepng($file) - { - //Extract info from a PNG file - $f=fopen($file,'rb'); - if(!$f) - $this->Error('Can\'t open image file: '.$file); - //Check signature - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) - $this->Error('Not a PNG file: '.$file); - //Read header chunk - $this->_readstream($f,4); - if($this->_readstream($f,4)!='IHDR') - $this->Error('Incorrect PNG file: '.$file); - $w=$this->_readint($f); - $h=$this->_readint($f); - $bpc=ord($this->_readstream($f,1)); - if($bpc>8) - $this->Error('16-bit depth not supported: '.$file); - $ct=ord($this->_readstream($f,1)); - if($ct==0) - $colspace='DeviceGray'; - elseif($ct==2) - $colspace='DeviceRGB'; - elseif($ct==3) - $colspace='Indexed'; - else - $this->Error('Alpha channel not supported: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Unknown compression method: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Unknown filter method: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Interlacing not supported: '.$file); - $this->_readstream($f,4); - $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; - //Scan chunks looking for palette, transparency and image data - $pal=''; - $trns=''; - $data=''; - do - { - $n=$this->_readint($f); - $type=$this->_readstream($f,4); - if($type=='PLTE') - { - //Read palette - $pal=$this->_readstream($f,$n); - $this->_readstream($f,4); - } - elseif($type=='tRNS') - { - //Read transparency info - $t=$this->_readstream($f,$n); - if($ct==0) - $trns=array(ord(substr($t,1,1))); - elseif($ct==2) - $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); - else - { - $pos=strpos($t,chr(0)); - if($pos!==false) - $trns=array($pos); - } - $this->_readstream($f,4); - } - elseif($type=='IDAT') - { - //Read image data block - $data.=$this->_readstream($f,$n); - $this->_readstream($f,4); - } - elseif($type=='IEND') - break; - else - $this->_readstream($f,$n+4); - } - while($n); - if($colspace=='Indexed' && empty($pal)) - $this->Error('Missing palette in '.$file); - fclose($f); - return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); - } - - function _readstream($f, $n) - { - //Read n bytes from stream - $res=''; - while($n>0 && !feof($f)) - { - $s=fread($f,$n); - if($s===false) - $this->Error('Error while reading stream'); - $n-=strlen($s); - $res.=$s; - } - if($n>0) - $this->Error('Unexpected end of stream'); - return $res; - } - - function _readint($f) - { - //Read a 4-byte integer from stream - $a=unpack('Ni',$this->_readstream($f,4)); - return $a['i']; - } - - function _parsegif($file) - { - //Extract info from a GIF file (via PNG conversion) - if(!function_exists('imagepng')) - $this->Error('GD extension is required for GIF support'); - if(!function_exists('imagecreatefromgif')) - $this->Error('GD has no GIF read support'); - $im=imagecreatefromgif($file); - if(!$im) - $this->Error('Missing or incorrect image file: '.$file); - imageinterlace($im,0); - $tmp=tempnam('.','gif'); - if(!$tmp) - $this->Error('Unable to create a temporary file'); - if(!imagepng($im,$tmp)) - $this->Error('Error while saving to temporary file'); - imagedestroy($im); - $info=$this->_parsepng($tmp); - unlink($tmp); - return $info; - } - - function _newobj() - { - //Begin a new object - $this->n++; - $this->offsets[$this->n]=strlen($this->buffer); - $this->_out($this->n.' 0 obj'); - } - - function _putstream($s) - { - $this->_out('stream'); - $this->_out($s); - $this->_out('endstream'); - } - - function _out($s) - { - //Add a line to the document - if($this->state==2) - $this->pages[$this->page].=$s."\n"; - else - $this->buffer.=$s."\n"; - } - - function _putpages() - { - $nb=$this->page; - if(!empty($this->AliasNbPages)) - { - //Replace number of pages - for($n=1;$n<=$nb;$n++) - $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); - } - if($this->DefOrientation=='P') - { - $wPt=$this->DefPageFormat[0]*$this->k; - $hPt=$this->DefPageFormat[1]*$this->k; - } - else - { - $wPt=$this->DefPageFormat[1]*$this->k; - $hPt=$this->DefPageFormat[0]*$this->k; - } - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - for($n=1;$n<=$nb;$n++) - { - //Page - $this->_newobj(); - $this->_out('<</Type /Page'); - $this->_out('/Parent 1 0 R'); - if(isset($this->PageSizes[$n])) - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); - $this->_out('/Resources 2 0 R'); - if(isset($this->PageLinks[$n])) - { - //Links - $annots='/Annots ['; - foreach($this->PageLinks[$n] as $pl) - { - $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; - if(is_string($pl[4])) - $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; - else - { - $l=$this->links[$pl[4]]; - $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; - $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); - } - } - $this->_out($annots.']'); - } - $this->_out('/Contents '.($this->n+1).' 0 R>>'); - $this->_out('endobj'); - //Page content - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; - $this->_newobj(); - $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); - $this->_putstream($p); - $this->_out('endobj'); - } - //Pages root - $this->offsets[1]=strlen($this->buffer); - $this->_out('1 0 obj'); - $this->_out('<</Type /Pages'); - $kids='/Kids ['; - for($i=0;$i<$nb;$i++) - $kids.=(3+2*$i).' 0 R '; - $this->_out($kids.']'); - $this->_out('/Count '.$nb); - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); - $this->_out('>>'); - $this->_out('endobj'); - } - - function _putfonts() - { - $nf=$this->n; - foreach($this->diffs as $diff) - { - //Encodings - $this->_newobj(); - $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); - $this->_out('endobj'); - } - foreach($this->FontFiles as $file=>$info) - { - //Font file embedding - $this->_newobj(); - $this->FontFiles[$file]['n']=$this->n; - $font=''; - $f=fopen($this->_getfontpath().$file,'rb',1); - if(!$f) - $this->Error('Font file not found'); - while(!feof($f)) - $font.=fread($f,8192); - fclose($f); - $compressed=(substr($file,-2)=='.z'); - if(!$compressed && isset($info['length2'])) - { - $header=(ord($font[0])==128); - if($header) - { - //Strip first binary header - $font=substr($font,6); - } - if($header && ord($font[$info['length1']])==128) - { - //Strip second binary header - $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); - } - } - $this->_out('<</Length '.strlen($font)); - if($compressed) - $this->_out('/Filter /FlateDecode'); - $this->_out('/Length1 '.$info['length1']); - if(isset($info['length2'])) - $this->_out('/Length2 '.$info['length2'].' /Length3 0'); - $this->_out('>>'); - $this->_putstream($font); - $this->_out('endobj'); - } - foreach($this->fonts as $k=>$font) - { - //Font objects - $this->fonts[$k]['n']=$this->n+1; - $type=$font['type']; - $name=$font['name']; - if($type=='core') - { - //Standard font - $this->_newobj(); - $this->_out('<</Type /Font'); - $this->_out('/BaseFont /'.$name); - $this->_out('/Subtype /Type1'); - if($name!='Symbol' && $name!='ZapfDingbats') - $this->_out('/Encoding /WinAnsiEncoding'); - $this->_out('>>'); - $this->_out('endobj'); - } - elseif($type=='Type1' || $type=='TrueType') - { - //Additional Type1 or TrueType font - $this->_newobj(); - $this->_out('<</Type /Font'); - $this->_out('/BaseFont /'.$name); - $this->_out('/Subtype /'.$type); - $this->_out('/FirstChar 32 /LastChar 255'); - $this->_out('/Widths '.($this->n+1).' 0 R'); - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); - if($font['enc']) - { - if(isset($font['diff'])) - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); - else - $this->_out('/Encoding /WinAnsiEncoding'); - } - $this->_out('>>'); - $this->_out('endobj'); - //Widths - $this->_newobj(); - $cw=&$font['cw']; - $s='['; - for($i=32;$i<=255;$i++) - $s.=$cw[chr($i)].' '; - $this->_out($s.']'); - $this->_out('endobj'); - //Descriptor - $this->_newobj(); - $s='<</Type /FontDescriptor /FontName /'.$name; - foreach($font['desc'] as $k=>$v) - $s.=' /'.$k.' '.$v; - $file=$font['file']; - if($file) - $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; - $this->_out($s.'>>'); - $this->_out('endobj'); - } - else - { - //Allow for additional types - $mtd='_put'.strtolower($type); - if(!method_exists($this,$mtd)) - $this->Error('Unsupported font type: '.$type); - $this->$mtd($font); - } - } - } - - function _putimages() - { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->images); - while(list($file,$info)=each($this->images)) - { - $this->_newobj(); - $this->images[$file]['n']=$this->n; - $this->_out('<</Type /XObject'); - $this->_out('/Subtype /Image'); - $this->_out('/Width '.$info['w']); - $this->_out('/Height '.$info['h']); - if($info['cs']=='Indexed') - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); - else - { - $this->_out('/ColorSpace /'.$info['cs']); - if($info['cs']=='DeviceCMYK') - $this->_out('/Decode [1 0 1 0 1 0 1 0]'); - } - $this->_out('/BitsPerComponent '.$info['bpc']); - if(isset($info['f'])) - $this->_out('/Filter /'.$info['f']); - if(isset($info['parms'])) - $this->_out($info['parms']); - if(isset($info['trns']) && is_array($info['trns'])) - { - $trns=''; - for($i=0;$i<count($info['trns']);$i++) - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; - $this->_out('/Mask ['.$trns.']'); - } - $this->_out('/Length '.strlen($info['data']).'>>'); - $this->_putstream($info['data']); - unset($this->images[$file]['data']); - $this->_out('endobj'); - //Palette - if($info['cs']=='Indexed') - { - $this->_newobj(); - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; - $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); - $this->_putstream($pal); - $this->_out('endobj'); - } - } - } - - function _putxobjectdict() - { - foreach($this->images as $image) - $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); - } - - function _putresourcedict() - { - $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); - $this->_out('/Font <<'); - foreach($this->fonts as $font) - $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); - $this->_out('>>'); - $this->_out('/XObject <<'); - $this->_putxobjectdict(); - $this->_out('>>'); - } - - function _putresources() - { - $this->_putfonts(); - $this->_putimages(); - //Resource dictionary - $this->offsets[2]=strlen($this->buffer); - $this->_out('2 0 obj'); - $this->_out('<<'); - $this->_putresourcedict(); - $this->_out('>>'); - $this->_out('endobj'); - } - - function _putinfo() - { - $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); - if(!empty($this->title)) - $this->_out('/Title '.$this->_textstring($this->title)); - if(!empty($this->subject)) - $this->_out('/Subject '.$this->_textstring($this->subject)); - if(!empty($this->author)) - $this->_out('/Author '.$this->_textstring($this->author)); - if(!empty($this->keywords)) - $this->_out('/Keywords '.$this->_textstring($this->keywords)); - if(!empty($this->creator)) - $this->_out('/Creator '.$this->_textstring($this->creator)); - $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); - } - - function _putcatalog() - { - $this->_out('/Type /Catalog'); - $this->_out('/Pages 1 0 R'); - if($this->ZoomMode=='fullpage') - $this->_out('/OpenAction [3 0 R /Fit]'); - elseif($this->ZoomMode=='fullwidth') - $this->_out('/OpenAction [3 0 R /FitH null]'); - elseif($this->ZoomMode=='real') - $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); - elseif(!is_string($this->ZoomMode)) - $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); - if($this->LayoutMode=='single') - $this->_out('/PageLayout /SinglePage'); - elseif($this->LayoutMode=='continuous') - $this->_out('/PageLayout /OneColumn'); - elseif($this->LayoutMode=='two') - $this->_out('/PageLayout /TwoColumnLeft'); - } - - function _putheader() - { - $this->_out('%PDF-'.$this->PDFVersion); - } - - function _puttrailer() - { - $this->_out('/Size '.($this->n+1)); - $this->_out('/Root '.$this->n.' 0 R'); - $this->_out('/Info '.($this->n-1).' 0 R'); - } - - function _enddoc() - { - $this->_putheader(); - $this->_putpages(); - $this->_putresources(); - //Info - $this->_newobj(); - $this->_out('<<'); - $this->_putinfo(); - $this->_out('>>'); - $this->_out('endobj'); - //Catalog - $this->_newobj(); - $this->_out('<<'); - $this->_putcatalog(); - $this->_out('>>'); - $this->_out('endobj'); - //Cross-ref - $o=strlen($this->buffer); - $this->_out('xref'); - $this->_out('0 '.($this->n+1)); - $this->_out('0000000000 65535 f '); - for($i=1;$i<=$this->n;$i++) - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); - //Trailer - $this->_out('trailer'); - $this->_out('<<'); - $this->_puttrailer(); - $this->_out('>>'); - $this->_out('startxref'); - $this->_out($o); - $this->_out('%%EOF'); - $this->state=3; - } - //End of class -} - -?>