Skip to content

Tweaked the code to make it works on Wordpress 8.1 and PHP 7 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions XPath.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5819,8 +5819,7 @@ function getDataParts($xPathQuery) {
$absoluteXPath = $matches[1];
$attribute = $matches[2];
if (!isSet($this->nodeIndex[$absoluteXPath]['attributes'][$attribute])) {
$this->_displayError("The $absoluteXPath/attribute::$attribute value isn't a node in this document.", __LINE__, __FILE__, FALSE);
continue;
$this->_displayError("The $absoluteXPath/attribute::$attribute value isn't a node in this document.", __LINE__, __FILE__, FALSE);
}
return array($this->nodeIndex[$absoluteXPath]['attributes'][$attribute]);
} else if (preg_match(":(.*)/text\(\)(\[(.*)\])?$:U", $xPathQuery, $matches)) {
Expand Down Expand Up @@ -5967,7 +5966,7 @@ function &_xml2Document($xmlString) {
XML_OPTION_CASE_FOLDING => $this->getProperties('caseFolding'),
XML_OPTION_SKIP_WHITE => $this->getProperties('skipWhiteSpaces')
);
$xmlParser =& new XPathEngine($xmlOptions);
$xmlParser = new XPathEngine($xmlOptions);
$xmlParser->setVerbose($this->properties['verboseLevel']);
// Parse the XML string
if (!$xmlParser->importFromString($xmlString)) {
Expand Down Expand Up @@ -6225,7 +6224,7 @@ function _title($title) {

// The sample code:
$xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE);
$xPath =& new XPath(FALSE, $xmlOptions);
$xPath = new XPath(FALSE, $xmlOptions);
//$xPath->bDebugXmlParse = TRUE;
if (!$xPath->importFromString($xmlSource)) { echo $xPath->getLastError(); exit; }

Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ BlogML WordPress import script

Original script is available [here](http://www.kavinda.net/content/other/BlogML-WordPress-Import.zip). From what I read in [this](http://www.craigbailey.net/migrating-from-blogengine-net-to-wordpress/) blog post, it was created by [Aaron Lerch](http://www.aaronlerch.com/blog/) but readme says otherwise so I'm not sure.

It lacked support for importing tags from BlogML format - it was simply ignoring them. I added some PHP code to support tags import, the same way categories were handled.
It lacked support for importing tags from BlogML format - it was simply ignoring them. I added some PHP code to support tags import, the same way categories were handled.

Note from *mectwork*: I made little changes to make it work on Wordpress 4.8.1.