@@ -21,7 +21,7 @@ |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // Provides read-only access to $length and $dom |
| 24 | - function __get ($prop) { |
|
| 24 | + function __get($prop) { |
|
| 25 | 25 | if ($prop == 'length') { |
| 26 | 26 | return $this->length; |
| 27 | 27 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->setErrorChecking($error_checking); |
| 42 | 42 | |
| 43 | - if(is_object($xml)){ |
|
| 43 | + if (is_object($xml)) { |
|
| 44 | 44 | $class = get_class($xml); |
| 45 | 45 | if ($class == 'DOMElement') { |
| 46 | 46 | $this->appendChild($this->importNode($xml, true)); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | else { |
| 66 | 66 | if (!$this->loadXML($xml, LIBXML_COMPACT)) { |
| 67 | - trigger_error('BetterDOMDocument\DOMDoc: Could not load: ' . htmlspecialchars($xml), E_USER_WARNING); |
|
| 67 | + trigger_error('BetterDOMDocument\DOMDoc: Could not load: '.htmlspecialchars($xml), E_USER_WARNING); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $prefix = $parts[0]; |
| 330 | 330 | if (isset($namespaces[$prefix])) { |
| 331 | 331 | if (!strpos($root_match[0], "xmlns:$prefix")) { |
| 332 | - $new_root .= " xmlns:$prefix='" . $namespaces[$prefix] . "'"; |
|
| 332 | + $new_root .= " xmlns:$prefix='".$namespaces[$prefix]."'"; |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $dom = new DOMDoc($xml, $this->auto_ns); |
| 340 | 340 | if (!$dom->documentElement) { |
| 341 | - trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: ' . $xml); |
|
| 341 | + trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: '.$xml); |
|
| 342 | 342 | } |
| 343 | 343 | $element = $dom->documentElement; |
| 344 | 344 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $this->createContext($newnode, 'xml'); |
| 451 | 451 | $this->createContext($context, 'xpath'); |
| 452 | 452 | |
| 453 | - if (!$context){ |
|
| 453 | + if (!$context) { |
|
| 454 | 454 | return FALSE; |
| 455 | 455 | } |
| 456 | 456 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | if ($node) { |
| 530 | 530 | if (is_array($node) || get_class($node) == 'BetterDOMDocument\DOMList') { |
| 531 | - foreach($node as $item) { |
|
| 531 | + foreach ($node as $item) { |
|
| 532 | 532 | $this->remove($item); |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | if (get_class($node) == 'DOMElement') { |
| 597 | 597 | $elemname = array_pop(explode(':', $node->tagName)); |
| 598 | 598 | |
| 599 | - $replace = DOMDocument::createElementNS($url, $prefix . ':' . $elemname); |
|
| 599 | + $replace = DOMDocument::createElementNS($url, $prefix.':'.$elemname); |
|
| 600 | 600 | |
| 601 | 601 | $xsl = ' |
| 602 | 602 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 603 | 603 | <xsl:template match="*"> |
| 604 | - <xsl:element name="' . $prefix . ':{local-name()}" namespace="' . $url . '"> |
|
| 604 | + <xsl:element name="' . $prefix.':{local-name()}" namespace="'.$url.'"> |
|
| 605 | 605 | <xsl:copy-of select="@*"/> |
| 606 | 606 | <xsl:apply-templates/> |
| 607 | 607 | </xsl:element> |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | else { |
| 615 | 615 | // @@TODO: Report the correct calling file and number |
| 616 | - throw new Exception("Changing the namespace of a " . get_class($node) . " is not supported"); |
|
| 616 | + throw new Exception("Changing the namespace of a ".get_class($node)." is not supported"); |
|
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | foreach ($this->getNamespaces() as $prefix => $url) { |
| 689 | 689 | $namespaces = ''; |
| 690 | 690 | if ($prefix != 'xsl' && $prefix != 'xlink') { |
| 691 | - $namespaces .= 'xmlns:' . $prefix . '="' . $url. '" '; |
|
| 691 | + $namespaces .= 'xmlns:'.$prefix.'="'.$url.'" '; |
|
| 692 | 692 | } |
| 693 | 693 | $xslOptions = str_replace("||namespaces||", $namespaces, $xslOptions); |
| 694 | 694 | } |
@@ -727,8 +727,8 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | // Copy namespace prefixes |
| 729 | 729 | foreach ($this->ns as $prefix => $namespace) { |
| 730 | - if (!$context->hasAttribute('xmlns:' . $prefix)) { |
|
| 731 | - $context->setAttribute('xmlns:' . $prefix, $namespace); |
|
| 730 | + if (!$context->hasAttribute('xmlns:'.$prefix)) { |
|
| 731 | + $context->setAttribute('xmlns:'.$prefix, $namespace); |
|
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | // The types listed are html "void" elements. |
| 739 | 739 | // Find any of these elements that have no child nodes and are therefore candidates for self-closing, replace them with a self-closed version. |
| 740 | 740 | $pattern = '<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(\b[^<]*)><\/\1>'; |
| 741 | - return preg_replace('/' . $pattern . '/', '<$1$2/>', $output); |
|
| 741 | + return preg_replace('/'.$pattern.'/', '<$1$2/>', $output); |
|
| 742 | 742 | } |
| 743 | 743 | else { |
| 744 | 744 | return $this->saveXML($context, LIBXML_NOEMPTYTAG); |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | // If it's an "XML" document, then get namespaces via xpath |
| 781 | 781 | $xpath = new \DOMXPath($this); |
| 782 | - foreach($xpath->query('namespace::*') as $namespace) { |
|
| 782 | + foreach ($xpath->query('namespace::*') as $namespace) { |
|
| 783 | 783 | if (!empty($namespace->prefix)) { |
| 784 | 784 | if ($namespace->prefix != 'xml' && $namespace->nodeValue != 'http://www.w3.org/XML/1998/namespace') { |
| 785 | 785 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); |
@@ -817,8 +817,8 @@ discard block |
||
| 817 | 817 | } |
| 818 | 818 | } |
| 819 | 819 | } |
| 820 | - else if (substr($attr->name,0,6) == 'xmlns:') { |
|
| 821 | - $prefix = substr($attr->name,6); |
|
| 820 | + else if (substr($attr->name, 0, 6) == 'xmlns:') { |
|
| 821 | + $prefix = substr($attr->name, 6); |
|
| 822 | 822 | $this->registerNamespace($prefix, $attr->value); |
| 823 | 823 | } |
| 824 | 824 | } |