* zin: support to set props with an plain object
This commit is contained in:
@@ -18,6 +18,7 @@ class set
|
||||
public static function __callStatic($prop, $args)
|
||||
{
|
||||
$value = array_shift($args);
|
||||
if(is_object($value)) $value = (array)$value;
|
||||
if($prop === '_' && is_array($value)) return directive('prop', $value);
|
||||
return directive('prop', array($prop => $value));
|
||||
}
|
||||
|
||||
@@ -17,7 +17,12 @@ require_once 'wg.class.php';
|
||||
|
||||
function set($name, $value = NULL)
|
||||
{
|
||||
return directive('prop', (is_array($name) || $name instanceof props) ? $name : array($name => $value));
|
||||
$props = null;
|
||||
if($name instanceof props) $props = $name;
|
||||
else if(is_array($name)) $props = $name;
|
||||
else if(is_object($name)) $props = (array)$name;
|
||||
else if(is_string($name)) $props = array($name => $value);
|
||||
if($props) return directive('prop', $props);
|
||||
}
|
||||
|
||||
function prop($name, $value = NULL)
|
||||
|
||||
Reference in New Issue
Block a user