Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-fix-todo
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeutz committed Jan 19, 2019
2 parents 8109d59 + 031318b commit 3ca6082
Show file tree
Hide file tree
Showing 16 changed files with 967 additions and 549 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Joomla\CMS\MVC\Controller\AdminController;

/**
* Search master display controller.
* Reports list controller class.
*
* @since 4.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
Expand Down
8 changes: 4 additions & 4 deletions administrator/language/en-GB/en-GB.mod_menu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MOD_MENU_CONFIGURATION="Global Configuration"
MOD_MENU_CONTROL_PANEL="Control Panel"
MOD_MENU_EXTENSIONS_EXTENSION_MANAGER="Manage"
MOD_MENU_EXTENSIONS_EXTENSIONS="Extensions"
MOD_MENU_EXTENSIONS_LANGUAGE_MANAGER="Language(s)"
MOD_MENU_EXTENSIONS_LANGUAGE_MANAGER="Languages"
MOD_MENU_EXTENSIONS_MODULE_MANAGER_ADMINISTRATOR="Administrator Modules"
MOD_MENU_EXTENSIONS_MODULE_MANAGER_SITE="Site Modules"
MOD_MENU_EXTENSIONS_PLUGIN_MANAGER="Plugins"
Expand Down Expand Up @@ -98,8 +98,8 @@ MOD_MENU_MAINTAIN="Maintain"
MOD_MENU_MANAGE="Manage"
MOD_MENU_MANAGE_CSP="Content Security Policy"
MOD_MENU_MANAGE_EXTENSIONS="Extensions"
MOD_MENU_MANAGE_LANGUAGES="Language(s)"
MOD_MENU_MANAGE_LANGUAGES_CONTENT="Content Language(s)"
MOD_MENU_MANAGE_LANGUAGES="Languages"
MOD_MENU_MANAGE_LANGUAGES_CONTENT="Content Languages"
MOD_MENU_MANAGE_LANGUAGES_OVERRIDES="Language Overrides"
MOD_MENU_MANAGE_PLUGINS="Plugins"
MOD_MENU_MANAGE_REDIRECTS="Redirects"
Expand Down Expand Up @@ -130,4 +130,4 @@ MOD_MENU_UPDATE_EXTENSIONS="Extensions"
MOD_MENU_UPDATE_JOOMLA="Joomla"
MOD_MENU_UPDATE_SOURCES="Update Sources"
MOD_MENU_USER_PROFILE="My Profile"
MOD_MENU_XML_DESCRIPTION="This module displays an administrator menu module."
MOD_MENU_XML_DESCRIPTION="This module displays an administrator menu module."
2 changes: 1 addition & 1 deletion administrator/language/en-GB/en-GB.mod_quickicon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MOD_QUICKICON_GLOBAL_CONFIGURATION="Global"
MOD_QUICKICON_GROUP_DESC="The group of this module (this value is compared with the group value used in <strong>Quick Icons</strong> plugins to inject icons). The 'mod_quickicon' group always displays the Joomla! core icons."
MOD_QUICKICON_GROUP_LABEL="Group"
MOD_QUICKICON_INSTALL_EXTENSIONS="Install Extensions"
MOD_QUICKICON_LANGUAGE_MANAGER="Language(s)"
MOD_QUICKICON_LANGUAGE_MANAGER="Languages"
MOD_QUICKICON_MAINTENANCE="Maintenance"
MOD_QUICKICON_MEDIA_MANAGER="Media"
MOD_QUICKICON_MENU_MANAGER="Menu(s)"
Expand Down
64 changes: 64 additions & 0 deletions libraries/src/Form/Field/CalendarField.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\Registry\Registry;

/**
* Form Field class for the Joomla Platform.
Expand Down Expand Up @@ -317,4 +318,67 @@ protected function getLayoutData()

return array_merge($data, $extraData);
}

/**
* Method to filter a field value.
*
* @param mixed $value The optional value to use as the default for the field.
* @param string $group The optional dot-separated form group path on which to find the field.
* @param Registry $input An optional Registry object with the entire data set to filter
* against the entire form.
*
* @return mixed The filtered value.
*
* @since __DEPLOY_VERSION__
*/
public function filter($value, $group = null, Registry $input = null)
{
// Make sure there is a valid SimpleXMLElement.
if (!($this->element instanceof \SimpleXMLElement))
{
throw new \UnexpectedValueException(sprintf('%s::filter `element` is not an instance of SimpleXMLElement', get_class($this)));
}

// Get the field filter type.
$filter = (string) $this->element['filter'];

$return = $value;

switch (strtoupper($filter))
{
// Convert a date to UTC based on the server timezone offset.
case 'SERVER_UTC':
if ((int) $value > 0)
{
// Get the server timezone setting.
$offset = Factory::getConfig()->get('offset');

// Return an SQL formatted datetime string in UTC.
$return = Factory::getDate($value, $offset)->toSql();
}
else
{
$return = '';
}
break;

// Convert a date to UTC based on the user timezone offset.
case 'USER_UTC':
if ((int) $value > 0)
{
// Get the user timezone setting defaulting to the server timezone setting.
$offset = Factory::getUser()->getParam('timezone', Factory::getConfig()->get('offset'));

// Return an SQL formatted datetime string in UTC.
$return = Factory::getDate($value, $offset)->toSql();
}
else
{
$return = '';
}
break;
}

return $return;
}
}
53 changes: 53 additions & 0 deletions libraries/src/Form/Filter/IntarrayFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Form\Filter;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormFilterInterface;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

/**
* Form Filter class for integer arrays
*
* @since __DEPLOY_VERSION__
*/
class IntarrayFilter implements FormFilterInterface
{
/**
* Method to filter a field value.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return mixed The filtered value.
*
* @since __DEPLOY_VERSION__
*/
public function filter(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
if (is_object($value))
{
$value = get_object_vars($value);
}

$value = is_array($value) ? $value : array($value);

$value = ArrayHelper::toInteger($value);

return $value;
}
}
43 changes: 43 additions & 0 deletions libraries/src/Form/Filter/RawFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Form\Filter;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormFilterInterface;
use Joomla\Registry\Registry;

/**
* Form Filter class for raw values
*
* @since __DEPLOY_VERSION__
*/
class RawFilter implements FormFilterInterface
{
/**
* Method to filter a field value.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return mixed The filtered value.
*
* @since __DEPLOY_VERSION__
*/
public function filter(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
return $value;
}
}
59 changes: 59 additions & 0 deletions libraries/src/Form/Filter/RulesFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Form\Filter;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormFilterInterface;
use Joomla\Registry\Registry;

/**
* Form Filter class for rules
*
* @since __DEPLOY_VERSION__
*/
class RulesFilter implements FormFilterInterface
{
/**
* Method to filter a field value.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return mixed The filtered value.
*
* @since __DEPLOY_VERSION__
*/
public function filter(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
$return = array();

foreach ((array) $value as $action => $ids)
{
// Build the rules array.
$return[$action] = array();

foreach ($ids as $id => $p)
{
if ($p !== '')
{
$return[$action][$id] = ($p == '1' || $p == 'true') ? true : false;
}
}
}

return $return;
}
}
44 changes: 44 additions & 0 deletions libraries/src/Form/Filter/SafehtmlFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Form\Filter;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormFilterInterface;
use Joomla\Registry\Registry;

/**
* Form Filter class for safe HTML
*
* @since __DEPLOY_VERSION__
*/
class SafehtmlFilter implements FormFilterInterface
{
/**
* Method to filter a field value.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control value. This acts as an array container for the field.
* For example if the field has name="foo" and the group value is set to "bar" then the
* full field name would end up being "bar[foo]".
* @param Registry $input An optional Registry object with the entire data set to validate against the entire form.
* @param Form $form The form object for which the field is being tested.
*
* @return mixed The filtered value.
*
* @since __DEPLOY_VERSION__
*/
public function filter(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
{
return InputFilter::getInstance(null, null, 1, 1)->clean($value, 'html');
}
}

0 comments on commit 3ca6082

Please sign in to comment.