[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_plugins 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Plugins\Administrator\Helper; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Filesystem\Path; 15 use Joomla\CMS\HTML\HTMLHelper; 16 use Joomla\CMS\Installer\Installer; 17 use Joomla\CMS\Object\CMSObject; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * Plugins component helper. 25 * 26 * @since 1.6 27 */ 28 class PluginsHelper 29 { 30 public static $extension = 'com_plugins'; 31 32 /** 33 * Returns an array of standard published state filter options. 34 * 35 * @return array The HTML code for the select tag 36 */ 37 public static function publishedOptions() 38 { 39 // Build the active state filter options. 40 $options = array(); 41 $options[] = HTMLHelper::_('select.option', '1', 'JENABLED'); 42 $options[] = HTMLHelper::_('select.option', '0', 'JDISABLED'); 43 44 return $options; 45 } 46 47 /** 48 * Returns a list of folders filter options. 49 * 50 * @return string The HTML code for the select tag 51 */ 52 public static function folderOptions() 53 { 54 $db = Factory::getDbo(); 55 $query = $db->getQuery(true) 56 ->select('DISTINCT(folder) AS value, folder AS text') 57 ->from('#__extensions') 58 ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) 59 ->order('folder'); 60 61 $db->setQuery($query); 62 63 try { 64 $options = $db->loadObjectList(); 65 } catch (\RuntimeException $e) { 66 Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); 67 } 68 69 return $options; 70 } 71 72 /** 73 * Returns a list of elements filter options. 74 * 75 * @return string The HTML code for the select tag 76 */ 77 public static function elementOptions() 78 { 79 $db = Factory::getDbo(); 80 $query = $db->getQuery(true) 81 ->select('DISTINCT(element) AS value, element AS text') 82 ->from('#__extensions') 83 ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) 84 ->order('element'); 85 $db->setQuery($query); 86 87 try { 88 $options = $db->loadObjectList(); 89 } catch (\RuntimeException $e) { 90 Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); 91 } 92 93 return $options; 94 } 95 96 /** 97 * Parse the template file. 98 * 99 * @param string $templateBaseDir Base path to the template directory. 100 * @param string $templateDir Template directory. 101 * 102 * @return CMSObject|bool 103 */ 104 public function parseXMLTemplateFile($templateBaseDir, $templateDir) 105 { 106 $data = new CMSObject(); 107 108 // Check of the xml file exists. 109 $filePath = Path::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml'); 110 111 if (is_file($filePath)) { 112 $xml = Installer::parseXMLInstallFile($filePath); 113 114 if ($xml['type'] != 'template') { 115 return false; 116 } 117 118 foreach ($xml as $key => $value) { 119 $data->set($key, $value); 120 } 121 } 122 123 return $data; 124 } 125 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |