CoreFiles by mySites.guru
content.php79 lines, 1,962 bytes, from Joomla_3.9.0-Stable-Full_Package.zip
Raw History Compare with 3.8.13
md5
3389704dcaba98b5de8c27b61a7a3b99
sha1
f169945b6cb60bd49812e68444dc54c370f9dc86
sha256
fda527cba8e27568a9a07bbd1d0b55dd54060a7cae0e6b2a6558574d16d90c77
<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  HTML
 *
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

/**
 * Utility class to fire onContentPrepare for non-article based content.
 *
 * @since  1.5
 */
abstract class JHtmlContent
{
	/**
	 * Fire onContentPrepare for content that isn't part of an article.
	 *
	 * @param   string  $text     The content to be transformed.
	 * @param   array   $params   The content params.
	 * @param   string  $context  The context of the content to be transformed.
	 *
	 * @return  string   The content after transformation.
	 *
	 * @since   1.5
	 */
	public static function prepare($text, $params = null, $context = 'text')
	{
		if ($params === null)
		{
			$params = new JObject;
		}

		$article = new stdClass;
		$article->text = $text;
		JPluginHelper::importPlugin('content');
		$dispatcher = JEventDispatcher::getInstance();
		$dispatcher->trigger('onContentPrepare', array($context, &$article, &$params, 0));

		return $article->text;
	}

	/**
	 * Returns an array of months.
	 *
	 * @param   Registry  $state  The state object.
	 *
	 * @return  array
	 *
	 * @since   3.9.0
	 */
	public static function months($state)
	{
		$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));

		foreach ($state as $key => $value) 
		{
			$model->setState($key, $value);
		}

		$model->setState('filter.category_id', $state->get('category.id'));
		$model->setState('list.start', 0);
		$model->setState('list.limit', -1);
		$model->setState('list.direction', 'asc');
		$model->setState('list.filter', '');

		$items = array();

		foreach ($model->countItemsByMonth() as $item)
		{
			$items[] = JHtml::_('select.option', $item->d, (new JDate($item->d))->format('F Y') . ' [' . $item->c . ']');
		}

		return $items;
	}
}

The same content is in 8 releases, Joomla 3.9.0-alpha to 3.9.0. See them all, or every version of this file.