- md5
- 955e13911e3f0d93b22e3af0c732171b
- sha1
- 5529886d903858382079810e4262016afaf52e14
- sha256
- 5cdd0a4490141494dbde9458ce75f570dfb54507232a8f3746bb82d299731836
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
<?php
/**
* @package Joomla.Administrator
* @subpackage com_csp
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Csp\Administrator\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
/**
* Reporter component helper.
*
* @since 4.0.0
*/
class ReporterHelper
{
/**
* Gets the httpheaders system plugin extension id.
*
* @return integer The httpheaders system plugin extension id.
*
* @since 4.0.0
*/
public static function getHttpHeadersPluginId()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('httpheaders'));
$db->setQuery($query);
try
{
$result = (int) $db->loadResult();
}
catch (\RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $result;
}
/**
* Check the com_csp trash to show a warning in this case
*
* @return boolean The status of the trash; Do items exists in the trash
*
* @since 4.0.0
*/
public static function getCspTrashStatus()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__csp'))
->where($db->quoteName('published') . ' = ' . $db->quote('-2'));
$db->setQuery($query);
try
{
$result = (int) $db->loadResult();
}
catch (\RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return boolval($result);
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha11 to 4.0.0-alpha12. See them all, or every version of this file.