Пример #1
0
function shift_pop(&$d, $n = 1, $t = 0)
{
    if (!is_int($n) || $n <= 0) {
        $n = 1;
    }
    $j = 0;
    $shift = 0;
    $r = array();
    $d = _drw($d);
    for ($i = 0; $i < $n; $i++) {
        if ($t == 0) {
            if ($d->eq($i) !== null) {
                $r[] = array($d->eq($i, KEYS), $d->eq($i));
            }
        } else {
            if ($d->eq($n - $i) !== null) {
                $r[] = array($d->eq($n - $i, KEYS), $d->eq($n - $i));
            }
        }
    }
    for ($i = 0; $i < $n; $i++) {
        $t == 0 ? array_shift($d->O) : array_pop($d->O);
    }
    $d = $d->O;
    return count($r) ? pure($r) : null;
}
 function remove($k = null)
 {
     $s = $k == null ? $this->cell : $k->cell;
     $j = '$this->cell_store->O';
     $a = $this->cell_store->O;
     if (isEle(_drw($s)->eq(0))) {
         $s = array($s);
     }
     foreach ($s as $v1) {
         $m = $this->cell_store->search($v1);
         $this->removeChild($v1[0]);
         if (!count($m[0])) {
             continue;
         }
         foreach ($m[0] as $u) {
             $w = explode('/', $u[1]);
             for ($i = 0; $i < count($w); $i++) {
                 pure($w[$i]);
                 $j .= isset($a->O) ? "->O['" . $w[$i] . "']" : "['" . $w[$i] . "']";
                 $h = OBJ($a, false);
                 $a =& $h[$w[$i]];
             }
             eval('unset(' . $j . ');');
         }
     }
     return $this;
 }
 static function c_attrs($a, $v = null)
 {
     $p = func_get_args();
     $m = array();
     if (isStr($a) && isNumStr($v)) {
         $s = cur_doc()->createAttribute($a);
         $s->value = $v;
         return $s;
     }
     foreach ($p as $v) {
         if (isDrw($v)) {
             foreach ($v as $i => $k) {
                 $m[] = self::c_attrs($i, $k);
             }
         }
     }
     return pure($m);
 }