Skip to content

Commit

Permalink
Merge branch 'integration' of github.com:symphonists/xmlimporter into…
Browse files Browse the repository at this point in the history
… integration
  • Loading branch information
brendo committed May 27, 2013
2 parents 365e311 + 672f604 commit 2ef9d60
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/xmlimporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
}).trigger('change.xmlimporter');
});

})(jQuery.noConflict());
})(jQuery);
7 changes: 6 additions & 1 deletion content/content.importers.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ public function __viewRun() {
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;

$xml->loadXML($entry->ownerDocument->saveXML($entry));
if(is_null($entry->ownerDocument)) {
$xml->loadXML($entry->saveXML());
}
else {
$xml->loadXML($entry->ownerDocument->saveXML($entry));
}

$source = htmlentities($xml->saveXML($xml->documentElement), ENT_COMPAT, 'UTF-8');

Expand Down
9 changes: 7 additions & 2 deletions lib/class.xmlimporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,13 @@ function handleXMLError($errno, $errstr, $errfile, $errline, $context) {
foreach ($current['values'] as $field_id => $value) {
$field = FieldManager::fetch($field_id);

if(is_array($value) && count($value) === 1) {
$value = current($value);
if(is_array($value)) {
if(count($value) === 1) {
$value = current($value);
}
if(count($value) === 0) {
$value = '';
}
}

// Adjust value?
Expand Down

0 comments on commit 2ef9d60

Please sign in to comment.