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 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Data-Types for CFPropertyList as defined by Apple. {@link http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html Property Lists}

Author: Rodney Rehm <rodney.rehm@medialize.de>
Author: Christian Kruse <cjk@wwwtech.de>
Version: $Id$
File Size: 757 lines (23 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 9 classes

CFType:: (5 methods):
  __construct()
  getValue()
  setValue()
  toXML()
  toArray()

CFString:: (2 methods):
  toXML()
  toBinary()

CFUid:: (2 methods):
  toXML()
  toBinary()

CFNumber:: (2 methods):
  toXML()
  toBinary()

CFDate:: (6 methods):
  __construct()
  setValue()
  getValue()
  toXML()
  toBinary()
  dateValue()

CFBoolean:: (2 methods):
  toXML()
  toBinary()

CFData:: (6 methods):
  __construct()
  setValue()
  getCodedValue()
  getValue()
  toXML()
  toBinary()

CFArray:: (17 methods):
  __construct()
  setValue()
  add()
  get()
  del()
  toXML()
  toBinary()
  toArray()
  rewind()
  current()
  key()
  next()
  valid()
  offsetExists()
  offsetGet()
  offsetSet()
  offsetUnset()

CFDictionary:: (14 methods):
  __construct()
  setValue()
  add()
  get()
  __get()
  del()
  toXML()
  toBinary()
  toArray()
  rewind()
  current()
  key()
  next()
  valid()


Class: CFType  - X-Ref

Base-Class of all CFTypes used by CFPropertyList

__construct($value=null)   X-Ref
Create new CFType.

param: mixed $value Value of CFType

getValue()   X-Ref
Get the CFType's value

return: mixed CFType's value

setValue($value)   X-Ref
Set the CFType's value

return: void

toXML(DOMDocument $doc, $nodeName)   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName Name of element to create
return: DOMNode Node created based on CType

toArray()   X-Ref
Get CFType's value.

return: mixed primitive value

Class: CFString  - X-Ref

String Type of CFPropertyList

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;string&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

Class: CFUid  - X-Ref

toXML(DOMDocument $doc,$nodeName="")   X-Ref
No description

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
No description

Class: CFNumber  - X-Ref

Number Type of CFPropertyList

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.
Returns &lt;real&gt; if $value is a float, &lt;integer&gt; if $value is an integer.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;real&gt; or &lt;integer&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

Class: CFDate  - X-Ref

Date Type of CFPropertyList
Note: CFDate uses Unix timestamp (epoch) to store dates internally

__construct($value,$format=CFDate::TIMESTAMP_UNIX)   X-Ref
Create new Date CFType.

param: integer $value timestamp to set
param: integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_APPLE}

setValue($value,$format=CFDate::TIMESTAMP_UNIX)   X-Ref
Set the Date CFType's value.

param: integer $value timestamp to set
param: integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_UNIX}
return: void

getValue($format=CFDate::TIMESTAMP_UNIX)   X-Ref
Get the Date CFType's value.

param: integer $format format the timestamp is specified in, use {@link TIMESTAMP_APPLE} or {@link TIMESTAMP_UNIX}, defaults to {@link TIMESTAMP_UNIX}
return: integer Unix timestamp

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;date&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

dateValue($val)   X-Ref
Create a UNIX timestamp from a PList date string

param: string $val The date string (e.g. "2009-05-13T20:23:43Z")
return: integer The UNIX timestamp

Class: CFBoolean  - X-Ref

Boolean Type of CFPropertyList

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.
Returns &lt;true&gt; if $value is a true, &lt;false&gt; if $value is false.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;true&gt; or &lt;false&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

Class: CFData  - X-Ref

Data Type of CFPropertyList
Note: Binary data is base64-encoded.

__construct($value=null,$already_coded=false)   X-Ref
Create new Data CFType

param: string $value data to be contained by new object
param: boolean $already_coded if true $value will not be base64-encoded, defaults to false

setValue($value)   X-Ref
Set the CFType's value and base64-encode it.
<b>Note:</b> looks like base64_encode has troubles with UTF-8 encoded strings

return: void

getCodedValue()   X-Ref
Get base64 encoded data

return: string The base64 encoded data value

getValue()   X-Ref
Get the base64-decoded CFType's value.

return: mixed CFType's value

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;data&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

Class: CFArray  - X-Ref

Array Type of CFPropertyList

__construct($value=array()   X-Ref
Create new CFType.

param: array $value Value of CFType

setValue($value)   X-Ref
Set the CFType's value
<b>Note:</b> this dummy does nothing

return: void

add(CFType $value=null)   X-Ref
Add CFType to collection.

param: CFType $value CFType to add to collection, defaults to null which results in an empty {@link CFString}
return: void

get($key)   X-Ref
Get CFType from collection.

param: integer $key Key of CFType to retrieve from collection
return: CFType CFType found at $key, null else

del($key)   X-Ref
Remove CFType from collection.

param: integer $key Key of CFType to removes from collection
return: CFType removed CFType, null else

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;array&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

toArray()   X-Ref
Get CFType's value.

return: array primitive value

rewind()   X-Ref
Rewind {@link $iteratorPosition} to first position (being 0)

return: void

current()   X-Ref
Get Iterator's current {@link CFType} identified by {@link $iteratorPosition}

return: CFType current Item

key()   X-Ref
Get Iterator's current key identified by {@link $iteratorPosition}

return: string key of the current Item

next()   X-Ref
Increment {@link $iteratorPosition} to address next {@see CFType}

return: void

valid()   X-Ref
Test if {@link $iteratorPosition} addresses a valid element of {@link $value}

return: boolean true if current position is valid, false else

offsetExists($key)   X-Ref
Determine if the array's key exists

param: string $key the key to check
author: Sean Coates <sean@php.net>
return: bool true if the offset exists, false if not

offsetGet($key)   X-Ref
Fetch a specific key from the CFArray

param: string $key the key to check
author: Sean Coates <sean@php.net>
return: mixed the value associated with the key; null if the key is not found

offsetSet($key, $value)   X-Ref
Set a value in the array

param: string $key the key to set
param: string $value the value to set
author: Sean Coates <sean@php.net>
return: void

offsetUnset($key)   X-Ref
Unsets a value in the array
<b>Note:</b> this dummy does nothing

param: string $key the key to set
author: Sean Coates <sean@php.net>
return: void

Class: CFDictionary  - X-Ref

Array Type of CFPropertyList

__construct($value=array()   X-Ref
Create new CFType.

param: array $value Value of CFType

setValue($value)   X-Ref
Set the CFType's value
<b>Note:</b> this dummy does nothing

return: void

add($key, CFType $value=null)   X-Ref
Add CFType to collection.

param: string $key Key to add to collection
param: CFType $value CFType to add to collection, defaults to null which results in an empty {@link CFString}
return: void

get($key)   X-Ref
Get CFType from collection.

param: string $key Key of CFType to retrieve from collection
return: CFType CFType found at $key, null else

__get($key)   X-Ref
Generic getter (magic)

param: integer $key Key of CFType to retrieve from collection
author: Sean Coates <sean@php.net>
return: CFType CFType found at $key, null else

del($key)   X-Ref
Remove CFType from collection.

param: string $key Key of CFType to removes from collection
return: CFType removed CFType, null else

toXML(DOMDocument $doc,$nodeName="")   X-Ref
Get XML-Node.

param: DOMDocument $doc DOMDocument to create DOMNode in
param: string $nodeName For compatibility reasons; just ignore it
return: DOMNode &lt;dict&gt;-Element

toBinary(CFBinaryPropertyList &$bplist)   X-Ref
convert value to binary representation

param: CFBinaryPropertyList The binary property list object
return: The offset in the object table

toArray()   X-Ref
Get CFType's value.

return: array primitive value

rewind()   X-Ref
Rewind {@link $iteratorPosition} to first position (being 0)

return: void

current()   X-Ref
Get Iterator's current {@link CFType} identified by {@link $iteratorPosition}

return: CFType current Item

key()   X-Ref
Get Iterator's current key identified by {@link $iteratorPosition}

return: string key of the current Item

next()   X-Ref
Increment {@link $iteratorPosition} to address next {@see CFType}

return: void

valid()   X-Ref
Test if {@link $iteratorPosition} addresses a valid element of {@link $value}

return: boolean true if current position is valid, false else