Class: I2CE MagicDataNode: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 65: Line 65:
Construct a new configuration value or grouping.
Construct a new configuration value or grouping.
*Signature: protected function __construct($name,$parent,$check_key)
*Signature: protected function __construct($name,$parent,$check_key)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $name<br/>The name of this configuration setting.
** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>The name of this configuration setting.
**Default Value: null
***Default Value: null
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $parent<br/>The parent of this configuration setting.
** [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $parent <br/>The parent of this configuration setting.
**Default Value: null
***Default Value: null
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $check_key<br/>Defaults to true in which case we check that the key is valid.
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $check_key <br/>Defaults to true in which case we check that the key is valid.
**Default Value: true
***Default Value: true
===__get()===
===__get()===
Get the value for a child configuration option.
Get the value for a child configuration option.
*Signature: public function __get($path)
*Signature: public function __get($path)
*Returns: mixed.  Null if the path was
*Parameters:
invalid. I2CE_MagicDataNode or string on success
Parameters:
*$path  
*$path  
*Returns: mixed.<br/>Null if the path was invalid. I2CE_MagicDataNode or string on success
===__isset()===
===__isset()===
Check to see if a given key or path exists and the value is set
Check to see if a given key or path exists and the value is set
returns mixed.  Booolean true or false if the magic data referenced by the given path is set.  null on failure (invalid path)
*Signature: public function __isset($path)
*Signature: public function __isset($path)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()} returns mixed.  Booolean true or false if the magic data referenced by the given path is set.  null on failure (invalid path)
===__set()===
===__set()===
Set the value for a child configuration option.
Set the value for a child configuration option.
*Signature: public function __set($path,$value)
*Signature: public function __set($path,$value)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()}
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===__toString()===
===__toString()===
*Signature: public function __toString()
*Signature: public function __toString()
Line 97: Line 94:
Unset a given key in the children array.
Unset a given key in the children array.
*Signature: final public function __unset($key)
*Signature: final public function __unset($key)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $key
** [http://www.php.net/manual/en/language.types.string.php string ] $key
===_getAsArray()===
===_getAsArray()===
*Signature: protected function _getAsArray($locale)
*Signature: protected function _getAsArray($locale)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $locale<br/>The locale we wish to get the values for.  Defaults to null meaning we are not getting tranlsated values.
** [http://www.php.net/manual/en/language.types.string.php string ] $locale <br/>The locale we wish to get the values for.  Defaults to null meaning we are not getting tranlsated values.
**Default Value: null
***Default Value: null
===_getAttribute()===
===_getAttribute()===
*Signature: protected function _getAttribute($key,$prefix)
*Signature: protected function _getAttribute($key,$prefix)
Parameters:
*Parameters:
*$key  
*$key  
*$prefix  
*$prefix  
===_getAttributes()===
===_getAttributes()===
*Signature: protected function _getAttributes($keys_only,$prefix)
*Signature: protected function _getAttributes($keys_only,$prefix)
Parameters:
*Parameters:
*$keys_only  
*$keys_only  
*$prefix  
*$prefix  
===_hasAttribute()===
===_hasAttribute()===
*Signature: protected function _hasAttribute($key,$prefix)
*Signature: protected function _hasAttribute($key,$prefix)
Parameters:
*Parameters:
*$key  
*$key  
*$prefix  
*$prefix  
===_removeAttribute()===
===_removeAttribute()===
*Signature: protected function _removeAttribute($prefix,$key)
*Signature: protected function _removeAttribute($prefix,$key)
Parameters:
*Parameters:
*$prefix  
*$prefix  
*$key  
*$key  
===_setAttribute()===
===_setAttribute()===
*Signature: protected function _setAttribute($key,$val,$prefix)
*Signature: protected function _setAttribute($key,$val,$prefix)
Parameters:
*Parameters:
*$key  
*$key  
*$val  
*$val  
*$prefix  
*$prefix  
===checkKey()===
===checkKey()===
Check to make sure a given key is valid. It can be any combination of
Check to make sure a given key is valid. It can be any combination of _-+.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
_-+.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
*Signature: static public function checkKey($key)
*Signature: static public function checkKey($key)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $key
===count()===
===count()===
*Signature: public function count()
*Signature: public function count()
Line 144: Line 140:
Erases the current node and all of its subnodes from the storage mechanism.
Erases the current node and all of its subnodes from the storage mechanism.
*Signature: public function erase($locale)
*Signature: public function erase($locale)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true on success
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $locale <br/>The locale we wish to erase the values for.  Defaults to null meaning we erase all values/locales
* [http://www.php.net/manual/en/language.types.string.php string ] $locale<br/>The locale we wish to erase the values for.  Defaults to null meaning we erase all values/locales
***Default Value: null
**Default Value: null
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true on success
===eraseChildren()===
===eraseChildren()===
Erases all children of the current node and all of its
Erases all children of the current node and all of its subnodes from the storage mechanism.
subnodes from the storage mechanism.
 
values for.  Defaults to null meaning we erase all
values/locales
*Signature: public function eraseChildren($locale)
*Signature: public function eraseChildren($locale)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true on success
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $locale <br/>The locale we wish to erase the values for.  Defaults to null meaning we erase all values/locales
* [http://www.php.net/manual/en/language.types.string.php string ] $locale<br/>The locale we wish to erase the
***Default Value: null
**Default Value: null
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true on success
===getAsArray()===
===getAsArray()===
Return an array of all the child values for this object.
Return an array of all the child values for this object.
*Signature: public function getAsArray($path,$locale)
*Signature: public function getAsArray($path,$locale)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()}.  Defaults to null which means we get at this node
***Default Value: null
** [http://www.php.net/manual/en/language.types.string.php string ] $locale <br/>The locale we wish to get the values for.  Defaults to null meaning we are not getting tranlsated values.
***Default Value: null
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}.  Defaults to null which means we get at this node
**Default Value: null
* [http://www.php.net/manual/en/language.types.string.php string ] $locale<br/>The locale we wish to get the values for.  Defaults to null meaning we are not getting tranlsated values.
**Default Value: null
===getAttribute()===
===getAttribute()===
Gets an attribute
Gets an attribute
*Signature: public function getAttribute($key)
*Signature: public function getAttribute($key)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] string if the attribute value. null if it does not exist.
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
* [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>string if the attribute value. null if it does not exist.
===getAttributes()===
===getAttributes()===
Get the attributes
Get the attributes
If true returns associative array of attribute=>value pairs
*Signature: public function getAttributes($keys_only)
*Signature: public function getAttributes($keys_only)
*Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $keys_only <br/>Defaults to false.  If true returns only the attribute names that are set. If true returns associative array of attribute=>value pairs
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $keys_only<br/>Defaults to false.  If true returns only the attribute names that are set.
**Default Value: false
===getChildren()===
===getChildren()===
*Signature: public function getChildren()
*Signature: public function getChildren()
Line 187: Line 178:
Return an array of all child keys for this object.
Return an array of all child keys for this object.
*Signature: public function getKeys($path,$attrs)
*Signature: public function getKeys($path,$attrs)
*Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()}
***Default Value: null
*$attrs
***Default Value: false
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}
**Default Value: null
*$attrs
**Default Value: false
===getName()===
===getName()===
Return the name of this configuration setting.
Return the name of this configuration setting.
Line 204: Line 195:
Return the full path to this configuration setting.
Return the full path to this configuration setting.
*Signature: public function getPath($show_top)
*Signature: public function getPath($show_top)
*Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $show_top <br/>defaults to true if we are to show the parent
***Default Value: true
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $show_top<br/>defaults to true if we are to show the parent
**Default Value: true
===getSaveValue()===
===getSaveValue()===
Return the direct scalar value for this node.
Return the direct scalar value for this node.
Line 214: Line 205:
===getTranslation()===
===getTranslation()===
*Signature: public function getTranslation($locale,$resolve,$path)
*Signature: public function getTranslation($locale,$resolve,$path)
Parameters:
*Parameters:
*$locale  
*$locale  
*$resolve  
*$resolve  
**Default Value: true
***Default Value: true
*$path  
*$path  
**Default Value: null
***Default Value: null
===getTranslations()===
===getTranslations()===
Get the translations for the current node
Get the translations for the current node
If true returns associative array of locale=>translation pairs
*Signature: public function getTranslations($locales_only,$include_default_locale)
*Signature: public function getTranslations($locales_only,$include_default_locale)
*Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $locales_only <br/>Defaults to false.  If true returns only the loclaes for which a translation exists If true returns associative array of locale=>translation pairs
***Default Value: false
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $include_default_locale <br/>Defaults to true in which case we include the nodes values under the default locale
***Default Value: true
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $locales_only<br/>Defaults to false.  If true returns only the loclaes for which a translation exists
**Default Value: false
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $include_default_locale<br/>Defaults to true in which case we include the nodes values under the default locale
**Default Value: true
===getType()===
===getType()===
Return the type of this node.
Return the type of this node.
*Signature: public function getType()
*Signature: public function getType()
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ] or false on failure
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]<br/>or false on failure
===getValue()===
===getValue()===
Return the value of this configuration object if the type == 1 and the current
Return the value of this configuration object if the type == 1 and the current object if type is anything else.
object if type is anything else.
*Signature: public function getValue()
*Signature: public function getValue()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Line 242: Line 231:
Checks to see if an attribute is present
Checks to see if an attribute is present
*Signature: public function hasAttribute($key)
*Signature: public function hasAttribute($key)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] boolean.  true if key exists, false if it does not, null if an invalid key
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
* [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>boolean.  true if key exists, false if it does not, null if an invalid key
===hasChildren()===
===hasChildren()===
whether the current key has children or not.
whether the current key has children or not. this is _not_ whether this has a children or not
this is _not_ whether this has a children or not
*Signature: public function hasChildren()
*Signature: public function hasChildren()
===isScalar()===
===isScalar()===
*Signature: private function isScalar()
*Signature: private function isScalar()
===is_indeterminate()===
===is_indeterminate()===
Check to see if the value at the specified path is indeterminate
Check to see if the value at the specified path is indeterminate @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: public function is_indeterminate($path)
*Signature: public function is_indeterminate($path)
*Returns: boolean.  True if it is a scalar value
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True if it is a scalar value
===is_parent()===
===is_parent()===
Check to see if the value at the specified path is set and is a parent node.
Check to see if the value at the specified path is set and is a parent node. @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: public function is_parent($path)
*Signature: public function is_parent($path)
*Returns: boolean.  True if it is a scalar value
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True if it is a scalar value
===is_populated()===
===is_populated()===
Check to see if the value at the specified path is populated
Check to see if the value at the specified path is populated @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: protected function is_populated($path)
*Signature: protected function is_populated($path)
*Returns: boolean.  True if it is a scalar value
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True if it is a scalar value
===is_root()===
===is_root()===
*Signature: public function is_root($path)
*Signature: public function is_root($path)
Parameters:
*Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
===is_scalar()===
===is_scalar()===
Check to see if the value at the specified path is set and is a scalar.
Check to see if the value at the specified path is set and is a scalar. @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: public function is_scalar($path)
*Signature: public function is_scalar($path)
*Returns: boolean.  True if it is a scalar value
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True if it is a scalar value
===is_translatable()===
===is_translatable()===
Checked to see if the node referenced is translatable
Checked to see if the node referenced is translatable
*Signature: public function is_translatable($path)
*Signature: public function is_translatable($path)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $path <br/>Defaults to null, meaning the current node.
***Default Value: null
*Returns: boolean.
*Returns: boolean.
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $path<br/>Defaults to null, meaning the current node.
**Default Value: null
===is_translated()===
===is_translated()===
Checked to see if the node referenced is translated ito the given locale
Checked to see if the node referenced is translated ito the given locale
*Signature: public function is_translated($locale,$path)
*Signature: public function is_translated($locale,$path)
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $locale
** [http://www.php.net/manual/en/language.types.string.php string ] $path <br/>Defaults to null, meaning the current node.
***Default Value: null
*Returns: boolean.
*Returns: boolean.
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $locale
* [http://www.php.net/manual/en/language.types.string.php string ] $path<br/>Defaults to null, meaning the current node.
**Default Value: null
===key()===
===key()===
*Signature: public function key()
*Signature: public function key()
===krsort()===
===krsort()===
*Signature: public function krsort($sort_flags,$recurse)
*Signature: public function krsort($sort_flags,$recurse)
Parameters:
*Parameters:
*$sort_flags  
*$sort_flags  
**Default Value: SORT_REGULAR
***Default Value: SORT_REGULAR
*$recurse  
*$recurse  
**Default Value: false
***Default Value: false
===ksort()===
===ksort()===
*Signature: public function ksort($sort_flags,$recurse)
*Signature: public function ksort($sort_flags,$recurse)
Parameters:
*Parameters:
*$sort_flags  
*$sort_flags  
**Default Value: SORT_REGULAR
***Default Value: SORT_REGULAR
*$recurse  
*$recurse  
**Default Value: false
***Default Value: false
===newAttribute()===
===newAttribute()===
Make a new attribute this object with the given key.  The $nosave flag should only be set when
Make a new attribute this object with the given key.  The $nosave flag should only be set when populating a parent node from storage.
populating a parent node from storage.
*Signature: protected function newAttribute($key,$save,$prefix)
*Signature: protected function newAttribute($key,$save,$prefix)
*Returns: mixed.  false on failure, the attribute created on succes
*Parameters:
Parameters:
** scalar $key <br/>the key
* scalar $key<br/>the key
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $save <br/>Set to true to not save the parent and attribute
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $save<br/>Set to true to not save the parent and attribute
*$prefix  
*$prefix  
*Returns: mixed.<br/>false on failure, the attribute created on succes
===newChild()===
===newChild()===
Make a new child for this object with the given key.  The
Make a new child for this object with the given key.  The $nosave flag should only be set when populating a parent node from storage.
$nosave flag should only be set when populating a parent
node from storage.
 
end of the array.  Otherwise we use the given key as a key.
 
after creating this child.
*Signature: protected function newChild($key,$save)
*Signature: protected function newChild($key,$save)
*Returns: [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] The child that was created or
*Parameters:
null on failure
** scalar $key <br/>If a boolean and true, we add to the end of the array.  Otherwise we use the given key as a key.
Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $save <br/>Set to true to not save the parent after creating this child.
* scalar $key<br/>If a boolean and true, we add to the
***Default Value: TRUE  
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $save<br/>Set to true to not save the parent
*Returns: [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]]<br/>The child that was created or null on failure
**Default Value: TRUE  
===next()===
===next()===
*Signature: public function next()
*Signature: public function next()
===offsetExists()===
===offsetExists()===
*Signature: public function offsetExists($key)
*Signature: public function offsetExists($key)
Parameters:
*Parameters:
*$key  
*$key  
===offsetGet()===
===offsetGet()===
*Signature: public function offsetGet($key)
*Signature: public function offsetGet($key)
Parameters:
*Parameters:
*$key  
*$key  
===offsetSet()===
===offsetSet()===
*Signature: public function offsetSet($key,$val)
*Signature: public function offsetSet($key,$val)
Parameters:
*Parameters:
*$key  
*$key  
*$val  
*$val  
===offsetUnset()===
===offsetUnset()===
*Signature: public function offsetUnset($key)
*Signature: public function offsetUnset($key)
Parameters:
*Parameters:
*$key  
*$key  
===pathDivider()===
===pathDivider()===
Line 368: Line 344:
===pathExists()===
===pathExists()===
Check to see if a given key  key or path exists
Check to see if a given key  key or path exists
returns mixed.  Booolean true or false if the magic data referenced by the given path is set.  null on failure (invalid path)
*Signature: public function pathExists($path)
*Signature: public function pathExists($path)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()} returns mixed.  Booolean true or false if the magic data referenced by the given path is set.  null on failure (invalid path)
===pop()===
===pop()===
Pop a value off the end of a parent/indeterminate node.
Pop a value off the end of a parent/indeterminate node. @param mixed.  Scalar value if the node is scalar, an array if it is a parent, otherwise null.
@param mixed.  Scalar value if the node is scalar, an array if it is a parent, otherwise null.
*Signature: public function pop()
*Signature: public function pop()
===populate()===
===populate()===
Populate any stored data based on the storage objects set in the top node.
Populate any stored data based on the storage objects set in the top node.
*Signature: protected function populate()
*Signature: protected function populate()
*Returns: true on success.
*Returns: true<br/>on success.
===push()===
===push()===
Push a value onto the end of a parent/indeterminate node.
Push a value onto the end of a parent/indeterminate node.
*Signature: public function push($val)
*Signature: public function push($val)
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ] the number of children the current node has.  null on failure
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $val <br/>;
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $val<br/>;
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]<br/>the number of children the current node has.  null on failure
===raiseError()===
===raiseError()===
Raise an error and redirect the user for any critical errors.
Raise an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.
 
The default redirect will go to the home page for the site.
@param string/mixed $message The error message.
@global array
*Signature: static public function raiseError($message,$type,$redirect)
*Signature: static public function raiseError($message,$type,$redirect)
Parameters:
*Parameters:
*$message  
*$message  
* integer $type<br/>The error type.
** integer $type <br/>The error type.
**Default Value: E_USER_NOTICE
***Default Value: E_USER_NOTICE
* [http://www.php.net/manual/en/language.types.string.php string ] $redirect<br/>The page to redirect to for critical errors.
** [http://www.php.net/manual/en/language.types.string.php string ] $redirect <br/>The page to redirect to for critical errors. @global array
**Default Value: ""  
***Default Value: ""  
===removeAttribute()===
===removeAttribute()===
Removes an attribute
Removes an attribute
*Signature: public function removeAttribute($key)
*Signature: public function removeAttribute($key)
*Returns: true if the attribute was removed.  false if the attribute did not exist
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $key
* [http://www.php.net/manual/en/language.types.string.php string ] $key
*Returns: true<br/>if the attribute was removed.  false if the attribute did not exist
===removeTranslation()===
===removeTranslation()===
*Signature: public function removeTranslation($locale)
*Signature: public function removeTranslation($locale)
Parameters:
*Parameters:
*$locale  
*$locale  
===rewind()===
===rewind()===
Line 414: Line 383:
===save()===
===save()===
Call all the storage methods associated with this configuration.
Call all the storage methods associated with this configuration.
of this node as well.
*Signature: protected function save($recurse)
*Signature: protected function save($recurse)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $recurse<br/>Defaults to false.  If true, and we were able to succesfully save this node, we recrusively save all the populated children
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $recurse <br/>Defaults to false.  If true, and we were able to succesfully save this node, we recrusively save all the populated children of this node as well.
**Default Value: false
***Default Value: false
===setAttribute()===
===setAttribute()===
*Signature: public function setAttribute($key,$val)
*Signature: public function setAttribute($key,$val)
Parameters:
*Parameters:
*$key  
*$key  
*$val  
*$val  
===setIfIsSet()===
===setIfIsSet()===
If the data referenced by that path is set, we set the value of $data to that data
If the data referenced by that path is set, we set the value of $data to that data
magic data referenced by $path.  If false then we only set $data if the magic data node refrenced by $path
is a leaf node/value
*Signature: public function setIfIsSet($data,$path,$as_array)
*Signature: public function setIfIsSet($data,$path,$as_array)
*Returns: boolean.  true if the value was set
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] &$data <br/>where you wish to store the magic data if it is set
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] &$data<br/>where you wish to store the magic data if it is set
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path <br/>{@see traverse()}.  Defaults to null which means we get at this node
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $path<br/>{@see traverse()}.  Defaults to null which means we get at this node
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $as_array <br/>defaults to false.  If true, will set $data to be the result of calling getAsArray() on the magic data referenced by $path.  If false then we only set $data if the magic data node refrenced by $path is a leaf node/value
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $as_array<br/>defaults to false.  If true, will set $data to be the result of calling getAsArray() on the
***Default Value: false
**Default Value: false
*Returns: boolean.<br/>true if the value was set
===setTranslatable()===
===setTranslatable()===
Sets the translatable attribute for the referenced node
Sets the translatable attribute for the referenced node @param boolean $transtable. Defaults to true
@param boolean $transtable. Defaults to true
*Signature: public function setTranslatable($path,$translatable)
*Signature: public function setTranslatable($path,$translatable)
*Returns: true on success, false on failure
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $path <br/>Defaults to null, meaning the current node
* [http://www.php.net/manual/en/language.types.string.php string ] $path<br/>Defaults to null, meaning the current node
***Default Value: null
**Default Value: null
*$translatable  
*$translatable  
**Default Value: true
***Default Value: true
*Returns: true<br/>on success, false on failure
===setTranslation()===
===setTranslation()===
*Signature: public function setTranslation($locale,$translation,$path)
*Signature: public function setTranslation($locale,$translation,$path)
Parameters:
*Parameters:
*$locale  
*$locale  
*$translation  
*$translation  
*$path  
*$path  
**Default Value: null
***Default Value: null
===setType()===
===setType()===
Set the type for this object.  The nosave flag should be set to true if the calling function
Set the type for this object.  The nosave flag should be set to true if the calling function is going to save so that it doesn't get saved twice.
is going to save so that it doesn't get saved twice.
*Signature: protected function setType($type)
*Signature: protected function setType($type)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true on success
*Parameters:
Parameters:
** integer $type
* integer $type
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true on success
===setValue()===
===setValue()===
Set the scalar value for this object.
Set the scalar value for this object.
*Signature: public function setValue($value,$locale,$set_default_locale)
*Signature: public function setValue($value,$locale,$set_default_locale)
*Returns: true on sucess
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
** [http://www.php.net/manual/en/language.types.string.php string ] $locale <br/>The locale we wish to set the value for.  Defaults to null meaning we are not setting tranlsated values.
* [http://www.php.net/manual/en/language.types.string.php string ] $locale<br/>The locale we wish to set the value for.  Defaults to null meaning we are not setting tranlsated values.
***Default Value: null
**Default Value: null
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $set_default_locale <br/>Defautls to true.  When setting values, make sure the default locale is set.
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $set_default_locale<br/>Defautls to true.  When setting values, make sure the default locale is set.
***Default Value: true
**Default Value: true
*Returns: true<br/>on sucess
===set_parent()===
===set_parent()===
Set the magic data node at the specified  path to be a parent node if is indeterminate
Set the magic data node at the specified  path to be a parent node if is indeterminate @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: public function set_parent($path)
*Signature: public function set_parent($path)
*Returns: boolean.  True on success
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True on success
===set_scalar()===
===set_scalar()===
Set the magic data node at the specified  path to be scalar if is indeterminate
Set the magic data node at the specified  path to be scalar if is indeterminate @param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
@param strign $key. A key or path in the magic data.  If null (default) then we are checking on the node itself
*Signature: public function set_scalar($path)
*Signature: public function set_scalar($path)
*Returns: boolean.  True on success
*Parameters:
Parameters:
*$path  
*$path  
**Default Value: null
***Default Value: null
*Returns: boolean.<br/>True on success
===traverse()===
===traverse()===
Traverse magic data by a given path
Traverse magic data by a given path
e.g. array('some','magic','data','path).
There are three special path components, '', '.' and  '..' The first two mean don't go anywhere, while the third
means go to the parent node.
return null if the path is not already set.
*Signature: public function traverse($path,$create,$return_value)
*Signature: public function traverse($path,$create,$return_value)
*Returns: mixed. String, if the path is valid and refers to a leaf node.
*Parameters:
I2CE_MagicDataNode  if the path is valid but not a leaf node, or  null on ffailure (invalid path/path not set)
** [http://www.php.net/manual/en/language.types.array.php array ] $path <br/>A string which is a path e.g. '/some/magic/data/path' or an array of path components e.g. array('some','magic','data','path). There are three special path components, '', '.' and  '..' The first two mean don't go anywhere, while the third means go to the parent node.
Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $create <br/>Defaults to false.  If true, it will create the magic data path as it goes.  If false, it will return null if the path is not already set.
* [http://www.php.net/manual/en/language.types.array.php array ] $path<br/>A string which is a path e.g. '/some/magic/data/path' or an array of path components
***Default Value: false
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $create<br/>Defaults to false.  If true, it will create the magic data path as it goes.  If false, it will
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $return_value <br/>Defaults to true.  If true returns the value of of a leaf node rather than the node itself
**Default Value: false
***Default Value: true
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $return_value<br/>Defaults to true.  If true returns the value of of a leaf node rather than the node itself
*Returns: mixed.<br/>String, if the path is valid and refers to a leaf node. I2CE_MagicDataNode  if the path is valid but not a leaf node, or  null on ffailure (invalid path/path not set)
**Default Value: true
===uksort()===
===uksort()===
*Signature: public function uksort($cmp_function,$recurse)
*Signature: public function uksort($cmp_function,$recurse)
Parameters:
*Parameters:
*$cmp_function  
*$cmp_function  
*$recurse  
*$recurse  
**Default Value: false
***Default Value: false
===unpopulate()===
===unpopulate()===
*Signature: public function unpopulate($deep)
*Signature: public function unpopulate($deep)
Parameters:
*Parameters:
*$deep  
*$deep  
**Default Value: true
***Default Value: true
===valid()===
===valid()===
*Signature: public function valid()
*Signature: public function valid()
===volatile()===
===volatile()===
Check/set whether this magic data is volatile or not
Check/set whether this magic data is volatile or not
this node (does not apply to subnodes).  If not set we
return the volatility state of this node.  Defaults to not
set (null).  Recursively sets all sub-nodes to volatile.
*Signature: public function volatile($volatile)
*Signature: public function volatile($volatile)
*Parameters:
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $volatile <br/>If set, we set the volatility of this node (does not apply to subnodes).  If not set we return the volatility state of this node.  Defaults to not set (null).  Recursively sets all sub-nodes to volatile.
***Default Value: null
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $volatile<br/>If set, we set the volatility of
**Default Value: null




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 23:40, 16 October 2009

This article desrcibes the class I2CE_MagicDataNode.

Configuration class to lookup and save configuration options.

Constants

I2CE_MagicDataNode::TYPE_NOT_POPULATED

Constant type value when this data set hasn't tried to

populate from storage yet.

Defined as: -2

I2CE_MagicDataNode::TYPE_INDETERMINATE

Constant type value when this data set hasn't been defined. Defined as: -1

I2CE_MagicDataNode::TYPE_PARENT

Constant type value when this data set is a parent node. Defined as: 0

I2CE_MagicDataNode::TYPE_STRING_VALUE

Constant type value when this data set is a string value. Defined as: 1

Variables

$type

The type of this configuration setting. Possible values are -1 = unset, 0 = parent object, 1 = scalar/value.

  • Type: protected nteger $type

$name

The name of this configuration setting.

  • Type: protected ng $name

$value

The value of this configuration setting. This is only valid when type = 1.

  • Type: protected ng $value

$children

All children configuration objects for this configuration group. This is only valid when type = 0

  • Type: protected y $children

$parent

The parent of this configuration.

$parentPath

  • Type: protected $parentPath

$parentPathTop

  • Type: protected $parentPathTop

$top

The top level of this configuration.

$volatile

. True if the data is volatile. Defaults to false

  • Type: protected n $volatile

$attributes

  • Type: protected $attributes

Methods

__construct()

Construct a new configuration value or grouping.

  • Signature: protected function __construct($name,$parent,$check_key)
  • Parameters:
    • string $name
      The name of this configuration setting.
      • Default Value: null
    • I2CE_MagicDataNode $parent
      The parent of this configuration setting.
      • Default Value: null
    • boolean $check_key
      Defaults to true in which case we check that the key is valid.
      • Default Value: true

__get()

Get the value for a child configuration option.

  • Signature: public function __get($path)
  • Parameters:
  • $path
  • Returns: mixed.
    Null if the path was invalid. I2CE_MagicDataNode or string on success

__isset()

Check to see if a given key or path exists and the value is set

  • Signature: public function __isset($path)
  • Parameters:
    • mixed $path
      {@see traverse()} returns mixed. Booolean true or false if the magic data referenced by the given path is set. null on failure (invalid path)

__set()

Set the value for a child configuration option.

  • Signature: public function __set($path,$value)
  • Parameters:

__toString()

  • Signature: public function __toString()

__unset()

Unset a given key in the children array.

  • Signature: final public function __unset($key)
  • Parameters:

_getAsArray()

  • Signature: protected function _getAsArray($locale)
  • Parameters:
    • string $locale
      The locale we wish to get the values for. Defaults to null meaning we are not getting tranlsated values.
      • Default Value: null

_getAttribute()

  • Signature: protected function _getAttribute($key,$prefix)
  • Parameters:
  • $key
  • $prefix

_getAttributes()

  • Signature: protected function _getAttributes($keys_only,$prefix)
  • Parameters:
  • $keys_only
  • $prefix

_hasAttribute()

  • Signature: protected function _hasAttribute($key,$prefix)
  • Parameters:
  • $key
  • $prefix

_removeAttribute()

  • Signature: protected function _removeAttribute($prefix,$key)
  • Parameters:
  • $prefix
  • $key

_setAttribute()

  • Signature: protected function _setAttribute($key,$val,$prefix)
  • Parameters:
  • $key
  • $val
  • $prefix

checkKey()

Check to make sure a given key is valid. It can be any combination of _-+.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

  • Signature: static public function checkKey($key)
  • Parameters:
  • Returns: boolean

count()

  • Signature: public function count()

current()

  • Signature: public function current()

erase()

Erases the current node and all of its subnodes from the storage mechanism.

  • Signature: public function erase($locale)
  • Parameters:
    • string $locale
      The locale we wish to erase the values for. Defaults to null meaning we erase all values/locales
      • Default Value: null
  • Returns: boolean
    true on success

eraseChildren()

Erases all children of the current node and all of its subnodes from the storage mechanism.

  • Signature: public function eraseChildren($locale)
  • Parameters:
    • string $locale
      The locale we wish to erase the values for. Defaults to null meaning we erase all values/locales
      • Default Value: null
  • Returns: boolean
    true on success

getAsArray()

Return an array of all the child values for this object.

  • Signature: public function getAsArray($path,$locale)
  • Parameters:
    • mixed $path
      {@see traverse()}. Defaults to null which means we get at this node
      • Default Value: null
    • string $locale
      The locale we wish to get the values for. Defaults to null meaning we are not getting tranlsated values.
      • Default Value: null
  • Returns: array

getAttribute()

Gets an attribute

  • Signature: public function getAttribute($key)
  • Parameters:
  • Returns: mixed
    string if the attribute value. null if it does not exist.

getAttributes()

Get the attributes

  • Signature: public function getAttributes($keys_only)
  • Parameters:
    • boolean $keys_only
      Defaults to false. If true returns only the attribute names that are set. If true returns associative array of attribute=>value pairs
      • Default Value: false
  • Returns: array

getChildren()

  • Signature: public function getChildren()

getKeys()

Return an array of all child keys for this object.

  • Signature: public function getKeys($path,$attrs)
  • Parameters:
    • mixed $path
      {@see traverse()}
      • Default Value: null
  • $attrs
      • Default Value: false
  • Returns: array

getName()

Return the name of this configuration setting.

  • Signature: public function getName()
  • Returns: string

getParent()

Get the parent magic data node

getPath()

Return the full path to this configuration setting.

  • Signature: public function getPath($show_top)
  • Parameters:
    • boolean $show_top
      defaults to true if we are to show the parent
      • Default Value: true
  • Returns: string

getSaveValue()

Return the direct scalar value for this node.

  • Signature: public function getSaveValue()
  • Returns: string

getTranslation()

  • Signature: public function getTranslation($locale,$resolve,$path)
  • Parameters:
  • $locale
  • $resolve
      • Default Value: true
  • $path
      • Default Value: null

getTranslations()

Get the translations for the current node

  • Signature: public function getTranslations($locales_only,$include_default_locale)
  • Parameters:
    • boolean $locales_only
      Defaults to false. If true returns only the loclaes for which a translation exists If true returns associative array of locale=>translation pairs
      • Default Value: false
    • boolean $include_default_locale
      Defaults to true in which case we include the nodes values under the default locale
      • Default Value: true
  • Returns: array

getType()

Return the type of this node.

  • Signature: public function getType()
  • Returns: int
    or false on failure

getValue()

Return the value of this configuration object if the type == 1 and the current object if type is anything else.

  • Signature: public function getValue()
  • Returns: mixed

hasAttribute()

Checks to see if an attribute is present

  • Signature: public function hasAttribute($key)
  • Parameters:
  • Returns: mixed
    boolean. true if key exists, false if it does not, null if an invalid key

hasChildren()

whether the current key has children or not. this is _not_ whether this has a children or not

  • Signature: public function hasChildren()

isScalar()

  • Signature: private function isScalar()

is_indeterminate()

Check to see if the value at the specified path is indeterminate @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: public function is_indeterminate($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True if it is a scalar value

is_parent()

Check to see if the value at the specified path is set and is a parent node. @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: public function is_parent($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True if it is a scalar value

is_populated()

Check to see if the value at the specified path is populated @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: protected function is_populated($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True if it is a scalar value

is_root()

  • Signature: public function is_root($path)
  • Parameters:
  • $path
      • Default Value: null

is_scalar()

Check to see if the value at the specified path is set and is a scalar. @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: public function is_scalar($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True if it is a scalar value

is_translatable()

Checked to see if the node referenced is translatable

  • Signature: public function is_translatable($path)
  • Parameters:
    • string $path
      Defaults to null, meaning the current node.
      • Default Value: null
  • Returns: boolean.

is_translated()

Checked to see if the node referenced is translated ito the given locale

  • Signature: public function is_translated($locale,$path)
  • Parameters:
    • string $locale
    • string $path
      Defaults to null, meaning the current node.
      • Default Value: null
  • Returns: boolean.

key()

  • Signature: public function key()

krsort()

  • Signature: public function krsort($sort_flags,$recurse)
  • Parameters:
  • $sort_flags
      • Default Value: SORT_REGULAR
  • $recurse
      • Default Value: false

ksort()

  • Signature: public function ksort($sort_flags,$recurse)
  • Parameters:
  • $sort_flags
      • Default Value: SORT_REGULAR
  • $recurse
      • Default Value: false

newAttribute()

Make a new attribute this object with the given key. The $nosave flag should only be set when populating a parent node from storage.

  • Signature: protected function newAttribute($key,$save,$prefix)
  • Parameters:
    • scalar $key
      the key
    • boolean $save
      Set to true to not save the parent and attribute
  • $prefix
  • Returns: mixed.
    false on failure, the attribute created on succes

newChild()

Make a new child for this object with the given key. The $nosave flag should only be set when populating a parent node from storage.

  • Signature: protected function newChild($key,$save)
  • Parameters:
    • scalar $key
      If a boolean and true, we add to the end of the array. Otherwise we use the given key as a key.
    • boolean $save
      Set to true to not save the parent after creating this child.
      • Default Value: TRUE
  • Returns: I2CE_MagicDataNode
    The child that was created or null on failure

next()

  • Signature: public function next()

offsetExists()

  • Signature: public function offsetExists($key)
  • Parameters:
  • $key

offsetGet()

  • Signature: public function offsetGet($key)
  • Parameters:
  • $key

offsetSet()

  • Signature: public function offsetSet($key,$val)
  • Parameters:
  • $key
  • $val

offsetUnset()

  • Signature: public function offsetUnset($key)
  • Parameters:
  • $key

pathDivider()

Return the path divider for this MagicDataNode object

  • Signature: protected function pathDivider()
  • Returns: string

pathExists()

Check to see if a given key key or path exists

  • Signature: public function pathExists($path)
  • Parameters:
    • mixed $path
      {@see traverse()} returns mixed. Booolean true or false if the magic data referenced by the given path is set. null on failure (invalid path)

pop()

Pop a value off the end of a parent/indeterminate node. @param mixed. Scalar value if the node is scalar, an array if it is a parent, otherwise null.

  • Signature: public function pop()

populate()

Populate any stored data based on the storage objects set in the top node.

  • Signature: protected function populate()
  • Returns: true
    on success.

push()

Push a value onto the end of a parent/indeterminate node.

  • Signature: public function push($val)
  • Parameters:
  • Returns: int
    the number of children the current node has. null on failure

raiseError()

Raise an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.

  • Signature: static public function raiseError($message,$type,$redirect)
  • Parameters:
  • $message
    • integer $type
      The error type.
      • Default Value: E_USER_NOTICE
    • string $redirect
      The page to redirect to for critical errors. @global array
      • Default Value: ""

removeAttribute()

Removes an attribute

  • Signature: public function removeAttribute($key)
  • Parameters:
  • Returns: true
    if the attribute was removed. false if the attribute did not exist

removeTranslation()

  • Signature: public function removeTranslation($locale)
  • Parameters:
  • $locale

rewind()

  • Signature: public function rewind()

save()

Call all the storage methods associated with this configuration.

  • Signature: protected function save($recurse)
  • Parameters:
    • boolean $recurse
      Defaults to false. If true, and we were able to succesfully save this node, we recrusively save all the populated children of this node as well.
      • Default Value: false

setAttribute()

  • Signature: public function setAttribute($key,$val)
  • Parameters:
  • $key
  • $val

setIfIsSet()

If the data referenced by that path is set, we set the value of $data to that data

  • Signature: public function setIfIsSet($data,$path,$as_array)
  • Parameters:
    • mixed &$data
      where you wish to store the magic data if it is set
    • mixed $path
      {@see traverse()}. Defaults to null which means we get at this node
    • boolean $as_array
      defaults to false. If true, will set $data to be the result of calling getAsArray() on the magic data referenced by $path. If false then we only set $data if the magic data node refrenced by $path is a leaf node/value
      • Default Value: false
  • Returns: boolean.
    true if the value was set

setTranslatable()

Sets the translatable attribute for the referenced node @param boolean $transtable. Defaults to true

  • Signature: public function setTranslatable($path,$translatable)
  • Parameters:
    • string $path
      Defaults to null, meaning the current node
      • Default Value: null
  • $translatable
      • Default Value: true
  • Returns: true
    on success, false on failure

setTranslation()

  • Signature: public function setTranslation($locale,$translation,$path)
  • Parameters:
  • $locale
  • $translation
  • $path
      • Default Value: null

setType()

Set the type for this object. The nosave flag should be set to true if the calling function is going to save so that it doesn't get saved twice.

  • Signature: protected function setType($type)
  • Parameters:
    • integer $type
  • Returns: boolean
    true on success

setValue()

Set the scalar value for this object.

  • Signature: public function setValue($value,$locale,$set_default_locale)
  • Parameters:
    • mixed $value
    • string $locale
      The locale we wish to set the value for. Defaults to null meaning we are not setting tranlsated values.
      • Default Value: null
    • boolean $set_default_locale
      Defautls to true. When setting values, make sure the default locale is set.
      • Default Value: true
  • Returns: true
    on sucess

set_parent()

Set the magic data node at the specified path to be a parent node if is indeterminate @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: public function set_parent($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True on success

set_scalar()

Set the magic data node at the specified path to be scalar if is indeterminate @param strign $key. A key or path in the magic data. If null (default) then we are checking on the node itself

  • Signature: public function set_scalar($path)
  • Parameters:
  • $path
      • Default Value: null
  • Returns: boolean.
    True on success

traverse()

Traverse magic data by a given path

  • Signature: public function traverse($path,$create,$return_value)
  • Parameters:
    • array $path
      A string which is a path e.g. '/some/magic/data/path' or an array of path components e.g. array('some','magic','data','path). There are three special path components, , '.' and '..' The first two mean don't go anywhere, while the third means go to the parent node.
    • boolean $create
      Defaults to false. If true, it will create the magic data path as it goes. If false, it will return null if the path is not already set.
      • Default Value: false
    • boolean $return_value
      Defaults to true. If true returns the value of of a leaf node rather than the node itself
      • Default Value: true
  • Returns: mixed.
    String, if the path is valid and refers to a leaf node. I2CE_MagicDataNode if the path is valid but not a leaf node, or null on ffailure (invalid path/path not set)

uksort()

  • Signature: public function uksort($cmp_function,$recurse)
  • Parameters:
  • $cmp_function
  • $recurse
      • Default Value: false

unpopulate()

  • Signature: public function unpopulate($deep)
  • Parameters:
  • $deep
      • Default Value: true

valid()

  • Signature: public function valid()

volatile()

Check/set whether this magic data is volatile or not

  • Signature: public function volatile($volatile)
  • Parameters:
    • boolean $volatile
      If set, we set the volatility of this node (does not apply to subnodes). If not set we return the volatility state of this node. Defaults to not set (null). Recursively sets all sub-nodes to volatile.
      • Default Value: null
  • Returns: mixed