-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.0-dev' into 4.0-dev-fix-todo
- Loading branch information
Showing
16 changed files
with
967 additions
and
549 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
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
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; | ||
} | ||
} |
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,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; | ||
} | ||
} |
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,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; | ||
} | ||
} |
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,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'); | ||
} | ||
} |
Oops, something went wrong.