|
| array_sort_key (array &$array, $key) |
|
| array_filter_ex ($array, $key, $value) |
|
| array_keys_exists ($keys, $search, &$missing=NULL) |
|
| toArray ($object) |
|
| array_boolval ($array, $key) |
|
if(!function_exists("boolval")) | boolvalEx ($var) |
|
| is_uuid ($var) |
|
| is_devicefile ($var) |
|
| is_block ($filename) |
|
| is_json ($var) |
|
| is_ipaddr ($var) |
|
| is_ipaddr4 ($var) |
|
| is_ipaddr6 ($var) |
|
| is_multiarray ($var) |
|
| json_validate ($json, $schema, &$errors=NULL) |
|
| json_encode_safe ($value, $options=0) |
|
if(!function_exists('json_last_error_msg')) | binary_format ($number, $options=NULL) |
|
| binary_convert ($number, $fromPrefix, $toPrefix, $decimalPlaces=0) |
|
| strpdate ($date, $format) |
|
| mkdtemp ($prefix="", $mode=0700) |
|
| inet_getnetmask ($bits, $forceipv6=FALSE) |
|
This file is part of OpenMediaVault.
- License:
- http://www.gnu.org/licenses/gpl.html GPL Version 3
- Author
- Volker Theile volke.nosp@m.r.th.nosp@m.eile@.nosp@m.open.nosp@m.media.nosp@m.vaul.nosp@m.t.org
- Copyright
- Copyright (c) 2009-2014 Volker Theile
OpenMediaVault is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
OpenMediaVault is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with OpenMediaVault. If not, see http://www.gnu.org/licenses/.
array_boolval |
( |
|
$array, |
|
|
|
$key |
|
) |
| |
Get boolean value of an array element.
- Parameters
-
array | An array with keys. |
key | The key of the element. Returns the boolean value of the given key. |
array_filter_ex |
( |
|
$array, |
|
|
|
$key, |
|
|
|
$value |
|
) |
| |
Filter an array by key and values.
- Parameters
-
array | The array to sort |
key | The key used as filter criteria |
value | The value used as filter criteria |
- Returns
- Returns the filtered array.
array_keys_exists |
( |
|
$keys, |
|
|
|
$search, |
|
|
& |
$missing = NULL |
|
) |
| |
Checks if the given keys or index exists in the array.
- Parameters
-
keys | An array containing the keys to check |
search | An array with keys to check |
missing | Contains the missing keys if function fails |
- Returns
- Returns TRUE on success or FALSE on failure.
array_sort_key |
( |
array & |
$array, |
|
|
|
$key |
|
) |
| |
This file is part of OpenMediaVault.
- License:
- http://www.gnu.org/licenses/gpl.html GPL Version 3
- Author
- Volker Theile volke.nosp@m.r.th.nosp@m.eile@.nosp@m.open.nosp@m.media.nosp@m.vaul.nosp@m.t.org
- Copyright
- Copyright (c) 2009-2014 Volker Theile
OpenMediaVault is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
OpenMediaVault is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with OpenMediaVault. If not, see http://www.gnu.org/licenses/. Sort an array by values using a user-defined key.
- Parameters
-
array | The array to sort |
key | The key used as sort criteria |
- Returns
- Returns TRUE on success or FALSE on failure.
binary_convert |
( |
|
$number, |
|
|
|
$fromPrefix, |
|
|
|
$toPrefix, |
|
|
|
$decimalPlaces = 0 |
|
) |
| |
Convert a number to bytes using binary multiples.
- Parameters
-
number | The number to convert. |
fromPrefix | The binary prefix name number is in, e.g. 'KiB'. |
toPrefix | The binary prefix name to convert number to, e.g. 'TiB'. |
decimalPlaces | The number of decimal places. Defaults to 0. |
- Returns
- The converted number as string or FALSE on failure.
if (!function_exists('json_last_error_msg')) binary_format |
( |
|
$number, |
|
|
|
$options = NULL |
|
) |
| |
Returns the error string of the last JSON API call.
- Returns
- Returns the error message on success or NULL with wrong parameters. Convert a number into the highest possible binary unit.
- Parameters
-
value | The number to convert (per default this is in Bytes). |
options | An array of additional options. |
- Returns
- The converted string value including the unit or an indexed array with the fields value and unit.
if (!function_exists("boolval")) boolvalEx |
( |
|
$var | ) |
|
Get the boolean value of a variable.
- Deprecated:
- Parameters
-
var | The scalar value being converted to a boolean. Returns the boolean value of the given value. |
Get the boolean value of a variable. A boolean TRUE will be returned for the values 1, '1', 'on', 'yes', 'y' and 'true'.
- Parameters
-
var | The scalar value being converted to a boolean. Returns the boolean value of the given value. |
inet_getnetmask |
( |
|
$bits, |
|
|
|
$forceipv6 = FALSE |
|
) |
| |
Build a netmask based on the given number of bits.
- Parameters
-
bits | The number of bits to be set in the desired netmask. |
forceipv6 | Set to TRUE to force an IPv6 netmask, even if bits <= 32. Defaults to FALSE which auto-detects the address family. |
- Returns
- The netmask as string.
Tells whether the given file is a block device.
- Parameters
-
filename | Path to the file. |
- Returns
- Returns TRUE if the file is a block device, FALSE otherwise.
Finds out whether a variable describes a devicefile, e.g. /dev/sda1.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable describes a devicefile, otherwise FALSE.
Finds out whether a variable is an IP address.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is an IP address, otherwise FALSE.
Finds out whether a variable is an IPv4 address.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is an IPv4 address, otherwise FALSE.
Finds out whether a variable is an IPv6 address.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is an IPv6 address, otherwise FALSE.
Finds out whether a variable is JSON.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is JSON, otherwise FALSE.
Finds out whether a variable is a multidimensional array.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is a multidimensional array, otherwise FALSE.
Finds out whether a variable is an UUID v4.
- Parameters
-
var | The variable being evaluated. |
- Returns
- TRUE if the variable is an UUID, otherwise FALSE.
json_encode_safe |
( |
|
$value, |
|
|
|
$options = 0 |
|
) |
| |
Returns the JSON representation of a value. All strings will be encoded to UTF-8 before, thus json_encode should not throw an exception like 'Invalid UTF-8 sequence in argument' (Mantis 0000355).
- Parameters
-
value | The value being encoded. |
options | Bitmask, see PHP json_encode manual pages. |
- Returns
- Returns a string containing the JSON representation of value.
json_validate |
( |
|
$json, |
|
|
|
$schema, |
|
|
& |
$errors = NULL |
|
) |
| |
Validate JSON data via JSON schema.
- Parameters
-
json | The JSON string to validate. |
schema | The JSON schema to use for validation. |
errors | Optional parameter which will contain the error messages if validation fails. |
- Returns
- TRUE if successful, otherwise FALSE.
mkdtemp |
( |
|
$prefix = "" , |
|
|
|
$mode = 0700 |
|
) |
| |
Create a directory with unique file name.
- Parameters
-
prefix | The prefix of the generated temporary directory. |
mode | The mode of the temporary directory. Defaults to 0700. |
- Returns
- Returns the full path of the created directory, or FALSE on failure.
strpdate |
( |
|
$date, |
|
|
|
$format |
|
) |
| |
Convert any time/date into a Unix timestamp according to the specified format.
- Parameters
-
date | A date/time string to parse. |
format | The format used in date. |
- Returns
- Returns a Unix timestamp on success, FALSE otherwise.
Convert an object to an array.
- Parameters
-
object | The object instance. |
- Returns
- Returns an associative array of defined object accessible non-static properties for the specified object in scope.