Commit 9ac6975e authored by Sigrid Suski's avatar Sigrid Suski

1.0.5 final

parent 438deb9c
......@@ -51,7 +51,7 @@ abstract class Input
*/
public static function Int( $name, $request = 'request', $default = 0 )
{
return (int)Request::Instance()->{$request}->getInt( $name, $default );
return (int) Request::Instance()->{$request}->getInt( $name, $default );
}
/**
......@@ -67,6 +67,7 @@ abstract class Input
{
/** No need for cleaning - Joomla! is doing it already */
$arr = Request::Instance()->{$request}->get( $name, $default, 'array' );
/** if we use the 'array' filter Joomla! will automatically convert it into an array
* so we need to check the original request for its state */
return isset( $_REQUEST[ $name ] ) && is_array( $_REQUEST[ $name ] ) ? $arr : $default;
......@@ -78,6 +79,7 @@ abstract class Input
*
* @param string $search variable name
* @param string $request request method
*
* @return mixed
*/
static public function Search( $search, $request = 'request' )
......@@ -121,6 +123,7 @@ abstract class Input
}
}
}
return $var;
}
......@@ -142,12 +145,13 @@ abstract class Input
* @param string $name
* @param bool $default
* @param string $request
*
* @return bool
* @since version
*/
public static function Bool( $name, $request = 'request', $default = false )
{
return (bool)Request::Instance()->{$request}->getBool( $name, $default );
return (bool) Request::Instance()->{$request}->getBool( $name, $default );
}
/**
......@@ -168,12 +172,13 @@ abstract class Input
* @param string $name
* @param float $default
* @param string $request
*
* @return float
* @since version
*/
public static function Double( $name, $request = 'request', $default = 0.0 )
{
return (float)Request::Instance()->{$request}->getFloat( $name, $default );
return (float) Request::Instance()->{$request}->getFloat( $name, $default );
}
/**
......@@ -187,7 +192,7 @@ abstract class Input
*/
public static function Float( $name, $request = 'request', $default = 0.0 )
{
return (float)Request::Instance()->{$request}->getFloat( $name, $default );
return (float) Request::Instance()->{$request}->getFloat( $name, $default );
}
/**
......@@ -222,6 +227,7 @@ abstract class Input
}
}
$html = Request::Instance()->{$request}->getRaw( $name, $default );
return str_replace( '
', "\n", $filter->filter( $config, $html ) );
}
......@@ -237,6 +243,7 @@ abstract class Input
public static function String( $name, $request = 'request', $default = null )
{
$value = Request::Instance()->{$request}->getString( $name, $default );
return filter_var( $value, FILTER_SANITIZE_MAGIC_QUOTES );
}
......@@ -291,6 +298,7 @@ abstract class Input
$r = $_REQUEST[ $name ];
break;
}
return $r ? $r : $default;
}
......@@ -309,6 +317,7 @@ abstract class Input
/**
* @param string $name
* @param array $arguments
*
* @return int
* @throws Exception
* @since version
......@@ -319,6 +328,7 @@ abstract class Input
if ( !( count( $arguments ) ) ) {
$arguments = [ 0 => 'request', 1 => 0 ];
}
return self::Int( strtolower( $name ), $arguments[ 0 ], $arguments[ 1 ] );
}
else {
......@@ -329,14 +339,17 @@ abstract class Input
/**
* Returns double value of requested variable and checks for a valid timestamp
* Sun, Jan 5, 2014 11:27:04 changed to double because of 32 bit systems (seriously?!)
*
* @param string $name variable name
* @param float|int $default default value
* @param string $method request method
*
* @return int
*/
static public function Timestamp( $name, $method = 'request', $default = 0.0 )
{
$val = self::Double( $name, $method, $default );
// JavaScript conversion
return $val > 10000000000 ? $val / 1000 : $val;
}
......@@ -367,15 +380,15 @@ abstract class Input
public static function Set( $name, $value, $request = 'request' )
{
Request::Instance()->{$request}->set( $name, $value );
// switch ( $request ) {
// case 'post':
// $_POST[ $name ] = $value;
// break;
// case 'get':
// $_GET[ $name ] = $value;
// break;
// }
// $_REQUEST[ $name ] = $value;
switch ( $request ) {
case 'post':
$_POST[ $name ] = $value;
break;
case 'get':
$_GET[ $name ] = $value;
break;
}
$_REQUEST[ $name ] = $value;
}
/**
......@@ -397,6 +410,7 @@ abstract class Input
* @param string $name variable name
* @param string $property
* @param string $request request method
*
* @return string
*/
static public function File( $name, $property = null, $request = 'files' )
......@@ -416,6 +430,7 @@ abstract class Input
}
}
$data = Request::Instance()->files->get( $name );
return ( $property && isset( $data[ $property ] ) ) ? $data[ $property ] : $data;
}
}
......@@ -27,7 +27,7 @@ Legend:
- (!) - Change
1.0.5 ()
1.0.5 (3 May 2018)
-------------------
(#) Closing for empty tags changed to short closing and leads to problems (Issue #7)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment