Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Copyright 2009-2017 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Copyright: 2009-2017 Horde LLC
License: http://www.horde.org/licenses/lgpl21 LGPL 2.1
File Size: 403 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Variables:: (22 methods):
  getDefaultVariables()
  __construct()
  sanitize()
  exists()
  __isset()
  offsetExists()
  get()
  __get()
  offsetGet()
  getExists()
  set()
  __set()
  offsetSet()
  remove()
  __unset()
  offsetUnset()
  merge()
  add()
  filter()
  _getExists()
  count()
  getIterator()


Class: Horde_Variables  - X-Ref

An OO-way to access form variables.

getDefaultVariables($sanitize = false)   X-Ref
Returns a Horde_Variables object populated with the form input.

param: string $sanitize  Sanitize the input variables?
return: Horde_Variables  Variables object.

__construct($vars = array()   X-Ref
Constructor.

param: array $vars       The list of form variables (if null, defaults
param: string $sanitize  Sanitize the input variables?

sanitize()   X-Ref
Sanitize the form input.


exists($varname)   X-Ref
Alias of isset().


__isset($varname)   X-Ref
isset() implementation.

param: string $varname  The form variable name.
return: boolean  Does $varname form variable exist?

offsetExists($field)   X-Ref
Implements isset() for ArrayAccess interface.


get($varname, $default = null)   X-Ref
Returns the value of a given form variable.

param: string $varname  The form variable name.
param: string $default  The default form variable value.
return: mixed  The form variable, or $default if it doesn't exist.

__get($varname)   X-Ref
Returns the value of a given form variable.

param: string $varname  The form variable name.
return: mixed  The form variable, or null if it doesn't exist.

offsetGet($field)   X-Ref
Implements getter for ArrayAccess interface.


getExists($varname, &$exists)   X-Ref
Given a variable name, returns the value and sets a variable indicating
whether the value exists in the form data.

param: string $varname   The form variable name.
param: boolean &$exists  Reference to variable that will indicate
return: mixed  The form variable, or null if it doesn't exist.

set($varname, $value)   X-Ref
Sets the value of a given form variable.


__set($varname, $value)   X-Ref
Sets the value of a given form variable.

param: string $varname  The form variable name.
param: mixed $value     The value to set.

offsetSet($field, $value)   X-Ref
Implements setter for ArrayAccess interface.


remove($varname)   X-Ref
Deletes a given form variable.


__unset($varname)   X-Ref
Deletes a given form variable.

param: string $varname  The form variable name.

offsetUnset($field)   X-Ref
Implements unset() for ArrayAccess interface.


merge($vars)   X-Ref
Merges a list of variables into the current form variable list.

param: array $vars  Form variables.

add($varname, $value)   X-Ref
Set $varname to $value ONLY if it's not already present.

param: string $varname  The form variable name.
param: mixed $value     The value to set.
return: boolean  True if the value was altered.

filter($varname)   X-Ref
Filters a form value so that it can be used in HTML output.

param: string $varname  The form variable name.
return: mixed  The filtered variable, or null if it doesn't exist.

_getExists($array, $varname, &$value)   X-Ref
Fetch the requested variable ($varname) into $value, and return
whether or not the variable was set in $array.

param: array $array     The array to search in (usually either
param: string $varname  The name of the variable to look for.
param: mixed &$value    $varname's value gets assigned to this variable.
return: boolean  Whether or not the variable was set (or, if we've

count()   X-Ref
No description

getIterator()   X-Ref
No description