Converts an OPML File to a Tree Menu List.
@access		public
@static
@param		string		$fileName		File Name of OPML File
@param		string		$labelRoot		Label of Top Tree Menu List
@param		string		$rootClass		CSS Class of root node
@return		ADT_Tree_Menu_List
189636
public static function convertFromOpmlFile( $fileName, $labelRoot, $rootClass = NULL )
	{
		$opml		= FS_File_Reader::load( $fileName );
		return self::convertFromOpml( $opml, $labelRoot, $rootClass );
	}
49041
private function addRichTextSection(ArrayNodeDefinition $rootNode)
    {
        $ezRichTextNode = $rootNode->children()->arrayNode('ezrichtext')->children();
        $this->addCustomTagsSection($ezRichTextNode);
        $this->addCustomStylesSection($ezRichTextNode);
        $ezRichTextNode->end()->end()->end();
    }
905117
protected static function buildTree(&$data, $rootID = 0)
    {
        $tree = [];

        foreach ($data as $id => $node) {
            if ($node->parentId == $rootID) {
                unset($data[$id]);
                $node->children = self::buildTree($data, $node->id);
                $tree[] = $node;
            }
        }

        return $tree;
    }
1009889
public function standard(&$rootDoc, $formatter)
    {

        // set doclet options
        $this->_rootDoc =& $rootDoc;
        $phpdoctor =& $rootDoc->phpdoctor();
        $options =& $rootDoc->options();

        $this->formatter = $formatter;

        if (isset($options['d'])) {
            $this->_d = $phpdoctor->makeAbsolutePath($options['d'], $phpdoctor->sourcePath());
        } elseif (isset($options['output_dir'])) {
            $this->_d = $phpdoctor->makeAbsolutePath($options['output_dir'], $phpdoctor->sourcePath());
        } else {
            $this->_d = $phpdoctor->makeAbsolutePath('apidocs', $phpdoctor->sourcePath());
        }
        $this->_d = $phpdoctor->fixPath($this->_d);

        if (is_dir($this->_d)) {
            $phpdoctor->warning('Output directory already exists, overwriting');
        } else {
            mkdir($this->_d);
        }
        $phpdoctor->verbose('Setting output directory to "'.$this->_d.'"');

        if (isset($options['windowtitle'])) $this->_windowTitle = $options['windowtitle'];
        if (isset($options['doctitle'])) $this->_docTitle = $options['doctitle'];
        if (isset($options['header'])) $this->_header = $options['header'];
        if (isset($options['footer'])) $this->_footer = $options['footer'];
        if (isset($options['bottom'])) $this->_bottom = $options['bottom'];

        if (isset($options['tree'])) $this->_tree = $options['tree'];

        if (isset($options['include_source'])) $this->_includeSource = $options['include_source'];
        if ($this->_includeSource) {
            @include_once 'geshi/geshi.php';
            if (!class_exists('GeSHi')) {
                $phpdoctor->warning('Could not find GeSHi in "geshi/geshi.php", not pretty printing source');
            }
        }

        // write frame
        $frameOutputWriter =& new frameOutputWriter($this);

        // write overview summary
        $packageIndexWriter =& new packageIndexWriter($this);

        // write package overview frame
        $packageIndexFrameWriter =& new packageIndexFrameWriter($this);

        // write package summaries
        $packageWriter =& new packageWriter($this);

        // write package frame
        $packageFrameWriter =& new packageFrameWriter($this);

        // write classes
        $classWriter =& new classWriter($this);

        // write global functions
        $functionWriter =& new functionWriter($this);

        // write global variables
        $globalWriter =& new globalWriter($this);

        // write index
        $indexWriter =& new indexWriter($this);

        // write deprecated index
        $deprecatedWriter =& new deprecatedWriter($this);

        // write todo index
        $todoWriter =& new todoWriter($this);

        // write source files
        if ($this->_includeSource) {
            $sourceWriter =& new sourceWriter($this);
        }

        // copy stylesheet
        $phpdoctor->message('Copying stylesheet');
        copy($phpdoctor->docletPath().'stylesheet.css', $this->_d.'stylesheet.css');

    }
575129
public static function readFile(string $filename, string $rootDir = '.', ParserInterface $parser = null): array
    {
        $data = ['@import' => $filename];

        $story = new Complex($rootDir);
        $parser = $parser ?? new Standard;

        $parser->parse($data, $story);
        return $data;
    }
94367
protected function createBaseRootElement()
    {
        $root = $this->createNewInstance();

        $root->setIsRoot(true);

        $root->setName('_ROOT_' . strtoupper($this->getResourceName()));
        $root->setTitle('_ROOT_' . strtoupper($this->getResourceName()));
        $root->setDescription('ROOT node for ' . $this->getResourceName());
        $root->setLevel(-1);
        $root->setPosition(0);
        $root->setLft(0);
        $root->setRgt(0);
        $root->setRgt(PHP_INT_MAX);

        $root->setParent(null);
        $root->setEnabled(true);

        $this->persist($root);

        $this->updateLftRgtForAllElements();

        return $root;
    }
928107
public function tree($rootId = NULL){
        if($rootId === NULL){
            $rootId = '__root';
        }

        if(!isset($this->_rootNodeCache[$rootId])){

            $result = $this->getHierarchyByRootIdQuery($rootId)
                           ->get($this->getSelectColumns());

            $this->fillNodeCache($result);

            Helper::toHierarchy($result);

        }

        return $this->_rootNodeCache[$rootId];
    }
817573
protected function generateTreeView($collection, $treeClass)
    {
        $content = [];

        // Generate buttons - only if not in select mode!
        if (!$this->isSelectModeActive()) {
            (new ButtonRenderer($this->environment))->renderButtonsForCollection($collection);
        }

        foreach ($collection as $model) {
            /** @var ModelInterface $model */

            $toggleID = $model->getProviderName() . '_' . $treeClass . '_' . $model->getId();

            $content[] = $this->parseModel($model, $toggleID);

            if ($model->getMeta($model::HAS_CHILDREN) && $model->getMeta($model::SHOW_CHILDREN)) {
                $template = $this->getTemplate('dcbe_general_treeview_child');
                $subHtml  = '';

                foreach ($model->getMeta($model::CHILD_COLLECTIONS) as $childCollection) {
                    $subHtml .= $this->generateTreeView($childCollection, $treeClass);
                }

                $this
                    ->addToTemplate('select', $this->isSelectModeActive(), $template)
                    ->addToTemplate('objParentModel', $model, $template)
                    ->addToTemplate('strToggleID', $toggleID, $template)
                    ->addToTemplate('strHTML', $subHtml, $template)
                    ->addToTemplate('strTable', $model->getProviderName(), $template);

                $content[] = $template->parse();
            }
        }

        return \implode("\n", $content);
    }
1296464
protected function addMenu(ItemInterface $parentMenu, $routeName, $menuLabel, $icon = 'fa-bars', $classCss = '')
    {
        $classCss = $classCss.' treeview';

        return $parentMenu->addChild($menuLabel, array(
            'route' => $routeName,
            'label' => sprintf('<i class="fa %s" aria-hidden="true"></i> <span>%s</span>', $icon, $this->translator->trans($menuLabel, array(), $this->translationDomain)),
            'extras' => array(
                'safe_label' => true,
                'translation_domain' => false,
            ),
            'attributes' => array(
                'class' => $classCss,
            ),
        ));
    }
1000451
public function getRootNodeMenuItem()
    {
        if (is_null($this->rootNodeMenuItem)) {
            $rootNode = $this->domainConfiguration->getRootNode();
            if (!is_null($rootNode)) {
                $nodeTranslation = $rootNode->getNodeTranslation(
                    $this->locale,
                    $this->includeOffline
                );
                $this->rootNodeMenuItem = new NodeMenuItem(
                    $rootNode,
                    $nodeTranslation,
                    false,
                    $this
                );
            } else {
                $this->rootNodeMenuItem = $this->breadCrumb[0];
            }
        }

        return $this->rootNodeMenuItem;
    }
178493
public function toXhtml(\DOMDocument $document, \DOMElement $root)
    {
        $content = '';

        /** @var \ezcDocumentRstToken $token */
        foreach ($this->node->tokens as $token) {
            $content .= $token->content;
        }

        $content = rtrim($content, "\n");

        $pre = $document->createElement('pre');
        $root->appendChild($pre);
        $code = $document->createElement('code', $content);
        $pre->appendChild($code);
    }
772011
public function setDocumentRoot($documentRoot)
    {
        if ($documentRoot) {
            $this->documentRoot = $documentRoot;
        } else {
            $this->documentRoot = $this->getDefaultDocRoot();
        }
    }
686033
public function addCssFile($file, $docRoot = null)
    {
        if (null === $docRoot) {
            $docRoot = $this->getDocRoot();
        }

        $docRoot = (string) $docRoot;

        if ('' !== $docRoot) {
            $docRoot .= DIRECTORY_SEPARATOR;
        }

        $file    = preg_replace('/^https?:\/\/[^\/]+/i', '', $file);
        $abspath = $docRoot . $file;

        $this->getCssFileList()->addFile($file, $abspath);

        return $this;
    }
1346869
private function addDocumentManagersSection(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->fixXmlConfig('document_manager')
            ->children()
                ->arrayNode('document_managers')
                    ->useAttributeAsKey('id')
                    ->requiresAtLeastOneElement()
                    ->prototype('array')
                        ->treatNullLike([])
                        ->fixXmlConfig('filter')
                        ->children()
                            ->scalarNode('connection')->end()
                            ->scalarNode('database')->end()
                            ->booleanNode('logging')->defaultValue('%kernel.debug%')->end()
                            ->arrayNode('profiler')
                                ->addDefaultsIfNotSet()
                                ->treatTrueLike(['enabled' => true])
                                ->treatFalseLike(['enabled' => false])
                                ->children()
                                    ->booleanNode('enabled')->defaultValue('%kernel.debug%')->end()
                                    ->booleanNode('pretty')->defaultValue('%kernel.debug%')->end()
                                ->end()
                            ->end()
                            ->scalarNode('default_document_repository_class')->defaultValue(DocumentRepository::class)->end()
                            ->scalarNode('default_gridfs_repository_class')->defaultValue(DefaultGridFSRepository::class)->end()
                            ->scalarNode('repository_factory')->defaultValue('doctrine_mongodb.odm.container_repository_factory')->end()
                            ->scalarNode('persistent_collection_factory')->defaultNull()->end()
                            ->booleanNode('auto_mapping')->defaultFalse()->end()
                            ->arrayNode('filters')
                                ->useAttributeAsKey('name')
                                ->prototype('array')
                                    ->fixXmlConfig('parameter')
                                    ->beforeNormalization()
                                        ->ifString()
                                        ->then(static function ($v) {
                                            return ['class' => $v];
                                        })
                                    ->end()
                                    ->beforeNormalization()
                                        // The content of the XML node is returned as the "value" key so we need to rename it
                                        ->ifTrue(static function ($v) {
                                            return is_array($v) && isset($v['value']);
                                        })
                                        ->then(static function ($v) {
                                            $v['class'] = $v['value'];
                                            unset($v['value']);

                                            return $v;
                                        })
                                    ->end()
                                    ->children()
                                        ->scalarNode('class')->isRequired()->end()
                                        ->booleanNode('enabled')->defaultFalse()->end()
                                        ->arrayNode('parameters')
                                            ->treatNullLike([])
                                            ->useAttributeAsKey('name')
                                            ->prototype('variable')
                                                ->beforeNormalization()
                                                    // Detect JSON object and array syntax (for XML)
                                                    ->ifTrue(static function ($v) {
                                                        return is_string($v) && (preg_match('/\[.*\]/', $v) || preg_match('/\{.*\}/', $v));
                                                    })
                                                    // Decode objects to associative arrays for consistency with YAML
                                                    ->then(static function ($v) {
                                                        return json_decode($v, true);
                                                    })
                                                ->end()
                                            ->end()
                                        ->end()
                                    ->end()
                                ->end()
                            ->end()
                            ->arrayNode('metadata_cache_driver')
                                ->addDefaultsIfNotSet()
                                ->beforeNormalization()
                                    ->ifString()
                                    ->then(static function ($v) {
                                        return ['type' => $v];
                                    })
                                ->end()
                                ->children()
                                    ->scalarNode('type')->defaultValue('array')->end()
                                    ->scalarNode('class')->end()
                                    ->scalarNode('host')->end()
                                    ->integerNode('port')->end()
                                    ->scalarNode('instance_class')->end()
                                    ->scalarNode('id')->end()
                                    ->scalarNode('namespace')->end()
                                ->end()
                            ->end()
                        ->end()
                        ->fixXmlConfig('mapping')
                        ->children()
                            ->arrayNode('mappings')
                                ->useAttributeAsKey('name')
                                ->prototype('array')
                                    ->beforeNormalization()
                                        ->ifString()
                                        ->then(static function ($v) {
                                            return ['type' => $v];
                                        })
                                    ->end()
                                    ->treatNullLike([])
                                    ->treatFalseLike(['mapping' => false])
                                    ->performNoDeepMerging()
                                    ->children()
                                        ->scalarNode('mapping')->defaultValue(true)->end()
                                        ->scalarNode('type')->end()
                                        ->scalarNode('dir')->end()
                                        ->scalarNode('prefix')->end()
                                        ->scalarNode('alias')->end()
                                        ->booleanNode('is_bundle')->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
235553
static function decorate_root(Frame $root, Dompdf $dompdf)
    {
        $frame = new PageFrameDecorator($root, $dompdf);
        $frame->set_reflower(new PageFrameReflower($frame));
        $root->set_decorator($frame);

        return $frame;
    }
505846
public static function getNodesToOpen($uris, core_kernel_classes_Class $rootNode) {
        // this array is in the form of
        // URI to test => array of uris that depend on the URI
        $toTest = array();
        foreach($uris as $uri){
            $resource = new core_kernel_classes_Resource($uri);
            foreach ($resource->getTypes() as $type) {
                $toTest[$type->getUri()] = array();
            }
        }
        $toOpen = array($rootNode->getUri());
        while (!empty($toTest)) {
            reset($toTest);
            $classUri = key($toTest);
            $depends = current($toTest);
            unset($toTest[$classUri]);
            if (in_array($classUri, $toOpen)) {
                $toOpen = array_merge($toOpen, $depends);
            } else {
                $class = new core_kernel_classes_Class($classUri);
                /** @var core_kernel_classes_Class $parent */
                foreach ($class->getParentClasses(false) as $parent) {
                    if ($parent->getUri() === OntologyRdfs::RDFS_CLASS) {
                        continue;
                    }
                    if (!isset($toTest[$parent->getUri()])) {
                        $toTest[$parent->getUri()] = array();
                    }
                    $toTest[$parent->getUri()] = array_merge(
                        $toTest[$parent->getUri()],
                        array($classUri),
                        $depends
                    );
                }
            }
        }
        return $toOpen;
    }
208584
public function array2xml($rootName="", $encoding="utf-8"){
		global $debug;
		$this->doc = new domdocument("1.0", $encoding);
		$arr = array();
		if (count($this->XMLArray) > 1){
			if ($rootName != ""){
				$root = $this->doc->createElement($rootName);
			}else{
				$root = $this->doc->createElement("root");
				$rootName = "root";
			}
			$arr = $this->XMLArray;
		}else{

			$key = key($this->XMLArray);
			$val = $this->XMLArray[$key];

			if (!is_int($key)){
				$root = $this->doc->createElement($key);
				$rootName = $key;
			}else{
				if ($rootName != ""){
					$root = $this->doc->createElement($rootName);
				}else{
					$root = $this->doc->createElement("root");
					$rootName = "root";
				}
			}
			$arr = $this->XMLArray[$key];
		}
		
		$root = $this->doc->appendchild($root);
	
		$this->addArray($arr, $root, $rootName);

/*		foreach ($arr as $key => $val){
			$n = $this->doc->createElement($key);
			$nText = $this->doc->createTextNode($val);
			$n->appendChild($nodeText);
			$root->appendChild($n);
		}
*/		
		
		return $this->doc->saveXML();
	}