Skip to content

Commit

Permalink
[updated] minor cleanup, feed validation, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
pjkix committed Jun 2, 2011
1 parent 41b7636 commit f284b97
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .htaccess
@@ -1,5 +1,5 @@
# Protect files and directories
<Files ~ "(\.(conf|svn|git|inc|pl|sh|sql|tpl|ini)|Repositories|scripts|updates|_notes)$">
<Files ~ "(\.(conf|svn|git|inc|sh|sql|tpl|ini)|Repositories|scripts|updates|_notes)$">
order deny,allow
deny from all
</Files>
24 changes: 14 additions & 10 deletions README.md
@@ -1,16 +1,20 @@
Tumblr Dashboard RSS
====================

Author:
PJ Kix <pj@pjkix.com>
Version:
1.1.0
Copyright:
(cc) 2010 pjkix some rights reserved
License:
http://creativecommons.org/licenses/by-nc-nd/3.0/
See Also:
http://www.tumblr.com/docs/en/api
Author:
PJ Kix <pj@pjkix.com>

Version:
1.1.0

Copyright:
(cc) 2010 pjkix some rights reserved

License:
http://creativecommons.org/licenses/by-nc-nd/3.0/

See Also:
http://www.tumblr.com/docs/en/api

Overview
--------
Expand Down
13 changes: 8 additions & 5 deletions tumblr-dashboard-rss.php
Expand Up @@ -9,7 +9,7 @@
* @copyright (cc) 2010 pjkix
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/
* @see http://www.tumblr.com/docs/en/api
* @version 1.2.0 $Id:$
* @version 1.1.0 $Id:$
* @todo make it more secure, multi-user friendly, compression
*/

Expand Down Expand Up @@ -226,8 +226,11 @@ function read_xml($result)
case 'video':
$item['title'] = sprintf($format, $post['type'], $post['tumblelog'], $post->tumblelog['title'], $post['slug']) ;
$item['description'] = $post->{'video-player'}[0] . $post->{'video-caption'};
$item['enclosure']['url'] = $post->{'video-source'};
$item['enclosure']['type'] = 'video/mp4'; // FIXME: best guess without looking at extension
if ( preg_match('/https?:\/\/[^"]+/i', $post->{'video-source'}, $matches) )
{
$item['enclosure']['url'] = $matches[0]; // must be full url
$item['enclosure']['type'] = 'video/mp4'; // FIXME: best guess without looking at extension
}
break;

default:
Expand All @@ -254,7 +257,7 @@ function output_rss ($posts, $cache=false, $file=NULL)
$lastmod = strtotime($posts[0]['date']);

// http headers
header('Content-type: text/xml'); // set mime ... application/rss+xml
header('Content-type: application/xml; charset=utf-8'); // set mime ... application/rss+xml
header('Cache-Control: max-age=300, must-revalidate'); // cache control 5 mins
header('Last-Modified: ' . gmdate('D, j M Y H:i:s T', $lastmod) ); //D, j M Y H:i:s T
header('Expires: ' . gmdate('D, j M Y H:i:s T', time() + 300));
Expand Down Expand Up @@ -338,7 +341,7 @@ function output_rss ($posts, $cache=false, $file=NULL)
$enclosure->setAttribute('type', $post['enclosure']['type']); // valid mime type
$item->appendChild($enclosure);

// media rss
// media rss?
}

$channel->appendChild( $item );
Expand Down

0 comments on commit f284b97

Please sign in to comment.