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

// No direct access
defined('_JEXEC') or die;

jimport('joomla.html.toolbar');

/**
 * Utility class for the button bar.
 *
 * @package		Joomla.Administrator
 * @subpackage	Application
 */
abstract class JToolBarHelper
{
	/**
	 * Title cell.
	 * For the title and toolbar to be rendered correctly,
	 * this title fucntion must be called before the starttable function and the toolbars icons
	 * this is due to the nature of how the css has been used to postion the title in respect to the toolbar.
	 *
	 * @param	string	$title	The title.
	 * @param	string	$icon	The space-separated names of the image.
	 * @since	1.5
	 */
	public static function title($title, $icon = 'generic.png')
	{
		// Strip the extension.
		$icons = explode(' ', $icon);
		foreach($icons as &$icon) {
			$icon = 'icon-48-'.preg_replace('#\.[^.]*$#', '', $icon);
		}

		$html = '<div class="pagetitle '.htmlspecialchars(implode(' ', $icons)).'"><h2>'.$title.'</h2></div>';

		$app = JFactory::getApplication();
		$app->JComponentTitle = $html;
		$doc = JFactory::getDocument();
		$doc->setTitle($app->getCfg('sitename'). ' - ' .JText::_('JADMINISTRATION').' - '.$title);
	}

	/**
	 * Writes a spacer cell.
	 *
	 * @param	string	$width	The width for the cell
	 * @since	1.0
	 */
	public static function spacer($width = '')
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a spacer.
		$bar->appendButton('Separator', 'spacer', $width);
	}

	/**
	 * Writes a divider between menu buttons
	 *
	 * @since	1.0
	 */
	public static function divider()
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a divider.
		$bar->appendButton('Separator', 'divider');
	}

	/**
	 * Writes a custom option and task button for the button bar.
	 *
	 * @param	string	$task		The task to perform (picked up by the switch($task) blocks.
	 * @param	string	$icon		The image to display.
	 * @param	string	$iconOver	The image to display when moused over.
	 * @param	string	$alt		The alt text for the icon image.
	 * @param	bool	$listSelect	True if required to check that a standard list item is checked.
	 * @since	1.0
	 */
	public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
	{
		$bar = JToolBar::getInstance('toolbar');

		// Strip extension.
		$icon = preg_replace('#\.[^.]*$#', '', $icon);

		// Add a standard button.
		$bar->appendButton('Standard', $icon, $alt, $task, $listSelect);
	}

	/**
	 * Writes a custom option and task button for the button bar.
	 *
	 * @param	string	$task		The task to perform (picked up by the switch($task) blocks.
	 * @param	string	$icon		The image to display.
	 * @param	string	$iconOver	The image to display when moused over.
	 * @param	string	$alt		The alt text for the icon image.
	 * @param	bool	$listSelect	True if required to check that a standard list item is checked.
	 * @since	1.0
	 * @deprecated
	 */
	public static function customX($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
	{
		self::custom($task, $icon, $iconOver, $alt, $listSelect);
	}

	/**
	 * Writes a preview button for a given option (opens a popup window).
	 *
	 * @param	string	$url	The name of the popup file (excluding the file extension)
	 * @param	bool	$updateEditors
	 * @since	1.0
	 */
	public static function preview($url = '', $updateEditors = false)
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a preview button.
		$bar->appendButton('Popup', 'preview', 'Preview', $url.'&task=preview');
	}

	/**
	 * Writes a preview button for a given option (opens a popup window).
	 *
	 * @param	string	$ref		The name of the popup file (excluding the file extension for an xml file).
	 * @param	bool	$com		Use the help file in the component directory.
	 * @param	string	$override	Use this URL instead of any other
	 * @param	string	$component	Name of component to get Help (null for current component)
	 * @since	1.0
	 */
	public static function help($ref, $com = false, $override = null, $component = null)
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a help button.
		$bar->appendButton('Help', $ref, $com, $override, $component);
	}

	/**
	 * Writes a cancel button that will go back to the previous page without doing
	 * any other operation.
	 *
	 * @param	string	$alt	Alternative text.
	 * @param	string	$href	URL of the href attribute.
	 * @since	1.0
	 */
	public static function back($alt = 'JTOOLBAR_BACK', $href = 'javascript:history.back();')
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a back button.
		$bar->appendButton('Link', 'back', $alt, $href);
	}

	/**<commit_msg>[LIB_JOOMLA] JToolbarHelper::help() now accepts a url which will launch a help page popup.<commit_after><?php
/**
 * @copyright	Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access
defined('_JEXEC') or die;

jimport('joomla.html.toolbar');

/**
 * Utility class for the button bar.
 *
 * @package		Joomla.Administrator
 * @subpackage	Application
 */
abstract class JToolBarHelper
{
	/**
	 * Title cell.
	 * For the title and toolbar to be rendered correctly,
	 * this title fucntion must be called before the starttable function and the toolbars icons
	 * this is due to the nature of how the css has been used to postion the title in respect to the toolbar.
	 *
	 * @param	string	$title	The title.
	 * @param	string	$icon	The space-separated names of the image.
	 * @since	1.5
	 */
	public static function title($title, $icon = 'generic.png')
	{
		// Strip the extension.
		$icons = explode(' ', $icon);
		foreach($icons as &$icon) {
			$icon = 'icon-48-'.preg_replace('#\.[^.]*$#', '', $icon);
		}

		$html = '<div class="pagetitle '.htmlspecialchars(implode(' ', $icons)).'"><h2>'.$title.'</h2></div>';

		$app = JFactory::getApplication();
		$app->JComponentTitle = $html;
		$doc = JFactory::getDocument();
		$doc->setTitle($app->getCfg('sitename'). ' - ' .JText::_('JADMINISTRATION').' - '.$title);
	}

	/**
	 * Writes a spacer cell.
	 *
	 * @param	string	$width	The width for the cell
	 * @since	1.0
	 */
	public static function spacer($width = '')
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a spacer.
		$bar->appendButton('Separator', 'spacer', $width);
	}

	/**
	 * Writes a divider between menu buttons
	 *
	 * @since	1.0
	 */
	public static function divider()
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a divider.
		$bar->appendButton('Separator', 'divider');
	}

	/**
	 * Writes a custom option and task button for the button bar.
	 *
	 * @param	string	$task		The task to perform (picked up by the switch($task) blocks.
	 * @param	string	$icon		The image to display.
	 * @param	string	$iconOver	The image to display when moused over.
	 * @param	string	$alt		The alt text for the icon image.
	 * @param	bool	$listSelect	True if required to check that a standard list item is checked.
	 * @since	1.0
	 */
	public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
	{
		$bar = JToolBar::getInstance('toolbar');

		// Strip extension.
		$icon = preg_replace('#\.[^.]*$#', '', $icon);

		// Add a standard button.
		$bar->appendButton('Standard', $icon, $alt, $task, $listSelect);
	}

	/**
	 * Writes a custom option and task button for the button bar.
	 *
	 * @param	string	$task		The task to perform (picked up by the switch($task) blocks.
	 * @param	string	$icon		The image to display.
	 * @param	string	$iconOver	The image to display when moused over.
	 * @param	string	$alt		The alt text for the icon image.
	 * @param	bool	$listSelect	True if required to check that a standard list item is checked.
	 * @since	1.0
	 * @deprecated
	 */
	public static function customX($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
	{
		self::custom($task, $icon, $iconOver, $alt, $listSelect);
	}

	/**
	 * Writes a preview button for a given option (opens a popup window).
	 *
	 * @param	string	$url	The name of the popup file (excluding the file extension)
	 * @param	bool	$updateEditors
	 * @since	1.0
	 */
	public static function preview($url = '', $updateEditors = false)
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a preview button.
		$bar->appendButton('Popup', 'preview', 'Preview', $url.'&task=preview');
	}

	/**
	 * Writes a preview button for a given option (opens a popup window).
	 *
	 * @param	string	$ref		The name of the popup file (excluding the file extension for an xml file).
	 * @param	bool	$com		Use the help file in the component directory.
	 * @param	string	$override	Use this URL instead of any other
	 * @param	string	$component	Name of component to get Help (null for current component)
	 * @since	1.0
	 */
	public static function help($url)
	{
		$bar = JToolBar::getInstance('toolbar');

		// Add a help button.
		$bar->appendButton('Help', 'help', 'Help', $url);
	}

	/**
	 * Writes a cancel button that will go back to the previous page without doing
	 * any other operation.
	 *
	 * @param	string	$alt	Alternative text.
	 * @param	string	$href	URL of the href attribute.
	 * @since	1.0
	 */
	public static function back($alt = 'JTOOLBAR_BACK', $href = 'javascript:history.back();')
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add a back button.
		$bar->appendButton('Link', 'back', $alt, $href);
	}

	/**
{'fraction_non_alphanumeric': 0.146613378207825, 'fraction_numerical': 0.006100126209507783, 'mean_word_length': 3.466416157820573, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '345121', 'n_tokens_mistral': 3293, 'n_tokens_neox': 3025, 'n_words': 1087}