- md5
- 778edc53270623eeffa8e7b8f4aa057f
- sha1
- 574c5b173118063df7eb2fc3b8568f0b5dfe6c54
- sha256
- a0c64dd2b5a6137481c238c44b1016db426f7888844d1057ffd38c4c8f480637
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
<?php
/**
* @package Joomla.Administrator
* @subpackage com_plugins
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Plugins\Administrator\Helper;
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Installer\Installer;
/**
* Plugins component helper.
*
* @since 1.6
*/
class PluginsHelper
{
public static $extension = 'com_plugins';
/**
* Returns an array of standard published state filter options.
*
* @return string The HTML code for the select tag
*/
public static function publishedOptions()
{
// Build the active state filter options.
$options = array();
$options[] = HTMLHelper::_('select.option', '1', 'JENABLED');
$options[] = HTMLHelper::_('select.option', '0', 'JDISABLED');
return $options;
}
/**
* Returns a list of folders filter options.
*
* @return string The HTML code for the select tag
*/
public static function folderOptions()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT(folder) AS value, folder AS text')
->from('#__extensions')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->order('folder');
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (\RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $options;
}
/**
* Returns a list of elements filter options.
*
* @return string The HTML code for the select tag
*/
public static function elementOptions()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT(element) AS value, element AS text')
->from('#__extensions')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->order('element');
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (\RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $options;
}
/**
* Parse the template file.
*
* @param string $templateBaseDir Base path to the template directory.
* @param string $templateDir Template directory.
*
* @return \JObject
*/
public function parseXMLTemplateFile($templateBaseDir, $templateDir)
{
$data = new \JObject;
// Check of the xml file exists.
$filePath = Path::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml');
if (is_file($filePath))
{
$xml = Installer::parseXMLInstallFile($filePath);
if ($xml['type'] != 'template')
{
return false;
}
foreach ($xml as $key => $value)
{
$data->set($key, $value);
}
}
return $data;
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.