CoreFiles by mySites.guru
json.php72 lines, 1,644 bytes, from Joomla_3.2.1-Stable-Full_Package.zip
Raw History Compare with 3.2.0
md5
6b6293f823484518fd20f7514a3408a2
sha1
c39f1a5b49b6708193284647511b5ecb310c4fba
sha256
336da684445e0808f98c9c3aff8ffa7a371fd7f168e1adec24980e073edae771
<?php
/**
 * @package     Joomla.Installation
 * @subpackage  Response
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * JSON Response class for the Joomla Installer.
 *
 * @package     Joomla.Installation
 * @subpackage  Response
 * @since       3.1
 */
class InstallationResponseJson
{
	/**
	 * Constructor for the JSON response
	 *
	 * @param   mixed  $data  Exception if there is an error, otherwise, the session data
	 *
	 * @since   3.1
	 */
	public function __construct($data)
	{
		// The old token is invalid so send a new one.
		$this->token = JSession::getFormToken(true);

		// Get the language and send it's tag along
		$this->lang = JFactory::getLanguage()->getTag();

		// Get the message queue
		$messages = JFactory::getApplication()->getMessageQueue();

		// Build the sorted message list
		if (is_array($messages) && count($messages))
		{
			foreach ($messages as $msg)
			{
				if (isset($msg['type']) && isset($msg['message']))
				{
					$lists[$msg['type']][] = $msg['message'];
				}
			}
		}

		// If messages exist add them to the output
		if (isset($lists) && is_array($lists))
		{
			$this->messages = $lists;
		}

		// Check if we are dealing with an error.
		if ($data instanceof Exception)
		{
			// Prepare the error response.
			$this->error   = true;
			$this->header  = JText::_('INSTL_HEADER_ERROR');
			$this->message = $data->getMessage();
		}
		else
		{
			// Prepare the response data.
			$this->error = false;
			$this->data  = $data;
		}
	}
}

The same content is in 7 releases, Joomla 3.1.0 to 3.2.1. See them all, or every version of this file.