Ejemplo n.º 1
0
 /**
  * Normalize value of the text nodes, descendants of an element
  *
  * @param  DOMElement $element
  * @return void
  */
 protected function normalizeElement(DOMElement $element)
 {
     $xpath = new DOMXPath($element->ownerDocument);
     $query = './/text()[normalize-space() != ""]';
     foreach ($xpath->query($query, $element) as $i => $node) {
         $value = BuiltInFilters::sanitizeUrl($node->nodeValue);
         if (!$i) {
             $value = $this->unescapeBrackets(ltrim($value));
         }
         $node->nodeValue = $value;
     }
     if (isset($node)) {
         $node->nodeValue = rtrim($node->nodeValue);
     }
 }
Ejemplo n.º 2
0
 /**
  * @testdox sanitizeUrl() tests
  * @dataProvider getSanitizeUrlTests
  */
 public function testSanitizeUrl($url, $expected)
 {
     $this->assertSame($expected, BuiltInFilters::sanitizeUrl($url));
 }