Example #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);
     }
 }
 /**
  * @testdox sanitizeUrl() tests
  * @dataProvider getSanitizeUrlTests
  */
 public function testSanitizeUrl($url, $expected)
 {
     $this->assertSame($expected, BuiltInFilters::sanitizeUrl($url));
 }