[DOCS] fixed code comment in one programlisting
[zend/radio.git] / library / Zend / Markup.php
blobde6cd992bbec69e9d679a75a72dbe60a8cc4b85b
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Markup
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id$
22 /**
23 * @see Zend_Loader_PluginLoader
25 require_once 'Zend/Loader/PluginLoader.php';
27 /**
28 * @category Zend
29 * @package Zend_Markup
30 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31 * @license http://framework.zend.com/license/new-bsd New BSD License
33 class Zend_Markup
35 const CALLBACK = 'callback';
36 const REPLACE = 'replace';
39 /**
40 * The parser loader
42 * @var Zend_Loader_PluginLoader
44 protected static $_parserLoader;
46 /**
47 * The renderer loader
49 * @var Zend_Loader_PluginLoader
51 protected static $_rendererLoader;
54 /**
55 * Disable instantiation of Zend_Markup
57 private function __construct() { }
59 /**
60 * Get the parser loader
62 * @return Zend_Loader_PluginLoader
64 public static function getParserLoader()
66 if (!(self::$_parserLoader instanceof Zend_Loader_PluginLoader)) {
67 self::$_parserLoader = new Zend_Loader_PluginLoader(array(
68 'Zend_Markup_Parser' => 'Zend/Markup/Parser/',
69 ));
72 return self::$_parserLoader;
75 /**
76 * Get the renderer loader
78 * @return Zend_Loader_PluginLoader
80 public static function getRendererLoader()
82 if (!(self::$_rendererLoader instanceof Zend_Loader_PluginLoader)) {
83 self::$_rendererLoader = new Zend_Loader_PluginLoader(array(
84 'Zend_Markup_Renderer' => 'Zend/Markup/Renderer/',
85 ));
88 return self::$_rendererLoader;
91 /**
92 * Add a parser path
94 * @param string $prefix
95 * @param string $path
96 * @return Zend_Loader_PluginLoader
98 public static function addParserPath($prefix, $path)
100 return self::getParserLoader()->addPrefixPath($prefix, $path);
104 * Add a renderer path
106 * @param string $prefix
107 * @param string $path
108 * @return Zend_Loader_PluginLoader
110 public static function addRendererPath($prefix, $path)
112 return self::getRendererLoader()->addPrefixPath($prefix, $path);
116 * Factory pattern
118 * @param string $parser
119 * @param string $renderer
120 * @param array $options
121 * @return Zend_Markup_Renderer_RendererAbstract
123 public static function factory($parser, $renderer = 'Html', array $options = array())
125 $parserClass = self::getParserLoader()->load($parser);
126 $rendererClass = self::getRendererLoader()->load($renderer);
128 $parser = new $parserClass();
129 $options['parser'] = $parser;
130 $renderer = new $rendererClass($options);
132 return $renderer;