初始化，载入数据
@param array $data
@param bool $recursive
@return $this
960461
public function load($data, $recursive = false)
    {
        foreach ($data as $name => $value) {
            $name = trim($name);

            if (is_numeric($name)) {
                continue;
            }

            $this->$name = $recursive && \is_array($value) ? static::create($value, $recursive) : $value;
        }

        return $this;
    }
27439
public function delete(bool $recursive = true): bool
    {
        $this->each(function (Folder $item) use ($recursive) {
            $item->delete($recursive);
        });

        return true;
    }
476049
public static function expand($var, array $params, $recursive = FALSE)
	{
		if (is_array($var)) {
			$res = [];
			foreach ($var as $key => $val) {
				$res[$key] = self::expand($val, $params, $recursive);
			}
			return $res;
		} elseif ($var instanceof Nette\DI\Statement) {
			return new Nette\DI\Statement(
				self::expand($var->getEntity(), $params, $recursive),
				self::expand($var->arguments, $params, $recursive)
			);
		} elseif (!is_string($var)) {
			return $var;
		}

		$parts = preg_split('#%%([\w.-]*)%%#i', $var, -1, PREG_SPLIT_DELIM_CAPTURE);
		$res = '';
		foreach ($parts as $n => $part) {
			if ($n % 2 === 0) {
				$res .= $part;
			} elseif ($part === '') {
				$res .= '%';
			} elseif (isset($recursive[$part])) {
				throw new \Nette\InvalidArgumentException(
					sprintf('Circular reference detected for variables: %s.', implode(', ', array_keys($recursive)))
				);
			} else {
				try {
					$val = Nette\Utils\Arrays::get($params, explode('.', $part));
				} catch (\Nette\InvalidArgumentException $exc) {
					//FIXME: OutOfRangeException only because of BC
					throw new \Nette\OutOfRangeException(
						"Cannot replace %%$part%% because parameter does not exist.",
						0,
						$exc
					);
				}
				if ($recursive) {
					$val = self::expand($val, $params, (is_array($recursive) ? $recursive : []) + [$part => 1]);
				}
				if (strlen($part) + 4 === strlen($var)) {
					return $val;
				}
				if (!is_scalar($val) && $val !== NULL) {
					throw new \Nette\InvalidArgumentException("Unable to concatenate non-scalar parameter '$part' into '$var'.");
				}
				$res .= $val;
			}
		}
		return $res;
	}
918850
function(recursive, callback) {
		var i, l, node,
			dict = {},
			self = this;

		$.each(NODE_ATTRS, function(i, a){
			if(self[a] || self[a] === false){
				dict[a] = self[a];
			}
		});
		if(!$.isEmptyObject(this.data)){
			dict.data = $.extend({}, this.data);
			if($.isEmptyObject(dict.data)){
				delete dict.data;
			}
		}
		if( callback ){
			callback(dict);
		}
		if( recursive ) {
			if(this.hasChildren()){
				dict.children = [];
				for(i=0, l=this.children.length; i<l; i++ ){
					node = this.children[i];
					if( !node.isStatusNode() ){
						dict.children.push(node.toDict(true, callback));
					}
				}
			}else{
//                dict.children = null;
			}
		}
		return dict;
	}
1105934
public static function toArray($data, bool $recursive = false)
    {
        $arr = [];

        // Ensure the input data is an array.
        if (\is_object($data)) {
            if ($data instanceof \Traversable) {
                $arr = \iterator_to_array($data);
            } elseif (\method_exists($data, 'toArray')) {
                $arr = $data->toArray();
            }
        } else {
            $arr = (array)$data;
        }

        if ($recursive) {
            foreach ($arr as $key => $value) {
                if (\is_array($value) || \is_object($value)) {
                    $arr[$key] = static::toArray($value, $recursive);
                }
            }
        }

        return $arr;
    }
1207822
public function delete($recursive = true) {
		$this->deleteImages();
		$this->deleteAlbumDir();

		return parent::delete($recursive);
	}
1173798
public function merge($source, $recursive = false)
	{
		if (!$source)
		{
			return false;
		}

		// If the source isn't already a Registry
		// we'll turn it into one
		if (!($source instanceof Registry) && !method_exists($source, 'toArray'))
		{
			$source = new self($source);
		}

		// Load the variables into the registry's default namespace.
		$this->bind($this->data, $source->toArray(), $recursive, false);

		return true;
	}
1341601
public function delete($recursive = true) {
		$success = 0;
		$count = $this->getCount();
		$comments = $this->getAll()->setIncrementOffset(false);
		foreach ($comments as $comment) {
			if ($comment->delete($recursive)) {
				$success++;
			}
		}
		return ($success == $count);
	}
20357
public function join($type, $table, $conditions=null, $recursive=true) {
		if($recursive && is_array($table)) {
			foreach($table as $_table=>$_conditions) {
				if($_conditions instanceof static)
					$this->join($type, $table, $conditions, false);
				elseif($_conditions instanceof Raw)
					$this->join($type, $table, $conditions, false);
				else
					$this->join($type, $_table, $_conditions);
			}

			return $this;
		}

		#for tables that are static or Raw
		if(is_array($table)) {
			$alias = array_keys($table)[0];
			$table = array_values($table)[0];
		}
		else {
			$table_alias = explode(' ', $table);
			$table = $table_alias[0];
			if(isset($table_alias[1]))
				$alias = $table_alias[1];
			else
				$alias = $table;
		}

		$this->joins[$alias] = [$type, $table, $conditions];

		return $this;
	}
1188082
public function toArray($recursive = true)
    {
        $values = $this->values;

        if (!$recursive) {
            return $values;
        }

        foreach ($values as $key => $value) {
            if (gettype($value) === 'object') {
                if ($value instanceof Hash) {
                    $value = $value->toArray($recursive);
                }
            }

            $values[$key] = $value;
        }

        return $values;
    }
568509
public function getChildren ($recursive = true, $includeInactiveFields = false)
    {
        $children = array();
        foreach ($this->children as $component)
            /* @var $component Component */
            if ($component->isActive() || $includeInactiveFields) {
                array_push($children, $component);
                if ($recursive)
                    $children = array_merge($children, $component->getChildren(true, $includeInactiveFields));
            }
        return $children;
    }
1038826
public function delete(bool $recursive = true): bool
    {
        if (is_writeable($this->path)) {
            if ($recursive) {
                $files = $this->findFiles('{,.}{,..}[!.,!..]*', GLOB_MARK | GLOB_BRACE);
                foreach ($files as $file) {
                    $file->delete();
                }
                $folders = $this->findFolders('{,.}{,..}[!.,!..]*', GLOB_MARK | GLOB_BRACE | GLOB_ONLYDIR);
                foreach ($folders as $folder) {
                    $folder->delete(true);
                }
            }

            return rmdir($this->path);
        }
        throw new FolderException('Cannot delete folder, because ('.$this->path.') is not writable', FolderException::NOT_WRITEABLE);
    }
1227722
public function isActive($recursive = false)
        {
            if (!$this->_active && $recursive) {
                foreach ($this->_pages as $page) {
                    if ($page->isActive(true)) {
                        return true;
                    }
                }

                return false;
            }

            return $this->_active;
        }
425667
public function merge(array $items, $recursive = false)
    {
        foreach ($items as $key => $value)
        {
            $this->set($key, $value);
        }

        return $this;
    }
627536
public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self
    {
        if ($recursive === true) {
            $result = \array_merge_recursive($this->getArray(), $array);
        } else {
            $result = \array_merge($this->getArray(), $array);
        }

        return static::create(
            $result,
            $this->iteratorClass,
            false
        );
    }
1259186
private function recursiveTreeStrip(array $data)
    {
        if (count($data) === 1 && !empty($data[0]['children'])) {
            return $this->recursiveTreeStrip($data[0]['children']);
        }

        return $data;
    }
490596
private static function recursiveGetFromKey($data, $key, $default)
    {
        if (empty($key)) {
            return $data;
        } else {
            $currentKey = array_shift($key);
            return isset($data[$currentKey]) ? self::recursiveGetFromKey($data[$currentKey], $key, $default) : $default;
        }
    }