first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,148 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Button base class
*
* The JButton is the base class for all JButton types
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
abstract class JToolbarButton
{
/**
* element name
*
* This has to be set in the final renderer classes.
*
* @var string
*/
protected $_name = null;
/**
* reference to the object that instantiated the element
*
* @var JButton
*/
protected $_parent = null;
/**
* Constructor
*
* @param object $parent The parent
*/
public function __construct($parent = null)
{
$this->_parent = $parent;
}
/**
* Get the element name
*
* @return string type of the parameter
*
* @since 3.0
*/
public function getName()
{
return $this->_name;
}
/**
* Get the HTML to render the button
*
* @param array &$definition Parameters to be passed
*
* @return string
*
* @since 3.0
*/
public function render(&$definition)
{
/*
* Initialise some variables
*/
$id = call_user_func_array(array(&$this, 'fetchId'), $definition);
$action = call_user_func_array(array(&$this, 'fetchButton'), $definition);
// Build id attribute
if ($id)
{
$id = ' id="' . $id . '"';
}
// Build the HTML Button
$options = array();
$options['id'] = $id;
$options['action'] = $action;
$layout = new JLayoutFile('joomla.toolbar.base');
return $layout->render($options);
}
/**
* Method to get the CSS class name for an icon identifier
*
* Can be redefined in the final class
*
* @param string $identifier Icon identification string
*
* @return string CSS class name
*
* @since 3.0
*/
public function fetchIconClass($identifier)
{
// It's an ugly hack, but this allows templates to define the icon classes for the toolbar
$layout = new JLayoutFile('joomla.toolbar.iconclass');
return $layout->render(array('icon' => $identifier));
}
/**
* Get the button
*
* Defined in the final button class
*
* @return string
*
* @since 3.0
*/
abstract public function fetchButton();
}
/**
* Deprecated class placeholder. You should use JToolbarButton instead.
*
* @package Joomla.Legacy
* @subpackage Toolbar
* @since 1.5
* @deprecated 4.0 Use JToolbarButton instead.
* @codeCoverageIgnore
*/
abstract class JButton extends JToolbarButton
{
/**
* Constructor
*
* @param object $parent The parent
*
* @deprecated 4.0 Use JToolbarButton instead.
*/
public function __construct($parent = null)
{
JLog::add('JButton is deprecated. Use JToolbarButton instead.', JLog::WARNING, 'deprecated');
parent::__construct($parent);
}
}

View File

@ -0,0 +1,106 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a standard button with a confirm dialog
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonConfirm extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Confirm';
/**
* Fetch the HTML for the button
*
* @param string $type Unused string.
* @param string $msg Message to render
* @param string $name Name to be used as apart of the id
* @param string $text Button text
* @param string $task The task associated with the button
* @param boolean $list True to allow use of lists
* @param boolean $hideMenu True to hide the menu on click
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Confirm', $msg = '', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
{
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_($text);
$options['msg'] = JText::_($msg, true);
$options['class'] = $this->fetchIconClass($name);
$options['doTask'] = $this->_getCommand($options['msg'], $name, $task, $list);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.confirm');
return $layout->render($options);
}
/**
* Get the button CSS Id
*
* @param string $type Button type
* @param string $name Name to be used as apart of the id
* @param string $text Button text
* @param string $task The task associated with the button
* @param boolean $list True to allow use of lists
* @param boolean $hideMenu True to hide the menu on click
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type = 'Confirm', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
{
return $this->_parent->getName() . '-' . $name;
}
/**
* Get the JavaScript command for the button
*
* @param object $msg The message to display.
* @param string $name Not used.
* @param string $task The task used by the application
* @param boolean $list True is requires a list confirmation.
*
* @return string JavaScript command string
*
* @since 3.0
*/
protected function _getCommand($msg, $name, $task, $list)
{
JHtml::_('behavior.framework');
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
$message = addslashes($message);
if ($list)
{
$cmd = "if (document.adminForm.boxchecked.value==0){alert('$message');}else{if (confirm('$msg')){Joomla.submitbutton('$task');}}";
}
else
{
$cmd = "if (confirm('$msg')){Joomla.submitbutton('$task');}";
}
return $cmd;
}
}

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a custom button
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonCustom extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Custom';
/**
* Fetch the HTML for the button
*
* @param string $type Button type, unused string.
* @param string $html HTML strng for the button
* @param string $id CSS id for the button
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Custom', $html = '', $id = 'custom')
{
return $html;
}
/**
* Get the button CSS Id
*
* @param string $type Not used.
* @param string $html Not used.
* @param string $id The id prefix for the button.
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type = 'Custom', $html = '', $id = 'custom')
{
return $this->_parent->getName() . '-' . $id;
}
}

View File

@ -0,0 +1,89 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a help popup window button
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonHelp extends JToolbarButton
{
/**
* @var string Button type
*/
protected $_name = 'Help';
/**
* Fetches the button HTML code.
*
* @param string $type Unused string.
* @param string $ref The name of the help screen (its key reference).
* @param boolean $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)
*
* @return string
*
* @since 3.0
*/
public function fetchButton($type = 'Help', $ref = '', $com = false, $override = null, $component = null)
{
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_('JTOOLBAR_HELP');
$options['doTask'] = $this->_getCommand($ref, $com, $override, $component);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.help');
return $layout->render($options);
}
/**
* Get the button id
*
* Redefined from JButton class
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId()
{
return $this->_parent->getName() . '-help';
}
/**
* Get the JavaScript command for the button
*
* @param string $ref The name of the help screen (its key reference).
* @param boolean $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)
*
* @return string JavaScript command string
*
* @since 3.0
*/
protected function _getCommand($ref, $com, $override, $component)
{
JHtml::_('behavior.framework');
// Get Help URL
$url = JHelp::createURL($ref, $com, $override, $component);
$url = htmlspecialchars($url, ENT_QUOTES);
$cmd = "Joomla.popupWindow('$url', '" . JText::_('JHELP', true) . "', 700, 500, 1)";
return $cmd;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,81 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a link button
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonLink extends JToolbarButton
{
/**
* Button type
* @var string
*/
protected $_name = 'Link';
/**
* Fetch the HTML for the button
*
* @param string $type Unused string.
* @param string $name Name to be used as apart of the id
* @param string $text Button text
* @param string $url The link url
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Link', $name = 'back', $text = '', $url = null)
{
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_($text);
$options['class'] = $this->fetchIconClass($name);
$options['doTask'] = $this->_getCommand($url);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.link');
return $layout->render($options);
}
/**
* Get the button CSS Id
*
* @param string $type The button type.
* @param string $name The name of the button.
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type = 'Link', $name = '')
{
return $this->_parent->getName() . '-' . $name;
}
/**
* Get the JavaScript command for the button
*
* @param object $url Button definition
*
* @return string JavaScript command string
*
* @since 3.0
*/
protected function _getCommand($url)
{
return $url;
}
}

View File

@ -0,0 +1,124 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a modal window button
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonPopup extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Popup';
/**
* Fetch the HTML for the button
*
* @param string $type Unused string, formerly button type.
* @param string $name Modal name, used to generate element ID
* @param string $text The link text
* @param string $url URL for popup
* @param integer $width Width of popup
* @param integer $height Height of popup
* @param integer $top Top attribute. [@deprecated Unused, will be removed in 4.0]
* @param integer $left Left attribute. [@deprecated Unused, will be removed in 4.0]
* @param string $onClose JavaScript for the onClose event.
* @param string $title The title text
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0,
$onClose = '', $title = '')
{
// If no $title is set, use the $text element
if (strlen($title) == 0)
{
$title = $text;
}
// Store all data to the options array for use with JLayout
$options = array();
$options['name'] = JText::_($name);
$options['text'] = JText::_($text);
$options['title'] = JText::_($title);
$options['class'] = $this->fetchIconClass($name);
$options['doTask'] = $this->_getCommand($url);
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.popup');
$html = array();
$html[] = $layout->render($options);
// Place modal div and scripts in a new div
$html[] = '</div><div class="btn-group" style="width: 0; margin: 0">';
// Build the options array for the modal
$params = array();
$params['title'] = $options['title'];
$params['url'] = $options['doTask'];
$params['height'] = $height;
$params['width'] = $width;
$html[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params);
// If an $onClose event is passed, add it to the modal JS object
if (strlen($onClose) >= 1)
{
$html[] = '<script>'
. 'jQuery(\'#modal-' . $name . '\').on(\'hide\', function () {' . $onClose . ';});'
. '</script>';
}
return implode("\n", $html);
}
/**
* Get the button id
*
* @param string $type Button type
* @param string $name Button name
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type, $name)
{
return $this->_parent->getName() . '-popup-' . $name;
}
/**
* Get the JavaScript command for the button
*
* @param string $url URL for popup
*
* @return string JavaScript command string
*
* @since 3.0
*/
private function _getCommand($url)
{
if (substr($url, 0, 4) !== 'http')
{
$url = JUri::base() . $url;
}
return $url;
}
}

View File

@ -0,0 +1,65 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a button separator
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonSeparator extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Separator';
/**
* Get the HTML for a separator in the toolbar
*
* @param array &$definition Class name and custom width
*
* @return string The HTML for the separator
*
* @see JButton::render()
* @since 3.0
*/
public function render(&$definition)
{
// Store all data to the options array for use with JLayout
$options = array();
// Separator class name
$options['class'] = (empty($definition[1])) ? '' : $definition[1];
// Custom width
$options['style'] = (empty($definition[2])) ? '' : ' style="width:' . (int) $definition[2] . 'px;"';
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.separator');
return $layout->render($options);
}
/**
* Empty implementation (not required for separator)
*
* @return void
*
* @since 3.0
*/
public function fetchButton()
{
}
}

View File

@ -0,0 +1,101 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a button to render an HTML element in a slider container
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonSlider extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Slider';
/**
* Fetch the HTML for the button
*
* @param string $type Unused string, formerly button type.
* @param string $name Button name
* @param string $text The link text
* @param string $url URL for popup
* @param integer $width Width of popup
* @param integer $height Height of popup
* @param string $onClose JavaScript for the onClose event.
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Slider', $name = '', $text = '', $url = '', $width = 640, $height = 480, $onClose = '')
{
JHtml::_('script', 'jui/cms.js', false, true);
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_($text);
$options['name'] = $name;
$options['class'] = $this->fetchIconClass($name);
$options['onClose'] = '';
$doTask = $this->_getCommand($url);
$options['doTask'] = 'Joomla.setcollapse(\'' . $doTask . '\', \'' . $name . '\', \'' . $height . '\');';
if ($onClose)
{
$options['onClose'] = ' rel="{onClose: function() {' . $onClose . '}}"';
}
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.slider');
return $layout->render($options);
}
/**
* Get the button id
*
* @param string $type Button type
* @param string $name Button name
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type, $name)
{
return $this->_parent->getName() . '-slider-' . $name;
}
/**
* Get the JavaScript command for the button
*
* @param string $url URL for popup
*
* @return string JavaScript command string
*
* @since 3.0
*/
private function _getCommand($url)
{
if (substr($url, 0, 4) !== 'http')
{
$url = JUri::base() . $url;
}
return $url;
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Renders a standard button
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 3.0
*/
class JToolbarButtonStandard extends JToolbarButton
{
/**
* Button type
*
* @var string
*/
protected $_name = 'Standard';
/**
* Fetch the HTML for the button
*
* @param string $type Unused string.
* @param string $name The name of the button icon class.
* @param string $text Button text.
* @param string $task Task associated with the button.
* @param boolean $list True to allow lists
*
* @return string HTML string for the button
*
* @since 3.0
*/
public function fetchButton($type = 'Standard', $name = '', $text = '', $task = '', $list = true)
{
// Store all data to the options array for use with JLayout
$options = array();
$options['text'] = JText::_($text);
$options['class'] = $this->fetchIconClass($name);
$options['doTask'] = $this->_getCommand($options['text'], $task, $list);
if ($name == 'apply' || $name == 'new')
{
$options['btnClass'] = 'btn btn-small btn-success';
$options['class'] .= ' icon-white';
}
else
{
$options['btnClass'] = 'btn btn-small';
}
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('joomla.toolbar.standard');
return $layout->render($options);
}
/**
* Get the button CSS Id
*
* @param string $type Unused string.
* @param string $name Name to be used as apart of the id
* @param string $text Button text
* @param string $task The task associated with the button
* @param boolean $list True to allow use of lists
* @param boolean $hideMenu True to hide the menu on click
*
* @return string Button CSS Id
*
* @since 3.0
*/
public function fetchId($type = 'Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
{
return $this->_parent->getName() . '-' . $name;
}
/**
* Get the JavaScript command for the button
*
* @param string $name The task name as seen by the user
* @param string $task The task used by the application
* @param boolean $list True is requires a list confirmation.
*
* @return string JavaScript command string
*
* @since 3.0
*/
protected function _getCommand($name, $task, $list)
{
JHtml::_('behavior.framework');
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
$message = addslashes($message);
if ($list)
{
$cmd = "if (document.adminForm.boxchecked.value==0){alert('$message');}else{ Joomla.submitbutton('$task')}";
}
else
{
$cmd = "Joomla.submitbutton('$task')";
}
return $cmd;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,306 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Toolbar
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* ToolBar handler
*
* @package Joomla.Libraries
* @subpackage Toolbar
* @since 1.5
*/
class JToolbar
{
/**
* Toolbar name
*
* @var string
*/
protected $_name = array();
/**
* Toolbar array
*
* @var array
*/
protected $_bar = array();
/**
* Loaded buttons
*
* @var array
*/
protected $_buttons = array();
/**
* Directories, where button types can be stored.
*
* @var array
*/
protected $_buttonPath = array();
/**
* Stores the singleton instances of various toolbar.
*
* @var JToolbar
* @since 2.5
*/
protected static $instances = array();
/**
* Constructor
*
* @param string $name The toolbar name.
*
* @since 1.5
*/
public function __construct($name = 'toolbar')
{
$this->_name = $name;
// Set base path to find buttons.
$this->_buttonPath[] = __DIR__ . '/button';
}
/**
* Returns the global JToolbar object, only creating it if it
* doesn't already exist.
*
* @param string $name The name of the toolbar.
*
* @return JToolbar The JToolbar object.
*
* @since 1.5
*/
public static function getInstance($name = 'toolbar')
{
if (empty(self::$instances[$name]))
{
self::$instances[$name] = new JToolbar($name);
}
return self::$instances[$name];
}
/**
* Set a value
*
* @return string The set value.
*
* @since 1.5
*/
public function appendButton()
{
// Push button onto the end of the toolbar array.
$btn = func_get_args();
array_push($this->_bar, $btn);
return true;
}
/**
* Get the list of toolbar links.
*
* @return array
*
* @since 1.6
*/
public function getItems()
{
return $this->_bar;
}
/**
* Get the name of the toolbar.
*
* @return string
*
* @since 1.6
*/
public function getName()
{
return $this->_name;
}
/**
* Get a value.
*
* @return string
*
* @since 1.5
*/
public function prependButton()
{
// Insert button into the front of the toolbar array.
$btn = func_get_args();
array_unshift($this->_bar, $btn);
return true;
}
/**
* Render a tool bar.
*
* @return string HTML for the toolbar.
*
* @since 1.5
*/
public function render()
{
$html = array();
// Start toolbar div.
$layout = new JLayoutFile('joomla.toolbar.containeropen');
$html[] = $layout->render(array('id' => $this->_name));
// Render each button in the toolbar.
foreach ($this->_bar as $button)
{
$html[] = $this->renderButton($button);
}
// End toolbar div.
$layout = new JLayoutFile('joomla.toolbar.containerclose');
$html[] = $layout->render(array());
return implode('', $html);
}
/**
* Render a button.
*
* @param object &$node A toolbar node.
*
* @return string
*
* @since 1.5
*/
public function renderButton(&$node)
{
// Get the button type.
$type = $node[0];
$button = $this->loadButtonType($type);
// Check for error.
if ($button === false)
{
return JText::sprintf('JLIB_HTML_BUTTON_NOT_DEFINED', $type);
}
return $button->render($node);
}
/**
* Loads a button type.
*
* @param string $type Button Type
* @param boolean $new False by default
*
* @return boolean
*
* @since 1.5
*/
public function loadButtonType($type, $new = false)
{
$signature = md5($type);
if (isset($this->_buttons[$signature]) && $new === false)
{
return $this->_buttons[$signature];
}
if (!class_exists('JToolbarButton'))
{
JLog::add(JText::_('JLIB_HTML_BUTTON_BASE_CLASS'), JLog::WARNING, 'jerror');
return false;
}
$buttonClass = 'JToolbarButton' . ucfirst($type);
// @deprecated 12.3 Remove the acceptance of legacy classes starting with JButton.
$buttonClassOld = 'JButton' . ucfirst($type);
if (!class_exists($buttonClass))
{
if (!class_exists($buttonClassOld))
{
if (isset($this->_buttonPath))
{
$dirs = $this->_buttonPath;
}
else
{
$dirs = array();
}
$file = JFilterInput::getInstance()->clean(str_replace('_', DIRECTORY_SEPARATOR, strtolower($type)) . '.php', 'path');
jimport('joomla.filesystem.path');
if ($buttonFile = JPath::find($dirs, $file))
{
include_once $buttonFile;
}
else
{
JLog::add(JText::sprintf('JLIB_HTML_BUTTON_NO_LOAD', $buttonClass, $buttonFile), JLog::WARNING, 'jerror');
return false;
}
}
}
if (!class_exists($buttonClass) && !class_exists($buttonClassOld))
{
// @todo remove code: return JError::raiseError('SOME_ERROR_CODE', "Module file $buttonFile does not contain class $buttonClass.");
return false;
}
$this->_buttons[$signature] = new $buttonClass($this);
return $this->_buttons[$signature];
}
/**
* Add a directory where JToolbar should search for button types in LIFO order.
*
* You may either pass a string or an array of directories.
*
* JToolbar will be searching for an element type in the same order you
* added them. If the parameter type cannot be found in the custom folders,
* it will look in libraries/joomla/html/toolbar/button.
*
* @param mixed $path Directory or directories to search.
*
* @return void
*
* @since boolean
* @see JToolbar
*/
public function addButtonPath($path)
{
// Just force path to array.
settype($path, 'array');
// Loop through the path directories.
foreach ($path as $dir)
{
// No surrounding spaces allowed!
$dir = trim($dir);
// Add trailing separators as needed.
if (substr($dir, -1) != DIRECTORY_SEPARATOR)
{
// Directory
$dir .= DIRECTORY_SEPARATOR;
}
// Add to the top of the search dirs.
array_unshift($this->_buttonPath, $dir);
}
}
}