home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / ParserPDF.inc < prev    next >
Encoding:
Text File  |  2004-03-24  |  21.7 KB  |  545 lines

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | phpDocumentor                                                          |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2000-2003 Joshua Eichorn, Gregory Beaver                 |
  7. // | Email         jeichorn@phpdoc.org, cellog@phpdoc.org                   |
  8. // | Web           http://www.phpdoc.org                                    |
  9. // | Mirror        http://phpdocu.sourceforge.net/                          |
  10. // | PEAR          http://pear.php.net/package-info.php?pacid=137           |
  11. // +------------------------------------------------------------------------+
  12. // | This source file is subject to version 3.00 of the PHP License,        |
  13. // | that is available at http://www.php.net/license/3_0.txt.               |
  14. // | If you did not receive a copy of the PHP license and are unable to     |
  15. // | obtain it through the world-wide-web, please send a note to            |
  16. // | license@php.net so we can mail you a copy immediately.                 |
  17. // +------------------------------------------------------------------------+
  18. //
  19. /**
  20.  * This class handles the XML-based CezPDF markup language created to allow
  21.  * templates for the PDFdefaultConverter
  22.  * @package Converters
  23.  * @subpackage PDFdefault
  24.  * @author Greg Beaver <cellog@users.sourceforge.net>
  25.  * @since 1.2
  26.  */
  27. /** when <text> is found in an ezText input */
  28. define('PHPDOCUMENTOR_PDF_EVENT_TEXT', 600);
  29. /** when <text> is found in an ezText input */
  30. define('PHPDOCUMENTOR_PDF_STATE_TEXT', 700);
  31. /** used for parsing stuff between <text> */
  32. define('PHPDOCUMENTOR_PDF_EVENT_CONTENT', 601);
  33. /** used for parsing stuff between <text> */
  34. define('PHPDOCUMENTOR_PDF_STATE_CONTENT', 701);
  35. /** when <font> is found in an ezText input */
  36. define('PHPDOCUMENTOR_PDF_EVENT_FONT', 602);
  37. /** when <font> is found in an ezText input */
  38. define('PHPDOCUMENTOR_PDF_STATE_FONT', 702);
  39. /** when <newpage/> is found in an ezText input */
  40. define('PHPDOCUMENTOR_PDF_EVENT_NEWPAGE', 603);
  41. /** when <newpage/> is found in an ezText input */
  42. define('PHPDOCUMENTOR_PDF_STATE_NEWPAGE', 703);
  43. /** when <pdffunction> is found in an ezText input */
  44. define('PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION', 604);
  45. /** when <pdffunction> is found in an ezText input */
  46. define('PHPDOCUMENTOR_PDF_STATE_PDFFUNCTION', 704);
  47.  
  48.  
  49. /**
  50.  * @package Converters
  51.  * @subpackage PDFdefault
  52.  * @author Greg Beaver <cellog@users.sourceforge.net>
  53.  * @since 1.2
  54.  */
  55. class PDFParser extends Parser
  56. {
  57.     /**
  58.      * Mapping of event constants to events handler function names
  59.      * @var array
  60.      * @access private
  61.      */
  62.     var $eventHandlers
  63.         = array(
  64.             PHPDOCUMENTOR_PDF_EVENT_TEXT => 'handleText',
  65.             PHPDOCUMENTOR_PDF_EVENT_FONT => 'handleFont',
  66.             PHPDOCUMENTOR_PDF_EVENT_NEWPAGE => 'handleNewPage',
  67.             PARSER_EVENT_QUOTE => 'handleQuote',
  68.             PARSER_EVENT_NOEVENTS => 'defaultHandler',
  69.             PHPDOCUMENTOR_PDF_EVENT_CONTENT => 'handleContent',
  70.             PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION => 'handlePDFfunction',
  71.             );
  72.     
  73.     /**
  74.      * Sets up the wordparser for this class
  75.      */
  76.     function PDFParser()
  77.     {
  78.         $this->wp = new WordParser;
  79.         $this->setupStates();
  80.     }
  81.     /**
  82.      * Parse text for PDFParser XML tags, and add the text to the PDF file
  83.      *
  84.      * @param    string text to parse for PDFParser XML tags
  85.      * @param    string full path to the font directory
  86.      * @param    phpdocpdf
  87.      * @param    boolean determines whether output is saved in a variable or
  88.      *                   added directly to the output
  89.      * @staticvar    integer    used for recursion limiting if a handler for an event is not found
  90.      * @return    bool
  91.      */
  92.     function parse ($parse_data,$fontdir,&$pdf,$debug=false)
  93.     {
  94.         static $endrecur = 0;
  95.         $this->_debug = $debug;
  96.  
  97.         // initialize variables so E_ALL error_reporting doesn't complain
  98.         $pevent = 0;
  99.         $word = 0;
  100.         $this->p_vars['event_stack'] = new EventStack;
  101.         $this->p_flags['reset_quote_data'] = true;
  102.         $this->p_vars['options'] = false;
  103.         $this->p_vars['font_dir'] = $fontdir;
  104.         $this->p_vars['text_size'] = false;
  105.         $this->p_vars['pdf'] = &$pdf;
  106.  
  107.         $this->wp->setup($parse_data);
  108.         $this->wp->setWhitespace(true);
  109.  
  110.         do
  111.         {
  112.             $lpevent = $pevent;
  113.             $pevent = $this->p_vars['event_stack']->getEvent();
  114.             if ($lpevent != $pevent)
  115.             {
  116.                 $this->p_vars['last_pevent'] = $lpevent;
  117.             }
  118.  
  119.             if ($this->p_vars['last_pevent'] != $pevent)
  120.             {
  121.                 // its a new event so the word parser needs to be reconfigured 
  122.                 $this->configWordParser($pevent);
  123.             }
  124.  
  125.  
  126.             $this->p_vars['last_word'] = $word;
  127.             $word = $this->wp->getWord();
  128.  
  129.             if (0)//PHPDOCUMENTOR_DEBUG == true)
  130.             {
  131.                 echo "----------------\n";
  132.                 echo "LAST: |" . $this->p_vars['last_word'] . "|\n";
  133. //                echo "INDEX: ".$this->p_vars['curpar']."\n";
  134.                 echo "PEVENT: " . $this->getParserEventName($pevent) . "\n";
  135.                 echo "LASTPEVENT: " . $this->getParserEventName($this->p_vars['last_pevent']) . "\n";
  136.                 echo $this->wp->getPos() . " WORD: |".$word."|\n\n";
  137.             }
  138.             if (isset($this->eventHandlers[$pevent]))
  139.             {
  140.                 $handle = $this->eventHandlers[$pevent];
  141.                 $this->$handle($word, $pevent);
  142.             } else
  143.             {
  144.                 debug('WARNING: possible error, no ParserPDFParser handler for event number '.$pevent);
  145.                 if ($endrecur++ == 25)
  146.                 {
  147.                     die("FATAL ERROR, recursion limit reached");
  148.                 }
  149.             }
  150.         } while (!($word === false));
  151.         if (false) {
  152.             $fp = fopen("C:/Documents and Settings/Owner/Desktop/pdfsource.txt", "a");
  153.             fwrite($fp, $this->wp->data);
  154.             fclose($fp);
  155.         }
  156.     }
  157.     
  158.     /**#@+
  159.      * Event Handlers
  160.      * @param string token
  161.      * @param integer event constant
  162.      * @access private
  163.      */
  164.     function defaultHandler($word, $pevent)
  165.     {
  166.         if ($this->checkEventPush($word, $pevent)) return;
  167.     }
  168.     
  169.     /**
  170.      * Handles <newpage />
  171.      * @tutorial ParserPDF.cls#tags.newpage
  172.      */
  173.     function handleNewPage($word, $pevent)
  174.     {
  175.         $this->p_vars['event_stack']->popEvent();
  176.         $this->p_vars['pdf']->ezNewPage($this->_debug);
  177.     }
  178.     
  179.     /**
  180.      * Handles <text></text>
  181.      * @tutorial ParserPDF.cls#tags.text
  182.      */
  183.     function handleText($word, $pevent)
  184.     {
  185.         $e = $this->checkEventPush($word, $pevent);
  186.         $e1 = $this->checkEventPop($word, $pevent);
  187.         if ($e == PARSER_EVENT_QUOTE) return;
  188.         if ($e1)
  189.         {
  190.             $this->p_flags['textcolor'] = false;
  191.             if (($a = $this->p_vars['savecolor']) != $this->p_vars['pdf']->getColor())
  192.             {
  193.                 $this->p_vars['pdf']->setColor($a['r'],$a['g'],$a['b']);
  194.             }
  195.         }
  196.         if ($this->p_vars['last_word'] == '<text')
  197.         {
  198.             // set up flags
  199.             $this->p_flags['paramval'] = false;
  200.             $this->p_flags['textcolor'] = false;
  201.             $this->p_vars['curparam'] = false;
  202.             $this->p_vars['savecolor'] = $this->p_vars['pdf']->getColor();
  203.             $this->p_vars['options'] = array();
  204.             unset($this->p_vars['quote_data']);
  205.         }
  206.         if (!$this->p_flags['paramval'])
  207.         {
  208.             if ($e || $e1) return;
  209.             if ($word == '=')
  210.             {
  211. //                debug('set paramval '.$this->p_vars['curparam']);
  212.                 $this->p_flags['paramval'] = true;
  213.                 return;
  214.             }
  215.             $this->p_vars['curparam'] = trim($word);
  216.         } else
  217.         {
  218.             if ($this->p_vars['last_pevent'] == PARSER_EVENT_QUOTE)
  219.             {
  220.                 if ($this->p_vars['curparam'] == 'size')
  221.                 {
  222.                     $this->p_vars['text_size'] = (int)$this->p_vars['quote_data'];
  223.                     $this->p_flags['paramval'] = false;
  224.                     $this->p_vars['curparam'] = false;
  225.                     if (!$e && !$e1)
  226.                     {
  227.                         $this->p_vars['curparam'] = trim($word);
  228.                     }
  229.                     unset($this->p_vars['quote_data']);
  230.                 } elseif ($this->p_vars['curparam'] == 'color')
  231.                 {
  232.                     if ($a = $this->p_vars['pdf']->validHTMLColor($this->p_vars['quote_data']))
  233.                     {
  234.                         $this->p_flags['textcolor'] = true;
  235.                         $this->p_vars['pdf']->setHTMLColor($a);
  236.                     }
  237.                 } else
  238.                 {
  239.                     if ($this->p_vars['quote_data'] === (string)(int)$this->p_vars['quote_data']) $this->p_vars['quote_data'] = (int)$this->p_vars['quote_data'];
  240. //                    debug('added '.$this->p_vars['curparam'].' = '.$this->p_vars['quote_data']);
  241.                     $this->p_vars['options'][$this->p_vars['curparam']] = $this->p_vars['quote_data'];
  242.                     $this->p_flags['paramval'] = false;
  243.                     $this->p_vars['curparam'] = false;
  244.                     if (!$e && !$e1)
  245.                     {
  246.                         $this->p_vars['curparam'] = trim($word);
  247.                     }
  248.                     unset($this->p_vars['quote_data']);
  249.                 }
  250.             }
  251.         }
  252.     }
  253.     
  254.     /**
  255.      * handles <font></font>
  256.      * @tutorial ParserPDF.cls#tags.font
  257.      */
  258.     function handleFont($word, $pevent)
  259.     {
  260.         $e = $this->checkEventPush($word, $pevent);
  261.         $e1 = $this->checkEventPop($word, $pevent);
  262.         if ($e == PARSER_EVENT_QUOTE) return;
  263.         if ($this->p_vars['last_word'] == '<font')
  264.         {
  265.             // set up flags
  266.             $this->p_flags['paramval'] = false;
  267.             $this->p_vars['curparam'] = false;
  268.             unset($this->p_vars['quote_data']);
  269.         }
  270.         if (!$this->p_flags['paramval'])
  271.         {
  272.             if ($e || $e1) return;
  273.             if ($word == '=')
  274.             {
  275.                 //debug('set paramval '.$this->p_vars['curparam']);
  276.                 $this->p_flags['paramval'] = true;
  277.                 return;
  278.             }
  279.             $this->p_vars['curparam'] = trim($word);
  280.         } else
  281.         {
  282.             if ($this->p_vars['last_pevent'] == PARSER_EVENT_QUOTE)
  283.             {
  284.                 if ($this->p_vars['curparam'] == 'face')
  285.                 {
  286.                     //debug('set face to '.$this->p_vars['font_dir'] . $this->p_vars['quote_data'] . '.afm');
  287.                     $this->p_vars['pdf']->selectFont($this->p_vars['font_dir'] . $this->p_vars['quote_data'] . '.afm');
  288.                     $this->p_flags['paramval'] = false;
  289.                     $this->p_vars['curparam'] = false;
  290.                     unset($this->p_vars['quote_data']);
  291.                 }
  292.             }
  293.         }
  294.     }
  295.     
  296.     /**
  297.      * handles <pdffunction>
  298.      * @tutorial ParserPDF.cls#tags.pdffunction
  299.      */
  300.     function handlePDFFunction($word, $pevent)
  301.     {
  302.         $e = $this->checkEventPush($word, $pevent);
  303.         $e1 = $this->checkEventPop($word, $pevent);
  304.         if ($e == PARSER_EVENT_QUOTE) return;
  305.         if ($this->p_vars['last_word'] == '<pdffunction:')
  306.         {
  307.             // set up flags
  308.             $this->p_flags['paramval'] = $this->p_flags['curparam'] = false;
  309.             $this->p_flags['returnval'] = false;
  310.             $this->p_vars['funcname'] = trim($word);
  311. //            debug("funcname is $word");
  312.             $this->p_vars['options'] = array();
  313.             unset($this->p_vars['quote_data']);
  314.             if ($e1) addErrorDie(PDERROR_PDFFUNCTION_NO_FUNC);
  315.         }
  316.         if (!$this->p_flags['paramval'])
  317.         {
  318.             if ($e1)
  319.             { // call function, no parameters
  320.                 $func = $this->p_vars['funcname'];
  321.                 if (!$func) addErrorDie(PDERROR_PDFFUNCTION_NO_FUNC);
  322.                 if (method_exists($this->p_vars['pdf'],$func))
  323.                 {
  324.                     if (count($this->p_vars['options']))
  325.                     {
  326. //                        fancy_debug("calling function $func",$this->p_vars['options']);
  327.                         $a = call_user_func_array(array(&$this->p_vars['pdf'],$func), $this->p_vars['options']);
  328.                     } else
  329.                     {
  330. //                        debug("calling function $func");
  331.                         $a = $this->p_vars['pdf']->$func();
  332.                     }
  333.                     if ($this->p_flags['returnval'])
  334.                     {
  335. //                        debug("setting returnvar ".$this->p_vars['return_varname']);
  336.                         $this->tempvars[$this->p_vars['return_varname']] = $a;
  337.                     }
  338.                 } else
  339.                 {
  340.                     addWarning(PDERROR_PDF_METHOD_DOESNT_EXIST,$func);
  341.                 }
  342.                 return;
  343.             }
  344.             if ($e) return;
  345.             if ($word == '=')
  346.             {
  347. //                debug('set paramval '.$this->p_vars['curparam']);
  348.                 $this->p_flags['paramval'] = true;
  349.                 return;
  350.             }
  351.             $this->p_vars['curparam'] = trim($word);
  352.         } else
  353.         {
  354.             if ($this->p_vars['last_word'] == '=')
  355.             { // check to see if we should use a tempvar from a previous return
  356.                 if (substr(trim($word),0,1) == '$')
  357.                 {
  358.                     if (substr(trim($word),0,7) == '$this->')
  359.                     { // this is a pdf var
  360.                         $a = substr(trim($word),7);
  361.                         $a = $this->p_vars['pdf']->$a;
  362.     //                    debug("set option to $word");
  363.                         $this->p_vars['options'][] = $a;
  364.                         $this->p_flags['paramval'] = false;
  365.                         unset($this->p_vars['quote_data']);
  366.                     } else
  367.                     { // this is a tempvar
  368.                         if (!isset($this->tempvars[substr(trim($word),1)]))
  369.                         {
  370.                             addErrorDie(PDERROR_PDF_TEMPVAR_DOESNT_EXIST,$this->p_vars['funcname'],trim($word),trim($word));
  371.                         }
  372.                         $a = $this->tempvars[substr(trim($word),1)];
  373.     //                    debug("set option to $word");
  374.                         $this->p_vars['options'][] = $a;
  375.                         $this->p_flags['paramval'] = false;
  376.                         unset($this->p_vars['quote_data']);
  377.                     }
  378.                 }
  379.             } else
  380.             {
  381.                 if ($this->p_vars['last_pevent'] == PARSER_EVENT_QUOTE)
  382.                 {
  383.                     if ($this->p_vars['quote_data'] === (string)(int)$this->p_vars['quote_data'])
  384.                     {
  385.                         $this->p_vars['quote_data'] = (int)$this->p_vars['quote_data'];
  386.                     }
  387.                     if ($this->p_vars['curparam'] == 'return')
  388.                     {
  389. //                        debug("param is return");
  390.                         $this->p_vars['return_varname'] = $this->p_vars['quote_data'];
  391.                         $this->p_flags['returnval'] = true;
  392.                     } else
  393.                     {
  394. //                        fancy_debug("set option to arg",$this->p_vars['quote_data']);
  395.                         $this->p_vars['options'][] = $this->p_vars['quote_data'];
  396.                     }
  397.                     $this->p_flags['paramval'] = false;
  398.                     unset($this->p_vars['quote_data']);
  399.                 }
  400.             }
  401.             if ($e1)
  402.             { // call function, with parameters
  403.                 $func = $this->p_vars['funcname'];
  404.                 if (method_exists($this->p_vars['pdf'],$func))
  405.                 {
  406.                     if (count($this->p_vars['options']))
  407.                     {
  408. //                        fancy_debug("calling function $func",$this->p_vars['options']);
  409.                         $a = call_user_func_array(array(&$this->p_vars['pdf'],$func), $this->p_vars['options']);
  410.                     } else
  411.                     {
  412. //                        debug("calling function $func");
  413.                         $a = $this->p_vars['pdf']->$func();
  414.                     }
  415.                     if ($this->p_flags['returnval'])
  416.                     {
  417. //                        debug("setting returnvar ".$this->p_vars['return_varname']);
  418.                         $this->tempvars[$this->p_vars['return_varname']] = $a;
  419.                     }
  420.                 } else
  421.                 {
  422.                     addWarning(PDERROR_PDF_METHOD_DOESNT_EXIST,$func);
  423.                 }
  424.             }
  425.         }
  426.     }
  427.     
  428.     /**
  429.      * Adds content to the <text> tag
  430.      */
  431.     function handleContent($word, $pevent)
  432.     {
  433.         if ($e = $this->checkEventPush($word, $pevent))
  434.         {
  435.             if ($e == PHPDOCUMENTOR_PDF_EVENT_FONT)
  436.             { // flush content
  437.                 if (!isset($this->p_vars['content'])) return;
  438.                 $this->p_vars['pdf']->_ezText($this->p_vars['content'],$this->p_vars['text_size'],$this->p_vars['options']);
  439.                 unset($this->p_vars['content']);
  440.             }
  441.             return;
  442.         }
  443.         if ($this->checkEventPop($word, $pevent))
  444.         {
  445.             $this->wp->backupPos($word);
  446.             if (!isset($this->p_vars['content'])) return;
  447.             $this->p_vars['pdf']->_ezText($this->p_vars['content'],$this->p_vars['text_size'],$this->p_vars['options']);
  448.             unset($this->p_vars['content']);
  449.         } else
  450.         {
  451.             if (!isset($this->p_vars['content'])) $this->p_vars['content'] = '';
  452.             if (isset($this->p_vars['quote_data']))
  453.             {
  454.                 $this->p_vars['content'] .= $this->p_vars['quote_data'];
  455.                 unset($this->p_vars['quote_data']);
  456.             }
  457.             $this->p_vars['content'] .= $word;
  458.         }
  459.     }
  460.     /**#@-*/
  461.     /**
  462.      * setup the parser tokens, and the pushEvent/popEvent arrays
  463.      * @see $tokens, $pushEvent, $popEvent
  464.      */
  465.     
  466.     function setupStates()
  467.     {
  468.         $this->tokens[STATE_NOEVENTS]            = array("<text","<font","<newpage />","<newpage/>",'<pdffunction:','"');
  469.         $this->tokens[PHPDOCUMENTOR_PDF_STATE_TEXT]    = array(">","=",'"',"</text>");
  470.         $this->tokens[PHPDOCUMENTOR_PDF_STATE_FONT] = array("/>","=",'"');
  471.         $this->tokens[PHPDOCUMENTOR_PDF_STATE_CONTENT]    = array("<font",'<pdffunction:',"</text>");
  472.         $this->tokens[PHPDOCUMENTOR_PDF_STATE_PDFFUNCTION]    = array('"',"/>","="," ");
  473.         $this->tokens[STATE_QUOTE]            = array("\\\"","\\\\","\"");
  474.         $this->tokens[STATE_ESCAPE]            = false;// this tells the word parser to just cycle
  475.  
  476.         // For each event word to event mapings
  477.         $this->pushEvent[PARSER_EVENT_QUOTE] = 
  478.             array(
  479.                 "\\"    => PARSER_EVENT_ESCAPE
  480.             );
  481.         $this->popEvent[PARSER_EVENT_QUOTE] = array("\"");
  482. ##########################
  483.         $this->pushEvent[PARSER_EVENT_NOEVENTS] = 
  484.             array(
  485.                 "<text"    => PHPDOCUMENTOR_PDF_EVENT_TEXT,
  486.                 "<font"    => PHPDOCUMENTOR_PDF_EVENT_FONT,
  487.                 "<newpage />" => PHPDOCUMENTOR_PDF_EVENT_NEWPAGE,
  488.                 "<newpage/>" => PHPDOCUMENTOR_PDF_EVENT_NEWPAGE,
  489.                 "<pdffunction:" => PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION,
  490.                 '"' => PARSER_EVENT_QUOTE,
  491.             );
  492. ##########################
  493.         $this->pushEvent[PHPDOCUMENTOR_PDF_EVENT_TEXT] =
  494.             array(
  495.                 '"' => PARSER_EVENT_QUOTE,
  496.                 '>' => PHPDOCUMENTOR_PDF_EVENT_CONTENT,
  497.             );
  498.          
  499.         $this->popEvent[PHPDOCUMENTOR_PDF_EVENT_TEXT] = array("</text>");
  500. ##########################
  501.         $this->pushEvent[PHPDOCUMENTOR_PDF_EVENT_FONT] =
  502.             array(
  503.                 '"' => PARSER_EVENT_QUOTE,
  504.             );
  505.          
  506.         $this->popEvent[PHPDOCUMENTOR_PDF_EVENT_FONT] = array("/>");
  507. ##########################
  508.         $this->pushEvent[PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION] =
  509.             array(
  510.                 '"' => PARSER_EVENT_QUOTE,
  511.             );
  512.         
  513.         $this->popEvent[PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION] = array("/>");
  514. ##########################
  515.         $this->pushEvent[PHPDOCUMENTOR_PDF_EVENT_CONTENT] =
  516.             array(
  517.                 "<font"    => PHPDOCUMENTOR_PDF_EVENT_FONT,
  518.                 "<newpage />" => PHPDOCUMENTOR_PDF_EVENT_NEWPAGE,
  519.                 "<newpage/>" => PHPDOCUMENTOR_PDF_EVENT_NEWPAGE,
  520.                 "<pdffunction:" => PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION,
  521.             );
  522.         
  523.         $this->popEvent[PHPDOCUMENTOR_PDF_EVENT_CONTENT] = array("</text>");
  524.     }
  525.     
  526.     /**
  527.      * Return the name of the parser event
  528.      * @param integer
  529.      */
  530.     function getParserEventName ($value)
  531.     {
  532.         $lookup = array(
  533.             PARSER_EVENT_NOEVENTS         => "PARSER_EVENT_NOEVENTS",
  534.             PARSER_EVENT_QUOTE        => "PARSER_EVENT_QUOTE",
  535.             PHPDOCUMENTOR_PDF_EVENT_TEXT        => "PHPDOCUMENTOR_PDF_EVENT_TEXT",
  536.             PHPDOCUMENTOR_PDF_EVENT_CONTENT        => "PHPDOCUMENTOR_PDF_EVENT_CONTENT",
  537.             PHPDOCUMENTOR_PDF_EVENT_FONT    => "PHPDOCUMENTOR_PDF_EVENT_FONT",
  538.             PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION    => "PHPDOCUMENTOR_PDF_EVENT_PDFFUNCTION",
  539.         );
  540.         if (isset($lookup[$value]))
  541.         return $lookup[$value];
  542.         else return $value;
  543.     }
  544. }
  545. ?>