mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +00:00
DAT-2875 check for empty nodes updated
This commit is contained in:
parent
6ab4e92781
commit
87e83502b8
|
@ -156,6 +156,7 @@ class PortableInfoboxParserTagController extends WikiaController {
|
|||
//make sure no whitespaces, prevents side effects
|
||||
return self::INFOBOX_LAYOUT_PREFIX . $layoutName;
|
||||
}
|
||||
|
||||
return self::INFOBOX_LAYOUT_PREFIX . self::DEFAULT_LAYOUT_NAME;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class SimpleXmlUtil {
|
|||
if ( is_null( self::$instance ) ) {
|
||||
self::$instance = new self;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
@ -23,11 +24,13 @@ class SimpleXmlUtil {
|
|||
* Will return empty string for a non-node argument
|
||||
*
|
||||
* @param $node
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInnerXML( $node ) {
|
||||
$innerXML = '';
|
||||
if ( $node instanceof \SimpleXMLElement ) {
|
||||
// check for empty nodes, strlen used for "0" strings match
|
||||
if ( $node instanceof \SimpleXMLElement && ( strlen( (string)$node ) || $node->count() ) ) {
|
||||
$domElement = dom_import_simplexml( $node );
|
||||
|
||||
if ( ( $domElement instanceof \DOMElement ) && ( $domElement->hasChildNodes() ) ) {
|
||||
|
@ -36,6 +39,7 @@ class SimpleXmlUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $innerXML;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue