Wrapper for CFPropertyList to handle low level iteration.
More...
Wrapper for CFPropertyList to handle low level iteration.
- Copyright
- 2020 Catalyst IT
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
quizaccess_seb\property_list::__construct |
( |
string |
$xml = '' | ) |
|
property_list constructor.
- Parameters
-
string | $xml | A Plist XML string. |
◆ 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 | $key | Key to assign to new element. |
CFType | $element | The 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 | $key | Key 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 | $key | Key of element. |
- Return values
-
mixed | Value 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
-
◆ 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
- Don't add any whitespace or line formatting to the SEB-JSON string.
- Don't add character escaping (also backshlashes "::" as found in URL filter rules should not be escaped).
- 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.
- 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.
- All string elements must be UTF8 encoded.
- Base16 strings should use lower-case a-f characters, even though this isn't relevant in the current implementation of the Config Key calculation.
- <data> plist XML elements must be converted to Base64 strings.
- <date> plist XML elements must be converted to ISO 8601 formatted strings.
- Return values
-
string | A json encoded string. |
◆ to_xml()
quizaccess_seb\property_list::to_xml |
( |
| ) |
|
Convert the PList to XML.
- Return values
-
string | XML 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 | $key | Key of element to update. |
array | $value | Array 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 | $key | Key of element to update. |
mixed | $value | Value to update element with. |
The documentation for this class was generated from the following file: