[pLog-svn] r2279 - in plog/branches/plog-1.0.2:
class/summary/action class/summary/view templates/summary
templates/summary/rss
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Thu Jun 30 06:18:24 GMT 2005
Author: oscar
Date: 2005-06-30 06:18:23 +0000 (Thu, 30 Jun 2005)
New Revision: 2279
Added:
plog/branches/plog-1.0.2/templates/summary/rss/blogs_atom.template
plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss090.template
plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss10.template
plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss20.template
Modified:
plog/branches/plog-1.0.2/class/summary/action/summaryrssaction.class.php
plog/branches/plog-1.0.2/class/summary/view/summaryrssview.class.php
plog/branches/plog-1.0.2/templates/summary/index.template
plog/branches/plog-1.0.2/templates/summary/rss/rss20.template
Log:
implemented feature request 606 (http://bugs.plogworld.net/view.php?id=606)
Modified: plog/branches/plog-1.0.2/class/summary/action/summaryrssaction.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/summary/action/summaryrssaction.class.php 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/class/summary/action/summaryrssaction.class.php 2005-06-30 06:18:23 UTC (rev 2279)
@@ -5,10 +5,13 @@
include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
include_once( PLOG_CLASS_PATH."class/summary/view/summaryrssview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/net/rawrequestgenerator.class.php" );
define( "SUMMARY_RSS_TYPE_DEFAULT", "default" );
define( "SUMMARY_RSS_TYPE_MOST_COMMENTED", "mostcommented" );
define( "SUMMARY_RSS_TYPE_MOST_READ", "mostread" );
+ define( "SUMMARY_RSS_TYPE_MOST_ACTIVE_BLOGS", "mostactiveblogs" );
+ define( "SUMMARY_RSS_TYPE_NEWEST_BLOGS", "newestblogs" );
/**
* This is the one and only default action. It simply fetches all the most recent
@@ -33,8 +36,11 @@
$this->_mode = $this->_request->getValue( "type" );
if( $this->_mode != SUMMARY_RSS_TYPE_DEFAULT &&
$this->_mode != SUMMARY_RSS_TYPE_MOST_COMMENTED &&
- $this->_mode != SUMMARY_RSS_TYPE_MOST_READ ) {
+ $this->_mode != SUMMARY_RSS_TYPE_MOST_READ &&
+ $this->_mode != SUMMARY_RSS_TYPE_MOST_ACTIVE_BLOGS &&
+ $this->_mode != SUMMARY_RSS_TYPE_NEWEST_BLOGS ) {
+ // in case the parameter looks weird, let's use a default one...
$this->_mode = SUMMARY_RSS_TYPE_DEFAULT;
}
@@ -48,37 +54,77 @@
*/
function perform()
{
- $this->_view = new SummaryRssView( $this->_profile, Array( "summary" => "rss",
- "mode" => $this->_mode,
- "profile" => $this->_profile ));
- if( $this->_view->isCached()) {
- return true;
- }
+ if( $this->_mode == SUMMARY_RSS_TYPE_MOST_COMMENTED ||
+ $this->_mode == SUMMARY_RSS_TYPE_MOST_READ ||
+ $this->_mode == SUMMARY_RSS_TYPE_DEFAULT ) {
+
+ // RSS feeds for posts stuff
+ $this->_view = new SummaryRssView( $this->_profile, Array( "summary" => "rss",
+ "mode" => $this->_mode,
+ "profile" => $this->_profile ));
+ if( $this->_view->isCached()) {
+ return true;
+ }
- $blogs = new Blogs();
- $stats = new SummaryStats();
-
- if( $this->_mode == SUMMARY_RSS_TYPE_MOST_COMMENTED ) {
- $posts = $stats->getMostCommentedArticles( $this->_numPosts);
+ $blogs = new Blogs();
+ $stats = new SummaryStats();
+
+ if( $this->_mode == SUMMARY_RSS_TYPE_MOST_COMMENTED ) {
+ $posts = $stats->getMostCommentedArticles( $this->_numPosts);
+ }
+ elseif( $this->_mode == SUMMARY_RSS_TYPE_MOST_READ ) {
+ $posts = $stats->getMostReadArticles( $this->_numPosts);
+ }
+ else {
+ // load the most recent posts, filtering out all those registration messages...
+ $registerTopic = $this->_locale->tr( "register_default_article_topic" );
+ $registerText = $this->_locale->tr( "register_default_article_text" );
+ $posts = $stats->getRecentArticles( $this->_numPosts, $registerTopic, $registerText );
+ }
+
+ if( !$posts ) {
+ $posts = Array();
+ }
+
+ $this->_view->setValue( "posts", $posts );
}
- elseif( $this->_mode == SUMMARY_RSS_TYPE_MOST_READ ) {
- $posts = $stats->getMostReadArticles( $this->_numPosts);
+ elseif( $this->_mode == SUMMARY_RSS_TYPE_MOST_ACTIVE_BLOGS ||
+ $this->_mode == SUMMARY_RSS_TYPE_NEWEST_BLOGS ) {
+ // RSS feeds for blogs, need different template sets...
+
+ $this->_view = new SummaryRssView( "blogs_".$this->_profile, Array( "summary" => "rss",
+ "mode" => $this->_mode,
+ "profile" => $this->_profile ));
+ if( $this->_view->isCached()) {
+ return true;
+ }
+
+ // load the stuff
+ $stats = new SummaryStats();
+
+ if( $this->_mode == SUMMARY_RSS_TYPE_MOST_ACTIVE_BLOGS ) {
+ $blogs = $stats->getMostActiveBlogs( $this->_numPosts );
+ }
+ else {
+ $blogs = $stats->getRecentBlogs( $this->_numPosts);
+ }
+
+ // in case there is really no data to fetch...
+ if( !$blogs )
+ $blogs = Array();
+
+ // this 'url' object is just a dummy one... But we cannot get it from the list
+ // of blogs that we fetched because it could potentially be null! Besides, we only
+ // need it to generate the base url to rss.css and to summary.php, so no need to
+ // have a fully-featured object
+ $this->_view->setValue( "url", new RawRequestGenerator( null ));
+ $this->_view->setValue( "blogs", $blogs );
}
- else {
- // load the most recent posts, filtering out all those registration messages...
- $registerTopic = $this->_locale->tr( "register_default_article_topic" );
- $registerText = $this->_locale->tr( "register_default_article_text" );
- $posts = $stats->getRecentArticles( $this->_numPosts, $registerTopic, $registerText );
- }
-
- if( !$posts ) {
- $posts = Array();
- }
-
- $this->_view->setValue( "posts", $posts );
+
+ $this->_view->setValue( "type", $this->_mode );
$this->_view->setValue( "summary", true );
- $this->setCommonData();
+ $this->setCommonData();
return true;
}
Modified: plog/branches/plog-1.0.2/class/summary/view/summaryrssview.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/summary/view/summaryrssview.class.php 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/class/summary/view/summaryrssview.class.php 2005-06-30 06:18:23 UTC (rev 2279)
@@ -12,9 +12,9 @@
function SummaryRssView( $profile, $data = Array())
{
- if( $profile == "" ) {
+ if( $profile == "" || $profile == "blogs_" ) {
$config =& Config::getConfig();
- $profile = $config->getValue( "default_rss_profile", "rss090" );
+ $profile .= $config->getValue( "default_rss_profile", "rss090" );
}
$this->SummaryCachedView( $profile, $data );
Modified: plog/branches/plog-1.0.2/templates/summary/index.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/index.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/index.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -18,7 +18,13 @@
<a href="?op=resetPasswordForm">{$locale->tr("password_forgotten")}</a>
</fieldset>
</form>
- <h4>{$locale->tr("summary_newest_blogs")}</h4>
+ <h4>{$locale->tr("summary_newest_blogs")}
+ {if $recentBlogs}
+ <a href="{$url->getRssUrl()}?summary=1&type=newestblogs">
+ <img src="{$url->getUrl("/imgs/rss_logo_small.gif")}"
+ alt="RSS" /></a>
+ {/if}
+ </h4>
<ul class="itemList">
{foreach from=$recentBlogs item=blog}
{assign var="url" value=$blog->getBlogRequestGenerator()}
@@ -51,7 +57,13 @@
<input type="submit" class="button" name="summarySearch" value="{$locale->tr("search")}" tabindex="21" />
</fieldset>
</form>
- <h4>{$locale->tr("summary_most_active_blogs")}</h4>
+ <h4>{$locale->tr("summary_most_active_blogs")}
+ {if $activeBlogs}
+ <a href="{$url->getRssUrl()}?summary=1&type=mostactiveblogs">
+ <img src="{$url->getUrl("/imgs/rss_logo_small.gif")}"
+ alt="RSS" /></a>
+ {/if}
+ </h4>
<ul class="itemList">
{foreach from=$activeBlogs item=blog}
{assign var="url" value=$blog->getBlogRequestGenerator()}
@@ -102,4 +114,4 @@
{/if}
{/foreach}
</div>
-{include file="summary/footer.template"}
+{include file="summary/footer.template"}
\ No newline at end of file
Added: plog/branches/plog-1.0.2/templates/summary/rss/blogs_atom.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/rss/blogs_atom.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/rss/blogs_atom.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="{$locale->getCharset()}"?>
+<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="{$locale->getLanguageId()|lower}">
+<title>Your site title</title>
+<generator url="http://www.plogworld.net/" version="1.0">pLog</generator>
+<copyright>Copyright (c) Your copyright notice</copyright>
+ {foreach from=$blogs item=blog}
+ {assign var=url value=$blog->getBlogRequestGenerator()}
+ <entry>
+ <id>{$url->blogLink()}</id>
+ <title>{$blog->getBlog()|escape}</title>
+ <link rel="alternate" type="text/html" href="{$url->blogLink()}" />
+ {assign var="blogDate" value=$blog->getCreateDateObject()}
+ {assign var="modifiedDate" value=$blog->getUpdateDateObject()}
+ <modified>{$modifiedDate->getW3Date()}</modified>
+ <issued>{$locale->formatDate($blogDate, "%Y-%m-%dT%H:%M:%S")}</issued>
+ <created>{$locale->formatDate($blogDate, "%Y-%m-%dT%H:%M:%SZ")}</created>
+ <summary type="text/plain">{$blog->getAbout()|strip_tags|truncate:200:" ..."}</summary>
+ <author>
+ {assign var="blogOwner" value=$blog->getOwnerInfo()}
+ <name>{$blogOwner->getUsername()}</name>
+ <url>{$url->blogLink()}</url>
+ <email>{$blogOwner->getEmail()}</email>
+</author>
+ {assign var=blogLocale value=$blog->getLocale()}
+ <content type="text/html" mode="escaped" xml:lang="{$blogLocale->getLanguageId()|lower}" xml:base="{$url->blogLink()}">
+ {$blog->getAbout()|escape}
+</content>
+</entry>
+{/foreach}
+</feed>
\ No newline at end of file
Added: plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss090.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss090.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss090.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="{$locale->getCharset()}"?>
+<?xml-stylesheet href="{$url->getUrl("/styles/rss.css")}" type="text/css"?>
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">
+ <channel>
+ <title>Your service title</title>
+ <description>Your service description</description>
+ <link>{$url->getBaseUrl(false)}/summary.php</link>
+ </channel>
+ {foreach from=$blogs item=blog}
+ <item>
+ {assign var=url value=$blog->getBlogRequestGenerator()}
+ <title>{$blog->getBlog()|escape}</title>
+ <description>{$blog->getAbout()|escape}</description>
+ <link>{$url->blogLink()}</link>
+ </item>
+ {/foreach}
+</rdf:RDF>
Added: plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss10.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss10.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss10.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="{$locale->getCharset()}"?>
+<?xml-stylesheet href="{$url->getUrl("/styles/rss.css")}" type="text/css"?>
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://purl.org/rss/1.0/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+ <channel rdf:about="{$url->getRssUrl()}?summary=1&profile=rss10&type={$type}">
+ <title>Your service title</title>
+ <description>Your service description</description>
+ <link>{$url->getBaseUrl(false)}/summary.php</link>
+ </channel>
+ {foreach from=$blogs item=blog}
+ {assign var=url value=$blog->getBlogRequestGenerator()}
+ <item rdf:about="{$url->blogLink()}">
+ <title>{$blog->getBlog()|escape}</title>
+ <dc:title>{$blog->getBlog()|escape}</dc:title>
+ <description>{$blog->getAbout()|escape}</description>
+ <link>{$url->blogLink}</link>
+ {assign var="blogDate" value=$blog->getCreateDateObject()}
+ <dc:date>{$locale->formatDate($blogDate, "%Y-%m-%d %H:%M:%S")}</dc:date>
+ {assign var="blogOwner" value=$blog->getOwnerInfo()}
+ <dc:creator>{$blogOwner->getUsername()}</dc:creator>
+ </item>
+ {/foreach}
+</rdf:RDF>
Added: plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss20.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss20.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/rss/blogs_rss20.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="{$locale->getCharset()}"?>
+<?xml-stylesheet href="{$url->getUrl("/styles/rss.css")}" type="text/css"?>
+<rss version="2.0">
+ <channel>
+ <title>Your service title</title>
+ <description>Your service description</description>
+ <link>{$url->getBaseUrl(false)}/summary.php</link>
+ <generator>pLog 1.0</generator>
+ {foreach from=$blogs item=blog}
+ {assign var=url value=$blog->getBlogRequestGenerator()}
+ <item>
+ <title>{$blog->getBlog()|escape}</title>
+ <description>{$blog->getAbout()|escape}</description>
+ <link>{$url->blogLink()}</link>
+ <guid>{$url->blogLink()}</guid>
+ {assign var="blogOwner" value=$blog->getOwnerInfo()}
+ <author>{$blogOwner->getUsername()}</author>
+ <source url="{$url->rssLink("rss20")}">{$blog->getBlog()|escape}</source>
+ </item>
+ {/foreach}
+ </channel>
+</rss>
Modified: plog/branches/plog-1.0.2/templates/summary/rss/rss20.template
===================================================================
--- plog/branches/plog-1.0.2/templates/summary/rss/rss20.template 2005-06-29 10:24:00 UTC (rev 2278)
+++ plog/branches/plog-1.0.2/templates/summary/rss/rss20.template 2005-06-30 06:18:23 UTC (rev 2279)
@@ -7,7 +7,7 @@
<title>Your service title</title>
<description>Your service description</description>
<link>{$url->getBaseUrl(false)}/summary.php</link>
- <generator>pLog 0.3</generator>
+ <generator>pLog 1.0</generator>
{foreach from=$posts item=post}
{assign var=blog value=$post->getBlogInfo()}
{assign var=url value=$blog->getBlogRequestGenerator()}
More information about the pLog-svn
mailing list