[ 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_privacy 6 * 7 * @copyright (C) 2018 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\Privacy\Administrator\Model; 12 13 use Joomla\CMS\Component\ComponentHelper; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\Model\BaseModel; 17 use Joomla\CMS\Plugin\PluginHelper; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * Capabilities model class. 25 * 26 * @since 3.9.0 27 */ 28 class CapabilitiesModel extends BaseModel 29 { 30 /** 31 * Retrieve the extension capabilities. 32 * 33 * @return array 34 * 35 * @since 3.9.0 36 */ 37 public function getCapabilities() 38 { 39 $app = Factory::getApplication(); 40 41 /* 42 * Capabilities will be collected in two parts: 43 * 44 * 1) Core capabilities - This will cover the core API, i.e. all library level classes 45 * 2) Extension capabilities - This will be collected by a plugin hook to select plugin groups 46 * 47 * Plugins which report capabilities should return an associative array with a single root level key which is used as the title 48 * for the reporting section and an array with each value being a separate capability. All capability messages should be translated 49 * by the extension when building the array. An example of the structure expected to be returned from plugins can be found in the 50 * $coreCapabilities array below. 51 */ 52 53 $coreCapabilities = [ 54 Text::_('COM_PRIVACY_HEADING_CORE_CAPABILITIES') => [ 55 Text::_('COM_PRIVACY_CORE_CAPABILITY_SESSION_IP_ADDRESS_AND_COOKIE'), 56 Text::sprintf('COM_PRIVACY_CORE_CAPABILITY_LOGGING_IP_ADDRESS', $app->get('log_path', JPATH_ADMINISTRATOR . '/logs')), 57 Text::_('COM_PRIVACY_CORE_CAPABILITY_COMMUNICATION_WITH_JOOMLA_ORG'), 58 ], 59 ]; 60 61 /* 62 * We will search for capabilities from the following plugin groups: 63 * 64 * - Authentication: These plugins by design process user information and may have capabilities such as creating cookies 65 * - Captcha: These plugins may communicate information to third party systems 66 * - Installer: These plugins can add additional install capabilities to the Extension Manager, such as the Install from Web service 67 * - Privacy: These plugins are the primary integration point into this component 68 * - User: These plugins are intended to extend the user management system 69 * 70 * This is in addition to plugin groups which are imported before this method is triggered, generally this is the system group. 71 */ 72 73 PluginHelper::importPlugin('authentication'); 74 PluginHelper::importPlugin('captcha'); 75 PluginHelper::importPlugin('installer'); 76 PluginHelper::importPlugin('privacy'); 77 PluginHelper::importPlugin('user'); 78 79 $pluginResults = $app->triggerEvent('onPrivacyCollectAdminCapabilities'); 80 81 // We are going to "cheat" here and include this component's capabilities without using a plugin 82 $extensionCapabilities = [ 83 Text::_('COM_PRIVACY') => [ 84 Text::_('COM_PRIVACY_EXTENSION_CAPABILITY_PERSONAL_INFO'), 85 ], 86 ]; 87 88 foreach ($pluginResults as $pluginResult) { 89 $extensionCapabilities += $pluginResult; 90 } 91 92 // Sort the extension list alphabetically 93 ksort($extensionCapabilities); 94 95 // Always prepend the core capabilities to the array 96 return $coreCapabilities + $extensionCapabilities; 97 } 98 99 /** 100 * Method to auto-populate the model state. 101 * 102 * @return void 103 * 104 * @since 3.9.0 105 */ 106 protected function populateState() 107 { 108 // Load the parameters. 109 $this->setState('params', ComponentHelper::getParams('com_privacy')); 110 } 111 }
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 |