@@ -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 | if (is_a($xml, 'DOMElement')) { |
| 45 | 45 | $this->appendChild($this->importNode($xml, true)); |
| 46 | 46 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | @$this->loadXML($xml, LIBXML_COMPACT); |
| 62 | 62 | } |
| 63 | 63 | else if (!$this->loadXML($xml, LIBXML_COMPACT)) { |
| 64 | - trigger_error('BetterDOMDocument\DOMDoc: Could not load: ' . htmlspecialchars($xml), E_USER_WARNING); |
|
| 64 | + trigger_error('BetterDOMDocument\DOMDoc: Could not load: '.htmlspecialchars($xml), E_USER_WARNING); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $prefix = $parts[0]; |
| 327 | 327 | if (isset($namespaces[$prefix])) { |
| 328 | 328 | if (!strpos($root_match[0], "xmlns:$prefix")) { |
| 329 | - $new_root .= " xmlns:$prefix='" . $namespaces[$prefix] . "'"; |
|
| 329 | + $new_root .= " xmlns:$prefix='".$namespaces[$prefix]."'"; |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $dom = new DOMDoc($xml, $this->auto_ns); |
| 337 | 337 | if (!$dom->documentElement) { |
| 338 | - trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: ' . $xml); |
|
| 338 | + trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: '.$xml); |
|
| 339 | 339 | } |
| 340 | 340 | $element = $dom->documentElement; |
| 341 | 341 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $this->createContext($newnode, 'xml'); |
| 457 | 457 | $this->createContext($context, 'xpath'); |
| 458 | 458 | |
| 459 | - if (!$context){ |
|
| 459 | + if (!$context) { |
|
| 460 | 460 | return FALSE; |
| 461 | 461 | } |
| 462 | 462 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | if ($node) { |
| 545 | 545 | if (is_array($node) || get_class($node) == 'BetterDOMDocument\DOMList') { |
| 546 | - foreach($node as $item) { |
|
| 546 | + foreach ($node as $item) { |
|
| 547 | 547 | $this->remove($item); |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | $xsl = ' |
| 616 | 616 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 617 | 617 | <xsl:template match="*"> |
| 618 | - <xsl:element name="' . $prefix . ':{local-name()}" namespace="' . $url . '"> |
|
| 618 | + <xsl:element name="' . $prefix.':{local-name()}" namespace="'.$url.'"> |
|
| 619 | 619 | <xsl:copy-of select="@*"/> |
| 620 | 620 | <xsl:apply-templates/> |
| 621 | 621 | </xsl:element> |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | else { |
| 629 | 629 | // @@TODO: Report the correct calling file and number |
| 630 | - throw new Exception("Changing the namespace of a " . get_class($node) . " is not supported"); |
|
| 630 | + throw new Exception("Changing the namespace of a ".get_class($node)." is not supported"); |
|
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | foreach ($this->getNamespaces() as $prefix => $url) { |
| 703 | 703 | $namespaces = ''; |
| 704 | 704 | if ($prefix != 'xsl' && $prefix != 'xlink') { |
| 705 | - $namespaces .= 'xmlns:' . $prefix . '="' . $url. '" '; |
|
| 705 | + $namespaces .= 'xmlns:'.$prefix.'="'.$url.'" '; |
|
| 706 | 706 | } |
| 707 | 707 | $xslOptions = str_replace("||namespaces||", $namespaces, $xslOptions); |
| 708 | 708 | } |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | // Copy namespace prefixes |
| 743 | 743 | foreach ($this->ns as $prefix => $namespace) { |
| 744 | - if (!$context->hasAttribute('xmlns:' . $prefix)) { |
|
| 745 | - $context->setAttribute('xmlns:' . $prefix, $namespace); |
|
| 744 | + if (!$context->hasAttribute('xmlns:'.$prefix)) { |
|
| 745 | + $context->setAttribute('xmlns:'.$prefix, $namespace); |
|
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | // The types listed are html "void" elements. |
| 753 | 753 | // Find any of these elements that have no child nodes and are therefore candidates for self-closing, replace them with a self-closed version. |
| 754 | 754 | $pattern = '<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(\b[^<]*)><\/\1>'; |
| 755 | - return preg_replace('/' . $pattern . '/', '<$1$2/>', $output); |
|
| 755 | + return preg_replace('/'.$pattern.'/', '<$1$2/>', $output); |
|
| 756 | 756 | } |
| 757 | 757 | else { |
| 758 | 758 | return $this->saveXML($context, LIBXML_NOEMPTYTAG); |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | // If it's an "XML" document, then get namespaces via xpath |
| 809 | 809 | $xpath = new \DOMXPath($this); |
| 810 | - foreach($xpath->query('namespace::*') as $namespace) { |
|
| 810 | + foreach ($xpath->query('namespace::*') as $namespace) { |
|
| 811 | 811 | if (!empty($namespace->prefix)) { |
| 812 | 812 | if ($namespace->prefix != 'xml' && $namespace->nodeValue != 'http://www.w3.org/XML/1998/namespace') { |
| 813 | 813 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | } |
| 848 | - else if (substr($attr->name,0,6) == 'xmlns:') { |
|
| 849 | - $prefix = substr($attr->name,6); |
|
| 848 | + else if (substr($attr->name, 0, 6) == 'xmlns:') { |
|
| 849 | + $prefix = substr($attr->name, 6); |
|
| 850 | 850 | $this->registerNamespace($prefix, $attr->value); |
| 851 | 851 | } |
| 852 | 852 | } |