PageRenderTime 51ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 1ms

/secured/phpDocumentor/phpDocumentor/Converter.inc

http://oregon-caspages.googlecode.com/
PHP | 5456 lines | 3509 code | 203 blank | 1744 comment | 743 complexity | 1ea9a6550994bf333f43d006e47affe2 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Base class for all Converters
  4. *
  5. * phpDocumentor :: automatic documentation generator
  6. *
  7. * PHP versions 4 and 5
  8. *
  9. * Copyright (c) 2001-2006 Gregory Beaver
  10. *
  11. * LICENSE:
  12. *
  13. * This library is free software; you can redistribute it
  14. * and/or modify it under the terms of the GNU Lesser General
  15. * Public License as published by the Free Software Foundation;
  16. * either version 2.1 of the License, or (at your option) any
  17. * later version.
  18. *
  19. * This library is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22. * Lesser General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Lesser General Public
  25. * License along with this library; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. *
  28. * @package Converters
  29. * @author Greg Beaver <cellog@php.net>
  30. * @copyright 2001-2006 Gregory Beaver
  31. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  32. * @version CVS: $Id: Converter.inc,v 1.39 2007/12/19 02:16:49 ashnazg Exp $
  33. * @filesource
  34. * @link http://www.phpdoc.org
  35. * @link http://pear.php.net/PhpDocumentor
  36. * @see parserDocBlock, parserInclude, parserPage, parserClass
  37. * @see parserDefine, parserFunction, parserMethod, parserVar
  38. * @since 1.0rc1
  39. */
  40. /**
  41. * Smarty template files
  42. */
  43. include_once("phpDocumentor/Smarty-2.6.0/libs/Smarty.class.php");
  44. /**
  45. * Base class for all output converters.
  46. *
  47. * The Converter marks the final stage in phpDocumentor. phpDocumentor works
  48. * in this order:
  49. *
  50. * <pre>Parsing => Intermediate Parsing organization => Conversion to output</pre>
  51. *
  52. * A Converter takes output from the {@link phpDocumentor_IntermediateParser} and
  53. * converts it to output. With version 1.2, phpDocumentor includes a variety
  54. * of output converters:
  55. * <ul>
  56. * <li>{@link HTMLframesConverter}</li>
  57. * <li>{@link HTMLSmartyConverter}</li>
  58. * <li>{@link PDFdefaultConverter}</li>
  59. * <li>{@link CHMdefaultConverter}</li>
  60. * <li>{@link CSVdia2codeConverter}</li>
  61. * <li>{@link XMLDocBookConverter}</li>
  62. * </ul>
  63. * {@internal
  64. * The converter takes output directly from {@link phpDocumentor_IntermediateParser}
  65. * and using {@link walk()} or {@link walk_everything} (depending on the value of
  66. * {@link $sort_absolutely_everything}) it "walks" over an array of phpDocumentor elements.}}
  67. *
  68. * @package Converters
  69. * @abstract
  70. * @author Greg Beaver <cellog@php.net>
  71. * @since 1.0rc1
  72. * @version $Id: Converter.inc,v 1.39 2007/12/19 02:16:49 ashnazg Exp $
  73. */
  74. class Converter
  75. {
  76. /**
  77. * This converter knows about the new root tree processing
  78. * In order to fix PEAR Bug #6389
  79. * @var boolean
  80. */
  81. var $processSpecialRoots = false;
  82. /**
  83. * output format of this converter
  84. *
  85. * in Child converters, this will match the first part of the -o command-line
  86. * as in -o HTML:frames:default "HTML"
  87. * @tutorial phpDocumentor.howto.pkg#using.command-line.output
  88. * @var string
  89. */
  90. var $outputformat = 'Generic';
  91. /**
  92. * package name currently being converted
  93. * @var string
  94. */
  95. var $package = 'default';
  96. /**
  97. * subpackage name currently being converted
  98. * @var string
  99. */
  100. var $subpackage = '';
  101. /**
  102. * set to a classname if currently parsing a class, false if not
  103. * @var string|false
  104. */
  105. var $class = false;
  106. /**#@+
  107. * @access private
  108. */
  109. /**
  110. * the workhorse of linking.
  111. *
  112. * This array is an array of link objects of format:
  113. * [package][subpackage][eltype][elname] = descendant of {@link abstractLink}
  114. * eltype can be page|function|define|class|method|var
  115. * if eltype is method or var, the array format is:
  116. * [package][subpackage][eltype][class][elname]
  117. * @var array
  118. * @see functionLink, pageLink, classLink, defineLink, methodLink, varLink, globalLink
  119. */
  120. var $links = array();
  121. /**
  122. * the workhorse of linking, with allowance for support of multiple
  123. * elements in different files.
  124. *
  125. * This array is an array of link objects of format:
  126. * [package][subpackage][eltype][file][elname] = descendant of {@link abstractLink}
  127. * eltype can be function|define|class|method|var
  128. * if eltype is method or var, the array format is:
  129. * [package][subpackage][eltype][file][class][elname]
  130. * @var array
  131. * @see functionLink, pageLink, classLink, defineLink, methodLink, varLink, globalLink
  132. */
  133. var $linkswithfile = array();
  134. /**#@-*/
  135. /**
  136. * set to value of -po commandline
  137. * @tutorial phpDocumentor.howto.pkg#using.command-line.packageoutput
  138. * @var mixed
  139. */
  140. var $package_output;
  141. /**
  142. * name of current page being converted
  143. * @var string
  144. */
  145. var $page;
  146. /**
  147. * path of current page being converted
  148. * @var string
  149. */
  150. var $path;
  151. /**
  152. * template for the procedural page currently being processed
  153. * @var Smarty
  154. */
  155. var $page_data;
  156. /**
  157. * template for the class currently being processed
  158. * @var Smarty
  159. */
  160. var $class_data;
  161. /**
  162. * current procedural page being processed
  163. * @var parserPage
  164. */
  165. var $curpage;
  166. /**
  167. * alphabetical index of all elements sorted by package, subpackage, page,
  168. * and class.
  169. * @var array Format: array(package => array(subpackage => array('page'|'class' => array(path|classname => array(element, element,...)))))
  170. * @uses $sort_absolutely_everything if true, then $package_elements is used,
  171. * otherwise, the {@link ParserData::$classelements} and
  172. * {@link ParserData::$pageelements} variables are used
  173. */
  174. var $package_elements = array();
  175. /**
  176. * alphabetical index of all elements
  177. *
  178. * @var array Format: array(first letter of element name => array({@link parserElement} or {@link parserPage},...))
  179. * @see formatIndex(), HTMLframesConverter::formatIndex()
  180. */
  181. var $elements = array();
  182. /**
  183. * alphabetized index of procedural pages by package
  184. *
  185. * @see $leftindex
  186. * @var array Format: array(package => array(subpackage => array({@link pageLink} 1,{@link pageLink} 2,...)
  187. */
  188. var $page_elements = array();
  189. /**
  190. * alphabetized index of defines by package
  191. *
  192. * @see $leftindex
  193. * @var array Format: array(package => array(subpackage => array({@link defineLink} 1,{@link defineLink} 2,...)
  194. */
  195. var $define_elements = array();
  196. /**
  197. * alphabetized index of classes by package
  198. *
  199. * @see $leftindex
  200. * @var array Format: array(package => array(subpackage => array({@link classLink} 1,{@link classLink} 2,...)
  201. */
  202. var $class_elements = array();
  203. /**
  204. * alphabetized index of global variables by package
  205. *
  206. * @see $leftindex
  207. * @var array Format: array(package => array(subpackage => array({@link globalLink} 1,{@link globalLink} 2,...)
  208. */
  209. var $global_elements = array();
  210. /**
  211. * alphabetized index of functions by package
  212. *
  213. * @see $leftindex
  214. * @var array Format: array(package => array(subpackage => array({@link functionLink} 1,{@link functionLink} 2,...)
  215. */
  216. var $function_elements = array();
  217. /**
  218. * alphabetical index of all elements, indexed by package/subpackage
  219. *
  220. * @var array Format: array(first letter of element name => array({@link parserElement} or {@link parserPage},...))
  221. * @see formatPkgIndex(), HTMLframesConverter::formatPkgIndex()
  222. */
  223. var $pkg_elements = array();
  224. /**
  225. * alphabetical index of all elements on a page by package/subpackage
  226. *
  227. * The page itself has a link under ###main
  228. * @var array Format: array(package => array(subpackage => array(path => array({@link abstractLink} descendant 1, ...)))
  229. * @see formatLeftIndex()
  230. */
  231. var $page_contents = array();
  232. /**
  233. * This determines whether the {@link $page_contents} array should be sorted by element type as well as alphabetically by name
  234. * @see sortPageContentsByElementType()
  235. * @var boolean
  236. */
  237. var $sort_page_contents_by_type = false;
  238. /**
  239. * This is used if the content must be passed in the order it should be read, i.e. by package, procedural then classes
  240. *
  241. * This fixes bug 637921, and is used by {@link PDFdefaultConverter}
  242. */
  243. var $sort_absolutely_everything = false;
  244. /**
  245. * alphabetical index of all methods and vars in a class by package/subpackage
  246. *
  247. * The class itself has a link under ###main
  248. * @var array
  249. * Format:<pre>
  250. * array(package =>
  251. * array(subpackage =>
  252. * array(path =>
  253. * array(class =>
  254. * array({@link abstractLink} descendant 1, ...
  255. * )
  256. * )
  257. * )
  258. * )</pre>
  259. * @see formatLeftIndex()
  260. */
  261. var $class_contents = array();
  262. /**
  263. * controls processing of elements marked private with @access private
  264. *
  265. * defaults to false. Set with command-line --parseprivate or -pp
  266. * @var bool
  267. */
  268. var $parseprivate;
  269. /**
  270. * controls display of progress information while parsing.
  271. *
  272. * defaults to false. Set to true for cron jobs or other situations where no visual output is necessary
  273. * @var bool
  274. */
  275. var $quietmode;
  276. /**
  277. * directory that output is sent to. -t command-line sets this.
  278. * @tutorial phpDocumentor.howto.pkg#using.command-line.target
  279. */
  280. var $targetDir = '';
  281. /**
  282. * Directory that the template is in, relative to phpDocumentor root directory
  283. * @var string
  284. */
  285. var $templateDir = '';
  286. /**
  287. * Directory that the smarty templates are in
  288. * @var string
  289. */
  290. var $smarty_dir = '';
  291. /**
  292. * Name of the template, from last part of -o
  293. * @tutorial phpDocumentor.howto.pkg#using.command-line.output
  294. * @var string
  295. */
  296. var $templateName = '';
  297. /**
  298. * full path of the current file being converted
  299. */
  300. var $curfile;
  301. /**
  302. * All class information, organized by path, and by package
  303. * @var Classes
  304. */
  305. var $classes;
  306. /**
  307. * Flag used to help converters determine whether to do special source highlighting
  308. * @var boolean
  309. */
  310. var $highlightingSource = false;
  311. /**
  312. * Hierarchy of packages
  313. *
  314. * Every package that contains classes may have parent or child classes
  315. * in other packages. In other words, this code is legal:
  316. *
  317. * <code>
  318. * /**
  319. * * @package one
  320. * * /
  321. * class one {}
  322. *
  323. * /**
  324. * * @package two
  325. * * /
  326. * class two extends one {}
  327. * </code>
  328. *
  329. * In this case, package one is a parent of package two
  330. * @var array
  331. * @see phpDocumentor_IntermediateParser::$package_parents
  332. */
  333. var $package_parents;
  334. /**
  335. * Packages associated with categories
  336. *
  337. * Used by the XML:DocBook/peardoc2 converter, and available to others, to
  338. * group many packages into categories
  339. * @see phpDocumentor_IntermediateParser::$packagecategories
  340. * @var array
  341. */
  342. var $packagecategories;
  343. /**
  344. * All packages encountered in parsing
  345. * @var array
  346. * @see phpDocumentor_IntermediateParser::$all_packages
  347. */
  348. var $all_packages;
  349. /**
  350. * A list of files that have had source code generated
  351. * @var array
  352. */
  353. var $sourcePaths = array();
  354. /**
  355. * Controls which of the one-element-only indexes are generated.
  356. *
  357. * Generation of these indexes for large packages is time-consuming. This is an optimization feature. An
  358. * example of how to use this is in {@link HTMLframesConverter::$leftindex}, and in {@link HTMLframesConverter::formatLeftIndex()}.
  359. * These indexes are intended for use as navigational aids through documentation, but can be used for anything by converters.
  360. * @see $class_elements, $page_elements, $function_elements, $define_elements, $global_elements
  361. * @see formatLeftIndex()
  362. * @var array
  363. */
  364. var $leftindex = array('classes' => true, 'pages' => true, 'functions' => true, 'defines' => true, 'globals' => true);
  365. /** @access private */
  366. var $killclass = false;
  367. /**
  368. * @var string
  369. * @see phpDocumentor_IntermediateParser::$title
  370. */
  371. var $title = 'Generated Documentation';
  372. /**
  373. * Options for each template, parsed from the options.ini file in the template base directory
  374. * @tutorial phpDocumentor/tutorials.pkg#conversion.ppage
  375. * @var array
  376. */
  377. var $template_options;
  378. /**
  379. * Tutorials and Extended Documentation parsed from a tutorials/package[/subpackage] directory
  380. * @tutorial tutorials.pkg
  381. * @access private
  382. */
  383. var $tutorials = array();
  384. /**
  385. * tree-format structure of tutorials and their child tutorials, if any
  386. * @var array
  387. * @access private
  388. */
  389. var $tutorial_tree = false;
  390. /**
  391. * list of tutorials that have already been processed. Used by @link _setupTutorialTree()
  392. * @var array
  393. * @access private
  394. */
  395. var $processed_tutorials;
  396. /**
  397. * List of all @todo tags and a link to the element with the @todo
  398. *
  399. * Format: array(package => array(link to element, array(todo {@link parserTag},...)),...)
  400. * @tutorial tags.todo.pkg
  401. * @var array
  402. */
  403. var $todoList = array();
  404. /**
  405. * Directory where compiled templates go - will be deleted on exit
  406. *
  407. * @var string
  408. * @access private
  409. */
  410. var $_compiledDir = array();
  411. /**
  412. * Initialize Converter data structures
  413. * @param array {@link $all_packages} value
  414. * @param array {@link $package_parents} value
  415. * @param Classes {@link $classes} value
  416. * @param ProceduralPages {@link $proceduralpages} value
  417. * @param array {@link $package_output} value
  418. * @param boolean {@link $parseprivate} value
  419. * @param boolean {@link $quietmode} value
  420. * @param string {@link $targetDir} value
  421. * @param string {@link $templateDir} value
  422. * @param string (@link $title} value
  423. */
  424. function Converter(&$allp, &$packp, &$classes, &$procpages, $po, $pp, $qm, $targetDir, $template, $title)
  425. {
  426. $this->all_packages = $allp;
  427. $this->package_parents = $packp;
  428. $this->package = $GLOBALS['phpDocumentor_DefaultPackageName'];
  429. $this->proceduralpages = &$procpages;
  430. $this->package_output = $po;
  431. if (is_array($po))
  432. {
  433. $a = $po[0];
  434. $this->all_packages = array_flip($po);
  435. $this->all_packages[$a] = 1;
  436. }
  437. $this->parseprivate = $pp;
  438. $this->quietmode = $qm;
  439. $this->classes = &$classes;
  440. $this->roots = $classes->getRoots($this->processSpecialRoots);
  441. $this->title = $title;
  442. $this->setTemplateDir($template);
  443. $this->setTargetdir($targetDir);
  444. }
  445. /**
  446. * Called by IntermediateParser after creation
  447. * @access private
  448. */
  449. function setTutorials($tutorials)
  450. {
  451. $this->tutorials = $tutorials;
  452. }
  453. /**
  454. * @param pkg|cls|proc the tutorial type to search for
  455. * @param tutorial name
  456. * @param string package name
  457. * @param string subpackage name, if any
  458. * @return false|parserTutorial if the tutorial exists, return it
  459. */
  460. function hasTutorial($type, $name, $package, $subpackage = '')
  461. {
  462. if (isset($this->tutorials[$package][$subpackage][$type][$name . '.' . $type]))
  463. return $this->tutorials[$package][$subpackage][$type][$name . '.' . $type];
  464. return false;
  465. }
  466. /**
  467. * Called by {@link walk()} while converting, when the last class element
  468. * has been parsed.
  469. *
  470. * A Converter can use this method in any way it pleases. HTMLframesConverter
  471. * uses it to complete the template for the class and to output its
  472. * documentation
  473. * @see HTMLframesConverter::endClass()
  474. * @abstract
  475. */
  476. function endClass()
  477. {
  478. }
  479. /**
  480. * Called by {@link walk()} while converting, when the last procedural page
  481. * element has been parsed.
  482. *
  483. * A Converter can use this method in any way it pleases. HTMLframesConverter
  484. * uses it to complete the template for the procedural page and to output its
  485. * documentation
  486. * @see HTMLframesConverter::endClass()
  487. * @abstract
  488. */
  489. function endPage()
  490. {
  491. }
  492. /**
  493. * Called by {@link walk()} while converting.
  494. *
  495. * This method is intended to be the place that {@link $pkg_elements} is
  496. * formatted for output.
  497. * @see HTMLframesConverter::formatPkgIndex()
  498. * @abstract
  499. */
  500. function formatPkgIndex()
  501. {
  502. }
  503. /**
  504. * Called by {@link walk()} while converting.
  505. *
  506. * This method is intended to be the place that {@link $elements} is
  507. * formatted for output.
  508. * @see HTMLframesConverter::formatIndex()
  509. * @abstract
  510. */
  511. function formatIndex()
  512. {
  513. }
  514. /**
  515. * Called by {@link walk()} while converting.
  516. *
  517. * This method is intended to be the place that any of
  518. * {@link $class_elements, $function_elements, $page_elements},
  519. * {@link $define_elements}, and {@link $global_elements} is formatted for
  520. * output, depending on the value of {@link $leftindex}
  521. * @see HTMLframesConverter::formatLeftIndex()
  522. * @abstract
  523. */
  524. function formatLeftIndex()
  525. {
  526. }
  527. /**
  528. * Called by {@link parserSourceInlineTag::stringConvert()} to allow
  529. * converters to format the source code the way they'd like.
  530. *
  531. * default returns it unchanged (html with xhtml tags)
  532. * @param string output from highlight_string() - use this function to
  533. * reformat the returned data for Converter-specific output
  534. * @return string
  535. * @deprecated in favor of tokenizer-based highlighting. This will be
  536. * removed for 2.0
  537. */
  538. function unmangle($sourcecode)
  539. {
  540. return $sourcecode;
  541. }
  542. /**
  543. * Initialize highlight caching
  544. */
  545. function startHighlight()
  546. {
  547. $this->_highlightCache = array(false, false);
  548. $this->_appendHighlight = '';
  549. }
  550. function getHighlightState()
  551. {
  552. return $this->_highlightCache;
  553. }
  554. function _setHighlightCache($type, $token)
  555. {
  556. $test = ($this->_highlightCache[0] === $type && $this->_highlightCache[1] == $token);
  557. if (!$test) {
  558. $this->_appendHighlight = $this->flushHighlightCache();
  559. } else {
  560. $this->_appendHighlight = '';
  561. }
  562. $this->_highlightCache = array($type, $token);
  563. return $test;
  564. }
  565. /**
  566. * Return the close text for the current token
  567. * @return string
  568. */
  569. function flushHighlightCache()
  570. {
  571. $hc = $this->_highlightCache;
  572. $this->_highlightCache = array(false, false);
  573. if ($hc[0]) {
  574. if (!isset($this->template_options[$hc[0]]['/'.$hc[1]])) {
  575. return '';
  576. }
  577. return $this->template_options[$hc[0]]['/'.$hc[1]];
  578. }
  579. return '';
  580. }
  581. /**
  582. * Used to allow converters to format the source code the way they'd like.
  583. *
  584. * default returns it unchanged. Mainly used by the {@link HighlightParser}
  585. * {@internal
  586. * The method takes information from options.ini, the template options
  587. * file, specifically the [highlightSourceTokens] and [highlightSource]
  588. * sections, and uses them to enclose tokens.
  589. *
  590. * {@source}}}
  591. * @param integer token value from {@link PHP_MANUAL#tokenizer tokenizer constants}
  592. * @param string contents of token
  593. * @param boolean whether the contents are preformatted or need modification
  594. * @return string
  595. */
  596. function highlightSource($token, $word, $preformatted = false)
  597. {
  598. if ($token !== false)
  599. {
  600. if (!$preformatted) $word = $this->postProcess($word);
  601. if (isset($this->template_options['highlightSourceTokens'][token_name($token)]))
  602. {
  603. if ($this->_setHighlightCache('highlightSourceTokens', token_name($token))) {
  604. return $word;
  605. }
  606. $e = $this->_appendHighlight;
  607. return $e . $this->template_options['highlightSourceTokens'][token_name($token)] . $word;
  608. } else
  609. {
  610. $this->_setHighlightCache(false, false);
  611. $e = $this->_appendHighlight;
  612. return $e . $word;
  613. }
  614. } else
  615. {
  616. if (isset($this->template_options['highlightSource'][$word]))
  617. {
  618. $newword = ($preformatted ? $word : $this->postProcess($word));
  619. if ($this->_setHighlightCache('highlightSource', $word)) {
  620. return $newword;
  621. }
  622. $e = $this->_appendHighlight;
  623. return $e . $this->template_options['highlightSource'][$word] . $newword;
  624. } else
  625. {
  626. $this->_setHighlightCache(false, false);
  627. $e = $this->_appendHighlight;
  628. return $e . ($preformatted ? $word : $this->postProcess($word));
  629. }
  630. }
  631. }
  632. /**
  633. * Used to allow converters to format the source code of DocBlocks the way
  634. * they'd like.
  635. *
  636. * default returns it unchanged. Mainly used by the {@link HighlightParser}
  637. * {@internal
  638. * The method takes information from options.ini, the template options
  639. * file, specifically the [highlightDocBlockSourceTokens] section, and uses
  640. * it to enclose tokens.
  641. *
  642. * {@source}}}
  643. * @param string name of docblock token type
  644. * @param string contents of token
  645. * @param boolean whether the contents are preformatted or need modification
  646. * @return string
  647. */
  648. function highlightDocBlockSource($token, $word, $preformatted = false)
  649. {
  650. if (empty($word)) {
  651. $this->_setHighlightCache(false, false);
  652. $e = $this->_appendHighlight;
  653. return $e . $word;
  654. }
  655. if (isset($this->template_options['highlightDocBlockSourceTokens'][$token]))
  656. {
  657. if (!$preformatted) $word = $this->postProcess($word);
  658. if ($this->_setHighlightCache('highlightDocBlockSourceTokens', $token)) {
  659. return $word;
  660. }
  661. $e = $this->_appendHighlight;
  662. return $e . $this->template_options['highlightDocBlockSourceTokens'][$token] . $word;
  663. } else {
  664. $this->_setHighlightCache(false, false);
  665. $e = $this->_appendHighlight;
  666. return $e . ($preformatted ? $word : $this->postProcess($word));
  667. }
  668. }
  669. /**
  670. * Used to allow converters to format the source code of Tutorial XML the way
  671. * they'd like.
  672. *
  673. * default returns it unchanged. Mainly used by the {@link HighlightParser}
  674. * {@internal
  675. * The method takes information from options.ini, the template options
  676. * file, specifically the [highlightDocBlockSourceTokens] section, and uses
  677. * it to enclose tokens.
  678. *
  679. * {@source}}}
  680. * @param string name of docblock token type
  681. * @param string contents of token
  682. * @param boolean whether the contents are preformatted or need modification
  683. * @return string
  684. */
  685. function highlightTutorialSource($token, $word, $preformatted = false)
  686. {
  687. if (empty($word)) {
  688. $this->_setHighlightCache(false, false);
  689. $e = $this->_appendHighlight;
  690. return $e . $word;
  691. }
  692. if (isset($this->template_options['highlightTutorialSourceTokens'][$token]))
  693. {
  694. if (!$preformatted) $word = $this->postProcess($word);
  695. if ($this->_setHighlightCache('highlightTutorialSourceTokens', $token)) {
  696. return $word;
  697. }
  698. $e = $this->_appendHighlight;
  699. return $e . $this->template_options['highlightTutorialSourceTokens'][$token] . $word;
  700. } else {
  701. $this->_setHighlightCache(false, false);
  702. $e = $this->_appendHighlight;
  703. return $e . ($preformatted ? $word : $this->postProcess($word));
  704. }
  705. }
  706. /**
  707. * Called by {@link parserReturnTag::Convert()} to allow converters to
  708. * change type names to desired formatting
  709. *
  710. * Used by {@link XMLDocBookConverter::type_adjust()} to change true and
  711. * false to the peardoc2 values
  712. * @param string
  713. * @return string
  714. */
  715. function type_adjust($typename)
  716. {
  717. return $typename;
  718. }
  719. /**
  720. * Used to convert the {@}example} inline tag in a docblock.
  721. *
  722. * By default, this just wraps ProgramExample
  723. * @see XMLDocBookpeardoc2Converter::exampleProgramExample
  724. * @param string
  725. * @param boolean true if this is to highlight a tutorial <programlisting>
  726. * @return string
  727. */
  728. function exampleProgramExample($example, $tutorial = false, $inlinesourceparse = null/*false*/,
  729. $class = null/*false*/, $linenum = null/*false*/, $filesourcepath = null/*false*/)
  730. {
  731. return $this->ProgramExample($example, $tutorial, $inlinesourceparse, $class, $linenum, $filesourcepath);
  732. }
  733. /**
  734. * Used to convert the <<code>> tag in a docblock
  735. * @param string
  736. * @param boolean true if this is to highlight a tutorial <programlisting>
  737. * @return string
  738. */
  739. function ProgramExample($example, $tutorial = false, $inlinesourceparse = null/*false*/,
  740. $class = null/*false*/, $linenum = null/*false*/, $filesourcepath = null/*false*/)
  741. {
  742. $this->highlightingSource = true;
  743. if (tokenizer_ext)
  744. {
  745. $e = $example;
  746. if (!is_array($example))
  747. {
  748. $obj = new phpDocumentorTWordParser;
  749. $obj->setup($example);
  750. $e = $obj->getFileSource();
  751. $bOpenTagFound = false;
  752. foreach ($e as $ke => $ee)
  753. {
  754. foreach ($ee as $kee => $eee)
  755. {
  756. if ((int) $e[$ke][$kee][0] == T_OPEN_TAG)
  757. {
  758. $bOpenTagFound = true;
  759. }
  760. }
  761. }
  762. if (!$bOpenTagFound) {
  763. $example = "<?php\n".$example;
  764. $obj->setup($example);
  765. $e = $obj->getFileSource();
  766. unset($e[0]);
  767. $e = array_values($e);
  768. }
  769. unset($obj);
  770. }
  771. $saveclass = $this->class;
  772. $parser = new phpDocumentor_HighlightParser;
  773. if (!isset($inlinesourceparse))
  774. {
  775. $example = $parser->parse($e, $this, true); // force php mode
  776. } else
  777. {
  778. if (isset($filesourcepath))
  779. {
  780. $example = $parser->parse($e, $this, $inlinesourceparse, $class, $linenum, $filesourcepath);
  781. } elseif (isset($linenum))
  782. {
  783. $example = $parser->parse($e, $this, $inlinesourceparse, $class, $linenum);
  784. } elseif (isset($class))
  785. {
  786. $example = $parser->parse($e, $this, $inlinesourceparse, $class);
  787. } else
  788. {
  789. $example = $parser->parse($e, $this, $inlinesourceparse);
  790. }
  791. }
  792. $this->class = $saveclass;
  793. } else
  794. {
  795. $example = $this->postProcess($example);
  796. }
  797. $this->highlightingSource = false;
  798. if ($tutorial)
  799. {
  800. return $example;
  801. }
  802. if (!isset($this->template_options['desctranslate'])) return $example;
  803. if (!isset($this->template_options['desctranslate']['code'])) return $example;
  804. $example = $this->template_options['desctranslate']['code'] . $example;
  805. if (!isset($this->template_options['desctranslate']['/code'])) return $example;
  806. return $example . $this->template_options['desctranslate']['/code'];
  807. }
  808. /**
  809. * @param string
  810. */
  811. function TutorialExample($example)
  812. {
  813. $this->highlightingSource = true;
  814. $parse = new phpDocumentor_TutorialHighlightParser;
  815. $x = $parse->parse($example, $this);
  816. $this->highlightingSource = false;
  817. return $x;
  818. }
  819. /**
  820. * Used to convert the contents of <<li>> in a docblock
  821. * @param string
  822. * @return string
  823. */
  824. function ListItem($item)
  825. {
  826. if (!isset($this->template_options['desctranslate'])) return $item;
  827. if (!isset($this->template_options['desctranslate']['li'])) return $item;
  828. $item = $this->template_options['desctranslate']['li'] . $item;
  829. if (!isset($this->template_options['desctranslate']['/li'])) return $item;
  830. return $item . $this->template_options['desctranslate']['/li'];
  831. }
  832. /**
  833. * Used to convert the contents of <<ol>> or <<ul>> in a docblock
  834. * @param string
  835. * @return string
  836. */
  837. function EncloseList($list,$ordered)
  838. {
  839. $listname = ($ordered ? 'ol' : 'ul');
  840. if (!isset($this->template_options['desctranslate'])) return $list;
  841. if (!isset($this->template_options['desctranslate'][$listname])) return $list;
  842. $list = $this->template_options['desctranslate'][$listname] . $list;
  843. if (!isset($this->template_options['desctranslate']['/'.$listname])) return $list;
  844. return $list . $this->template_options['desctranslate']['/'.$listname];
  845. }
  846. /**
  847. * Used to convert the contents of <<pre>> in a docblock
  848. * @param string
  849. * @return string
  850. */
  851. function PreserveWhiteSpace($string)
  852. {
  853. if (!isset($this->template_options['desctranslate'])) return $string;
  854. if (!isset($this->template_options['desctranslate']['pre'])) return $string;
  855. $string = $this->template_options['desctranslate']['pre'] . $string;
  856. if (!isset($this->template_options['desctranslate']['/pre'])) return $string;
  857. return $string . $this->template_options['desctranslate']['/pre'];
  858. }
  859. /**
  860. * Used to enclose a paragraph in a docblock
  861. * @param string
  862. * @return string
  863. */
  864. function EncloseParagraph($para)
  865. {
  866. if (!isset($this->template_options['desctranslate'])) return $para;
  867. if (!isset($this->template_options['desctranslate']['p'])) return $para;
  868. $para = $this->template_options['desctranslate']['p'] . $para;
  869. if (!isset($this->template_options['desctranslate']['/p'])) return $para;
  870. return $para . $this->template_options['desctranslate']['/p'];
  871. }
  872. /**
  873. * Used to convert the contents of <<b>> in a docblock
  874. * @param string
  875. * @return string
  876. */
  877. function Bolden($para)
  878. {
  879. if (!isset($this->template_options['desctranslate'])) return $para;
  880. if (!isset($this->template_options['desctranslate']['b'])) return $para;
  881. $para = $this->template_options['desctranslate']['b'] . $para;
  882. if (!isset($this->template_options['desctranslate']['/b'])) return $para;
  883. return $para . $this->template_options['desctranslate']['/b'];
  884. }
  885. /**
  886. * Used to convert the contents of <<i>> in a docblock
  887. * @param string
  888. * @return string
  889. */
  890. function Italicize($para)
  891. {
  892. if (!isset($this->template_options['desctranslate'])) return $para;
  893. if (!isset($this->template_options['desctranslate']['i'])) return $para;
  894. $para = $this->template_options['desctranslate']['i'] . $para;
  895. if (!isset($this->template_options['desctranslate']['/i'])) return $para;
  896. return $para . $this->template_options['desctranslate']['/i'];
  897. }
  898. /**
  899. * Used to convert the contents of <<var>> in a docblock
  900. * @param string
  901. * @return string
  902. */
  903. function Varize($para)
  904. {
  905. if (!isset($this->template_options['desctranslate'])) return $para;
  906. if (!isset($this->template_options['desctranslate']['var'])) return $para;
  907. $para = $this->template_options['desctranslate']['var'] . $para;
  908. if (!isset($this->template_options['desctranslate']['/var'])) return $para;
  909. return $para . $this->template_options['desctranslate']['/var'];
  910. }
  911. /**
  912. * Used to convert the contents of <<kbd>> in a docblock
  913. * @param string
  914. * @return string
  915. */
  916. function Kbdize($para)
  917. {
  918. if (!isset($this->template_options['desctranslate'])) return $para;
  919. if (!isset($this->template_options['desctranslate']['kbd'])) return $para;
  920. $para = $this->template_options['desctranslate']['kbd'] . $para;
  921. if (!isset($this->template_options['desctranslate']['/kbd'])) return $para;
  922. return $para . $this->template_options['desctranslate']['/kbd'];
  923. }
  924. /**
  925. * Used to convert the contents of <<samp>> in a docblock
  926. * @param string
  927. * @return string
  928. */
  929. function Sampize($para)
  930. {
  931. if (!isset($this->template_options['desctranslate'])) return $para;
  932. if (!isset($this->template_options['desctranslate']['samp'])) return $para;
  933. $para = $this->template_options['desctranslate']['samp'] . $para;
  934. if (!isset($this->template_options['desctranslate']['/samp'])) return $para;
  935. return $para . $this->template_options['desctranslate']['/samp'];
  936. }
  937. /**
  938. * Used to convert <<br>> in a docblock
  939. * @param string
  940. * @return string
  941. */
  942. function Br($para)
  943. {
  944. if (!isset($this->template_options['desctranslate'])) return $para;
  945. if (!isset($this->template_options['desctranslate']['br'])) return $para;
  946. $para = $this->template_options['desctranslate']['br'] . $para;
  947. return $para;
  948. }
  949. /**
  950. * This version does nothing
  951. *
  952. * Perform necessary post-processing of string data. For example, the HTML
  953. * Converters should escape < and > to become &lt; and &gt;
  954. * @return string
  955. */
  956. function postProcess($text)
  957. {
  958. return $text;
  959. }
  960. /**
  961. * Creates a table of contents for a {@}toc} inline tag in a tutorial
  962. *
  963. * This function should return a formatted table of contents. By default, it
  964. * does nothing, it is up to the converter to format the TOC
  965. * @abstract
  966. * @return string table of contents formatted for use in the current output format
  967. * @param array format: array(array('tagname' => section, 'link' => returnsee link, 'id' => anchor name, 'title' => from title tag),...)
  968. */
  969. function formatTutorialTOC($toc)
  970. {
  971. return '';
  972. }
  973. /**
  974. * Write out the formatted source code for a php file
  975. *
  976. * This function provides the primary functionality for the
  977. * {@tutorial tags.filesource.pkg} tag.
  978. * @param string full path to the file
  979. * @param string fully highlighted/linked source code of the file
  980. * @abstract
  981. */
  982. function writeSource($filepath, $source)
  983. {
  984. debug($source);
  985. return;
  986. }
  987. /**
  988. * Write out the formatted source code for an example php file
  989. *
  990. * This function provides the primary functionality for the
  991. * {@tutorial tags.example.pkg} tag.
  992. * @param string example title
  993. * @param string example filename (no path)
  994. * @param string fully highlighted/linked source code of the file
  995. * @abstract
  996. */
  997. function writeExample($title, $path, $source)
  998. {
  999. return;
  1000. }
  1001. /** Translate the path info into a unique file name for the highlighted
  1002. * source code.
  1003. * @param string $pathinfo
  1004. * @return string
  1005. */
  1006. function getFileSourceName($path)
  1007. {
  1008. global $_phpDocumentor_options;
  1009. $pathinfo = $this->proceduralpages->getPathInfo($path, $this);
  1010. $pathinfo['source_loc'] = str_replace($_phpDocumentor_options['Program_Root'].'/','',$pathinfo['source_loc']);
  1011. $pathinfo['source_loc'] = str_replace('/','_',$pathinfo['source_loc']);
  1012. return "fsource_{$pathinfo['package']}_{$pathinfo['subpackage']}_{$pathinfo['source_loc']}";
  1013. }
  1014. /** Return the fixed path to the source-code file folder.
  1015. * @param string $base Path is relative to this folder
  1016. * @return string
  1017. */
  1018. function getFileSourcePath($base)
  1019. {
  1020. if (substr($base, strlen($base) - 1) != PATH_DELIMITER) {
  1021. $base .= PATH_DELIMITER;
  1022. }
  1023. return $base . '__filesource';
  1024. }
  1025. /** Return the path to the current
  1026. * @param string $pathinfo
  1027. * @return string
  1028. */
  1029. function getCurrentPageURL()
  1030. {
  1031. return '{$srcdir}' . PATH_DELIMITER . $this->page_dir;
  1032. }
  1033. /**
  1034. * @return string an output-format dependent link to phpxref-style highlighted
  1035. * source code
  1036. * @abstract
  1037. */
  1038. function getSourceLink($path)
  1039. {
  1040. return '';
  1041. }
  1042. /**
  1043. * @return string Link to the current page being parsed.
  1044. * Should return {@link $curname} and a converter-specific extension.
  1045. * @abstract
  1046. */
  1047. function getCurrentPageLink()
  1048. {
  1049. }
  1050. /**
  1051. * Return a line of highlighted source code with formatted line number
  1052. *
  1053. * If the $path is a full path, then an anchor to the line number will be
  1054. * added as well
  1055. * @param integer line number
  1056. * @param string highlighted source code line
  1057. * @param false|string full path to @filesource file this line is a part of,
  1058. * if this is a single line from a complete file.
  1059. * @return string formatted source code line with line number
  1060. */
  1061. function sourceLine($linenumber, $line, $path = false)
  1062. {
  1063. if ($path)
  1064. {
  1065. return $this->getSourceAnchor($path, $linenumber) .
  1066. $this->Br(sprintf('%-6u',$linenumber).str_replace("\n",'',$line));
  1067. } else
  1068. {
  1069. return $this->Br(sprintf('%-6u',$linenumber).str_replace("\n",'',$line));
  1070. }
  1071. }
  1072. /**
  1073. * Determine whether an element's file has generated source code, used for
  1074. * linking to line numbers of source.
  1075. *
  1076. * Wrapper for {@link $sourcePaths} in this version
  1077. *
  1078. * {@internal since file paths get stored with most/all slashes
  1079. * set to forward slash '/', we need to doublecheck that
  1080. * we're not given a backslashed path to search for...
  1081. * if we are, it's likely that it was originally stored
  1082. * with a forward slash. Further, I'm not convinced it's safe
  1083. * to just check the {@link PHPDOCUMENTOR_WINDOWS} flag, so I'm checking
  1084. * specifically for backslashes intead.}}
  1085. *
  1086. * @param string full path to the source code file
  1087. * @return boolean
  1088. */
  1089. function hasSourceCode($path)
  1090. {
  1091. return isset($this->sourcePaths[$path]);
  1092. if (strpos($path, '\\') > -1) {
  1093. $modifiedPath = str_replace('\\', '/', $path);
  1094. return isset($this->sourcePaths[$modifiedPath]);
  1095. } else {
  1096. return isset($this->sourcePaths[$path]);
  1097. }
  1098. }
  1099. /**
  1100. * Mark a file as having had source code highlighted
  1101. * @param string full path of source file
  1102. */
  1103. function setSourcePaths($path)
  1104. {
  1105. $this->sourcePaths[$path] = true;
  1106. }
  1107. /**
  1108. * Used to translate an XML DocBook entity like &rdquo; from a tutorial by
  1109. * reading the options.ini file for the template.
  1110. * @param string entity name
  1111. */
  1112. function TranslateEntity($name)
  1113. {
  1114. if (!isset($this->template_options['ppage']))
  1115. {
  1116. if (!$this->template_options['preservedocbooktags'])
  1117. return '';
  1118. else
  1119. return '&'.$name.';';
  1120. }
  1121. if (isset($this->template_options['ppage']['&'.$name.';']))
  1122. {
  1123. return $this->template_options['ppage']['&'.$name.';'];
  1124. } else
  1125. {
  1126. if (!$this->template_options['preservedocbooktags'])
  1127. return '';
  1128. else
  1129. return '&'.$name.';';
  1130. }
  1131. }
  1132. /**
  1133. * Used to translate an XML DocBook tag from a tutorial by reading the
  1134. * options.ini file for the template.
  1135. * @param string tag name
  1136. * @param string any attributes Format: array(name => value)
  1137. * @param string the tag contents, if any
  1138. * @param string the tag contents, if any, unpost-processed
  1139. * @return string
  1140. */
  1141. function TranslateTag($name,$attr,$cdata,$unconvertedcdata)
  1142. {
  1143. if (!isset($this->template_options['ppage']))
  1144. {
  1145. if (!$this->template_options['preservedocbooktags'])
  1146. return $cdata;
  1147. else
  1148. return '<'.$name.$this->AttrToString($name,$attr,true).'>'.$cdata.'</'.$name.'>'."\n";
  1149. }
  1150. // make sure this template transforms the tag into something
  1151. if (isset($this->template_options['ppage'][$name]))
  1152. {
  1153. // test for global attribute transforms like $attr$role = class, changing
  1154. // all role="*" attributes to class="*" in html, for example
  1155. foreach($attr as $att => $val)
  1156. {
  1157. if (isset($this->template_options['$attr$'.$att]))
  1158. {
  1159. $new = '';
  1160. if (!isset($this->template_options['$attr$'.$att]['close']))
  1161. {
  1162. $new .= '<'.$this->template_options['$attr$'.$att]['open'];
  1163. if (isset($this->template_options['$attr$'.$att]['cdata!']))
  1164. {
  1165. if (isset($this->template_options['$attr$'.$att]['separateall']))
  1166. $new .= $this->template_options['$attr$'.$att]['separator'];
  1167. else
  1168. $new .= ' ';
  1169. $new .= $this->template_options['$attr$'.$att]['$'.$att];
  1170. $new .= $this->template_options['$attr$'.$att]['separator'];
  1171. if ($this->template_options['$attr$'.$att]['quotevalues']) $val = '"'.$val.'"';
  1172. $new .= $val.'>';
  1173. } else
  1174. {
  1175. $new .= '>'.$val;
  1176. }
  1177. $new .= '</'.$this->template_options['$attr$'.$att]['open'].'>';
  1178. } else
  1179. {
  1180. $new .= $this->template_options['$attr$'.$att]['open'] . $val . $this->template_options['$attr$'.$att]['close'];
  1181. }
  1182. unset($attr[$att]);
  1183. $cdata = $new . $cdata;
  1184. }
  1185. }
  1186. if (!isset($this->template_options['ppage']['/'.$name]))
  1187. {// if the close tag isn't specified, we put opening and closing tags around it, with translated attributes
  1188. if (isset($this->template_options['ppage'][$name.'/']))
  1189. $cdata = '<'.$this->template_options['ppage'][$name].$this->AttrToString($name,$attr).'/>' . $cdata;
  1190. else
  1191. $cdata = '<'.$this->template_options['ppage'][$name].$this->AttrToString($name,$attr).'>' . $cdata .
  1192. '</'.$this->template_options['ppage'][$name].'>';
  1193. } else
  1194. { // if close tag is specified, use the open and close as literal
  1195. if ($name == 'programlisting' && isset($attr['role']) &&
  1196. ($attr['role'] == 'php' || $attr['role'] == 'tutorial' || $attr['role'] == 'html'))
  1197. { // highlight PHP source
  1198. // var_dump($unconvertedcdata, $cdata);exit;
  1199. if ($attr['role'] == 'php') {
  1200. $cdata = $this->ProgramExample($unconvertedcdata, true);
  1201. } elseif ($attr['role'] == 'tutorial') {
  1202. $cdata = $this->TutorialExample($unconvertedcdata);
  1203. } elseif ($attr['role'] == 'html') {
  1204. $cdata = $unconvertedcdata;
  1205. }
  1206. } else
  1207. {// normal case below
  1208. $cdata = $this->template_options['ppage'][$name].$this->AttrToString($name,$attr). $cdata .$this->template_options['ppage']['/'.$name];
  1209. }
  1210. }
  1211. return $cdata;
  1212. } else
  1213. {
  1214. if ($this->template_options['preservedocbooktags'])
  1215. {
  1216. return '<'.$name.$this->AttrToString($name,$attr,true).'>' . $cdata .
  1217. '</'.$name.'>'."\n";
  1218. } else
  1219. {
  1220. return $cdata;
  1221. }
  1222. }
  1223. }
  1224. /**
  1225. * Convert the attribute of a Tutorial docbook tag's attribute list
  1226. * to a string based on the template options.ini
  1227. * @param string tag name
  1228. * @param attribute array
  1229. * @param boolean if true, returns attrname="value"...
  1230. * @return string
  1231. */
  1232. function AttrToString($tag,$attr,$unmodified = false)
  1233. {
  1234. $ret = '';
  1235. if ($unmodified)
  1236. {
  1237. $ret = ' ';
  1238. foreach($attr as $n => $v)
  1239. {
  1240. $ret .= $n.' = "'.$v.'"';
  1241. }
  1242. return $ret;
  1243. }
  1244. // no_attr tells us to ignore all attributes
  1245. if (isset($this->template_options['no_attr'])) return $ret;
  1246. // tagname! tells us to ignore all attributes for this tag
  1247. if (isset($this->template_options['ppage'][$tag.'!'])) return $ret;
  1248. if (count($attr)) $ret = ' ';
  1249. // pass 1, check to see if any attributes add together
  1250. $same = array();
  1251. foreach($attr as $n => $v)
  1252. {
  1253. if (isset($this->template_options['ppage'][$tag.'->'.$n]))
  1254. {
  1255. $same[$this->template_options['ppage'][$tag.'->'.$n]][] = $n;
  1256. }
  1257. }
  1258. foreach($attr as $n => $v)
  1259. {
  1260. if (isset($this->template_options['ppage'][$tag.'->'.$n]))
  1261. {
  1262. if (count($same[$this->template_options['ppage'][$tag.'->'.$n]]) == 1)
  1263. { // only 1 attribute translated for this one
  1264. // this is useful for equivalent value names
  1265. if (isset($this->template_options['ppage'][$tag.'->'.$n.'+'.$v])) $v = $this->template_options['ppage'][$tag.'->'.$n.'+'.$v];
  1266. } else
  1267. { // more than 1 attribute combines to make the new attribute
  1268. $teststrtemp = array();
  1269. foreach($same[$this->template_options['ppage'][$tag.'->'.$n]] as $oldattr)
  1270. {
  1271. $teststrtemp[] = $oldattr.'+'.$attr[$oldattr];
  1272. }
  1273. $teststrs = array();
  1274. $num = count($same[$this->template_options['ppage'][$tag.'->'.$n]]);
  1275. for($i=0;$i<$num;$i++)
  1276. {
  1277. $started = false;
  1278. $a = '';
  1279. for($j=$i;!$started || $j != $i;$j = ($j + $i) % $num)
  1280. {
  1281. if (!empty($a)) $a .= '|';
  1282. $a .= $teststrtemp[$j];
  1283. }
  1284. $teststrs[$i] = $a;
  1285. }
  1286. $done = false;
  1287. foreach($teststrs as $test)
  1288. {
  1289. if ($done) break;
  1290. if (isset($this->template_options['ppage'][$tag.'->'.$test]))
  1291. {
  1292. $done = true;
  1293. $v = $this->template_options['ppage'][$tag.'->'.$test];
  1294. }
  1295. }
  1296. }
  1297. $ret .= $this->template_options['ppage'][$tag.'->'.$n].' = "'.$v.'"';
  1298. } else
  1299. {
  1300. if (!isset($this->template_options['ppage'][$tag.'!'.$n]))
  1301. {
  1302. if (isset($this->template_options['ppage']['$attr$'.$n]))
  1303. $ret .= $this->template_options['ppage']['$attr$'.$n].' = "'.$v.'"';
  1304. else
  1305. $ret .= $n.' = "'.$v.'"';
  1306. }
  1307. }
  1308. }
  1309. return $ret;
  1310. }
  1311. /**
  1312. * Convert the title of a Tutorial docbook tag section
  1313. * to a string based on the template options.ini
  1314. * @param string tag name
  1315. * @param array
  1316. * @param string title text
  1317. * @param string
  1318. * @return string
  1319. */
  1320. function ConvertTitle($tag,$attr,$title,$cdata)
  1321. {
  1322. if (!isset($this->template_options[$tag.'_title'])) return array($attr,$cdata);
  1323. if (isset($this->template_options[$tag.'_title']['tag_attr']))
  1324. {
  1325. $attr[$this->template_options[$tag.'_title']['tag_attr']] = urlencode($cdata);
  1326. $cdata = '';
  1327. } elseif(isset($this->template_options[$tag.'_title']['cdata_start']))
  1328. {
  1329. $cdata = $this->template_options[$tag.'_title']['open'] . $title .
  1330. $this->template_options[$tag.'_title']['close'] . $cdata;
  1331. } else $cdata = $title.$cdata;
  1332. return array($attr,$cdata);
  1333. }
  1334. /**
  1335. * Return a converter-specific id to distinguish tutorials and their
  1336. * sections
  1337. *
  1338. * Used by {@}id}
  1339. * @return string
  1340. */
  1341. function getTutorialId($package,$subpackage,$tutorial,$id)
  1342. {
  1343. return $package.$subpackage.$tutorial.$id;
  1344. }
  1345. /**
  1346. * Create the {@link $elements, $pkg_elements} and {@link $links} arrays
  1347. * @access private
  1348. * @todo version 2.0 - faulty package_ou…

Large files files are truncated, but you can click here to view the full file