phpDocumentor
[ class tree: phpDocumentor ] [ index: phpDocumentor ] [ all elements ]

Source for file DocBlockTags.inc

Documentation is available at DocBlockTags.inc

  1. <?php
  2. /**
  3.  * All abstract representations of DocBlock tags are defined
  4.  * by the classes in this file
  5.  *
  6.  * phpDocumentor :: automatic documentation generator
  7.  * 
  8.  * PHP versions 4 and 5
  9.  *
  10.  * Copyright (c) 2002-2008 Gregory Beaver
  11.  * 
  12.  * LICENSE:
  13.  * 
  14.  * This library is free software; you can redistribute it
  15.  * and/or modify it under the terms of the GNU Lesser General
  16.  * Public License as published by the Free Software Foundation;
  17.  * either version 2.1 of the License, or (at your option) any
  18.  * later version.
  19.  * 
  20.  * This library is distributed in the hope that it will be useful,
  21.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23.  * Lesser General Public License for more details.
  24.  * 
  25.  * You should have received a copy of the GNU Lesser General Public
  26.  * License along with this library; if not, write to the Free Software
  27.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  28.  *
  29.  * @category   ToolsAndUtilities
  30.  * @package    phpDocumentor
  31.  * @subpackage DocBlockTags
  32.  * @author     Greg Beaver <cellog@php.net>
  33.  * @copyright  2002-2008 Gregory Beaver
  34.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  35.  * @version    CVS: $Id: DocBlockTags.inc 287889 2009-08-30 07:27:39Z ashnazg $
  36.  * @filesource
  37.  * @link       http://www.phpdoc.org
  38.  * @link       http://pear.php.net/PhpDocumentor
  39.  * @see        parserDocBlock, parserInclude, parserPage, parserClass
  40.  * @see        parserDefine, parserFunction, parserMethod, parserVar
  41.  * @since      separate file since version 1.2
  42.  * @todo       CS cleanup - change package to PhpDocumentor
  43.  */
  44. /**
  45.  * used to represent standard tags like @access, etc.
  46.  * This class is aware of inline tags, and will automatically handle them
  47.  * using inherited functions
  48.  *
  49.  * @category   ToolsAndUtilities
  50.  * @package    phpDocumentor
  51.  * @subpackage DocBlockTags
  52.  * @author     Greg Beaver <cellog@php.net>
  53.  * @copyright  2002-2008 Gregory Beaver
  54.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  55.  * @version    Release: @VER@
  56.  * @link       http://www.phpdoc.org
  57.  * @link       http://pear.php.net/PhpDocumentor
  58.  * @since      1.0rc1
  59.  * @todo       CS cleanup - change package to PhpDocumentor
  60.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  61.  */
  62. class parserTag extends parserStringWithInlineTags
  63. {
  64.     /**
  65.      * Type is used by many functions to skip the hassle of
  66.      * if phpDocumentor_get_class($blah) == 'parserBlah' always '_tag'
  67.      * @var string 
  68.      */
  69.     var $type = '_tag';
  70.     /**
  71.      * tag name (see, access, etc.)
  72.      * @var string 
  73.      */
  74.     var $keyword = '';
  75.    
  76.     /**
  77.      * Set up the tag
  78.      *
  79.      * {@source } 
  80.      *
  81.      * @param string                     $keyword tag name
  82.      * @param parserStringWithInlineTags $value   tag value
  83.      * @param boolean                    $noparse whether to parse the $value
  84.      *                                             for html tags
  85.      */
  86.     function parserTag($keyword$value$noparse false)
  87.     {
  88.         $this->keyword = $keyword;
  89.         if (!$noparse{
  90.             $parser new parserDescParser;
  91.             $parser->subscribe('*'$this);
  92.             $parser->parse($value->valuetrue'parserstringwithinlinetags');
  93.         else 
  94.             $this->value = $value
  95.         }
  96.     }
  97.    
  98.     /**
  99.      * Perform the output conversion on this {@link parserTag}
  100.      * using the {@link Converter output converter} that is passed in
  101.      *
  102.      * @param Converter &$converter the converter object
  103.      *
  104.      * @return string 
  105.      * @see Converter
  106.      * @todo CS cleanup - rename to convert for camelCase rule
  107.      */
  108.     function Convert(&$converter)
  109.     {
  110.         if (is_array($this->value)) {
  111.             if (count($this->value== 1{
  112.                 reset($this->value);
  113.                 list($valeach($this->value);
  114.                 $a           $val->Convert($converter);
  115.                 return $a;
  116.             }
  117.             $result '';
  118.             foreach ($this->value as $val{
  119.                 // this is only true if we processed the description
  120.                 // in the constructor
  121.                 if (phpDocumentor_get_class($val
  122.                         == 'parserstringwithinlinetags'{
  123.                     $result .= $converter->
  124.                         EncloseParagraph($val->Convert($converter));
  125.                 else {
  126.                     $result .= $val->Convert($converter);
  127.                 }
  128.             }
  129.             return $result;
  130.         else {
  131.             $a $this->value->Convert($converter);
  132.             return $a;
  133.         }
  134.     }
  135.    
  136.     /**
  137.      * Gets a count of the number of paragraphs in this
  138.      * tag's description.
  139.      *
  140.      * Useful in determining whether to enclose the
  141.      * tag in a paragraph or not.
  142.      *
  143.      * @return integer (actually, body is empty, so it doesn't return at all)
  144.      * @access private
  145.      * @todo does this need to be implemented?  its body is empty
  146.      */
  147.     function _valueParagraphCount()
  148.     {
  149.     }
  150.    
  151.     /**
  152.      * Called by the {@link parserDescParser} when processing a description.
  153.      *
  154.      * @param integer $a    not used
  155.      * @param array   $desc array of {@link parserStringWithInlineTags}
  156.      *                       representing paragraphs in the tag description
  157.      *
  158.      * @return void 
  159.      * @see parserTag::parserTag()
  160.      * @todo CS cleanup - rename to handleEvent for camelCase rule
  161.      */
  162.     function HandleEvent($a,$desc)
  163.     {
  164.         $this->value = $desc;
  165.     }
  166.    
  167.     /**
  168.      * Returns the text minus any inline tags
  169.      *
  170.      * @return string the text minus any inline tags
  171.      * @see parserStringWithInlineTags::getString()
  172.      */
  173.     function getString()
  174.     {
  175.         if (is_array($this->value)) {
  176.             $result '';
  177.             foreach ($this->value as $val{
  178.                 $result .= $val->getString();
  179.             }
  180.             return $result;
  181.         else {
  182.             return $this->value->getString();
  183.         }
  184.     }
  185. }
  186.  
  187. /**
  188.  * This class represents the @name tag
  189.  *
  190.  * @category   ToolsAndUtilities
  191.  * @package    phpDocumentor
  192.  * @subpackage DocBlockTags
  193.  * @author     Greg Beaver <cellog@php.net>
  194.  * @copyright  2002-2008 Gregory Beaver
  195.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  196.  * @version    Release: @VER@
  197.  * @link       http://www.phpdoc.org
  198.  * @link       http://pear.php.net/PhpDocumentor
  199.  * @tutorial   tags.name.pkg
  200.  * @todo       CS cleanup - change package to PhpDocumentor
  201.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  202.  */
  203. class parserNameTag extends parserTag
  204. {
  205.     /**
  206.      * tag name
  207.      * @var string 
  208.      */
  209.     var $keyword = 'name';
  210.    
  211.     /**
  212.      * set up the name tag
  213.      *
  214.      * @param string $name  tag name (not used)
  215.      * @param string $value tag value
  216.      */
  217.     function parserNameTag($name$value)
  218.     {
  219.         $this->value = $value;
  220.     }
  221.    
  222.     /**
  223.      * process this tag through the given output converter
  224.      *
  225.      * @param Converter &$c output converter
  226.      *
  227.      * @return string converted value of the tag
  228.      * @see parserStringWithInlineTags::Convert()
  229.      * @todo CS cleanup - rename to convert for camelCase rule
  230.      */
  231.     function Convert(&$c)
  232.     {
  233.         return $this->value;
  234.     }
  235. }
  236.  
  237. /**
  238.  * This class represents the @access tag
  239.  *
  240.  * @category   ToolsAndUtilities
  241.  * @package    phpDocumentor
  242.  * @subpackage DocBlockTags
  243.  * @author     Greg Beaver <cellog@php.net>
  244.  * @copyright  2002-2008 Gregory Beaver
  245.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  246.  * @version    Release: @VER@
  247.  * @link       http://www.phpdoc.org
  248.  * @link       http://pear.php.net/PhpDocumentor
  249.  * @tutorial   tags.access.pkg
  250.  * @todo       CS cleanup - change package to PhpDocumentor
  251.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  252.  */
  253. class parserAccessTag extends parserTag
  254. {
  255.     /**
  256.      * tag name
  257.      * @var string 
  258.      */
  259.     var $keyword = 'access';
  260.    
  261.     /**
  262.      * set to true if the returned tag has a value type of private, protected
  263.      * or public, false otherwise
  264.      * @var boolean 
  265.      */
  266.     var $isvalid = false;
  267.    
  268.     /**
  269.      * checks $value to make sure it is private, protected or public, otherwise
  270.      * it's not a valid @access tag
  271.      *
  272.      * @param parserStringWithInlineTags $value the tag value
  273.      *
  274.      * @see $isvalid
  275.      */
  276.     function parserAccessTag($value)
  277.     {
  278.         if (!is_string($value)) {
  279.             if (is_object($value)) {
  280.                 if (method_exists($value'getstring')) {
  281.                     $value $value->getString();
  282.                 }
  283.             }
  284.         }
  285.         switch(trim($value)) {
  286.         case 'private' :
  287.         case 'public' :
  288.         case 'protected' :
  289.             $this->value   = $value;
  290.             $this->isvalid = true;
  291.             break;
  292.         default :
  293.             addError(PDERROR_ACCESS_WRONG_PARAM$value);
  294.             $this->value = 'public';
  295.             break;
  296.         }
  297.     }
  298.    
  299.     /**
  300.      * process this tag through the given output converter
  301.      *
  302.      * @param Converter &$converter the output converter
  303.      *
  304.      * @return string converted value of the tag
  305.      * @see parserStringWithInlineTags::Convert()
  306.      * @todo CS cleanup - rename to convert for camelCase rule
  307.      */
  308.     function Convert(&$converter)
  309.     {
  310.         return $this->value;
  311.     }
  312.    
  313.     /**
  314.      * No inline tags are possible, returns 'public', 'protected' or 'private'
  315.      *
  316.      * @return string returns the text minus any inline tags
  317.      */
  318.     function getString()
  319.     {
  320.         return $this->value;
  321.     }
  322. }
  323.  
  324. /**
  325.  * represents the "@return" tag
  326.  *
  327.  * @category   ToolsAndUtilities
  328.  * @package    phpDocumentor
  329.  * @subpackage DocBlockTags
  330.  * @author     Greg Beaver <cellog@php.net>
  331.  * @copyright  2002-2008 Gregory Beaver
  332.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  333.  * @version    Release: @VER@
  334.  * @link       http://www.phpdoc.org
  335.  * @link       http://pear.php.net/PhpDocumentor
  336.  * @tutorial   tags.return.pkg
  337.  * @since      1.0rc1
  338.  * @todo       CS cleanup - change package to PhpDocumentor
  339.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  340.  */
  341. class parserReturnTag extends parserTag
  342. {
  343.     /**
  344.      * always 'return'
  345.      * @var string 
  346.      */
  347.     var $keyword = 'return';
  348.     /**
  349.      * the type a function returns
  350.      */
  351.     var $returnType = 'void';
  352.    
  353.     /**
  354.      * contains a link to the documentation for a class
  355.      * passed as a type in @return, @var or @param
  356.      *
  357.      * Example:
  358.      *
  359.      * <code>
  360.      * class myclass
  361.      * {
  362.      * ...
  363.      * }
  364.      * /** @return myclass blahblahblah
  365.      * ...
  366.      * </code>
  367.      *
  368.      * In this case, $converted_returnType will contain a link to myclass
  369.      * instead of the string 'myclass'
  370.      *
  371.      * @var mixed either the same as $returnType or a link to the docs for a class
  372.      * @see $returnType
  373.      */
  374.     var $converted_returnType = false;
  375.    
  376.     /**
  377.      * set up the tag
  378.      *
  379.      * @param string                     $returnType returned datatype
  380.      * @param parserStringWithInlineTags $value      tag value
  381.      */
  382.     function parserReturnTag($returnType$value)
  383.     {
  384.         $this->returnType = $returnType;
  385.         parent::parserTag('return'$value);
  386.     }
  387.    
  388.     /**
  389.      * process this tag through the given output converter
  390.      * (sets up the $converted_returnType)
  391.      *
  392.      * @param Converter &$converter the output converter
  393.      *
  394.      * @return string converted value of the tag
  395.      * @see parserStringWithInlineTags::Convert(), $converted_returnType
  396.      * @todo CS cleanup - rename to convert for camelCase rule
  397.      */
  398.     function Convert(&$converter)
  399.     {
  400.         $my_types '';
  401.         if (strpos($this->returnType'|')) {
  402.             $types explode('|'$this->returnType);
  403.             foreach ($types as $returntype{
  404.                 $a $converter->getLink($returntype);
  405.                 if (is_object($a&& phpDocumentor_get_class($a== 'classlink'{
  406.                     if (!empty($my_types)) {
  407.                         $my_types .= '|';
  408.                     }
  409.                     $my_types .= $converter->
  410.                         returnSee($a$converter->type_adjust($returntype));
  411.                 else {
  412.                     if (!empty($my_types)) {
  413.                         $my_types .= '|';
  414.                     }
  415.                     $my_types .= $converter->type_adjust($returntype);
  416.                 }
  417.             }
  418.             $this->converted_returnType = $my_types;
  419.         else {
  420.             $a $converter->getLink($this->returnType);
  421.             if (is_object($a&& phpDocumentor_get_class($a== 'classlink'{
  422.                 $this->converted_returnType = $converter->
  423.                     returnSee($a$converter->type_adjust($this->returnType));
  424.             else {
  425.                 $this->converted_returnType = $converter->
  426.                     type_adjust($this->returnType);
  427.             }
  428.         }
  429.         return parserTag::Convert($converter);
  430.     }
  431. }
  432.  
  433. /**
  434.  * represents the "@property" tag
  435.  *
  436.  * @category   ToolsAndUtilities
  437.  * @package    phpDocumentor
  438.  * @subpackage DocBlockTags
  439.  * @author     Greg Beaver <cellog@php.net>
  440.  * @copyright  2002-2008 Gregory Beaver
  441.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  442.  * @version    Release: @VER@
  443.  * @link       http://www.phpdoc.org
  444.  * @link       http://pear.php.net/PhpDocumentor
  445.  * @tutorial   tags.property.pkg
  446.  * @since      1.4.0a1
  447.  * @todo       CS cleanup - change package to PhpDocumentor
  448.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  449.  */
  450. class parserPropertyTag extends parserReturnTag
  451. {
  452.     /**
  453.      * always 'property'
  454.      * @var string 
  455.      */
  456.     var $keyword = 'property';
  457.     /**
  458.      * the type a property has
  459.      * @var string 
  460.      */
  461.     var $returnType = 'mixed';
  462.  
  463.     /**
  464.      * set up the property tag
  465.      *
  466.      * @param string                     $returnType the tag value's datatype
  467.      * @param parserStringWithInlineTags $value      the tag value
  468.      */
  469.     function parserPropertyTag($returnType$value)
  470.     {
  471.         $this->returnType = $returnType;
  472.         parent::parserTag($this->keyword$value);
  473.     }
  474. }
  475.  
  476. /**
  477.  * represents the "@property-read" tag
  478.  *
  479.  * @category   ToolsAndUtilities
  480.  * @package    phpDocumentor
  481.  * @subpackage DocBlockTags
  482.  * @author     Greg Beaver <cellog@php.net>
  483.  * @copyright  2002-2008 Gregory Beaver
  484.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  485.  * @version    Release: @VER@
  486.  * @link       http://www.phpdoc.org
  487.  * @link       http://pear.php.net/PhpDocumentor
  488.  * @tutorial   tags.property.pkg
  489.  * @since      1.4.0a1
  490.  * @todo       CS cleanup - change package to PhpDocumentor
  491.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  492.  */
  493. class parserPropertyReadTag extends parserPropertyTag
  494. {
  495.     /**
  496.      * always 'property-read'
  497.      * @var string 
  498.      */
  499.     var $keyword = 'property-read';
  500. }
  501.  
  502. /**
  503.  * represents the "@property-write" tag
  504.  *
  505.  * @category   ToolsAndUtilities
  506.  * @package    phpDocumentor
  507.  * @subpackage DocBlockTags
  508.  * @author     Greg Beaver <cellog@php.net>
  509.  * @copyright  2002-2008 Gregory Beaver
  510.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  511.  * @version    Release: @VER@
  512.  * @link       http://www.phpdoc.org
  513.  * @link       http://pear.php.net/PhpDocumentor
  514.  * @tutorial   tags.property.pkg
  515.  * @since      1.4.0a1
  516.  * @todo       CS cleanup - change package to PhpDocumentor
  517.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  518.  */
  519. class parserPropertyWriteTag extends parserPropertyTag
  520. {
  521.     /**
  522.      * always 'property-write'
  523.      * @var string 
  524.      */
  525.     var $keyword = 'property-write';
  526. }
  527.  
  528. /**
  529.  * represents the "@method" tag
  530.  *
  531.  * @category   ToolsAndUtilities
  532.  * @package    phpDocumentor
  533.  * @subpackage DocBlockTags
  534.  * @author     Greg Beaver <cellog@php.net>
  535.  * @copyright  2002-2008 Gregory Beaver
  536.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  537.  * @version    Release: @VER@
  538.  * @link       http://www.phpdoc.org
  539.  * @link       http://pear.php.net/PhpDocumentor
  540.  * @tutorial   tags.method.pkg
  541.  * @since      1.4.0a1
  542.  * @todo       CS cleanup - change package to PhpDocumentor
  543.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  544.  */
  545. class parserMethodTag extends parserPropertyTag
  546. {
  547.     /**
  548.      * always 'method'
  549.      * @var string 
  550.      */
  551.     var $keyword = 'method';
  552.     /**
  553.      * the return type a method has
  554.      * @var string 
  555.      */
  556.     var $returnType = 'void';
  557. }
  558.  
  559. /**
  560.  * represents the "@var" tag
  561.  *
  562.  * @category   ToolsAndUtilities
  563.  * @package    phpDocumentor
  564.  * @subpackage DocBlockTags
  565.  * @author     Greg Beaver <cellog@php.net>
  566.  * @copyright  2002-2008 Gregory Beaver
  567.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  568.  * @version    Release: @VER@
  569.  * @link       http://www.phpdoc.org
  570.  * @link       http://pear.php.net/PhpDocumentor
  571.  * @tutorial   tags.var.pkg
  572.  * @since      1.0rc1
  573.  * @todo       CS cleanup - change package to PhpDocumentor
  574.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  575.  */
  576. class parserVarTag extends parserReturnTag
  577. {
  578.     /**
  579.      * always 'var'
  580.      * @var string 
  581.      */
  582.     var $keyword = 'var';
  583.     /**
  584.      * the type a var has
  585.      * @var string 
  586.      */
  587.     var $returnType = 'mixed';
  588. }
  589.  
  590. /**
  591.  * represents the "@param" tag
  592.  *
  593.  * @category   ToolsAndUtilities
  594.  * @package    phpDocumentor
  595.  * @subpackage DocBlockTags
  596.  * @author     Greg Beaver <cellog@php.net>
  597.  * @copyright  2002-2008 Gregory Beaver
  598.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  599.  * @version    Release: @VER@
  600.  * @link       http://www.phpdoc.org
  601.  * @link       http://pear.php.net/PhpDocumentor
  602.  * @tutorial   tags.param.pkg
  603.  * @todo       CS cleanup - change package to PhpDocumentor
  604.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  605.  */
  606. class parserParamTag extends parserVarTag
  607. {
  608.     /**
  609.      * always 'param'
  610.      * @var string 
  611.      */
  612.     var $keyword = 'param';
  613. }
  614.  
  615. /**
  616.  * represents the "@staticvar" tag
  617.  *
  618.  * @category   ToolsAndUtilities
  619.  * @package    phpDocumentor
  620.  * @subpackage DocBlockTags
  621.  * @author     Greg Beaver <cellog@php.net>
  622.  * @copyright  2002-2008 Gregory Beaver
  623.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  624.  * @version    Release: @VER@
  625.  * @link       http://www.phpdoc.org
  626.  * @link       http://pear.php.net/PhpDocumentor
  627.  * @tutorial   tags.staticvar.pkg
  628.  * @todo       CS cleanup - change package to PhpDocumentor
  629.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  630.  */
  631. class parserStaticvarTag extends parserParamTag
  632. {
  633.     /**
  634.      * always 'staticvar'
  635.      * @var string 
  636.      */
  637.     var $keyword = 'staticvar';
  638. }
  639.  
  640. /**
  641.  * represents the "@link" tag
  642.  *
  643.  * @category   ToolsAndUtilities
  644.  * @package    phpDocumentor
  645.  * @subpackage DocBlockTags
  646.  * @author     Greg Beaver <cellog@php.net>
  647.  * @copyright  2002-2008 Gregory Beaver
  648.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  649.  * @version    Release: @VER@
  650.  * @link       http://www.phpdoc.org
  651.  * @link       http://pear.php.net/PhpDocumentor
  652.  * @since      1.0rc1
  653.  * @tutorial   tags.link.pkg
  654.  * @todo       CS cleanup - change package to PhpDocumentor
  655.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  656.  */
  657. class parserLinkTag extends parserTag
  658. {
  659.     /**
  660.      * always 'link'
  661.      * @var string 
  662.      */
  663.     var $keyword = 'link';
  664.    
  665.     /**
  666.      * sets up the link tag
  667.      *
  668.      * @param string $link URL to link to
  669.      *                      (might also contain the URL's
  670.      *                      description text)
  671.      */
  672.     function parserLinkTag($link)
  673.     {
  674.         $start $val $link->getString();
  675.         if (strpos($val' ')) {
  676.             $val   explode(' '$val);
  677.             $start array_shift($val);
  678.             $val   join($val' ');
  679.         }
  680.         $a new parserLinkInlineTag($start$val);
  681.         $b new parserStringWithInlineTags;
  682.         $b->add($a);
  683.         $this->value = $b;
  684.     }
  685. }
  686.  
  687. /**
  688.  * represents the "@see" tag
  689.  *
  690.  * @category   ToolsAndUtilities
  691.  * @package    phpDocumentor
  692.  * @subpackage DocBlockTags
  693.  * @author     Greg Beaver <cellog@php.net>
  694.  * @copyright  2002-2008 Gregory Beaver
  695.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  696.  * @version    Release: @VER@
  697.  * @link       http://www.phpdoc.org
  698.  * @link       http://pear.php.net/PhpDocumentor
  699.  * @since      1.0rc1
  700.  * @tutorial   tags.see.pkg
  701.  * @todo       CS cleanup - change package to PhpDocumentor
  702.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  703.  */
  704. class parserSeeTag extends parserLinkTag
  705. {
  706.     /**
  707.      * always 'see'
  708.      * @var string 
  709.      */
  710.     var $keyword = 'see';
  711.    
  712.     /**
  713.      * sets up the see tag
  714.      *
  715.      * @param string $name element to link to
  716.      */
  717.     function parserSeeTag($name)
  718.     {
  719.         parserTag::parserTag($this->keyword$nametrue);
  720.     }
  721.  
  722.     /**
  723.      * process this tag through the given output converter
  724.      *
  725.      * @param Converter &$converter the output converter
  726.      *
  727.      * @return string converted value of the tag
  728.      * @see parserStringWithInlineTags::Convert()
  729.      * @todo CS cleanup - rename to convert for camelCase rule
  730.      */
  731.     function Convert(&$converter)
  732.     {
  733.         if ($this->value->hasInlineTag()) {
  734.             addErrorDie(PDERROR_INLINETAG_IN_SEE);
  735.         }
  736.         $a $converter->getLink(trim($this->value->Convert($converter)));
  737.         if (is_string($a)) {
  738.             // feature 564991
  739.             if (strpos($a'://')) {
  740.                 // php function
  741.                 return $converter->returnLink($astr_replace('PHP_MANUAL#'''
  742.                     $this->value->Convert($converter)));
  743.             }
  744.             return $a;
  745.         }
  746.         if (is_object($a)) {
  747.             return $converter->returnSee($a);
  748.         }
  749.         // getLink parsed a comma-delimited list of linked thingies, 
  750.         // add the commas back in
  751.         if (is_array($a)) {
  752.             $b '';
  753.             foreach ($a as $i => $bub{
  754.                 if (!empty($b)) {
  755.                     $b .= ', ';
  756.                 }
  757.                 if (is_string($a[$i])) {
  758.                     $b .= $a[$i];
  759.                 }
  760.                 if (is_object($a[$i])) {
  761.                     $b .= $converter->returnSee($a[$i]);
  762.                 }
  763.             }
  764.             return $b;
  765.         }
  766.         return false;
  767.     }
  768. }
  769.  
  770. /**
  771.  * represents the "@see" tag
  772.  *
  773.  * Link to a license, instead of including lines and lines of license information
  774.  * in every file
  775.  *
  776.  * @category   ToolsAndUtilities
  777.  * @package    phpDocumentor
  778.  * @subpackage DocBlockTags
  779.  * @author     Greg Beaver <cellog@php.net>
  780.  * @copyright  2002-2008 Gregory Beaver
  781.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  782.  * @version    Release: @VER@
  783.  * @link       http://www.phpdoc.org
  784.  * @link       http://pear.php.net/PhpDocumentor
  785.  * @tutorial   tags.license.pkg
  786.  * @todo       CS cleanup - change package to PhpDocumentor
  787.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  788.  */
  789. class parserLicenseTag extends parserLinkTag
  790. {
  791.     /**
  792.      * always 'license'
  793.      * @var string 
  794.      */
  795.     var $keyword = 'license';
  796.    
  797.     /**
  798.      * set up the license tag
  799.      *
  800.      * @param string $name unused?
  801.      * @param string $link URL to link to
  802.      */
  803.     function parserLicenseTag($name$link)
  804.     {
  805.         $a       explode(' '$link->getString());
  806.         $url     array_shift($a);
  807.         $license join($a' ');
  808.         if (empty($license)) {
  809.             $license $url;
  810.         }
  811.         $a new parserLinkInlineTag($url$license);
  812.         $b new parserStringWithInlineTags;
  813.         $b->add($a);
  814.         $this->value = $b;
  815.     }
  816. }
  817.  
  818. /**
  819.  * represents the "@uses" tag
  820.  *
  821.  * This is exactly like @see except that the element used
  822.  * has a @useby link to this element added to its docblock
  823.  *
  824.  * @category   ToolsAndUtilities
  825.  * @package    phpDocumentor
  826.  * @subpackage DocBlockTags
  827.  * @author     Greg Beaver <cellog@php.net>
  828.  * @copyright  2002-2008 Gregory Beaver
  829.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  830.  * @version    Release: @VER@
  831.  * @link       http://www.phpdoc.org
  832.  * @link       http://pear.php.net/PhpDocumentor
  833.  * @since      1.2
  834.  * @tutorial   tags.uses.pkg
  835.  * @todo       CS cleanup - change package to PhpDocumentor
  836.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  837.  */
  838. class parserUsesTag extends parserSeeTag
  839. {
  840.     /**
  841.      * Always "uses"
  842.      * @var string 
  843.      */
  844.     var $keyword = 'uses';
  845.     /**
  846.      * @access private
  847.      */
  848.     var $_description;
  849.    
  850.     /**
  851.      * set up the uses tag
  852.      *
  853.      * @param string                     $seeel       element to link to
  854.      * @param parserStringWithInlineTags $description description of how
  855.      *                                                 the element is used
  856.      */
  857.     function parserUsesTag($seeel$description)
  858.     {
  859.         if ($seeel->hasInlineTag()) {
  860.             addErrorDie(PDERROR_DUMB_USES);
  861.         }
  862.         parent::parserSeeTag($seeel);
  863.         $this->_description $description;
  864.     }
  865.    
  866.     /**
  867.      * Return a link to documentation for other element,
  868.      * and description of how it is used
  869.      *
  870.      * Works exactly like {@link parent::Convert()}
  871.      * except that it also includes a description of
  872.      * how the element used is used.
  873.      *
  874.      * @param Converter &$c the output converter
  875.      *
  876.      * @return string link to the uses target
  877.      * @todo CS cleanup - rename to convert for camelCase rule
  878.      */
  879.     function Convert(&$c)
  880.     {
  881.         $val         $this->value;
  882.         $see         parent::Convert($c);
  883.         $this->value = $this->_description;
  884.         $desc_val    parserTag::Convert($c);
  885.         if (!empty($desc_val)) {
  886.             $see .= ' - '.$desc_val;
  887.         }
  888.         $this->value = $val;
  889.         return $see;
  890.     }
  891.    
  892.     /**
  893.      * Get the text of the link to the element that is being used
  894.      *
  895.      * @return string 
  896.      * @access private
  897.      */
  898.     function getSeeElement()
  899.     {
  900.         return $this->value->getString();
  901.     }
  902.    
  903.     /**
  904.      * Get the description of how the element used is being used.
  905.      *
  906.      * @return parserStringWithInlineTags 
  907.      */
  908.     function getDescription()
  909.     {
  910.         return $this->_description;
  911.     }
  912. }
  913.  
  914. /**
  915.  * This is a virtual tag, it is created by @uses to cross-reference the used element
  916.  *
  917.  * This is exactly like @uses.
  918.  *
  919.  * @category   ToolsAndUtilities
  920.  * @package    phpDocumentor
  921.  * @subpackage DocBlockTags
  922.  * @author     Greg Beaver <cellog@php.net>
  923.  * @copyright  2002-2008 Gregory Beaver
  924.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  925.  * @version    Release: @VER@
  926.  * @link       http://www.phpdoc.org
  927.  * @link       http://pear.php.net/PhpDocumentor
  928.  * @since      1.2
  929.  * @todo       CS cleanup - change package to PhpDocumentor
  930.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  931.  */
  932. class parserUsedByTag extends parserUsesTag
  933. {
  934.     /**
  935.      * Always "usedby"
  936.      * @var string 
  937.      */
  938.     var $keyword = 'usedby';
  939.     /**
  940.      * @access private
  941.      */
  942.     var $_link;
  943.    
  944.     /**
  945.      * set up the usedby tag
  946.      *
  947.      * @param abstractLink $link        link of element that uses this element
  948.      * @param string       $description description of how the element is used
  949.      */
  950.     function parserUsedByTag($link$description)
  951.     {
  952.         $this->value = $description;
  953.         $this->_link $link;
  954.     }
  955.    
  956.     /**
  957.      * process this tag through the given output converter
  958.      *
  959.      * @param Converter &$c the output converter
  960.      *
  961.      * @return string 
  962.      * @todo CS cleanup - rename to convert for camelCase rule
  963.      */
  964.     function Convert(&$c)
  965.     {
  966.         $see      $c->returnSee($this->_link);
  967.         $desc_val parserTag::Convert($c);
  968.         if (!empty($desc_val)) {
  969.             $see .= ' - '.$desc_val;
  970.         }
  971.         return $see;
  972.     }
  973. }
  974.  
  975. /**
  976.  * represents "@tutorial"
  977.  *
  978.  * This is exactly like @see except that it only links to tutorials
  979.  *
  980.  * @category   ToolsAndUtilities
  981.  * @package    phpDocumentor
  982.  * @subpackage DocBlockTags
  983.  * @author     Greg Beaver <cellog@php.net>
  984.  * @copyright  2002-2008 Gregory Beaver
  985.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  986.  * @version    Release: @VER@
  987.  * @link       http://www.phpdoc.org
  988.  * @link       http://pear.php.net/PhpDocumentor
  989.  * @since      1.2
  990.  * @tutorial   phpDocumentor/tutorials.pkg
  991.  * @tutorial   tags.tutorial.pkg
  992.  * @todo       CS cleanup - change package to PhpDocumentor
  993.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  994.  */
  995. class parserTutorialTag extends parserSeeTag
  996. {
  997.     /**
  998.      * Always "tutorial"
  999.      * @var string 
  1000.      */
  1001.     var $keyword = 'tutorial';
  1002.  
  1003.     /**
  1004.      * process this tag through the given output converter
  1005.      *
  1006.      * @param Converter &$converter the output converter
  1007.      *
  1008.      * @return string|bool
  1009.      * @see parserStringWithInlineTags::Convert()
  1010.      * @todo CS cleanup - rename to convert for camelCase rule
  1011.      */
  1012.     function Convert(&$converter)
  1013.     {
  1014.         $a $converter->getTutorialLink(trim($this->value->Convert($converter)));
  1015.         if (is_string($a)) {
  1016.             return $a;
  1017.         }
  1018.         if (is_object($a)) {
  1019.             return $converter->returnSee($a);
  1020.         }
  1021.         // getLink parsed a comma-delimited list of linked thingies, 
  1022.         // add the commas back in
  1023.         if (is_array($a)) {
  1024.             $b '';
  1025.             foreach ($a as $i => $bub{
  1026.                 if (!empty($b)) {
  1027.                     $b .= ', ';
  1028.                 }
  1029.                 if (is_string($a[$i])) {
  1030.                     $b .= $a[$i];
  1031.                 }
  1032.                 if (is_object($a[$i])) {
  1033.                     $b .= $converter->returnSee($a[$i]);
  1034.                 }
  1035.             }
  1036.             return $b;
  1037.         }
  1038.         return false;
  1039.     }
  1040. }
  1041.  
  1042. /**
  1043.  * represents "@filesource"
  1044.  * 
  1045.  * Use this to create a link to a highlighted phpxref-style source file listing
  1046.  *
  1047.  * @category   ToolsAndUtilities
  1048.  * @package    phpDocumentor
  1049.  * @subpackage DocBlockTags
  1050.  * @author     Greg Beaver <cellog@php.net>
  1051.  * @copyright  2002-2008 Gregory Beaver
  1052.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  1053.  * @version    Release: @VER@
  1054.  * @link       http://www.phpdoc.org
  1055.  * @link       http://pear.php.net/PhpDocumentor
  1056.  * @since      1.2
  1057.  * @tutorial   tags.filesource.pkg
  1058.  * @todo       CS cleanup - change package to PhpDocumentor
  1059.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  1060.  */
  1061. class parserFileSourceTag extends parserTag
  1062. {
  1063.     /**
  1064.      * Always "filesource"
  1065.      * @var string 
  1066.      */
  1067.     var $keyword = 'filesource';
  1068.     /**
  1069.      * @var array 
  1070.      */
  1071.     var $source;
  1072.     /**
  1073.      * @var string 
  1074.      */
  1075.     var $path;
  1076.     /**
  1077.      * Flag variable, controls double writes of file for each converter
  1078.      * @var array 
  1079.      * @access private
  1080.      */
  1081.     var $_converted array();
  1082.  
  1083.     /**
  1084.      * Set {@link $source} to $value, and set up path
  1085.      *
  1086.      * @param string $filepath the file's path
  1087.      * @param array  $value    output from
  1088.      *                          {@link phpDocumentorTWordParser::getFileSource()}
  1089.      */
  1090.     function parserFileSourceTag($filepath$value)
  1091.     {
  1092.         parent::parserTag($this->keyword'');
  1093.         $this->path   = $filepath;
  1094.         $this->source = $value;
  1095.     }
  1096.  
  1097.     /**
  1098.      * Return a link to the highlighted source and generate the source
  1099.      *
  1100.      * @param Converter &$c the output converter
  1101.      *
  1102.      * @return string output from {@link getSourceLink()}
  1103.      * @uses ConvertSource() generate source code and write it out
  1104.      * @todo CS cleanup - rename to convert for camelCase rule
  1105.      */
  1106.     function Convert(&$c)
  1107.     {
  1108.         $this->ConvertSource($c);
  1109.         return $this->getSourceLink($c);
  1110.     }
  1111.  
  1112.     /**
  1113.      * convert the source code
  1114.      *
  1115.      * @param Converter &$c the output converter
  1116.      *
  1117.      * @return void 
  1118.      * @uses phpDocumentor_HighlightParser highlights source code
  1119.      * @uses writeSource()
  1120.      * @todo CS cleanup - rename to convertSource for camelCase rule
  1121.      * @todo what's up with all the "return" statements?
  1122.      *        can they _all_ be removed?
  1123.      */
  1124.     function ConvertSource(&$c)
  1125.     {
  1126.         $this->writeSource($c$c->
  1127.             ProgramExample($this->sourcetruefalsefalsefalse$this->path));
  1128.         return;
  1129.         $parser new phpDocumentor_HighlightParser;
  1130.         $return '';
  1131.         $return $parser->
  1132.             parse($this->source$cfalsefalsefalse$this->path);
  1133.         $this->writeSource($c$return);
  1134.     }
  1135.  
  1136.     /**
  1137.      * have the output converter write the source code
  1138.      *
  1139.      * @param Converter &$c     the output converter
  1140.      * @param string    $source highlighted source code
  1141.      *
  1142.      * @return void 
  1143.      * @uses Converter::writeSource() export highlighted file source
  1144.      */
  1145.     function writeSource(&$c$source)
  1146.     {
  1147.         $c->writeSource($this->path$source);
  1148.     }
  1149.  
  1150.     /**
  1151.      * gets path to the sourcecode file
  1152.      *
  1153.      * @param Converter &$c the output converter
  1154.      *
  1155.      * @return output from getSourceLink()
  1156.      * @uses Converter::getSourceLink()
  1157.      */
  1158.     function getSourceLink(&$c)
  1159.     {
  1160.         return $c->getSourceLink($this->path);
  1161.     }
  1162. }
  1163.  
  1164. /**
  1165.  * represents "@example"
  1166.  * 
  1167.  * @category   ToolsAndUtilities
  1168.  * @package    phpDocumentor
  1169.  * @subpackage DocBlockTags
  1170.  * @author     Greg Beaver <cellog@php.net>
  1171.  * @copyright  2002-2008 Gregory Beaver
  1172.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  1173.  * @version    Release: @VER@
  1174.  * @link       http://www.phpdoc.org
  1175.  * @link       http://pear.php.net/PhpDocumentor
  1176.  * @tutorial   tags.example.pkg
  1177.  * @todo       CS cleanup - change package to PhpDocumentor
  1178.  * @todo       CS cleanup - change classname to PhpDocumentor_*
  1179.  */
  1180. class parserExampleTag extends parserFileSourceTag
  1181. {
  1182.     /**
  1183.      * always "example"
  1184.      * @var string 
  1185.      */
  1186.     var $keyword = 'example';
  1187.  
  1188.     /**
  1189.      * Reads and parses the example file indicated
  1190.      *
  1191.      * The example tag takes one parameter: the full path to a php file that
  1192.      * should be parsed and included as an example.
  1193.      *
  1194.      * @param parserStringWithInlineTags $value        tag value
  1195.      * @param string                     $current_path path of file containing
  1196.      *                                                  this @example tag
  1197.      *
  1198.      * @uses phpDocumentorTWordParser::getFileSource() uses to parse an example
  1199.      *        and retrieve all tokens by line number
  1200.      * @todo does this "x = y = z = false" still work as expected in PHP5?
  1201.      * @todo CS cleanup - rename constant to TOKENIZER_EXT
  1202.      */
  1203.     function parserExampleTag($value$current_path)
  1204.     {
  1205.         global $_phpDocumentor_setting;
  1206.         parent::parserTag('example'$value);
  1207.         $path false;
  1208.         // code thanks to Sam Blum, modified by Greg Beaver
  1209.         $tagValue $value->getString();
  1210.  
  1211.         $path $isAbsPath 
  1212.               = $pathOnly 
  1213.               = $fileName 
  1214.               = $fileExt 
  1215.               = $original_path 
  1216.               = $title 
  1217.               = false;
  1218.         do {
  1219.             // make sure the format is stuff.ext description
  1220.             if (!preg_match('`(.*)\.(\w*)\s(.*)`'$tagValue$match)) {
  1221.                 // or format is stuff.ext
  1222.                 if (!preg_match('`(.*)\.(\w*)\s*$`'$tagValue$match)) {
  1223.                     // Murphy: Some funny path was given
  1224.                     $original_path $tagValue// used for error output
  1225.                     break// try-block
  1226.                 }
  1227.             }
  1228.             if (strlen($match[1]=== 0{
  1229.                 // Murphy: Some funny path was given
  1230.                 $original_path $tagValue// used for error output
  1231.                 break// try-block
  1232.             }
  1233.             $fileExt $match[2];
  1234.             $title   'example';
  1235.             if (isset($match[3])) {
  1236.                 $title trim($match[3]);
  1237.             }
  1238.             // Replace windows '\' the path.
  1239.             $pathTmp str_replace('\\''/'$match[1])
  1240.  
  1241.             // Is there a path and a file or is it just a file?
  1242.             if (strpos($pathTmp'/'=== false{
  1243.                 // No path part
  1244.                 $pathOnly '';
  1245.                 $fileName $pathTmp .'.'$fileExt;
  1246.             else {
  1247.                 // split the path on the last directory, find the filename
  1248.                 $splitPos strrpos($pathTmp'/')
  1249.                 $pathOnly substr($match[1]0$splitPos+1);
  1250.                 $fileName substr($match[1]$splitPos+1.'.'$fileExt;
  1251.                 // Is the path absolute? (i.e. does it start like an absolute path?)
  1252.                 if (('/' === $pathTmp[0]|| preg_match('`^\w*:`i'$pathTmp)) 
  1253.                     // works for both windows 'C:' and URLs like 'http://'
  1254.                     $isAbsPath true// Yes
  1255.                 }
  1256.             }
  1257.  
  1258.             $original_path $pathOnly $fileName;
  1259.  
  1260.             // Now look for the file starting with abs. path.
  1261.             if ($isAbsPath{
  1262.                 // remove any weirdities like /../file.ext
  1263.                 $tmp realpath($original_path)
  1264.                 if ($tmp && is_file($tmp)) {
  1265.                     $path $tmp;
  1266.                 }
  1267.                 // Alway break if abs. path was detected,
  1268.                 // even if file was not found.
  1269.                 break// try-block
  1270.             }
  1271.  
  1272.             // Search for the example file some standard places 
  1273.             // 1) Look if the ini-var examplesdir is set and look there ...
  1274.             if (isset($_phpDocumentor_setting['examplesdir'])) {
  1275.                 $tmp realpath($_phpDocumentor_setting['examplesdir'
  1276.                     . PATH_DELIMITER  $original_path);
  1277.                 if ($tmp && is_file($tmp)) {
  1278.                     $path $tmp// Yo! found it :)
  1279.                     break// try-block
  1280.                 }
  1281.             }
  1282.  
  1283.             // 2) Then try to look for an 'example/'-dir 
  1284.             //    below the *currently* parsed file ...
  1285.             if (!empty($current_path)) {
  1286.                 $tmp realpath(dirname($current_pathPATH_DELIMITER 
  1287.                     . 'examples' PATH_DELIMITER $fileName);
  1288.                 if ($tmp && is_file($tmp)) {
  1289.                     $path $tmp// Yo! found it :)
  1290.                     break// try-block
  1291.                 }
  1292.             }
  1293.  
  1294.             // 3) Then try to look for the example file 
  1295.             //    below the subdir PHPDOCUMENTOR_BASE/examples/ ...
  1296.             if (is_dir(PHPDOCUMENTOR_BASE PATH_DELIMITER 'examples')) {
  1297.                 $tmp realpath(PHPDOCUMENTOR_BASE PATH_DELIMITER 
  1298.                     . 'examples' PATH_DELIMITER $original_path);
  1299.                 if ($tmp && is_file($tmp)) {
  1300.                     $path $tmp// Yo! found it :)
  1301.                     break// try-block
  1302.                 }
  1303.             }
  1304.  
  1305.             $tmp realpath(PHPDOCUMENTOR_BASE PATH_DELIMITER $original_path);
  1306.             if ($tmp && is_file($tmp)) {
  1307.                 $path $tmp// Yo! found it :)
  1308.                 break// try-block
  1309.             }
  1310.             // If we reach this point, nothing was found and $path is false.
  1311.         while (false);
  1312.  
  1313.         if (!$path{
  1314.             addWarning(PDERROR_EXAMPLE_NOT_FOUND$original_path);
  1315.             $this->_title 'example not found';
  1316.             $this->path   = false;
  1317.         else {
  1318.             $this->_title ($title$title 'example';
  1319.             // make a unique html-filename but avoid it to get too long.
  1320.             $uniqueFileName str_replace(array(':'
  1321.                 DIRECTORY_SEPARATOR'/')array('_''_''_')$path);
  1322.             $uniqueFileName substr($uniqueFileName-50'_' md5($path);
  1323.             $this->path     = $uniqueFileName;
  1324.            
  1325.             $f @fopen($path'r');
  1326.             if ($f{
  1327.                 $example fread($ffilesize($path));
  1328.                 if (tokenizer_ext{
  1329.                     $obj new phpDocumentorTWordParser;
  1330.                     $obj->setup($example);
  1331.                     $this->source     = $obj->getFileSource();
  1332.                     $this->origsource $example;
  1333.                     unset($obj);
  1334.                 else {
  1335.                     $this->source = $example;
  1336.                 }
  1337.             }
  1338.         }
  1339.     }
  1340.    
  1341.     /**
  1342.      * convert the source code
  1343.      *
  1344.      * @param Converter &$c the output converter
  1345.      *
  1346.      * @return void 
  1347.      * @uses phpDocumentor_HighlightParser highlights source code
  1348.      * @uses writeSource()
  1349.      * @todo CS cleanup - rename to convertSource for camelCase rule
  1350.      * @todo what's up with all the "return" statements?
  1351.      *        can they _all_ be removed?
  1352.      */
  1353.     function ConvertSource(&$c)
  1354.     {
  1355.         $this->writeSource($c$c->ProgramExample($this->sourcetruenull,
  1356.                             nullnullnull$this->origsource));
  1357.         return;
  1358.         $parser new phpDocumentor_HighlightParser;
  1359.         $return '';
  1360.         $return $parser->parse($this->source$c);
  1361.         $this->writeSource($c$return);
  1362.     }
  1363.  
  1364.     /**
  1365.      * have the output converter write the source code
  1366.      *
  1367.      * @param Converter &$c     the output converter
  1368.      * @param string    $source highlighted source code
  1369.      *
  1370.      * @return void 
  1371.      * @access private
  1372.      * @uses Converter::writeExample() writes final example out
  1373.      */
  1374.     function writeSource(&$c$source)
  1375.     {
  1376.         if ($this->path{
  1377.             $c->writeExample($this->_title$this->path$source);
  1378.         }
  1379.     }
  1380.  
  1381.     /**
  1382.      * Retrieve a converter-specific link to the example
  1383.      *
  1384.      * @param Converter &$c the output converter
  1385.      *
  1386.      * @return string 
  1387.      * @uses Converter::getExampleLink() retrieve the link to the example
  1388.      */
  1389.     function getSourceLink(&$c)
  1390.     {
  1391.         if (!$this->pathreturn $this->_title;
  1392.         return $c->getExampleLink($this->path$this->_title);
  1393.     }
  1394. }
  1395.  
  1396. ?>
    Поддержать сайт на родительском проекте КГБ