Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 4ae90a9 + 41bd1ca commit 984c0926aeb46091437c1095446c22ea8438de5d @BenWard committed Feb 16, 2011
Showing with 17 additions and 15 deletions.
  1. +4 −1 README.markdown
  2. +13 −14 index.php
View
5 README.markdown
@@ -10,9 +10,12 @@ This work is licensed under the GPL v3 <http://www.gnu.org/licenses/gpl.html>
## Change Log
-### Version 0.4-benward
+### Version 0.4
* Added support for Tumblr photosets (where multiple photographs are added to a single post.)
+ * Updated HTML5 output for photos (`figure` and `figcaption` elements and HTML4 classnames.)
+ * Fixed issue with Tumblr IDs exceeding 32-bits and crashing the WordPress importer.
+ * Fixed an issue where invalid XML is generated by titles or descriptions containing & signs.
### Version 0.3.1-benward
View
27 index.php
@@ -1,6 +1,6 @@
<?php
-define(T2W_VERSION, '0.3.1-benward');
+define(T2W_VERSION, '0.4');
# Some pieces of content will have to be parsed into HTML where we have to add
# HTML strucutre (e.g. around conversations)
@@ -14,7 +14,8 @@
<html lang="en">
<head>
<meta charset="utf-8">
- <title>Tumblr2WordPress: Export Your Tumblr To WordPress</title>
+ <title>Tumblr2WordPress: Export Your Tumblr Blog To WordPress RSS</title>
+ <link rel="profile" href="http://microformats.org/profile/hcard">
<link rel="stylesheet" href="t2w.css" type="text/css">
</head>
<body>
@@ -537,11 +538,10 @@ function getWarnings() {
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
-
<channel>
- <title><?php echo $feed->tumblelog->attributes()->title ?></title>
+ <title><?php echo htmlspecialchars($feed->tumblelog->attributes()->title) ?></title>
<link>http://<?php echo $feed->tumblelog->attributes()->name ?>.tumblr.com/</link>
- <description><?php echo $feed->tumblelog ?></description>
+ <description><?php echo htmlspecialchars($feed->tumblelog) ?></description>
<pubDate><?php echo date("r") ?></pubDate>
<generator>http://<?php echo 'Tumblr2Wordpress/' . T2W_VERSION . '(' . $_SERVER['HTTP_HOST'] . ')' ?></generator>
<language>en</language>
@@ -568,7 +568,7 @@ function getWarnings() {
<dc:creator><![CDATA[post_author]]></dc:creator>
<?php getTags($post) ?>
<guid isPermaLink="false"><?php echo $post->attributes()->url ?></guid>
- <wp:post_id><?php echo $post->attributes()->id ?></wp:post_id>
+ <!--<wp:post_id><?php echo $post->attributes()->id ?></wp:post_id>-->
<wp:post_date><?php echo date('Y-m-d G:i:s', (double)$post->attributes()->{'unix-timestamp'}) ?></wp:post_date>
<wp:post_date_gmt><?php echo str_replace(" GMT", "", $post->attributes()->{'date-gmt'}) ?></wp:post_date_gmt>
<wp:comment_status><?php echo $comments ?></wp:comment_status>
@@ -595,22 +595,22 @@ function getWarnings() {
$image = "";
# Handle photosets vs. single photos
- # HTML5 `figure` is unstable, so just use class names on HTML4 now.
+ # Using combined HTML5 + classes shim:
if(isset($post->photoset)) {
foreach($post->xpath('photoset//photo') as $photo) {
- $image .= "\n\t\t\t<div class=\"figure\">\n";
+ $image .= "\n\t\t\t<div class=\"figure\"><figure>\n";
$image .= "\t\t\t\t<img src=\"{$photo->{'photo-url'}}\" alt=\"\">\n";
if(!empty($photo->attributes()->caption)) {
- $image .= "\t\t\t\t<p class=\"legend\">{$photo->attributes()->caption}</p>\n";
+ $image .= "\t\t\t\t<p class=\"figcaption\"><figcaption>{$photo->attributes()->caption}</figcaption></p>\n";
}
- $image .= "\t\t\t</div>\n";
+ $image .= "\t\t\t</figure></div>\n";
}
}
else {
$image = <<<FIGURE
- <div class="figure">
+ <div class="figure"><figure>
<img src="{$post->{'photo-url'}}" alt="">
- </div>\n\n
+ </figure></div>\n\n
FIGURE;
}
?>
@@ -680,10 +680,9 @@ function getWarnings() {
[googlevideo=<?php preg_match('/src="([\S\s]*?)"/', $post->{'video-player'}, $matches); echo $matches[1]; ?>]
<?php } else { ?>
<?php echo $post->{'video-player'} ?>
-
+ <?php } ?>
<?php echo $post_content ?>
]]></content:encoded>
- <?php } ?>
<wp:post_name><?php echo formatPermalinkSlug($post->attributes()->id, $post->{'video-caption'}) ?></wp:post_name>
<?php
break;

0 comments on commit 984c092

Please sign in to comment.