Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/public_html/administrator/components/com_redirect/helpers/html/ |
<?php
/**
* @package Joomla.Administrator
* @subpackage com_redirect
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Utility class for creating HTML Grids.
*
* @since 1.6
*/
class JHtmlRedirect
{
/**
* Display the published or unpublished state of an item.
*
* @param int $value The state value.
* @param int $i The ID of the item.
* @param boolean $canChange An optional prefix for the task.
*
* @return string
*
* @since 1.6
*
* @throws InvalidArgumentException
*/
public static function published($value = 0, $i = null, $canChange = true)
{
// Note: $i is required but has to be an optional argument in the function call due to argument order
if (null === $i)
{
throw new InvalidArgumentException('$i is a required argument in JHtmlRedirect::published');
}
// Array of image, task, title, action
$states = array(
1 => array('publish', 'links.unpublish', 'JENABLED', 'COM_REDIRECT_DISABLE_LINK'),
0 => array('unpublish', 'links.publish', 'JDISABLED', 'COM_REDIRECT_ENABLE_LINK'),
2 => array('archive', 'links.unpublish', 'JARCHIVED', 'JUNARCHIVE'),
-2 => array('trash', 'links.publish', 'JTRASHED', 'COM_REDIRECT_ENABLE_LINK'),
);
$state = ArrayHelper::getValue($states, (int) $value, $states[0]);
$icon = $state[0];
if ($canChange)
{
$html = '<a href="#" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" class="btn btn-micro hasTooltip'
. ($value == 1 ? ' active' : '') . '" title="' . JHtml::_('tooltipText', $state[3])
. '"><span class="icon-' . $icon . '" aria-hidden="true"></span></a>';
}
return $html;
}
}