+++ /dev/null
-<?php\r
-/**\r
- * All abstract representations of inline tags are in this file\r
- *\r
- * phpDocumentor :: automatic documentation generator\r
- * \r
- * PHP versions 4 and 5\r
- *\r
- * Copyright (c) 2002-2006 Gregory Beaver\r
- * \r
- * LICENSE:\r
- * \r
- * This library is free software; you can redistribute it\r
- * and/or modify it under the terms of the GNU Lesser General\r
- * Public License as published by the Free Software Foundation;\r
- * either version 2.1 of the License, or (at your option) any\r
- * later version.\r
- * \r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- * @author Gregory Beaver <cellog@php.net>\r
- * @copyright 2002-2006 Gregory Beaver\r
- * @license http://www.opensource.org/licenses/lgpl-license.php LGPL\r
- * @version CVS: $Id: InlineTags.inc,v 1.7 2007/04/19 20:20:57 ashnazg Exp $\r
- * @filesource\r
- * @link http://www.phpdoc.org\r
- * @link http://pear.php.net/PhpDocumentor\r
- * @since separate file since 1.2\r
- */\r
-/**\r
- * Use this element to represent an {@}inline tag} like {@}link}\r
- * @see parserStringWithInlineTags\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- * @author Greg Beaver <cellog@php.net>\r
- * @since 1.0rc1\r
- * @version $Revision: 1.7 $\r
- * @tutorial inlinetags.pkg\r
- */\r
-class parserInlineTag extends parserBase\r
-{\r
- /**\r
- * Element type\r
- *\r
- * Type is used by many functions to skip the hassle of\r
- *\r
- * <code>\r
- * if phpDocumentor_get_class($blah) == 'parserBlah'\r
- * </code>\r
- * always "inlinetag"\r
- * @var string\r
- */\r
- var $type = 'inlinetag';\r
- /**\r
- * the name of the inline tag (like link)\r
- * @var string\r
- */\r
- var $inlinetype = '';\r
- \r
- /**\r
- * @param string $type tag type (example: link)\r
- * @param string $value tag value (example: what to link to)\r
- */\r
- function parserInlineTag($type,$value)\r
- {\r
- $this->inlinetype = $type;\r
- $this->value = trim($value);\r
- }\r
- \r
- /**\r
- * @return integer length of the tag\r
- */\r
- function Strlen()\r
- {\r
- // fix 1203451\r
- if (is_array($this->value))\r
- {\r
- return array_reduce(create_function('$a,$b', 'return $a + strlen($b);')) +\r
- count($this->value);\r
- }\r
- return strlen($this->value);\r
- }\r
- \r
- /**\r
- * @return string always '', used by {@link Parser::handleDocBlock()} to\r
- * calculate the short description of a DocBlock\r
- * @see parserStringWithInlineTags::getString()\r
- * @see parserStringWithInlineTags::trimmedStrlen()\r
- */\r
- function getString()\r
- {\r
- return '';\r
- }\r
-}\r
-\r
-/**\r
- * represents inline links\r
- * @tutorial tags.inlinelink.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- * @author Greg Beaver <cellog@php.net>\r
- * @since 1.0rc1\r
- */\r
-class parserLinkInlineTag extends parserInlineTag\r
-{\r
- /**\r
- * text to display in the link, can be different from the link for standard\r
- * links like websites\r
- * @var string\r
- */\r
- var $linktext = '';\r
- \r
- /**\r
- * @param string $link stored in $value, see {@link parserBase::$value}\r
- * @param string $text see {@link $linktext}\r
- */\r
- function parserLinkInlineTag($link,$text)\r
- {\r
- if (strpos($link, ','))\r
- {\r
- $link = explode(',',$link);\r
- parserInlineTag::parserInlineTag('link','');\r
- $this->value = $link;\r
- } else\r
- {\r
- parserInlineTag::parserInlineTag('link',$link);\r
- }\r
- $this->linktext = trim($text);\r
- }\r
- \r
- /**\r
- * @param Converter converter used to change the abstract link into text for\r
- * display\r
- * @return false|string returns the converted link or false if not converted\r
- * successfully\r
- */\r
- function Convert(&$c)\r
- {\r
- if (is_array($this->value))\r
- {\r
- $ret = '';\r
- foreach($this->value as $text)\r
- {\r
- if (!empty($ret))\r
- {\r
- $ret .= ', ';\r
- }\r
- $ret .= $this->ConvertPart($c, trim($text));\r
- }\r
- return $ret;\r
- } else\r
- {\r
- return $this->ConvertPart($c, $this->value);\r
- }\r
- }\r
- \r
- function ConvertPart(&$c, $value)\r
- {\r
- if (strpos($value,'://') || (strpos($value,'mailto:') === 0))\r
- {\r
- if (strpos($value, ' '))\r
- {\r
- $value = explode(' ', $value);\r
- $link = array_shift($value);\r
- $text = join(' ', $value);\r
- } else\r
- {\r
- $link = $value;\r
- $text = $this->linktext;\r
- }\r
- return $c->returnLink($link,htmlspecialchars($text));\r
- } else\r
- {\r
- $savevalue = $value;\r
- $descrip = false;\r
- if (strpos(trim($value),' '))\r
- {\r
- $v = preg_split('/\s/',trim($value));\r
- if (in_array(strtolower($v[0]), array('object', 'function')))\r
- {\r
- if (!isset($v[1]) ||\r
- (isset($v[1]) && strlen($v[1])\r
- && !in_array($v[1]{0}, array('$','&'))\r
- && $v[1] != '###commanana####'))\r
- {\r
- $vsave = $v[0];\r
- array_shift($v);\r
- $v[0] = $vsave . ' ' . $v[0];\r
- }\r
- }\r
- $value = $c->getLink($v[0]);\r
- array_shift($v);\r
- $descrip = join($v,' ');\r
- $descrip = str_replace('###commanana####', ',', $descrip);\r
- } else\r
- {\r
- $value = $c->getLink($value);\r
- }\r
- if (is_string($value))\r
- {\r
- // feature 564991\r
- if (strpos($value,'://'))\r
- {\r
- // php function\r
- return $c->returnLink($value,\r
- $descrip ? $descrip : str_replace('PHP_MANUAL#','',$value));\r
- }\r
- return $value;\r
- }\r
- if (!$descrip) $descrip = $c->type_adjust($savevalue);\r
- if (is_object($value)) return $c->returnSee($value, $descrip);\r
-/* // getLink parsed a comma-delimited list of linked thingies, add the commas back in\r
- if (is_array($value))\r
- {\r
- $a = '';\r
- foreach($value as $i => $bub)\r
- {\r
- if (!empty($a)) $a .= ', ';\r
- if (is_string($value[$i]))\r
- {\r
- // feature 564991\r
- if (strpos($value[$i],'://'))\r
- {\r
- // php function\r
- $a .= $c->returnLink($value[$i],str_replace('PHP_MANUAL#','',$vals[$i]));\r
- } else\r
- $a .= $value[$i];\r
- }\r
- if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]);\r
- }\r
- return $a;\r
- } */\r
- return $savevalue;\r
- }\r
- }\r
-}\r
-\r
-/**\r
- * Represents inline links to external tutorial documentation\r
- * @tutorial tags.inlinetutorial.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserTutorialInlineTag extends parserLinkInlineTag\r
-{\r
- /**\r
- * @param string $link stored in $value, see {@link parserBase::$value}\r
- * @param string $text see {@link $linktext}\r
- */\r
- function parserTutorialInlineTag($link,$text)\r
- {\r
- parserInlineTag::parserInlineTag('tutorial',$link);\r
- $this->linktext = trim($text);\r
- }\r
-\r
- /**\r
- * @param Converter converter used to change the abstract link into text for display\r
- * @return mixed returns the converted link or false if not converted successfully\r
- */\r
- function Convert(&$c)\r
- {\r
- $descrip = false;\r
- if (strpos($this->value,',') === false)\r
- {\r
- if (strpos(trim($this->value),' '))\r
- {\r
- $v = split(' ',trim($this->value));\r
- $value = $c->getTutorialLink($v[0]);\r
- array_shift($v);\r
- $descrip = join($v,' ');\r
- } else $value = $c->getTutorialLink($this->value);\r
- } else\r
- {\r
- $vals = split(',',$this->value);\r
- $descrip = array();\r
- foreach($vals as $val)\r
- {\r
- $val = trim($val);\r
- if (strpos($val,' '))\r
- {\r
- $v = split(' ',$val);\r
- $value[] = $c->getTutorialLink($v[0]);\r
- array_shift($v);\r
- $descrip[] = join($v,' ');\r
- } else\r
- {\r
- $value[] = $c->getTutorialLink($val);\r
- $descrip[] = false;\r
- }\r
- }\r
- }\r
- if (is_string($value))\r
- {\r
- return $value;\r
- }\r
- if (is_object($value)) return $c->returnSee($value,$descrip);\r
- // getLink parsed a comma-delimited list of linked thingies, add the commas back in\r
- if (is_array($value))\r
- {\r
- $a = '';\r
- foreach($value as $i => $bub)\r
- {\r
- if (!empty($a)) $a .= ', ';\r
- if (is_string($value[$i]))\r
- {\r
- $a .= $value[$i];\r
- }\r
- if (is_object($value[$i])) $a .= $c->returnSee($value[$i],$descrip[$i]);\r
- }\r
- return $a;\r
- }\r
- return false;\r
- }\r
-}\r
-\r
-/**\r
- * represents inline source tag, used for function/method source\r
- * @tutorial tags.inlinesource.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserSourceInlineTag extends parserInlineTag\r
-{\r
- /**\r
- * always 'source'\r
- * @var string\r
- */\r
- var $inlinetype = 'source';\r
- /**\r
- * First line of source code to display\r
- * @var integer\r
- * @see $end\r
- */\r
- var $start = 1;\r
- /**\r
- * Last line to display\r
- * @var '*'|integer If '*' then the whole source will be used, otherwise\r
- * the {@link $start} to $end line numbers will be displayed\r
- */\r
- var $end = '*';\r
- /**\r
- * tokenized source organized by line numbers for php 4.3.0+, the old\r
- * {@}source} tag used a string\r
- * @var string|array\r
- */\r
- var $source = false;\r
- /**#@+ @access private */\r
- /** @var string|false */\r
- var $_class;\r
- /**#@-*/\r
- /**\r
- * @param string format "start [end]" where start and end are line numbers\r
- * with the end line number optional\r
- */\r
- function parserSourceInlineTag($value)\r
- {\r
- parserInlineTag::parserInlineTag('source','');\r
- preg_match('/^([0-9]+)\W([0-9]*)$/',trim($value), $match);\r
- if (!count($match))\r
- {\r
- preg_match('/^([0-9]+)$/',trim($value),$match);\r
- if (count($match))\r
- {\r
- $this->start = (int) $match[1];\r
- }\r
- } else\r
- {\r
- $this->start = (int) $match[1];\r
- $this->end = (int) $match[2];\r
- }\r
- }\r
- \r
- /**\r
- * only used to determine blank lines. {@}source} will not be blank,\r
- * probably\r
- */\r
- function Strlen()\r
- {\r
- return 1;\r
- }\r
- \r
- function getString()\r
- {\r
- return '{@source}';\r
- }\r
- \r
- /**\r
- * @param string|array source code\r
- * @param boolean in php 4.3.0, if this is a method this will be true\r
- * @param string class name if this is a method\r
- */\r
- function setSource($source, $class = false)\r
- {\r
- if (is_array($source))\r
- {\r
- $this->_class = $class;\r
- $this->source = $source;\r
- } else\r
- {\r
- $source = strstr($source,'function');\r
- $pos = strrpos($source,'}');\r
- $this->source = substr($source,0,$pos + 1);\r
- }\r
- }\r
- \r
- /**\r
- * @uses stringConvert() in PHP 4.2.3-, this method is used to convert\r
- * @uses arrayConvert() in PHP 4.3.0+, this method is used to convert\r
- * @param Converter\r
- */\r
- function Convert(&$c)\r
- {\r
- if (is_string($this->source)) return $this->stringConvert($c);\r
- return $this->arrayConvert($c);\r
- }\r
- \r
- /**\r
- * @param Converter\r
- * @uses phpDocumentor_HighlightParser Parses the tokenized source\r
- */\r
- function arrayConvert(&$c)\r
- {\r
- $source = $this->source;\r
- if ($this->end != '*')\r
- {\r
- $source = array_slice($this->source,0,$this->end + $this->start - 1);\r
- }\r
- $start = $this->start - 1;\r
- if ($start < 0) $start = 0;\r
- return $c->ProgramExample($source, true, true, $this->_class, $start);\r
- }\r
- \r
- /**\r
- * @param Converter\r
- * @uses Converter::unmangle() remove the extraneous stuff from\r
- * {@link highlight_string()}\r
- * @deprecated in favor of PHP 4.3.0+ {@link arrayConvert()}\r
- */\r
- function stringConvert(&$c)\r
- {\r
- $source = highlight_string('<?php '.$this->source.' ?>', true);\r
- $source = '<code>'.substr($source,strlen('<code><font color="#000000">\r
-<font color="#0000CC"><?php </font>') - 1);\r
- $source = str_replace('} </font><font color="#0000CC">?></font>','}</font></code>',$source);\r
- if ($this->start || ($this->end != '*'))\r
- {\r
- $source = explode('<br />',$source);\r
- $start = $this->start;\r
- if ($this->end != '*')\r
- {\r
- $source = array_slice($source,$start - 1,$this->end - $start + 1);\r
- } else\r
- {\r
- $source = array_slice($source,$start - 1);\r
- }\r
- $source = implode($source,'<br />');\r
- if ($start > 0) $source = "<code>$source";\r
- if ($this->end != '*') $source = "$source</code>";\r
- }\r
- $source = $c->unmangle($source,$this->source);\r
- return $source;\r
- }\r
-}\r
-\r
-/**\r
- * Represents the example inline tag, used to display an example file\r
- * inside a docblock or tutorial\r
- * @tutorial tags.inlineexample.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserExampleInlineTag extends parserSourceInlineTag\r
-{\r
- /**\r
- * @param string format "filepath[ start [end]]" where start and end are line numbers\r
- * with the end line number optional\r
- * @param string full path to the current file, used to check relative\r
- * directory locations\r
- * @param boolean if true, then this is in a tutorial\r
- */\r
- function parserExampleInlineTag($value, $current_path, $isTutorial = false)\r
- {\r
- global $_phpDocumentor_setting;\r
- parserInlineTag::parserInlineTag('example','');\r
- $path = false;\r
- $tagValue = trim($value);\r
- $path = $isAbsPath = $pathOnly = $fileName = $fileExt = $original_path = $title = FALSE;\r
- do\r
- {\r
- // make sure the format is stuff.ext startline[ endline]\r
- if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match))\r
- {\r
- // or format is stuff.ext\r
- if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match))\r
- {\r
- // Murphy: Some funny path was given\r
- $original_path = $tagValue; // used for error output\r
- break; // try-block\r
- }\r
- }\r
- if (strlen($match[1]) === 0)\r
- {\r
- // Murphy: Some funny path was given\r
- $original_path = $tagValue; // used for error output\r
- break; // try-block\r
- }\r
- $fileExt = $match[2];\r
- if (isset($match[3]))\r
- {\r
- $lines = explode(' ', trim($match[3]));\r
- $this->start = (int) $lines[0];\r
- if (isset($lines[1])) {\r
- $this->end = (int) $lines[1];\r
- }\r
- }\r
- $pathTmp = str_replace('\\', '/', $match[1]); // Replace windows '\' the path.\r
-\r
- // Is there a path and a file or is it just a file?\r
- if (strpos($pathTmp,'/') === false)\r
- {\r
- // No path part\r
- $pathOnly = '';\r
- $fileName = $pathTmp .'.'. $fileExt;\r
- } else\r
- {\r
- $splitPos = strrpos($pathTmp,'/'); // split the path on the last directory, find the filename\r
- $pathOnly = substr($match[1], 0, $splitPos+1);\r
- $fileName = substr($match[1], $splitPos+1) .'.'. $fileExt;\r
- // Is the path absolute? (i.e. does it start like an absolute path?)\r
- if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp))\r
- { // works for both windows 'C:' and URLs like 'http://'\r
- $isAbsPath = true; // Yes\r
- }\r
- }\r
-\r
- $original_path = $pathOnly . $fileName;\r
-\r
- // Now look for the file starting with abs. path.\r
- if ($isAbsPath)\r
- {\r
- $tmp = realpath($original_path); // remove any weirdities like /../file.ext\r
- if ($tmp && is_file($tmp))\r
- {\r
- $path = $tmp;\r
- }\r
- // Alway break if abs. path was detected; even if file was not found.\r
- break; // try-block\r
- }\r
-\r
- // Search for the example file some standard places \r
- // 1) Look if the ini-var examplesdir is set and look there ...\r
- if (isset($_phpDocumentor_setting['examplesdir']))\r
- {\r
- $tmp = realpath($_phpDocumentor_setting['examplesdir'] . PATH_DELIMITER . $original_path);\r
- if ($tmp && is_file($tmp))\r
- {\r
- $path = $tmp; // Yo! found it :)\r
- break; // try-block\r
- }\r
- }\r
-\r
- // 2) Then try to look for an 'example/'-dir below the *currently* parsed file ...\r
- if (!empty($current_path))\r
- {\r
- $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $fileName);\r
- if ($tmp && is_file($tmp))\r
- {\r
- $path = $tmp; // Yo! found it :)\r
- break; // try-block\r
- }\r
- }\r
-\r
- // 3) Then try to look for the example file below the subdir PHPDOCUMENTOR_BASE/examples/ ...\r
- if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples'))\r
- {\r
- $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $original_path);\r
- if ($tmp && is_file($tmp))\r
- {\r
- $path = $tmp; // Yo! found it :)\r
- break; // try-block\r
- }\r
- }\r
-\r
- $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . $original_path);\r
- if ($tmp && is_file($tmp))\r
- {\r
- $path = $tmp; // Yo! found it :)\r
- break; // try-block\r
- }\r
- // If we reach this point, nothing was found and $path is false.\r
- } while (false);\r
-\r
- if (!$path)\r
- {\r
- addWarning(PDERROR_EXAMPLE_NOT_FOUND, $original_path);\r
- $this->path = false;\r
- } else\r
- {\r
- $f = @fopen($path,'r');\r
- if ($f)\r
- {\r
- $example = fread($f,filesize($path));\r
- if (tokenizer_ext && !$isTutorial)\r
- {\r
- $obj = new phpDocumentorTWordParser;\r
- $obj->setup($example);\r
- $this->setSource($obj->getFileSource());\r
- unset($obj);\r
- } else\r
- {\r
- $this->setSource($example);\r
- }\r
- }\r
- }\r
- }\r
- \r
- /**\r
- * @param string|array source code\r
- * @param boolean in php 4.3.0, if this is a method this will be true\r
- * @param string class name if this is a method\r
- */\r
- function setSource($source, $class = false)\r
- {\r
- $this->_class = $class;\r
- $this->source = $source;\r
- }\r
- \r
- /**\r
- * @param Converter\r
- * @uses phpDocumentor_HighlightParser Parses the tokenized source\r
- */\r
- function arrayConvert(&$c)\r
- {\r
- $source = $this->source;\r
- if ($this->end != '*')\r
- {\r
- $source = array_slice($this->source,0,$this->end + $this->start - 1);\r
- }\r
- $start = $this->start - 1;\r
- if ($start < 0) $start = 0;\r
- return $c->exampleProgramExample($source, true, true, $this->_class, $start);\r
- }\r
-\r
- /**\r
- * Return the source for the example file, enclosed in\r
- * a <programlisting> tag to use in a tutorial\r
- * @return string\r
- */\r
- function getProgramListing()\r
- {\r
- $source = explode("\n", $this->source);\r
- $start = $this->start;\r
- if ($this->end != '*')\r
- {\r
- $source = array_slice($source,$start - 1,$this->end - $start + 1);\r
- } else\r
- {\r
- $source = array_slice($source,$start - 1);\r
- }\r
- $source = join("\n", $source);\r
- return\r
- "<programlisting role=\"php\">\r
- <![CDATA[\n" .\r
- $source .\r
- "\n]]>\n</programlisting>";\r
- }\r
-}\r
-\r
-/**\r
- * Represents the inheritdoc inline tag, used by classes/methods/vars to inherit\r
- * documentation from the parent class if possible\r
- * @tutorial tags.inlineinheritdoc.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserInheritdocInlineTag extends parserInlineTag\r
-{\r
- /**\r
- * always 'inheritdoc'\r
- * @var string\r
- */\r
- var $inlinetype = 'inheritdoc';\r
- \r
- /**\r
- * Does nothing, overrides parent constructor\r
- */\r
- function parserInheritdocInlineTag()\r
- {\r
- }\r
- \r
- function Convert()\r
- {\r
- addWarning(PDERROR_INHERITDOC_DONT_WORK_HERE);\r
- return '';\r
- }\r
-}\r
-\r
-/**\r
- * Represents the inline {@}id} tag for tutorials\r
- * @tutorial tags.inlineid.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserIdInlineTag extends parserInlineTag\r
-{\r
- /**\r
- * always 'id'\r
- * @var string\r
- */\r
- var $inlinetype = 'id';\r
- /**\r
- * package of the {@}id}\r
- * @var string\r
- */\r
- var $package = 'default';\r
- /**\r
- * category of the {@}id}\r
- * @var string\r
- */\r
- var $category = 'default';\r
- /**\r
- * subpackage of the {@}id}\r
- * @var string\r
- */\r
- var $subpackage = '';\r
- /**\r
- * full name of the tutorial\r
- * @var string\r
- */\r
- var $tutorial;\r
- /**\r
- * section/subsection name\r
- * @var string\r
- */\r
- var $id;\r
- \r
- /**\r
- * @param string package name\r
- * @param string subpackage name\r
- * @param string tutorial name\r
- * @param string section/subsection name\r
- * @param string category name\r
- */\r
- function parserIdInlineTag($category,$package,$subpackage,$tutorial,$id = false)\r
- {\r
- $this->package = $package;\r
- $this->subpackage = $subpackage;\r
- $this->tutorial = $tutorial;\r
- $this->id = $id;\r
- $this->category = $category;\r
- }\r
- \r
- /**\r
- * @param Converter\r
- * @uses Converter::getTutorialId() retrieve converter-specific ID\r
- */\r
- function Convert(&$c)\r
- {\r
- if (!$this->id) return '';\r
- return $c->getTutorialId($this->package,$this->subpackage,$this->tutorial,$this->id,$this->category);\r
- }\r
-}\r
-\r
-/**\r
- * Represents {@}toc} for table of contents generation in tutorials\r
- * @tutorial tags.inlinetoc.pkg\r
- * @package phpDocumentor\r
- * @subpackage InlineTags\r
- */\r
-class parserTocInlineTag extends parserInlineTag\r
-{\r
- /**\r
- * always 'toc'\r
- * @var string\r
- */\r
- var $inlinetype = 'toc';\r
- /**\r
- * @var array format:\r
- * <pre>\r
- * array(array('tagname' => section,\r
- * 'link' => returnsee link,\r
- * 'id' => anchor name,\r
- * 'title' => from title tag),...)\r
- * </pre>\r
- * @access private\r
- */\r
- var $_toc = false;\r
- /**\r
- * full path to tutorial, used in conversion\r
- * @var string\r
- * @access private\r
- */\r
- var $_path = false;\r
-\r
- function parserTocInlineTag()\r
- {\r
- parent::parserInlineTag('toc','');\r
- }\r
- \r
- /**\r
- * @param array format:\r
- * <pre>\r
- * array(array('tag' => {@link parserXMLDocBookTag},\r
- * 'id' => {@link parserIdInlineTag},\r
- * 'title' => {@link parserXMLDocBookTag title}),...)\r
- * </pre>\r
- */\r
- function setTOC($toc)\r
- {\r
- $this->toc = $toc;\r
- }\r
- \r
- /**\r
- * @param string\r
- */\r
- function setPath($path)\r
- {\r
- $this->_path = $path;\r
- }\r
- \r
- /**\r
- * @uses Converter::formatTutorialTOC() passes an array of format:\r
- *\r
- * <pre>\r
- * array(\r
- * 'tagname' => string name of tag,\r
- * 'link' => {@link tutorialLink} to the tutorial,\r
- * 'id' => converter specific tutorial ID from {@link Converter::getTutorialId()}\r
- * 'title' => title of the tutorial)\r
- * </pre>\r
- *\r
- * and returns the results as the table of contents\r
- * @uses Converter::getTutorialId() retrieve the tutorial ID for\r
- * @param Converter\r
- */\r
- function Convert(&$c)\r
- {\r
- $newtoc = array();\r
- if (isset($this->toc) && is_array($this->toc)) {\r
- foreach($this->toc as $i => $toc)\r
- {\r
- if (isset($toc['title']))\r
- $toc['tag']->setTitle($toc['title']);\r
- else\r
- $toc['tag']->setTitle(new parserStringWithInlineTags);\r
- $newtoc[$i]['tagname'] = $toc['tag']->name;\r
- $l = new tutorialLink;\r
- if (!isset($toc['title'])) $title = 'section '.$toc['id']->id;\r
- else\r
- $title = $toc['title']->Convert($c);\r
- $l->addLink($toc['id']->id,$this->_path,basename($this->_path),$toc['id']->package, $toc['id']->subpackage, strip_tags($title));\r
- $newtoc[$i]['link'] = $c->returnSee($l);\r
- $newtoc[$i]['id'] = $c->getTutorialId($toc['id']->package, $toc['id']->subpackage, basename($this->_path), $toc['id']->id, $toc['id']->category);\r
- $newtoc[$i]['title'] = $title;\r
- }\r
- }\r
- return $c->formatTutorialTOC($newtoc);\r
- }\r
-}\r
-?>\r