Beispiel #1
0
 public static function scan_for_pattern($root, $node = "", $priority = [])
 {
     if (@(!$node)) {
         $node = $root;
     }
     $children = Tree::get_tagged_children($node);
     if (@(!!$children)) {
         if (Node::get_class($node) == "posts-list-inner") {
             //$elig = Scanner::are_eligible( $root, $node, $children );
             //Log::log( "Children count is ".count( $children )." ".( $elig ? "and" : "but" )." they are ".( $elig ? "" : "not" )." eligible." );
         }
         if (Scanner::are_eligible($root, $node, $children) && !Scanner::has_been_prioritized($node['path'])) {
             $node['count'] = count($children);
             $id = Node::get_id($node);
             if ($id !== false) {
                 $node['id'] = "#" . $id;
             }
             $class = Node::get_class($node);
             if ($class !== false) {
                 $node['class'] = "." . $class;
             }
             $priority[] = $node;
             Scanner::$been_prioritized[] = $node['path'];
         }
         foreach ($children as $child) {
             $priority = Scanner::scan_for_pattern($root, $child, $priority);
         }
     }
     return $priority;
 }
Beispiel #2
0
 public static function get_siblings($root, $node)
 {
     $path = $node['path'];
     $parent = Tree::get_parent_from_path($root, $path);
     $siblings = [];
     foreach ($parent['children'] as $child) {
         if ($child['path'] != $path) {
             $siblings[] = $child;
         }
     }
     return $siblings;
 }