Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | |
__construct ($file=null, $format=self::FORMAT_AUTO) | |
Create new CFPropertyList. | |
__get ($key) | |
Generic getter (magic) | |
add (CFType $value=null) | |
Add CFType to collection. | |
arrayToBinary ($val) | |
Convert array to binary format and add it to the object table. | |
boolToBinary ($val) | |
Convert a bool value to binary and add it to the object table. | |
current () | |
Get Iterator's current CFType identified by $iteratorPosition @externalurl http://php.net/manual/en/iterator.current.php. | |
dataToBinary ($val) | |
Convert data value to binary format and add it to the object table. | |
dateToBinary ($val) | |
Convert date value (apple format) to binary and adds it to the object table. | |
del ($key) | |
Remove CFType from collection. | |
dictToBinary ($val) | |
Convert dictionary to binary format and add it to the object table. | |
get ($key) | |
Get CFType from collection. | |
getValue ($cftype=false) | |
Get first (and only) child, or complete collection. | |
key () | |
Get Iterator's current key identified by $iteratorPosition @externalurl http://php.net/manual/en/iterator.key.php. | |
load ($file=null, $format=null) | |
Load a plist file. | |
loadBinary ($file=null) | |
Load an binary PropertyList. | |
loadBinaryStream ($stream) | |
Load an binary PropertyList. | |
loadXML ($file=null) | |
Load an XML PropertyList. | |
loadXMLStream ($stream) | |
Load an XML PropertyList. | |
next () | |
Increment $iteratorPosition to address next {. | |
numToBinary ($value) | |
Converts a numeric value to binary and adds it to the object table. | |
parse ($str=null, $format=null) | |
Parse a plist string. | |
parseBinary ($content=null) | |
parse a binary plist string | |
parseBinaryString () | |
Parse a binary plist string. | |
purge () | |
Empty the collection. | |
readBinary ($file) | |
Read a binary plist file. | |
readBinaryObject () | |
Read an object type byte, decode it and delegate to the correct reader function. | |
readBinaryObjectAt ($pos) | |
Read an object type byte at position $pos, decode it and delegate to the correct reader function. | |
readBinaryStream ($stream) | |
Read a binary plist stream. | |
rewind () | |
Rewind $iteratorPosition to first position (being 0) @externalurl http://php.net/manual/en/iterator.rewind.php. | |
save ($file=null, $format=null, $formatted_xml=false) | |
Convert CFPropertyList to XML or binary and save to file. | |
saveBinary ($file) | |
Convert CFPropertyList to binary format (bplist00) and save to file. | |
saveXML ($file, $formatted=false) | |
Convert CFPropertyList to XML and save to file. | |
stringToBinary ($val) | |
Uniques and transforms a string value to binary format and adds it to the object table. | |
toArray () | |
Get PropertyList as array. | |
toBinary () | |
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray. | |
toXML ($formatted=false) | |
Convert CFPropertyList to XML. | |
uidToBinary ($value) | |
valid () | |
Test if $iteratorPosition addresses a valid element of $value @externalurl http://php.net/manual/en/iterator.valid.php. | |
Static Public Member Functions | |
static | bytesInt ($int) |
Calculate the byte needed for a „normal” integer value. | |
static | bytesNeeded ($count_objects) |
Calculate the bytes needed to save the number of objects. | |
static | bytesSizeInt ($int) |
calculate the bytes needed for a size integer value | |
static | charsetStrlen ($string, $charset="UTF-8") |
Count characters considering character set Trying to use MBString, Iconv - in that particular order. | |
static | convertCharset ($string, $fromCharset, $toCharset='UTF-8') |
Convert the given string from one charset to another. | |
static | guess ($value, $options=array()) |
Create CFType-structure from guessing the data-types. | |
static | intBytes ($int) |
Code an integer to byte representation. | |
static | packItWithSize ($nbytes, $int) |
„pack” a value (i.e. | |
static | typeBytes ($type, $type_len) |
Code an type byte, consisting of the type marker and the length of the type. | |
static | unpackWithSize ($nbytes, $buff) |
„unpack” multiple values of the specified size (i.e. | |
Protected Member Functions | |
getLibxmlErrors () | |
import (DOMNode $node, $parent) | |
Convert a DOMNode into a CFType. | |
intToBinary ($value) | |
Codes an integer to binary format. | |
readBinaryArray ($length) | |
Read an array value, including contained objects. | |
readBinaryData ($length) | |
Read a data value. | |
readBinaryDate ($length) | |
Read a date value. | |
readBinaryDict ($length) | |
Read a dictionary value, including contained objects. | |
readBinaryInt ($length) | |
Read an integer value. | |
readBinaryNullType ($length) | |
Read a „null type” (filler byte, true, false, 0 byte) | |
readBinaryReal ($length) | |
Read a real value. | |
readBinaryString ($length) | |
Read a string value, usually coded as utf8. | |
readBinaryUnicodeString ($length) | |
Read a unicode string value, coded as UTF-16BE. | |
realToBinary ($val) | |
Codes a real value to binary format. | |
uniqueAndCountValues ($value) | |
Count number of objects and create a unique table for strings. | |
Static Protected Member Functions | |
static | binaryStrlen ($val) |
Counts the number of bytes the string will have when coded; utf-16be if non-ascii characters are present. | |
static | make64Int ($hi, $lo) |
Create an 64 bit integer using bcmath or gmp. | |
Protected Attributes | |
string | $content = null |
Content of the plist (unparsed string) | |
integer | $countObjects = 0 |
Number of objects in file. | |
integer | $detectedFormat = null |
Detected format of PropertyList. | |
string | $file = null |
Path of PropertyList. | |
integer | $format = null |
Path of PropertyList. | |
integer | $intSize = 0 |
The length of all ints in file (byte length) | |
array | $iteratorKeys = null |
List of Keys for numerical iterator access | |
integer | $iteratorPosition = 0 |
Position of iterator | |
integer | $miscSize = 0 |
The length of misc objects (i.e. | |
integer | $objectRefs = 0 |
Number of object references in file (needed to calculate reference byte length) | |
$objectRefSize = 0 | |
The size of object references. | |
$objectTable = array() | |
Table containing all objects in the file. | |
$offsets = array() | |
The „offsets” (i.e. | |
integer | $pos = 0 |
position in the (unparsed) string | |
integer | $stringSize = 0 |
The length of all strings in the file (byte length, not character length) | |
array | $uniqueTable = array() |
Table containing uniqued objects. | |
array | $value = array() |
CFType nodes. | |
integer | $writtenObjectCount = 0 |
Number of objects written during save phase; needed to calculate the size of the object table. | |
Static Protected Attributes | |
static array | $types |
List of NodeNames to ClassNames for resolving plist-files. | |
CFPropertyList::__construct | ( | $file = null, | |
$format = self::FORMAT_AUTO ) |
Create new CFPropertyList.
If a path to a PropertyList is specified, it is loaded automatically.
string | $file | Path of PropertyList |
integer | $format | he format of the property list, see FORMAT_XML, FORMAT_BINARY and FORMAT_AUTO, defaults to FORMAT_AUTO |
IOException | if file could not be read by load() @uses $file for storing the current file, if specified @uses load() for loading the plist-file |
CFPropertyList::__get | ( | $key | ) |
CFPropertyList::add | ( | CFType | $value = null | ) |
|
inherited |
Convert array to binary format and add it to the object table.
CFArray | $val | The array to convert |
integer | The position in the object table |
|
staticprotectedinherited |
Counts the number of bytes the string will have when coded; utf-16be if non-ascii characters are present.
string | $val | The string value |
integer | The length of the coded string in bytes |
|
inherited |
Convert a bool value to binary and add it to the object table.
bool | $val | The boolean value |
integer | The position in the object table |
|
staticinherited |
Calculate the byte needed for a „normal” integer value.
integer | $int | The integer value |
integer | The number of bytes needed + 1 (because of the „marker byte”) |
|
staticinherited |
Calculate the bytes needed to save the number of objects.
integer | $count_objects | The number of objects |
integer | The number of bytes |
|
staticinherited |
calculate the bytes needed for a size integer value
integer | $int | The integer value to calculate |
integer | The number of bytes needed |
|
staticinherited |
Count characters considering character set Trying to use MBString, Iconv - in that particular order.
string | $string | the string to convert |
string | $charset | the charset the given string is currently encoded in |
integer | The number of characters in that string |
PListException | on neither MBString, Iconv being available |
|
staticinherited |
Convert the given string from one charset to another.
Trying to use MBString, Iconv, Recode - in that particular order.
string | $string | the string to convert |
string | $fromCharset | the charset the given string is currently encoded in |
string | $toCharset | the charset to convert to, defaults to UTF-8 |
string | the converted string |
PListException | on neither MBString, Iconv, Recode being available |
CFPropertyList::current | ( | ) |
Get Iterator's current CFType identified by $iteratorPosition @externalurl http://php.net/manual/en/iterator.current.php.
mixed | current Item @uses $iteratorPosition identify current key @uses $iteratorKeys identify current value |
|
inherited |
Convert data value to binary format and add it to the object table.
string | $val | The data value |
integer | The position in the object table |
|
inherited |
Convert date value (apple format) to binary and adds it to the object table.
integer | $value | The date value |
integer | The position of the coded value in the object table |
CFPropertyList::del | ( | $key | ) |
|
inherited |
Convert dictionary to binary format and add it to the object table.
CFDictionary | $val | The dict to convert |
integer | The position in the object table |
CFPropertyList::get | ( | $key | ) |
CFPropertyList::getValue | ( | $cftype = false | ) |
|
static |
Create CFType-structure from guessing the data-types.
The functionality has been moved to the more flexible CFTypeDetector facility.
mixed | $value | Value to convert to CFType |
array | $options | Configuration for casting values [autoDictionary, suppressExceptions, objectToArrayMethod, castNumericStrings] |
CFType | CFType based on guessed type @uses CFTypeDetector for actual type detection |
|
protected |
Convert a DOMNode into a CFType.
DOMNode | $node | Node to import children of |
CFDictionary | CFArray | CFPropertyList | $parent |
void |
|
staticinherited |
Code an integer to byte representation.
integer | $int | The integer value |
string | The packed byte value |
|
protectedinherited |
Codes an integer to binary format.
integer | $value | The integer value |
string | the coded integer |
CFPropertyList::key | ( | ) |
Get Iterator's current key identified by $iteratorPosition @externalurl http://php.net/manual/en/iterator.key.php.
mixed | key of the current Item @uses $iteratorPosition identify current key @uses $iteratorKeys identify current value |
CFPropertyList::load | ( | $file = null, | |
$format = null ) |
Load a plist file.
Load and import a plist file.
string | $file | Path of PropertyList, defaults to $file |
integer | $format | The format of the property list, see FORMAT_XML, FORMAT_BINARY and FORMAT_AUTO, defaults to $format |
void |
PListException | if file format version is not 00 |
IOException | if file could not be read |
DOMException | if plist file could not be parsed properly @uses $file if argument $file was not specified @uses $value reset to empty array @uses import() for importing the values |
CFPropertyList::loadBinary | ( | $file = null | ) |
Load an binary PropertyList.
string | $file | Path of PropertyList, defaults to $file |
void |
IOException | if file could not be read |
PListException | if binary plist-file could not be read properly @uses load() to actually load the file |
CFPropertyList::loadBinaryStream | ( | $stream | ) |
Load an binary PropertyList.
stream | $stream | Stream containing the PropertyList |
void |
IOException | if file could not be read |
PListException | if binary plist-file could not be read properly @uses parse() to actually load the file |
CFPropertyList::loadXML | ( | $file = null | ) |
Load an XML PropertyList.
string | $file | Path of PropertyList, defaults to $file |
void |
IOException | if file could not be read |
DOMException | if XML-file could not be read properly @uses load() to actually load the file |
CFPropertyList::loadXMLStream | ( | $stream | ) |
Load an XML PropertyList.
resource | $stream | A stream containing the xml document. |
void |
IOException | if stream could not be read |
DOMException | if XML-stream could not be read properly |
|
staticprotectedinherited |
Create an 64 bit integer using bcmath or gmp.
int | $hi | The higher word |
int | $lo | The lower word |
mixed | The integer (as int if possible, as string if not possible) |
PListException | if neither gmp nor bc available |
CFPropertyList::next | ( | ) |
Increment $iteratorPosition to address next {.
void | @uses $iteratorPosition increment by 1 |
|
inherited |
Converts a numeric value to binary and adds it to the object table.
numeric | $value | The numeric value |
integer | The position in the object table |
|
staticinherited |
„pack” a value (i.e.
write the binary representation as big endian to a string) with the specified size
integer | $nbytes | The number of bytes to pack |
integer | $int | The integer value to pack |
string | The packed value as string |
CFPropertyList::parse | ( | $str = null, | |
$format = null ) |
Parse a plist string.
Parse and import a plist string.
string | $str | String containing the PropertyList, defaults to $content |
integer | $format | The format of the property list, see FORMAT_XML, FORMAT_BINARY and FORMAT_AUTO, defaults to $format |
void |
PListException | if file format version is not 00 |
IOException | if file could not be read |
DOMException | if plist file could not be parsed properly @uses $content if argument $str was not specified @uses $value reset to empty array @uses import() for importing the values |
|
inherited |
parse a binary plist string
string | $content | The stream to read, defaults to ->content |
void |
IOException | if read error occurs |
|
inherited |
CFPropertyList::purge | ( | ) |
Empty the collection.
array | the removed CFTypes @uses $value for removing CFType of $key |
|
inherited |
Read a binary plist file.
string | $file | The file to read |
void |
IOException | if read error occurs |
|
protectedinherited |
Read an array value, including contained objects.
integer | $length | The number of contained objects |
CFArray | The array value, including the objects |
IOException | if read error occurs |
|
protectedinherited |
Read a data value.
integer | $length | The length (in bytes) of the integer value, coded as „set bit $length to 1” |
CFData | The data value |
IOException | if read error occurs |
|
protectedinherited |
Read a date value.
integer | $length | The length (in bytes) of the integer value, coded as „set bit $length to 1” |
CFDate | The date value |
PListException | if date val is invalid |
IOException | if read error occurs |
|
protectedinherited |
Read a dictionary value, including contained objects.
integer | $length | The number of contained objects |
CFDictionary | The dictionary value, including the objects |
IOException | if read error occurs |
|
protectedinherited |
Read an integer value.
integer | $length | The length (in bytes) of the integer value, coded as „set bit $length to 1” |
CFNumber | The integer value |
PListException | if integer val is invalid |
IOException | if read error occurs @uses make64Int() to overcome PHP's big integer problems |
|
protectedinherited |
Read a „null type” (filler byte, true, false, 0 byte)
$length | The byte itself |
the | byte value (e.g. CFBoolean(true), CFBoolean(false), 0 or 15) |
PListException | on encountering an unknown null type |
|
inherited |
Read an object type byte, decode it and delegate to the correct reader function.
mixed | The value of the delegate reader, so any of the CFType subclasses |
IOException | if read error occurs |
|
inherited |
Read an object type byte at position $pos, decode it and delegate to the correct reader function.
integer | $pos | The table position in the offsets table |
mixed | The value of the delegate reader, so any of the CFType subclasses |
|
protectedinherited |
Read a real value.
integer | $length | The length (in bytes) of the integer value, coded as „set bit $length to 1” |
CFNumber | The real value |
PListException | if real val is invalid |
IOException | if read error occurs |
|
inherited |
Read a binary plist stream.
resource | $stream | The stream to read |
void |
IOException | if read error occurs |
|
protectedinherited |
Read a string value, usually coded as utf8.
integer | $length | The length (in bytes) of the string value |
CFString | The string value, utf8 encoded |
IOException | if read error occurs |
|
protectedinherited |
Read a unicode string value, coded as UTF-16BE.
integer | $length | The length (in bytes) of the string value |
CFString | The string value, utf8 encoded |
IOException | if read error occurs |
|
protectedinherited |
Codes a real value to binary format.
float | $val | The real value |
string | The coded real |
CFPropertyList::rewind | ( | ) |
Rewind $iteratorPosition to first position (being 0) @externalurl http://php.net/manual/en/iterator.rewind.php.
void | @uses $iteratorPosition set to 0 @uses $iteratorKeys store keys of $value |
CFPropertyList::save | ( | $file = null, | |
$format = null, | |||
$formatted_xml = false ) |
Convert CFPropertyList to XML or binary and save to file.
string | $file | Path of PropertyList, defaults to $file |
string | $format | Format of PropertyList, defaults to $format |
bool | $formatted_xml | Print XML plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false |
void |
IOException | if file could not be read |
PListException | if evaluated $format is neither FORMAT_XML nor FORMAL_BINARY @uses $file if $file was not specified @uses $format if $format was not specified |
CFPropertyList::saveBinary | ( | $file | ) |
Convert CFPropertyList to binary format (bplist00) and save to file.
string | $file | Path of PropertyList, defaults to $file |
void |
IOException | if file could not be read @uses $file if $file was not specified |
CFPropertyList::saveXML | ( | $file, | |
$formatted = false ) |
Convert CFPropertyList to XML and save to file.
string | $file | Path of PropertyList, defaults to $file |
bool | $formatted | Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false |
void |
IOException | if file could not be read @uses $file if $file was not specified |
|
inherited |
Uniques and transforms a string value to binary format and adds it to the object table.
string | $val | The string value |
integer | The position in the object table |
CFPropertyList::toArray | ( | ) |
Get PropertyList as array.
mixed | primitive value of first (and only) CFType, or array of primitive values of collection @uses $value for retrieving CFTypes |
|
inherited |
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray.
string | The binary plist content |
CFPropertyList::toXML | ( | $formatted = false | ) |
Convert CFPropertyList to XML.
bool | $formatted | Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false |
string | The XML content |
|
staticinherited |
Code an type byte, consisting of the type marker and the length of the type.
string | $type | The type byte value (i.e. "d" for dictionaries) |
integer | $type_len | The length of the type |
string | The packed type byte value |
|
protectedinherited |
Count number of objects and create a unique table for strings.
$value | The value to count and unique |
void |
|
staticinherited |
„unpack” multiple values of the specified size (i.e.
get the integers from their binary representation) from a string
integer | $nbytes | The number of bytes of each value to unpack |
integer | $buff | The string packed with integer values |
array | The unpacked integers |
CFPropertyList::valid | ( | ) |
Test if $iteratorPosition addresses a valid element of $value @externalurl http://php.net/manual/en/iterator.valid.php.
boolean | true if current position is valid, false else @uses $iteratorPosition test if within $iteratorKeys @uses $iteratorPosition test if within $value |
|
protectedinherited |
The length of misc objects (i.e.
not integer and not string) in file
|
protectedinherited |
The „offsets” (i.e.
the different entries) in the file
|
staticprotected |
List of NodeNames to ClassNames for resolving plist-files.