Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
quizaccess_seb\property_list Class Reference

Wrapper for CFPropertyList to handle low level iteration. More...

Public Member Functions

 __construct (string $xml='')
 property_list constructor.
 
 add_element_to_root (string $key, CFType $element)
 Add a new element to the root dictionary element.
 
 delete_element (string $key)
 Delete any element with a matching key.
 
 get_element_value (string $key)
 Get value of element identified by key.
 
 set_or_update_value (string $key, CFType $input)
 Helper function to either set or update a CF type value to the plist.
 
 to_json ()
 Return a JSON representation of the PList.
 
 to_xml ()
 Convert the PList to XML.
 
 update_element_array (string $key, array $value)
 Update the array of any dict or array element with matching key.
 
 update_element_value (string $key, $value)
 Update the value of any element with matching key.
 

Detailed Description

Wrapper for CFPropertyList to handle low level iteration.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

quizaccess_seb\property_list::__construct ( string $xml = '')

property_list constructor.

Parameters
string$xmlA Plist XML string.

Member Function Documentation

◆ add_element_to_root()

quizaccess_seb\property_list::add_element_to_root ( string $key,
CFType $element )

Add a new element to the root dictionary element.

Parameters
string$keyKey to assign to new element.
CFType$elementThe new element. May be a collection such as an array.

◆ delete_element()

quizaccess_seb\property_list::delete_element ( string $key)

Delete any element with a matching key.

Parameters
string$keyKey of element to delete.

◆ get_element_value()

quizaccess_seb\property_list::get_element_value ( string $key)

Get value of element identified by key.

Parameters
string$keyKey of element.
Return values
mixedValue of element found, or null if none found.

◆ set_or_update_value()

quizaccess_seb\property_list::set_or_update_value ( string $key,
CFType $input )

Helper function to either set or update a CF type value to the plist.

Parameters
string$key
CFType$input

◆ to_json()

quizaccess_seb\property_list::to_json ( )

Return a JSON representation of the PList.

The JSON is constructed to be used to generate a SEB Config Key.

See the developer documention for SEB for more information on the requirements on generating a SEB Config Key. https://safeexambrowser.org/developer/seb-config-key.html

  1. Don't add any whitespace or line formatting to the SEB-JSON string.
  2. Don't add character escaping (also backshlashes "::" as found in URL filter rules should not be escaped).
  3. All <dict> elements from the plist XML must be ordered (alphabetically sorted) by their key names. Use a recursive method to apply ordering also to nested dictionaries contained in the root-level dictionary and in arrays. Use non-localized (culture invariant), non-ASCII value based case insensitive ordering. For example the key <key>allowWlan

</key> comes before <key>allowWLAN</key>. Cocoa/Obj-C and .NET/C# usually use this case insensitive ordering as default, but PHP for example doesn't.

  1. Remove empty <dict> elements (key/value). Current versions of SEB clients should anyways not generate empty dictionaries, but this was possible with outdated versions. If config files have been generated that time, such elements might still be around.
  2. All string elements must be UTF8 encoded.
  3. Base16 strings should use lower-case a-f characters, even though this isn't relevant in the current implementation of the Config Key calculation.
  4. <data> plist XML elements must be converted to Base64 strings.
  5. <date> plist XML elements must be converted to ISO 8601 formatted strings.
Return values
stringA json encoded string.

◆ to_xml()

quizaccess_seb\property_list::to_xml ( )

Convert the PList to XML.

Return values
stringXML ready for creating an XML file.

◆ update_element_array()

quizaccess_seb\property_list::update_element_array ( string $key,
array $value )

Update the array of any dict or array element with matching key.

Will replace array.

Parameters
string$keyKey of element to update.
array$valueArray to update element with.

◆ update_element_value()

quizaccess_seb\property_list::update_element_value ( string $key,
$value )

Update the value of any element with matching key.

Only allow string, number and boolean elements to be updated.

Parameters
string$keyKey of element to update.
mixed$valueValue to update element with.

The documentation for this class was generated from the following file: