forked from joomla/joomla-cms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/dev/privacy' into privacy_consent
- Loading branch information
Showing
11 changed files
with
317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
administrator/components/com_privacy/models/capabilities.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_privacy | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Capabilities model class. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class PrivacyModelCapabilities extends JModelLegacy | ||
{ | ||
/** | ||
* Retrieve the extension capabilities. | ||
* | ||
* @return array | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function getCapabilities() | ||
{ | ||
$app = JFactory::getApplication(); | ||
|
||
/* | ||
* Capabilities will be collected in two parts: | ||
* | ||
* 1) Core capabilities - This will cover the core API, i.e. all library level classes | ||
* 2) Extension capabilities - This will be collected by a plugin hook to select plugin groups | ||
* | ||
* Plugins which report capabilities should return an associative array with a single root level key which is used as the title | ||
* for the reporting section and an array with each value being a separate capability. All capability messages should be translated | ||
* by the extension when building the array. An example of the structure expected to be returned from plugins can be found in the | ||
* $coreCapabilities array below. | ||
*/ | ||
|
||
$coreCapabilities = array( | ||
JText::_('COM_PRIVACY_HEADING_CORE_CAPABILITIES') => array( | ||
JText::_('COM_PRIVACY_CORE_CAPABILITY_SESSION_IP_ADDRESS_AND_COOKIE'), | ||
JText::sprintf('COM_PRIVACY_CORE_CAPABILITY_LOGGING_IP_ADDRESS', $app->get('log_path', JPATH_ADMINISTRATOR . '/logs')), | ||
JText::_('COM_PRIVACY_CORE_CAPABILITY_COMMUNICATION_WITH_JOOMLA_ORG'), | ||
) | ||
); | ||
|
||
/* | ||
* We will search for capabilities from the following plugin groups: | ||
* | ||
* - Authentication: These plugins by design process user information and may have capabilities such as creating cookies | ||
* - Captcha: These plugins may communicate information to third party systems | ||
* - Installer: These plugins can add additional install capabilities to the Extension Manager, such as the Install from Web service | ||
* - Privacy: These plugins are the primary integration point into this component | ||
* - User: These plugins are intended to extend the user management system | ||
* | ||
* This is in addition to plugin groups which are imported before this method is triggered, generally this is the system group. | ||
*/ | ||
|
||
JPluginHelper::importPlugin('authentication'); | ||
JPluginHelper::importPlugin('captcha'); | ||
JPluginHelper::importPlugin('installer'); | ||
JPluginHelper::importPlugin('privacy'); | ||
JPluginHelper::importPlugin('user'); | ||
|
||
$pluginResults = $app->triggerEvent('onPrivacyCollectAdminCapabilities'); | ||
|
||
// We are going to "cheat" here and include this component's capabilities without using a plugin | ||
$extensionCapabilities = array( | ||
JText::_('COM_PRIVACY') => array( | ||
JText::_('COM_PRIVACY_EXTENSION_CAPABILITY_PERSONAL_INFO'), | ||
) | ||
); | ||
|
||
foreach ($pluginResults as $pluginResult) | ||
{ | ||
$extensionCapabilities += $pluginResult; | ||
} | ||
|
||
// Sort the extension list alphabetically | ||
ksort($extensionCapabilities); | ||
|
||
// Always prepend the core capabilities to the array | ||
return $coreCapabilities + $extensionCapabilities; | ||
} | ||
|
||
/** | ||
* Method to auto-populate the model state. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function populateState() | ||
{ | ||
// Load the parameters. | ||
$this->setState('params', JComponentHelper::getParams('com_privacy')); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
administrator/components/com_privacy/views/capabilities/tmpl/default.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_privacy | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** @var PrivacyViewCapabilities $this */ | ||
|
||
?> | ||
<?php if (!empty($this->sidebar)) : ?> | ||
<div id="j-sidebar-container" class="span2"> | ||
<?php echo $this->sidebar; ?> | ||
</div> | ||
<div id="j-main-container" class="span10"> | ||
<?php else : ?> | ||
<div id="j-main-container"> | ||
<?php endif; ?> | ||
<div class="alert alert-info"> | ||
<h4 class="alert-heading"><?php echo JText::_('COM_PRIVACY_MSG_CAPABILITIES_ABOUT_THIS_INFORMATION'); ?></h4> | ||
<?php echo JText::_('COM_PRIVACY_MSG_CAPABILITIES_INTRODUCTION'); ?> | ||
</div> | ||
<?php if (empty($this->capabilities)) : ?> | ||
<div class="alert alert-no-items"> | ||
<?php echo JText::_('COM_PRIVACY_MSG_CAPABILITIES_NO_CAPABILITIES'); ?> | ||
</div> | ||
<?php else : ?> | ||
<?php $i = 0; ?> | ||
<?php echo JHtml::_('bootstrap.startAccordion', 'slide-capabilities', array('active' => 'slide-0')); ?> | ||
|
||
<?php foreach ($this->capabilities as $extension => $capabilities) : ?> | ||
<?php echo JHtml::_('bootstrap.addSlide', 'slide-capabilities', $extension, 'slide-' . $i); ?> | ||
<?php if (empty($capabilities)) : ?> | ||
<div class="alert alert-no-items"> | ||
<?php echo JText::_('COM_PRIVACY_MSG_EXTENSION_NO_CAPABILITIES'); ?> | ||
</div> | ||
<?php else : ?> | ||
<ul> | ||
<?php foreach ($capabilities as $capability) : ?> | ||
<li><?php echo $capability; ?></li> | ||
<?php endforeach; ?> | ||
</ul> | ||
<?php endif; ?> | ||
<?php echo JHtml::_('bootstrap.endSlide'); ?> | ||
<?php $i++; ?> | ||
<?php endforeach; ?> | ||
|
||
<?php echo JHtml::_('bootstrap.endAccordion'); ?> | ||
<?php endif; ?> | ||
</div> |
86 changes: 86 additions & 0 deletions
86
administrator/components/com_privacy/views/capabilities/view.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_privacy | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
/** | ||
* Capabilities view class | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class PrivacyViewCapabilities extends JViewLegacy | ||
{ | ||
/** | ||
* The reported extension capabilities | ||
* | ||
* @var array | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $capabilities; | ||
|
||
/** | ||
* The HTML markup for the sidebar | ||
* | ||
* @var string | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $sidebar; | ||
|
||
/** | ||
* The state information | ||
* | ||
* @var JObject | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $state; | ||
|
||
/** | ||
* Execute and display a template script. | ||
* | ||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths. | ||
* | ||
* @return mixed A string if successful, otherwise an Error object. | ||
* | ||
* @see JViewLegacy::loadTemplate() | ||
* @since __DEPLOY_VERSION__ | ||
* @throws Exception | ||
*/ | ||
public function display($tpl = null) | ||
{ | ||
// Initialise variables | ||
$this->capabilities = $this->get('Capabilities'); | ||
$this->state = $this->get('State'); | ||
|
||
// Check for errors. | ||
if (count($errors = $this->get('Errors'))) | ||
{ | ||
throw new Exception(implode("\n", $errors), 500); | ||
} | ||
|
||
$this->addToolbar(); | ||
|
||
$this->sidebar = JHtmlSidebar::render(); | ||
|
||
return parent::display($tpl); | ||
} | ||
|
||
/** | ||
* Add the page title and toolbar. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function addToolbar() | ||
{ | ||
JToolbarHelper::title(JText::_('COM_PRIVACY_VIEW_CAPABILITIES'), 'dashboard'); | ||
|
||
JToolbarHelper::preferences('com_privacy'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.