105 lines
2.4 KiB
PHP
105 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* @package Joomla.Administrator
|
|
* @subpackage com_content
|
|
*
|
|
* @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;
|
|
|
|
/**
|
|
* Content component helper.
|
|
*
|
|
* @package Joomla.Administrator
|
|
* @subpackage com_content
|
|
* @since 1.6
|
|
*/
|
|
class ContentHelper
|
|
{
|
|
public static $extension = 'com_content';
|
|
|
|
/**
|
|
* Configure the Linkbar.
|
|
*
|
|
* @param string $vName The name of the active view.
|
|
*
|
|
* @return void
|
|
* @since 1.6
|
|
*/
|
|
public static function addSubmenu($vName)
|
|
{
|
|
JHtmlSidebar::addEntry(
|
|
JText::_('JGLOBAL_ARTICLES'),
|
|
'index.php?option=com_content&view=articles',
|
|
$vName == 'articles'
|
|
);
|
|
JHtmlSidebar::addEntry(
|
|
JText::_('COM_CONTENT_SUBMENU_CATEGORIES'),
|
|
'index.php?option=com_categories&extension=com_content',
|
|
$vName == 'categories');
|
|
JHtmlSidebar::addEntry(
|
|
JText::_('COM_CONTENT_SUBMENU_FEATURED'),
|
|
'index.php?option=com_content&view=featured',
|
|
$vName == 'featured'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Gets a list of the actions that can be performed.
|
|
*
|
|
* @param integer The category ID.
|
|
* @param integer The article ID.
|
|
*
|
|
* @return JObject
|
|
* @since 1.6
|
|
*/
|
|
public static function getActions($categoryId = 0, $articleId = 0)
|
|
{
|
|
// Reverted a change for version 2.5.6
|
|
$user = JFactory::getUser();
|
|
$result = new JObject;
|
|
|
|
if (empty($articleId) && empty($categoryId))
|
|
{
|
|
$assetName = 'com_content';
|
|
}
|
|
elseif (empty($articleId))
|
|
{
|
|
$assetName = 'com_content.category.'.(int) $categoryId;
|
|
}
|
|
else
|
|
{
|
|
$assetName = 'com_content.article.'.(int) $articleId;
|
|
}
|
|
|
|
$actions = array(
|
|
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'
|
|
);
|
|
|
|
foreach ($actions as $action)
|
|
{
|
|
$result->set($action, $user->authorise($action, $assetName));
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Applies the content tag filters to arbitrary text as per settings for current user group
|
|
*
|
|
* @param text $text The string to filter
|
|
*
|
|
* @return string The filtered string
|
|
*
|
|
* @deprecated 4.0 Use JComponentHelper::filterText() instead.
|
|
*/
|
|
public static function filterText($text)
|
|
{
|
|
JLog::add('ContentHelper::filterText() is deprecated. Use JComponentHelper::filterText() instead.', JLog::WARNING, 'deprecated');
|
|
|
|
return JComponentHelper::filterText($text);
|
|
}
|
|
}
|