Removes "raw" filters.

@param Twig_NodeInterface $node A Node
@param Twig_Environment   $env  The current Twig environment
426340
protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
    {
        if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) {
            return $node->getNode('node');
        }

        return $node;
    }
193311
public function evaluate(EnvironmentInterface $env)
    {
        $method = $this->operator;

        return $env->getOperator()->$method($env, $this);
    }
396952
public function renderArea(\Twig_Environment $env, $name, ReadNodeInterface $node, array $parameters = array())
    {
        $area = $node->getArea($name);
        if (!$area instanceof ReadAreaInterface) {
            throw new NonExistingAreaException();
        }

        $parameters = array(
            'area'       => $area,
            'parameters' => $parameters,
            'nodeId'     => $node->getNodeId(),
            'siteId'     => $node->getSiteId(),
            '_locale'    => $node->getLanguage()
        );

        return $env->render("OpenOrchestraFrontBundle:Node:area.html.twig", $parameters);
    }
513482
protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
    {
        if (!$node instanceof Twig_Node_Print) {
            return $node;
        }

        if (
            $node->getNode('expr') instanceof Twig_Node_Expression_BlockReference ||
            $node->getNode('expr') instanceof Twig_Node_Expression_Parent
        ) {
            $node->getNode('expr')->setAttribute('output', true);

            return $node->getNode('expr');
        }

        return $node;
    }
856570
public function delete(Node\NodeInterface $node)
	{
		if ( ! $this->locked) {
			//\Log::info('Should lock before changes');
		}

		if ( ! $node instanceof Node\DoctrineNode) {
			throw new Exception\WrongInstance($node, 'Node\DoctrineNode');
		}
		
		$left = $node->getLeftValue();
		$right = $node->getRightValue();

		// Deletes only children here because there could be associations that 
		// doesn't allow deletion, then only leafs could be erased
		$sql = "DELETE FROM {$this->tableName}
				WHERE lft > {$left} AND rgt < {$right}";

		$sql .= $this->getAdditionalConditionSql('AND');

		$this->entityManager->getConnection()
				->exec($sql);
		
//		// Deletes only children here because there could be associations that
//		// doesn't allow deletion, then only leafs could be erased
//		$dql = "DELETE FROM {$this->className} e
//				WHERE e.left > {$left} AND e.right < {$right}";
//
//		$dql .= $this->getAdditionalCondition('AND');
//
//		$query = $this->entityManager->createQuery($dql);
//		$query->execute();
		
		$this->arrayHelper->delete($node);
	}
960527
private function cleanup(OutputInterface $output, NodeInterface $node, $rootPath, $dryRun)
    {
        foreach ($node->getNodes() as $childNode) {
            $this->cleanup($output, $childNode, $rootPath, $dryRun);
        }

        $path = ltrim(str_replace($rootPath, '', $node->getPath()), '/');

        if (!$node->getPropertyValueWithDefault('sulu:history', false)) {
            $output->writeln(
                '<info>Processing aborted: </info>/' .
                $path . ' <comment>(no history url)</comment>'
            );

            return;
        }

        if (false === $dryRun) {
            $node->remove();
        }
        $output->writeln('<info>Processing: </info>/' . $path);
    }
1254794
public static function removeNonPkValues(Node $node) {
    $mapper = $node->getMapper();
    $pkValues = $mapper->getPkNames();
    $valueNames = $node->getValueNames();
    foreach($valueNames as $name) {
      if (!in_array($name, $pkValues)) {
        $node->removeValue($name);
      }
    }
  }
952052
public function removeNode(Node $node)
    {
        $node->setNavigation(null);
        $this->nodes->removeElement($node);
    }
130976
protected function & iniReadFilterEnvironmentSections (array & $rawIniData, $environment) {
		$iniData = [];
		foreach ($rawIniData as $keyOrSectionName => $valueOrSectionValues) {
			if (is_array($valueOrSectionValues)) {
				if (strpos($keyOrSectionName, '>') !== FALSE) {
					list($envNamesStrLocal, $keyOrSectionName) = explode('>', str_replace(' ', '', $keyOrSectionName));
					if (!in_array($environment, explode(',', $envNamesStrLocal))) continue;
				}
				$sectionValues = [];
				foreach ($valueOrSectionValues as $key => $value) $sectionValues[$keyOrSectionName.'.'.$key] = $value;
				$iniData = array_merge($iniData, $sectionValues);
			} else {
				$iniData[$keyOrSectionName] = $valueOrSectionValues;
			}
		}
		return $iniData;
	}
593881
private function _extractDomain(\Twig_Node $node)
	{
		// must be a filter node
		if (!$node instanceof \Twig_Node_Expression_Filter) {
			return null;
		}
		// is a trans filter
		if ($node->getNode('filter')->getAttribute('value') == 'trans') {
			if ($node->getNode('arguments')->hasNode(1)) {
				return $node->getNode('arguments')
					->getNode(1)
					->getAttribute('value');
			} else {
				return $this->defaultDomain;
			}
		}
		
		return $this->_extractDomain($node->getNode('node'));
	}
83492
private static function _cleanHTML(DOMNode $Node, array $filters){

		$node_contents = '';
		$tag_name = '';

		if(isset($Node->tagName)){

			$tag_name = strtolower(trim($Node->tagName));
		}

		// Drop tags

		assert('isset($filters[\'tags_drop\']) && is_array($filters[\'tags_drop\'])');
		if(!isset($filters['tags_drop']) || !is_array($filters['tags_drop'])){

			$filters['tags_drop'] = [];
		}

		if($Node instanceof DOMComment || in_array($tag_name, $filters['tags_drop'])){

			return '';
		}

		// Clean node contents

		if(!isset($Node->childNodes) || $Node->childNodes->length == 0){

			// As no charset conversion is needed, nodeValue can be directly used

			$node_contents = html_entity_decode($Node->nodeValue, ENT_QUOTES, DEFAULT_CHARSET);

			// Reduce every possible combination of whitespaces to a single space-character

			$node_contents = preg_replace('/\s+/', ' ', $node_contents);

			// Reapply HTML entities

			$node_contents = htmlentities($node_contents, ENT_QUOTES, DEFAULT_CHARSET);
		}
		else{

			foreach($Node->childNodes as $Child){

				$node_contents .= self::_cleanHTML($Child, $filters);
			}
		}

		// Nameless and disallowed nodes (return content only, no tags)

		assert('isset($filters[\'tags\']) && is_array($filters[\'tags\'])');
		if(!isset($filters['tags']) || !is_array($filters['tags'])){

			$filters['tags'] = [];
		}

		if($tag_name == '' || !in_array($tag_name, $filters['tags'])){

			return $node_contents;
		}

		// Allowed nodes (return tag and content)

		else{

			$node_attributes = self::_cleanAttributes($Node, $filters);

			// If (after filtering) "a" or "img" elements have no attributes, discard them

			if($node_attributes == '' && ($tag_name == 'a' || $tag_name == 'img')){

				return $node_contents;
			}

			switch($tag_name){

				// Empty elements (c.q. self-closing)

				case 'br':
				case 'hr':
				case 'input':
				case 'img':

					return "<$tag_name$node_attributes>";

				break;

				// Elements with content

				default:

					// Empty "a" elements (c.q. page anchors) are allowed

					if(trim($node_contents) == '' && $tag_name != 'a') return '';

					return "<$tag_name$node_attributes>$node_contents</$tag_name>";
			}
		}
	}
173506
public function removeNode(NodeInterface $node): NodeInterface
    {
        unset($this->_nodes[$node->getId()]);

        if ($this->getParent()) {
            $this->getParent()->removeNode($node);
        }

        return $this;
    }
48044
protected function doEnterNode(Twig_Node $node, Twig_Environment $env)
    {
        if ($node instanceof Twig_Node_Module) {
            $this->moduleNode = $node;
        }

        return $node;
    }
378988
private function loadEnvironment($env) {
    $this->exec = array_merge_recursive_distinct($this->exec, $this->environments[$env]);
    $this->loadedEnvs[$env] = $this->exec['filename'];
    unset($this->exec['filename']);
  }
1101175
public function free(EntityNodeInterface $entity)
	{
		$this->repository->free($entity);
		$this->repository = null;
	}
641858
public function removeNode( $node )
	{
		foreach( $this->getNodes() as $_node )
			$this->removeEdge( $_node, $node );									//  remove all Edges of Node
		$this->nodeSet->removeNode( $node );									//  remove Node
	}
329648
private function sanitizeNode(DOMNode $node)
    {
        // Traverse the nodes, without foreach because nodes may be removed
        $child = (!empty($node->childNodes) && $node->childNodes->length > 0) ? $node->childNodes->item(0) : null;
        while ($child !== null)
        {
            $tag = $child->nodeName;

            // Allow text nodes
            if ($tag === "#text")
            {
                $child = $child->nextSibling;
                continue;
            }

            if (isset($this->remove_tags[$tag]))
            {
                // Tag is on the list of nodes to fully remove including child nodes
                $remove = $child;
                $child = $child->nextSibling;
                $node->removeChild($remove);
            }
            elseif (!isset($this->allowed_tags[$tag]))
            {
                // Add the child nodes of the disalowed tag to the parent node in its place,
                // and move the pointer to the first inserted child node, or the next node.
                $child = $this->unwrapContents($node, $child);
            }
            else
            {
                // Sanitize the attributes of an allowed tag
                if ($child->attributes !== null)
                    $this->sanitizeAttributes($child);

                // And now process the contents
                $this->sanitizeNode($child);

                // Finally, call a callback if applicable
                if (isset($this->tag_callback[$tag]))
                    $this->tag_callback[$tag]($child);

                $child = $child->nextSibling;
            }
        }
    }