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]

CFPropertyList {@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: 608 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 5 files
 lib/plist/classes/CFPropertyList/IOException.php
 lib/plist/classes/CFPropertyList/CFBinaryPropertyList.php
 lib/plist/classes/CFPropertyList/CFType.php
 lib/plist/classes/CFPropertyList/CFTypeDetector.php
 lib/plist/classes/CFPropertyList/PListException.php

Defines 1 class

CFPropertyList:: (25 methods):
  __construct()
  loadXML()
  loadXMLStream()
  loadBinary()
  loadBinaryStream()
  load()
  parse()
  import()
  saveXML()
  saveBinary()
  save()
  toXML()
  add()
  get()
  __get()
  del()
  purge()
  getValue()
  guess()
  toArray()
  rewind()
  current()
  key()
  next()
  valid()


Class: CFPropertyList  - X-Ref

Property List
Interface for handling reading, editing and saving Property Lists as defined by Apple.

__construct($file=null,$format=self::FORMAT_AUTO)   X-Ref
Create new CFPropertyList.
If a path to a PropertyList is specified, it is loaded automatically.

param: string $file Path of PropertyList
param: integer $format he format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link FORMAT_AUTO}

loadXML($file=null)   X-Ref
Load an XML PropertyList.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

loadXMLStream($stream)   X-Ref
Load an XML PropertyList.

param: resource $stream A stream containing the xml document.
return: void

loadBinary($file=null)   X-Ref
Load an binary PropertyList.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

loadBinaryStream($stream)   X-Ref
Load an binary PropertyList.

param: stream $stream Stream containing the PropertyList
return: void

load($file=null,$format=null)   X-Ref
Load a plist file.
Load and import a plist file.

param: string $file Path of PropertyList, defaults to {@link $file}
param: integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format}
return: void

parse($str=NULL,$format=NULL)   X-Ref
Parse a plist string.
Parse and import a plist string.

param: string $str String containing the PropertyList, defaults to {@link $content}
param: integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format}
return: void

import(DOMNode $node, $parent)   X-Ref
Convert a DOMNode into a CFType.

param: DOMNode $node Node to import children of
param: CFDictionary|CFArray|CFPropertyList $parent
return: void

saveXML($file)   X-Ref
Convert CFPropertyList to XML and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

saveBinary($file)   X-Ref
Convert CFPropertyList to binary format (bplist00) and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

save($file=null,$format=null)   X-Ref
Convert CFPropertyList to XML or binary and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
param: string $format Format of PropertyList, defaults to {@link $format}
return: void

toXML($formatted=false)   X-Ref
Convert CFPropertyList to XML

param: bool $formatted Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false
return: string The XML content

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

param: CFType $value CFType to add to collection
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

__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: integer $key Key of CFType to removes from collection
return: CFType removed CFType, null else

purge()   X-Ref
Empty the collection

return: array the removed CFTypes

getValue($cftype=false)   X-Ref
Get first (and only) child, or complete collection.

param: string $cftype if set to true returned value will be CFArray instead of an array in case of a collection
return: CFType|array CFType or list of CFTypes known to the PropertyList

guess($value, $options=array()   X-Ref
Create CFType-structure from guessing the data-types.
The functionality has been moved to the more flexible {@link CFTypeDetector} facility.

param: mixed $value Value to convert to CFType
param: array $options Configuration for casting values [autoDictionary, suppressExceptions, objectToArrayMethod, castNumericStrings]
return: CFType CFType based on guessed type

toArray()   X-Ref
Get PropertyList as array.

return: mixed primitive value of first (and only) CFType, or array of primitive values of collection

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