|
@@ 502-511 (lines=10) @@
|
| 499 |
|
|
| 500 |
|
public function setAttribute( $name, $value, $dynamic = true ) { |
| 501 |
|
$value = $this->_runPatterns($value); |
| 502 |
|
if ($dynamic) { |
| 503 |
|
if ( isset($this->attributes[$name]) && is_array($value) && !isset($value[0]) ) { |
| 504 |
|
if (!is_array($this->attributes[$name])) { |
| 505 |
|
$this->attributes[$name] = array( $this->attributes[$name] ); |
| 506 |
|
} |
| 507 |
|
$this->attributes[$name] = array_merge( (array) $this->attributes[$name], $value ); |
| 508 |
|
} else { |
| 509 |
|
$this->attributes[$name] = $value; |
| 510 |
|
} |
| 511 |
|
} |
| 512 |
|
$position = 0; |
| 513 |
|
foreach ( $this as $node ) { |
| 514 |
|
if ($node instanceof ar_xmlElement) { |
|
@@ 1039-1049 (lines=11) @@
|
| 1036 |
|
$oldId = $this->attributes['id']; |
| 1037 |
|
} |
| 1038 |
|
} |
| 1039 |
|
if ( is_array($value) && !isset($value[0]) ) { |
| 1040 |
|
// this bit of magic allows ar_xmlNodes->setAttribute to override only |
| 1041 |
|
// specific attribute values, leaving others alone, by specifying a |
| 1042 |
|
// non-number key. |
| 1043 |
|
if ( !is_array($this->attributes[$name]) ) { |
| 1044 |
|
$this->attributes[$name] = array( $this->attributes[$name] ); |
| 1045 |
|
} |
| 1046 |
|
$this->attributes[$name] = array_merge( $this->attributes[$name], $value ); |
| 1047 |
|
} else { |
| 1048 |
|
$this->attributes[$name] = $value; |
| 1049 |
|
} |
| 1050 |
|
if ('id'==(string)$name) { // string cast is necessary, otherwise if $name is 0, 'id' will be cast to int, which is also 0... |
| 1051 |
|
if ( isset($oldId) ) { |
| 1052 |
|
$this->__updateIdCache( $oldId, null, $this ); |