1 <?php
2 /**
3 * @package Joomla.Libraries
4 * @subpackage HTML
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Utility class to fire onContentPrepare for non-article based content.
14 *
15 * @since 1.5
16 */
17 abstract class JHtmlContent
18 {
19 /**
20 * Fire onContentPrepare for content that isn't part of an article.
21 *
22 * @param string $text The content to be transformed.
23 * @param array $params The content params.
24 * @param string $context The context of the content to be transformed.
25 *
26 * @return string The content after transformation.
27 *
28 * @since 1.5
29 */
30 public static function prepare($text, $params = null, $context = 'text')
31 {
32 if ($params === null)
33 {
34 $params = new JObject;
35 }
36
37 $article = new stdClass;
38 $article->text = $text;
39 JPluginHelper::importPlugin('content');
40 $dispatcher = JEventDispatcher::getInstance();
41 $dispatcher->trigger('onContentPrepare', array($context, &$article, &$params, 0));
42
43 return $article->text;
44 }
45 }
46