Source for file input.php
Documentation is available at input.php
* @package FrameworkOnFramework
* @copyright Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
// Protect from unauthorized access
* FrameworkOnFramework input handling class. Extends upon the JInput class.
* @package FrameworkOnFramework
* Public constructor. Overriden to allow specifying the global input array
* to use as a string and instantiate from an objetc holding variables.
* @param array|string|object|null $source Source data; set null to use $_REQUEST
* @param array $options Filter options
public function __construct($source =
null, array $options =
array())
$source = (array)
$source;
// Nothing, it's already an array
// Magic quotes GPC handling (something JInput simply can't handle at all)
* Gets a value from the input data. Overriden to allow specifying a filter
* @param string $name Name of the value to get.
* @param mixed $default Default value to return if variable does not exist.
* @param string $filter Filter to apply to the value.
* @param int $mask The filter mask
* @return mixed The filtered input value.
public function get($name, $default =
null, $filter =
'cmd', $mask =
0)
if (isset
($this->data[$name]))
* Returns a copy of the raw data stored in the class
* Old static methods are now deprecated. This magic method makes sure there
* is a continuity in our approach. The downside is that it's only compatible
* @param string $name Name of the method we're calling
* @param array $arguments The arguments passed to the method
JLog::add('FOFInput: static getXXX() methods are deprecated. Use the input object\'s methods instead.', JLog::WARNING, 'deprecated');
if (substr($name, 0, 3) ==
'get')
return $input->get($key, $default, $type, $mask);
* Magic method to get filtered input data.
* @param mixed $name Name of the value to get.
* @param string $arguments Default value to return if variable does not exist.
* @return boolean The filtered boolean input value.
public function __call($name, $arguments)
if (substr($name, 0, 3) ==
'get')
if (isset
($arguments[1]))
$default =
$arguments[1];
if (isset
($arguments[2]))
return $this->get($arguments[0], $default, $filter, $mask);
* Sets an input variable. WARNING: IT SHOULD NO LONGER BE USED!
* @param string $name The name of the variable to set
* @param mixed $value The value to set it to
* @param array &$input The input array or FOFInput object
* @param boolean $overwrite Should I overwrite existing values (default: true)
* @return string Previous value
public static function setVar($name, $value =
null, &$input =
array(), $overwrite =
true)
JLog::add('FOFInput::setVar() is deprecated. Use set() instead.', JLog::WARNING, 'deprecated');
$input->set($name, $value);
* Custom filter implementation. Works better with arrays and allows the use
* @param mixed $var The variable (value) to clean
* @param integer $mask The clean mask
* @param string $type The variable type
protected function _cleanVar($var, $mask =
0, $type =
null)
foreach ($var as $k =>
$v)
$temp[$k] =
self::_cleanVar($v, $mask);
// If the no trim flag is not set, trim the variable
// Now we handle input filtering
// If the allow raw flag is set, do not modify the variable
// If the allow HTML flag is set, apply a safe HTML filter to the variable
$var =
$safeHtmlFilter->clean($var, $type);
$var =
$this->filter->clean($var, $type);
Documentation generated on Tue, 19 Nov 2013 15:05:37 +0100 by phpDocumentor 1.4.3