<commit_before><?php
/**
 * @package     Joomla.Plugin
 * @subpackage  System.Debug
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('_JEXEC') or die;

/**
 * Joomla! Debug plugin
 *
 * @package     Joomla.Plugin
 * @subpackage  System.Debug
 * @since       1.5
 */
class plgSystemDebug extends JPlugin
{
	protected $linkFormat = '';

	/**
	 * Constructor.
	 *
	 * @param   object  &$subject  The object to observe
	 * @param   array   $config    An array that holds the plugin configuration
	 *
	 * @since 1.5
	 */
	public function __construct(&$subject, $config)
	{
		parent::__construct($subject, $config);

		// Log the deprecated API.
		if ($this->params->get('log-deprecated'))
		{
			\JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated'));
		}

		// Log database errors
		if ($this->params->get('log-database-errors'))
		{
			\JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database'));
		}

		// Log database queries
		if ($this->params->get('log-database-queries'))
		{
			\JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery'));
		}

		// Only if debugging or language debug is enabled
		if (JDEBUG || \JFactory::getApplication()->getCfg('debug_lang'))
		{
			\JFactory::getConfig()->set('gzip', 0);
			ob_start();
			ob_implicit_flush(false);
		}

		$this->linkFormat = ini_get('xdebug.file_link_format');
	}

	/**
	 * Add the CSS for debug. We can't do this in the constructor because
	 * stuff breaks.
	 *
	 * @return  void
	 */
	public function onAfterDispatch()
	{
		// Only if debugging or language debug is enabled
		if (JDEBUG || \JFactory::getApplication()->getCfg('debug_lang'))
		{
			\JHtml::_('stylesheet', 'cms/debug.css', array(), true);
		}

		/* [!] HUBZERO - Add CSS diagnostics */
		if (JDEBUG && $this->params->get('css', 0) && is_file(JPATH_SITE . '/media/system/css/diagnostics.css'))
		{
			JFactory::getDocument()->addStyleSheet(rtrim(\JURI::base(true), '/') . '/media/system/css/diagnostics.css');
		}
	}

	/**
	 * Show the debug info
	 */
	public function __destruct()
	{
		// Do not render if debugging or language debug is not enabled
		if (!JDEBUG && !\JFactory::getApplication()->getCfg('debug_lang'))
		{
			return;
		}

		// Load the language
		$this->loadLanguage();<commit_msg>[PLG_SYSTEM_DEBUG] Add last modified time to CSS URLs to help with browser caching issues<commit_after><?php
/**
 * @package     Joomla.Plugin
 * @subpackage  System.Debug
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('_JEXEC') or die;

/**
 * Joomla! Debug plugin
 *
 * @package     Joomla.Plugin
 * @subpackage  System.Debug
 * @since       1.5
 */
class plgSystemDebug extends JPlugin
{
	protected $linkFormat = '';

	/**
	 * Constructor.
	 *
	 * @param   object  &$subject  The object to observe
	 * @param   array   $config    An array that holds the plugin configuration
	 *
	 * @since 1.5
	 */
	public function __construct(&$subject, $config)
	{
		parent::__construct($subject, $config);

		// Log the deprecated API.
		if ($this->params->get('log-deprecated'))
		{
			\JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated'));
		}

		// Log database errors
		if ($this->params->get('log-database-errors'))
		{
			\JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database'));
		}

		// Log database queries
		if ($this->params->get('log-database-queries'))
		{
			\JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery'));
		}

		// Only if debugging or language debug is enabled
		if (JDEBUG || \JFactory::getApplication()->getCfg('debug_lang'))
		{
			\JFactory::getConfig()->set('gzip', 0);
			ob_start();
			ob_implicit_flush(false);
		}

		$this->linkFormat = ini_get('xdebug.file_link_format');
	}

	/**
	 * Add the CSS for debug. We can't do this in the constructor because
	 * stuff breaks.
	 *
	 * @return  void
	 */
	public function onAfterDispatch()
	{
		$base = str_replace('/administrator', '', rtrim(\JURI::base(true), '/'));

		// Only if debugging or language debug is enabled
		if (JDEBUG || \JFactory::getApplication()->getCfg('debug_lang'))
		{
			JFactory::getDocument()->addStyleSheet($base . '/media/cms/css/debug.css?v=' . filemtime(JPATH_ROOT . '/media/cms/css/debug.css'));
		}

		// [!] HUBZERO - Add CSS diagnostics
		if (JDEBUG && $this->params->get('css', 0) && is_file(JPATH_SITE . '/media/system/css/diagnostics.css'))
		{
			JFactory::getDocument()->addStyleSheet($base . '/media/system/css/diagnostics.css?v=' . filemtime(JPATH_ROOT . '/media/system/css/diagnostics.css'));
		}
	}

	/**
	 * Show the debug info
	 */
	public function __destruct()
	{
		// Do not render if debugging or language debug is not enabled
		if (!JDEBUG && !\JFactory::getApplication()->getCfg('debug_lang'))
		{
			return;
		}

		// Load the language
		$this->loadLanguage();
{'fraction_non_alphanumeric': 0.16955684007707128, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 3.5415573053368328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5754008', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1677, 'n_words': 397}