<div dir="ltr">Hello,<br> I have created a Yahoo Pipe that will let you get a feed of items from your shared items from Google Reader for a particular time range. This does require that the feed is cached so when the pipe runs, the new items can be identified.<br>
<br><a href="http://pipes.yahoo.com/pwestbro/oPhVEt_Q3RGhS41kBRNMsA">http://pipes.yahoo.com/pwestbro/oPhVEt_Q3RGhS41kBRNMsA</a><br><br>--Paul<br><br><div class="gmail_quote">On Tue, Sep 2, 2008 at 10:50 AM, Paul Westbrook <span dir="ltr"><<a href="mailto:paul@westbrooks.org">paul@westbrooks.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Hello,<br> When the plugin successfully imports a feed, it goes to<br>
the DefaultView. So I can believe that you are getting that<br>warning. ( I assume that $posts is null)<br>
<br> The link to the rss item comes straight out of LifeType's<br>xml parser. If you look at the feed from google reader, does the<br>url look good there?<br><br> What you have described is exactly what I want to use it<br>
for. But there is a problem with the google reader feed. <br>Google doesn't have any indication of when an item was "shared" in the<br>feed itself. Without that, it is hard to generate the list of<br>the items that were shared in the last 24 hours. I am planning<br>
on working on a workaround for this, when I get a chance.<br><br> I have written up how I am using it here:<br><br><a href="http://www.paulstimesink.com/post/2008/08/21/posting_daily_activity" target="_blank">http://www.paulstimesink.com/post/2008/08/21/posting_daily_activity</a><br>
<br>Also, this plugin will not create a post, if there are no items in the<br>feed. The way that I was planning on using this is to pass a<br>feed that only has items added in the last 24 hours in it. I am<br>using Yahoo Pipes to do that now for my delicious items.<br>
<br><br><br>- --Paul<br><br><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.6 (GNU/Linux)<br>Comment: <a href="http://getfiregpg.org" target="_blank">http://getfiregpg.org</a><br><br>iD8DBQFIvXzwQIx6KJgT81kRArZZAKCJW+fqqrrwOMlmy/2n45Ji0sYwVQCfS/8U<br>
d3wxanQ34LKO4jNlLbvqYNk=<br>=x2VX<br>-----END PGP SIGNATURE-----<div><div></div><div class="Wj3C7c"><br><div class="gmail_quote">On Mon, Sep 1, 2008 at 7:43 PM, Jon Daley <span dir="ltr"><<a href="mailto:plogworld@jon.limedaley.com" target="_blank">plogworld@jon.limedaley.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I haven't looked into it yet, but I got this error every time I import the feed (google reader shared)<br>
<br>
Warning: Invalid argument supplied for foreach() in /home/jondaley/www/plog/class/view/defaultview.class.php on line 41<br>
<br>
Also, it is parsing the RSS feed incorrectly, and generating text like this:<br>
<br>
<li><a href="<a href="http://blog.wired.com/geekdad/2008/09/geekdad-puzzle.htmlhttp://blog.wired.com/geekdad/" target="_blank">http://blog.wired.com/geekdad/2008/09/geekdad-puzzle.htmlhttp://blog.wired.com/geekdad/</a>">GeekDad Puzzle of the Week: Cross Number PrimeGeekdad </a></li><br>
<br>
You mentioned you use it for google reader, so it seems odd that it would fail for me?<br>
<br>
Lastly, the ideal way to make it work with google reader is to setup a daily cron job to look at a feed url that only shows posts on that day, and it is smart enough to not generate a post if there aren't any links? i.e. if I simply give it my google reader url, then it will always generate links for all of my shared items each time, even though it already displayed them last time, right?<br>
<br>
Looks like I might have some work to make this work how I want it to, but a good start for me anyway.<div><div></div><div><br>
<br>
On Thu, 21 Aug 2008, Paul Westbrook wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
This creates a new post everytime the "import feed action" gets run<br>
(assuming that the right access key is specified).<br>
<br>
The reason that I wrote this was to have a way to create a daily post that<br>
contains links to my "shared" items. For example, my <a href="http://del.icio.us" target="_blank">del.icio.us</a> bookmarks<br>
and Google Reader Shared items. This timing is why I rely on an external<br>
action to call the plugin.<br>
<br>
--Paul<br>
<br>
On Wednesday 20 August 2008 08:15:59 Jon Daley wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Very nice. I have been aiming to do something like this. How<br>
does this work - it has one post that gets updated? Or it makes a new<br>
post with the same title every time the rss feed changes?<br>
<br>
On Wed, 20 Aug 2008, <a href="mailto:pwestbro@devel.lifetype.net" target="_blank">pwestbro@devel.lifetype.net</a> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Author: pwestbro<br>
Date: 2008-08-20 17:48:02 -0400 (Wed, 20 Aug 2008)<br>
New Revision: 6714<br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/<br>
plugins/branches/lifetype-1.2/rssimport/README.txt<br>
plugins/branches/lifetype-1.2/rssimport/class/<br>
plugins/branches/lifetype-1.2/rssimport/class/action/<br>
<br>
plugins/branches/lifetype-1.2/rssimport/class/action/importrssfeedaction.<br>
class.php<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportconfi<br>
gaction.class.php<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportupdat<br>
econfigaction.class.php<br>
plugins/branches/lifetype-1.2/rssimport/class/view/<br>
<br>
plugins/branches/lifetype-1.2/rssimport/class/view/pluginrssimportconfigv<br>
iew.class.php plugins/branches/lifetype-1.2/rssimport/locale/<br>
plugins/branches/lifetype-1.2/rssimport/locale/locale_en_UK.php<br>
plugins/branches/lifetype-1.2/rssimport/pluginrssimport.class.php<br>
plugins/branches/lifetype-1.2/rssimport/templates/<br>
plugins/branches/lifetype-1.2/rssimport/templates/rssimport.template<br>
Log:<br>
The rssimport plugin creates a post with the content of an rss feed. One<br>
use of this is to create a daily post of online activities (i.e. posted<br>
Flickr photos, Twitter tweets, delicious bookmarks, Google Reader shared<br>
items.)<br>
<br>
<br>
[USAGES]:<br>
1. Upload: Upload all the extract files and directories to<br>
$LifeType_Install_Dir/plugin/rssimport<br>
2. Specify the url to the rss feed to be imported<br>
3. Specify a title for the generated posts<br>
4. Speciy a category for the generated posts<br>
5. (Optionally) Specify a different access key needed to make a post<br>
6. Press Update<br>
<br>
Now when you access the "Url to import feed", and there are a post will<br>
be created<br>
<br>
<br>
<br>
<br>
Added: plugins/branches/lifetype-1.2/rssimport/README.txt<br>
<br>
</blockquote></blockquote>
===================================================================<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--- plugins/branches/lifetype-1.2/rssimport/README.txt<br>
(rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/README.txt 2008-08-20 21:48:02<br>
UTC (rev 6714) @@ -0,0 +1,52 @@<br>
+[DESCRIPTION]<br>
+The rssimport plugin creates a post with the content of an rss feed.<br>
One +use of this is to create a daily post of online activities (i.e.<br>
posted +Flickr photos, Twitter tweets, delicious bookmarks, Google Reader<br>
shared +items.)<br>
+<br>
+[USAGES]:<br>
+1. Upload: Upload all the extract files and directories to<br>
+ $LifeType_Install_Dir/plugin/rssimport<br>
+2. Specify the url to the rss feed to be imported<br>
+3. Specify a title for the generated posts<br>
+4. Speciy a category for the generated posts<br>
+5. (Optionally) Specify a different access key needed to make a post<br>
+6. Press Update<br>
+<br>
+Now when you access the "Url to import feed", and there are a post will<br>
be created +<br>
+<br>
+[ADVANCED USAGES]<br>
+Creating a rss feed for the last 24 hours of posts.<br>
+<br>
+ This Yahoo Pipe will filter a feed by date<br>
+ <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=SJDIxkAa3BG7s6ZYmLokhQ" target="_blank">http://pipes.yahoo.com/pipes/pipe.info?_id=SJDIxkAa3BG7s6ZYmLokhQ</a><br>
+<br>
+Automatically creating posts<br>
+<br>
+ On Linux and Max OS X, it is easy to schedule access to the "Url to<br>
+ import feed" with cron. For a cron tutorial<br>
+ <a href="http://www.clickmojo.com/code/cron-tutorial.html" target="_blank">http://www.clickmojo.com/code/cron-tutorial.html</a><br>
+<br>
+<br>
+[SECURITY CONCERNS]<br>
+The rssimport plugin does allow external processes to create posts in a<br>
+LifeType install. When first configured, the rssimport plugin creates a<br>
+random, relatively unique accessKey. This key is required to be<br>
specified +in a parameter of the url in order for a post to be created.<br>
+<br>
+It is possible, that if the accessKey is discovered, that a third party<br>
can +create posts. The third party will not be able to specify the<br>
content of +these posts, as the feed url is in retrieved from the plugin<br>
config. +<br>
+Followon release may add the following addition enhancement.<br>
+ 1) Allow a list of ip address/host names to be specified where<br>
posting is + allowed<br>
+<br>
+<br>
+<br>
+[TODO]<br>
+1) Add the ability to specify a list of the ip address that are<br>
permitted to create the posts. +2) Add an option to include the<br>
description of the rss items or a summary +int the pos<br>
+3) Change the title field, to not require characters to be escaped<br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/class/action/importrssfeedaction.<br>
class.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
---<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
plugins/branches/lifetype-1.2/rssimport/class/action/importrssfeedaction.<br>
class.php (rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/class/action/importrssfeedaction.<br>
class.php 2008-08-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,157 @@<br>
+<?php<br>
+<br>
+ lt_include( PLOG_CLASS_PATH."class/action/blogaction.class.php" );<br>
+ lt_include(<br>
PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php" ); +<br>
lt_include( PLOG_CLASS_PATH."class/view/errorview.class.php" ); +<br>
+ class ImportRssFeedAction extends BlogAction<br>
+ {<br>
+ var $_enteredPassword;<br>
+ var $_html;<br>
+<br>
+ function ImportRssFeedAction( $actionInfo, $request )<br>
+ {<br>
+<br>
+ $this->BlogAction( $actionInfo, $request );<br>
+ }<br>
+<br>
+ function perform()<br>
+ {<br>
+ // Get and confirm the password<br>
+ $this->_enteredPassword = $this->_request->getValue( "accessKey"<br>
); +<br>
+ $this->_html = "";<br>
+<br>
+ // Check the ip address to make sure that it is the list of<br>
+ // allowd ip address<br>
+<br>
+ $blogSettings = $this->_blogInfo->getSettings();<br>
+ if ($blogSettings->getValue( "plugin_rssimport_enabled" ) == FALSE)<br>
+ {<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "Plugin not enabled" );<br>
+<br>
+ $this->setCommonData();<br>
+ return true;<br>
+ }<br>
+<br>
+ $feedurl = $blogSettings->getValue( "plugin_rssimport_feedurl" );<br>
+ $accessKey = $blogSettings->getValue( "plugin_rssimport_accessKey"<br>
); +// $accessHosts = $blogSettings->getValue(<br>
"plugin_rssimport_accessHosts" ); + $titleFormat =<br>
$blogSettings->getValue( "plugin_rssimport_titleFormat" ); +<br>
+ // Compare the access key to that which is in the accessKey<br>
parameter + if ($accessKey != $this->_enteredPassword)<br>
+ {<br>
+ // Passwords don't match<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "Incorrect Access Key" );<br>
+<br>
+ $this->setCommonData();<br>
+ return true;<br>
+<br>
+ }<br>
+<br>
+// if ( $accessHosts != null && $accessHosts != "" )<br>
+// {<br>
+//<br>
+// }<br>
+<br>
+<br>
+ lt_include(<br>
PLOG_CLASS_PATH."class/xml/rssparser/rssparser.class.php" ); +<br>
+ $parser = new RSSParser();<br>
+<br>
+ if ( $parser->parse($feedurl) == FALSE )<br>
+ {<br>
+ // failed to parse the feed<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "Failed to parse feed" );<br>
+<br>
+ $this->setCommonData();<br>
+ return true;<br>
+ }<br>
+<br>
+ $items = $parser->getItems();<br>
+<br>
+ // Now add each of the items to our html documen that we are<br>
building + foreach ($items as $item) {<br>
+ $this->addItem($item);<br>
+ }<br>
+<br>
+ if ( $this->_html == "" )<br>
+ {<br>
+ // There were no items<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "No items in feed" );<br>
+<br>
+ $this->setCommonData();<br>
+ return true;<br>
+ }<br>
+<br>
+ // Now create an article with the html as the body,<br>
+<br>
+ lt_include( PLOG_CLASS_PATH.'class/dao/articles.class.php' );<br>
+ $articles = new Articles();<br>
+<br>
+ $postText = Textfilter::xhtmlize("<ul>" . $this->_html .<br>
"</ul>"); +<br>
+ $postTitle = date($titleFormat);<br>
+<br>
+<br>
+ // XXX_PW This should pull the category from the settings<br>
+ // Get the default category<br>
+ lt_include(<br>
PLOG_CLASS_PATH.'class/dao/articlecategories.class.php' ); +<br>
$category = new ArticleCategories();<br>
+ $cats =<br>
$category->getBlogCategories($this->_blogInfo->getId()); +<br>
+ // some protection again blogs without categories<br>
+ if( !$cats ) {<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "Error getting categories" );<br>
+<br>
+ $this->setCommonData();<br>
+ return true;<br>
+ }<br>
+<br>
+<br>
+ $idCategory = $blogSettings->getValue(<br>
"plugin_rssimport_article_category_id" ); +<br>
+ $article = new Article( $postTitle,<br>
+ $postText,<br>
+ Array( $idCategory ), // catid<br>
+ $this->_blogInfo->getOwner(),<br>
+ $this->_blogInfo->getId(),<br>
+ POST_STATUS_PUBLISHED,<br>
+ 0 );<br>
+ $article->setDateObject( new Timestamp());<br>
+ $article->setCommentsEnabled( true );<br>
+<br>
+<br>
+ // add the article to the db, finally<br>
+ if( $articles->addArticle( $article )) {<br>
+ lt_include( PLOG_CLASS_PATH."class/view/defaultview.class.php"<br>
); + $this->_view = new DefaultView( $this->_blogInfo );<br>
+ }<br>
+ else {<br>
+ $this->_view = new ErrorView( $this->_blogInfo );<br>
+ $this->_view->setValue( "message", "Error adding article to the<br>
database" ); + }<br>
+<br>
+ $this->setCommonData();<br>
+<br>
+<br>
+ return true;<br>
+ }<br>
+<br>
+ function addItem( $item )<br>
+ {<br>
+ // Add this item to the html text<br>
+ $this->_html .= "<li>";<br>
+ $this->_html .= "<a href=\"" . $item->getLink() . "\">" .<br>
$item->getTitle() . " </a>"; + $this->_html .= "</li>";<br>
+ }<br>
+<br>
+<br>
+ }<br>
+?><br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportconfi<br>
gaction.class.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
---<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportconfi<br>
gaction.class.php (rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportconfi<br>
gaction.class.php 2008-08-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,45 @@<br>
+<?php<br>
+<br>
+ /*<br>
+ Copyright 2006, 2008 Paul Westbrook (<a href="mailto:paul@westbrooks.org" target="_blank">paul@westbrooks.org</a>)<br>
+<br>
+ This program is free software; you can redistribute it and/or modify<br>
+ it under the terms of the GNU General Public License as published by<br>
+ the Free Software Foundation; either version 2 of the License, or<br>
+ (at your option) any later version.<br>
+<br>
+ This program is distributed in the hope that it will be useful,<br>
+ but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ GNU General Public License for more details.<br>
+<br>
+ You should have received a copy of the GNU General Public License<br>
+ along with this program; if not, write to the Free Software<br>
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307<br>
USA + */<br>
+<br>
+<br>
+ lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php"<br>
); + lt_include(<br>
PLOG_CLASS_PATH."plugins/rssimport/class/view/pluginrssimportconfigview.c<br>
lass.php" ); +<br>
+ /**<br>
+ * shows a form with the current configuration<br>
+ */<br>
+ class PluginRssImportConfigAction extends AdminAction<br>
+ {<br>
+<br>
+ function PluginRssImportConfigAction( $actionInfo, $request )<br>
+ {<br>
+ $this->AdminAction( $actionInfo, $request );<br>
+ }<br>
+<br>
+ function perform()<br>
+ {<br>
+ $this->_view = new PluginRssImportConfigView( $this->_blogInfo<br>
); +<br>
+ $this->setCommonData();<br>
+<br>
+ return true;<br>
+ }<br>
+ }<br>
+?><br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportupdat<br>
econfigaction.class.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
---<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportupdat<br>
econfigaction.class.php (rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/class/action/pluginrssimportupdat<br>
econfigaction.class.php 2008-08-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,165<br>
@@<br>
+<?php<br>
+<br>
+ /*<br>
+ Copyright 2006, 2008 Paul Westbrook (<a href="mailto:paul@westbrooks.org" target="_blank">paul@westbrooks.org</a>)<br>
+<br>
+ This program is free software; you can redistribute it and/or modify<br>
+ it under the terms of the GNU General Public License as published by<br>
+ the Free Software Foundation; either version 2 of the License, or<br>
+ (at your option) any later version.<br>
+<br>
+ This program is distributed in the hope that it will be useful,<br>
+ but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ GNU General Public License for more details.<br>
+<br>
+ You should have received a copy of the GNU General Public License<br>
+ along with this program; if not, write to the Free Software<br>
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307<br>
USA + */<br>
+<br>
+ lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php"<br>
); + lt_include(<br>
PLOG_CLASS_PATH."plugins/rssimport/class/view/pluginrssimportconfigview.c<br>
lass.php" ); + lt_include(<br>
PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );<br>
+ lt_include(<br>
PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" ); +<br>
+<br>
+ /**<br>
+ * updates the plugin configuration<br>
+ */<br>
+ class PluginRssImportUpdateConfigAction extends AdminAction<br>
+ {<br>
+ var $_pluginEnabled;<br>
+ var $_feedurl;<br>
+ var $_accessKey;<br>
+// var $_accessHosts;<br>
+ var $_titleFormat;<br>
+ var $_categoryId;<br>
+<br>
+ function PluginRssImportUpdateConfigAction( $actionInfo, $request )<br>
+ {<br>
+ $this->AdminAction( $actionInfo, $request );<br>
+ }<br>
+<br>
+ function validate()<br>
+ {<br>
+<br>
+ $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );<br>
+ $this->_pluginEnabled = ($this->_pluginEnabled != "" );<br>
+<br>
+ $this->_feedurl = $this->_request->getValue( "feedurl" );<br>
+<br>
+ $this->_accessKey = $this->_request->getValue( "accessKey" );<br>
+<br>
+// $this->_accessHosts = $this->_request->getValue( "accessHosts" );<br>
+<br>
+ $this->_titleFormat = $this->_request->getValue( "titleFormat" );<br>
+ $this->_categoryId = $this->_request->getValue( "categoryId" );<br>
+<br>
+ // This should validate the url<br>
+ $val = new HttpUrlValidator();<br>
+ if( !$val->validate($this->_feedurl) ) {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_url")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // Make sure that key is specied<br>
+ if (!$this->_accessKey || $this->_accessKey == "")<br>
+ {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_missing_accesskey")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // This should validate the url<br>
+ $val = new StringValidator();<br>
+ if( !$val->validate($this->_accessKey) ) {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_invalid_accesskey")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // This should validate the url<br>
+ $val = new StringValidator();<br>
+ if( !$val->validate($this->_accessKey) ) {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_invalid_accesskey")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // Make sure that titleFormat is specied<br>
+ if (!$this->_titleFormat || $this->_titleFormat == "")<br>
+ {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_missing_titleformat")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // This should validate the url<br>
+ $val = new StringValidator();<br>
+ if( !$val->validate($this->_titleFormat) ) {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("rssimport_error_invalid_titleformat")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ return true;<br>
+ }<br>
+<br>
+ function perform()<br>
+ {<br>
+ // update the plugin configurations to blog setting<br>
+ $blogSettings = $this->_blogInfo->getSettings();<br>
+ $blogSettings->setValue( "plugin_rssimport_enabled",<br>
$this->_pluginEnabled ); +<br>
+ $blogSettings->setValue( "plugin_rssimport_feedurl", $this->_feedurl<br>
); +<br>
+ $blogSettings->setValue( "plugin_rssimport_accessKey",<br>
$this->_accessKey); +<br>
+// $blogSettings->setValue( "plugin_rssimport_accessHosts",<br>
$this->_accessHosts); +<br>
+ $blogSettings->setValue( "plugin_rssimport_titleFormat",<br>
$this->_titleFormat); +<br>
+ $blogSettings->setValue( "plugin_rssimport_article_category_id",<br>
$this->_categoryId ); + $this->_blogInfo->setSettings( $blogSettings );<br>
+<br>
+<br>
+ // save the blogs settings<br>
+ $blogs = new Blogs();<br>
+ if( !$blogs->updateBlog( $this->_blogInfo )) {<br>
+ $this->_view = new PluginRssImportConfigView(<br>
$this->_blogInfo ); + $this->_view->setErrorMessage(<br>
$this->_locale->tr("error_updating_settings")); +<br>
$this->setCommonData();<br>
+<br>
+ return false;<br>
+ }<br>
+<br>
+ // if everything went ok...<br>
+ $this->_blogInfo->setSettings( $blogSettings );<br>
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );<br>
+ $this->saveSession();<br>
+<br>
+ $this->_view = new PluginRssImportConfigView( $this->_blogInfo );<br>
+ $this->_view->setSuccessMessage(<br>
$this->_locale->tr("rssimport_settings_saved_ok"));<br>
+ $this->setCommonData();<br>
+<br>
+ // clear the cache<br>
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());<br>
+<br>
+ return true;<br>
+ }<br>
+ }<br>
+?><br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/class/view/pluginrssimportconfigv<br>
iew.class.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
---<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
plugins/branches/lifetype-1.2/rssimport/class/view/pluginrssimportconfigv<br>
iew.class.php (rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/class/view/pluginrssimportconfigv<br>
iew.class.php 2008-08-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,94 @@<br>
+<?php<br>
+ /*<br>
+ Copyright 2006, 2008 Paul Westbrook (<a href="mailto:paul@westbrooks.org" target="_blank">paul@westbrooks.org</a>)<br>
+<br>
+ This program is free software; you can redistribute it and/or modify<br>
+ it under the terms of the GNU General Public License as published by<br>
+ the Free Software Foundation; either version 2 of the License, or<br>
+ (at your option) any later version.<br>
+<br>
+ This program is distributed in the hope that it will be useful,<br>
+ but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ GNU General Public License for more details.<br>
+<br>
+ You should have received a copy of the GNU General Public License<br>
+ along with this program; if not, write to the Free Software<br>
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307<br>
USA + */<br>
+<br>
+<br>
+ lt_include(<br>
PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );<br>
+<br>
+ /**<br>
+ * implements the main view of the feed reader plugin<br>
+ */<br>
+ class PluginRssImportConfigView extends AdminPluginTemplatedView<br>
+ {<br>
+<br>
+<br>
+ function PluginRssImportConfigView( $blogInfo )<br>
+ {<br>
+ $this->AdminPluginTemplatedView( $blogInfo, "rssimport", "rssimport"<br>
); +<br>
+ }<br>
+<br>
+ function render()<br>
+ {<br>
+ // load some configuration settings<br>
+ $blogSettings = $this->_blogInfo->getSettings();<br>
+ $pluginEnabled = $blogSettings->getValue( "plugin_rssimport_enabled"<br>
); +<br>
+ $feedurl = $blogSettings->getValue( "plugin_rssimport_feedurl" );<br>
+<br>
+ $accessKey = $blogSettings->getValue( "plugin_rssimport_accessKey" );<br>
+ // If accessKey is not set, generate a new one<br>
+ if ( $accessKey == null || $accessKey == "" )<br>
+ {<br>
+ $rg =& $this->_blogInfo->getBlogRequestGenerator();<br>
+ $rg->blogLink();<br>
+<br>
+ // Generate a unique accessKey for this plugin<br>
+ $accessKey = md5($rg->blogLink() . time());<br>
+ }<br>
+<br>
+// $accessHosts = $blogSettings->getValue(<br>
"plugin_rssimport_accessHosts" ); +<br>
+ // Get the title format string<br>
+ $titleFormat = $blogSettings->getValue(<br>
"plugin_rssimport_titleFormat" ); + if ( $titleFormat == null ||<br>
$titleFormat == "" )<br>
+ {<br>
+ $locale = $this->_blogInfo->getLocale();<br>
+ $titleFormat = $locale->tr("rssimport_default_titleformat");<br>
+ }<br>
+<br>
+ $categoryId = $blogSettings->getValue(<br>
"plugin_rssimport_article_category_id" ); +<br>
+ // fetch all the current article categories<br>
+ lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php");<br>
+ $categories = new ArticleCategories();<br>
+ $blogCategories = $categories->getBlogCategories(<br>
$this->_blogInfo->getId()); +<br>
+ // get the update url from rssimport plugin and pass to the plugin<br>
setting view + $plugins = $this->_pm->getPlugins();<br>
+ $this->setValue( 'importRssUrl',<br>
$plugins['rssimport']->getImportRssUrl($accessKey) ); +<br>
+<br>
+ // create a view and export the settings to the template<br>
+ $this->setValue( "pluginEnabled", $pluginEnabled );<br>
+<br>
+ $this->setValue( "feedurl", $feedurl );<br>
+<br>
+ $this->setValue( "accessKey", $accessKey );<br>
+<br>
+// $this->setValue( "accessHosts", $accessHosts );<br>
+<br>
+ $this->setValue( "titleFormat", $titleFormat );<br>
+<br>
+ $this->setValue( "categoryId", $categoryId );<br>
+ $this->setValue( "categories", $blogCategories );<br>
+<br>
+ parent::render();<br>
+ }<br>
+ }<br>
+?><br>
<br>
Added: plugins/branches/lifetype-1.2/rssimport/locale/locale_en_UK.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--- plugins/branches/lifetype-1.2/rssimport/locale/locale_en_UK.php<br>
(rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/locale/locale_en_UK.php 2008-08-2<br>
0 21:48:02 UTC (rev 6714) @@ -0,0 +1,32 @@<br>
+<?php<br>
+$messages["manageIntegrationPlugins"] = "Integration Management";<br>
+$messages["rssimport"] = "RSS Import";<br>
+<br>
+$messages["rssimport_plugin_enabled"] = "Enable this plugin";<br>
+$messages["rssimport_accessKey"] = "Access Key that is required to<br>
import a feed"; +$messages["rssimport_accessHosts"] = "IP address that<br>
are allowed to trigger a feed to be imported (leave blank to allow allow<br>
all hosts)"; +$messages["rssimport_feedurl"] = "Url of the feed to<br>
fetch";<br>
+$messages["rssimport_titleformat"] = "Format string that should be used<br>
for the titles of the new posts. See <a<br>
href='<a href="http://us3.php.net/manual/en/function.date.php" target="_blank">http://us3.php.net/manual/en/function.date.php</a>'>this page</a> for<br>
format parameters"; +$messages["rssimport_articles_categories_help"] =<br>
"In which category would you like articles posted to be categorized?";<br>
+$messages["rssimport_plugin"] = "RSS Import Plugin";<br>
+<br>
+$messages["detail"] = "Detail";<br>
+<br>
+$messages["rssimport_settings_saved_ok"] = "RSS Import settings saved<br>
successfully!"; +$messages["rssimport_error_url"] = "Invalid url<br>
specified ";<br>
+$messages["rssimport_error_missing_accesskey"] = "Access Key needs to be<br>
specified "; +$messages["rssimport_error_invalid_accesskey"] = "Invalid<br>
Access Key"; +$messages["rssimport_error_missing_titleformat"] = "Title<br>
Format needs to be specified";<br>
+$messages["rssimport_error_invalid_titleformat"] = "Invalid Title<br>
Format"; +<br>
+<br>
+$messages["label_configuration"] = "Configuration";<br>
+$messages["label_enable"] = "Enable";<br>
+$messages["label_rssimport_feedurl"] = "Feed URL";<br>
+$messages["label_rssimport_accessKey"] = "Access Key";<br>
+$messages["label_rssimport_accessHosts"] = "Allowed hosts";<br>
+$messages["label_rssimport_importurl"] = "Url to import feed";<br>
+$messages["label_rssimport_titleformat"] = "Title Format String";<br>
+<br>
+$messages["rssimport_default_titleformat"] = "\l\i\\n\k\s \f\o\\r F j,<br>
Y"; +?><br>
<br>
Added: plugins/branches/lifetype-1.2/rssimport/pluginrssimport.class.php<br>
<br>
</blockquote></blockquote>
===================================================================<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--- plugins/branches/lifetype-1.2/rssimport/pluginrssimport.class.php<br>
(rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/pluginrssimport.class.php 2008-08<br>
-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,93 @@<br>
+<?php<br>
+ /*<br>
+ Copyright 2006, 2008 Paul Westbrook (<a href="mailto:paul@westbrooks.org" target="_blank">paul@westbrooks.org</a>)<br>
+<br>
+ This program is free software; you can redistribute it and/or modify<br>
+ it under the terms of the GNU General Public License as published by<br>
+ the Free Software Foundation; either version 2 of the License, or<br>
+ (at your option) any later version.<br>
+<br>
+ This program is distributed in the hope that it will be useful,<br>
+ but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ GNU General Public License for more details.<br>
+<br>
+ You should have received a copy of the GNU General Public License<br>
+ along with this program; if not, write to the Free Software<br>
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307<br>
USA + */<br>
+<br>
+<br>
+<br>
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );<br>
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );<br>
+<br>
+<br>
+ class PluginRssImport extends PluginBase<br>
+ {<br>
+ var $pluginEnabled;<br>
+<br>
+ function PluginRssImport( $source = "" )<br>
+ {<br>
+ $this->PluginBase($source);<br>
+<br>
+ $this->id = "rssimport";<br>
+ $this->author = "Paul Westbrook";<br>
+ $this->desc = "The Rss Import plugin imports an rss feed and<br>
creates an article with the contentss"; + $this->version = "20080715";<br>
+<br>
+ $this->locales = Array( "en_UK");<br>
+<br>
+ if( $source == "admin" )<br>
+ $this->initAdmin();<br>
+ else<br>
+ $this->init();<br>
+ }<br>
+<br>
+ function init()<br>
+ {<br>
+ $this->registerBlogAction( "importFeed", "ImportRssFeedAction" );<br>
+ }<br>
+<br>
+<br>
+ function initAdmin()<br>
+ {<br>
+ $this->registerAdminAction( "rssImportConfig",<br>
"PluginRssImportConfigAction" ); + $this->registerAdminAction(<br>
"updateRssImportConfig", "PluginRssImportUpdateConfigAction" ); +<br>
+ $menu =& Menu::getMenu();<br>
+ if( !$menu->entryExists(<br>
"/menu/controlCenter/manageIntegrationPlugins" ))<br>
+ $this->addMenuEntry( "/menu/controlCenter",<br>
"manageIntegrationPlugins", "", "", true, false ); +<br>
+ $this->addMenuEntry( "/menu/controlCenter/manageIntegrationPlugins",<br>
"rssimport", "?op=rssImportConfig", "" ); + }<br>
+<br>
+ function register()<br>
+ {<br>
+ $blogSettings = $this->blogInfo->getSettings();<br>
+ $this->pluginEnabled = $blogSettings->getValue(<br>
"plugin_rssimport_enabled" ); +<br>
+ $this->accessKey = $blogSettings->getValue(<br>
"plugin_rssimport_accessKey" ); + }<br>
+<br>
+ function isEnabled()<br>
+ {<br>
+ return $this->pluginEnabled;<br>
+ }<br>
+<br>
+ function getImportRssUrl($accessKey)<br>
+ {<br>
+ lt_include( PLOG_CLASS_PATH."class/net/rawrequestgenerator.class.php"<br>
); +<br>
+ $rg = new RawRequestGenerator($this->blogInfo);<br>
+<br>
+ $rg->addParameter( "op", "importFeed" );<br>
+ $rg->addParameter( "accessKey", $accessKey);<br>
+<br>
+ $importRssUrl = $rg->getIndexUrl().$rg->getRequest();<br>
+<br>
+ return $importRssUrl;<br>
+ }<br>
+<br>
+ }<br>
+?><br>
<br>
Added:<br>
plugins/branches/lifetype-1.2/rssimport/templates/rssimport.template<br>
<br>
</blockquote></blockquote>
===================================================================<br>
---<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
plugins/branches/lifetype-1.2/rssimport/templates/rssimport.template<br>
(rev 0) +++<br>
plugins/branches/lifetype-1.2/rssimport/templates/rssimport.template 2008<br>
-08-20 21:48:02 UTC (rev 6714) @@ -0,0 +1,65 @@<br>
+{include file="$admintemplatepath/header.template"}<br>
+{include file="$admintemplatepath/navigation.template" showOpt=rssimport<br>
title=$locale->tr("rssimport_plugin")} +<form name="commentPluginConfig"<br>
method="post"><br>
+ <fieldset class="inputField"><br>
+ <legend>{$locale->tr("label_configuration")}</legend><br>
+ {include file="$admintemplatepath/successmessage.template"}<br>
+ {include file="$admintemplatepath/errormessage.template"}<br>
+ <div class="field"><br>
+ <label for="pluginEnabled">{$locale->tr("label_enable")}</label><br>
+ <div class="formHelp"><br>
+ <input class="checkbox" type="checkbox" name="pluginEnabled"<br>
id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1"<br>
/>{$locale->tr("rssimport_plugin_enabled")} + </div><br>
+ </div><br>
+<br>
+ <div class="field"><br>
+ <label<br>
for="accessKey">{$locale->tr("label_rssimport_accessKey")}</label> +<br>
<span class="required">*</span><br>
+ <div class="formHelp">{$locale->tr("rssimport_accessKey")}<br>
+ <input class="text" type="text" name="accessKey" id="accessKey"<br>
value="{$accessKey}" width="10" /> + </div><br>
+ </div><br>
+<br>
+ <div class="field"><br>
+ <label for="feedurl">{$locale->tr("label_rssimport_feedurl")}</label><br>
+ <span class="required">*</span><br>
+ <div class="formHelp">{$locale->tr("rssimport_feedurl")}<br>
+ <input class="text" type="text" name="feedurl" id="feedurl"<br>
value="{$feedurl}" width="10" /> + </div><br>
+ </div><br>
+<br>
+ <div class="field"><br>
+ <label<br>
for="feedurl">{$locale->tr("label_rssimport_titleformat")}</label> +<br>
<span class="required">*</span><br>
+ <div class="formHelp">{$locale->tr("rssimport_titleformat")}<br>
+ <input class="text" type="text" name="titleFormat" id="titleFormat"<br>
value="{$titleFormat}" width="10" /> + </div><br>
+ </div><br>
+<br>
+ <!-- article categories --><br>
+ <div class="field"><br>
+ <label for="categoryId">{$locale->tr("posts")}</label><br>
+ <div<br>
class="formHelp">{$locale->tr("rssimport_articles_categories_help")}</div<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
+ <select name="categoryId"><br>
</blockquote>
+ {foreach from=$categories item=category}<br>
+ <option value="{$category->getId()}" {if $categoryId ==<br>
$category->getId()}selected="selected"{/if}>{$category->getName()}</optio<br>
n> + {/foreach}<br>
+ </select><br>
+ </div><br>
+<br>
+ <div class="field"><br>
+ <label<br>
for="importurl">{$locale->tr("label_rssimport_importurl")}</label> +<br/><br>
+ <span><a href="{$importRssUrl}">{$importRssUrl}</a></span><br>
+ </div><br>
+<br>
+ </fieldset><br>
+<br>
+ <div class="buttons"><br>
+ <input type="hidden" name="op" value="updateRssImportConfig" /><br>
+ <input type="reset" name="{$locale->tr("reset")}" /><br>
+ <input type="submit" name="{$locale->tr("update_settings")}"<br>
value="{$locale->tr("update")}" /> + </div><br>
+</form><br>
+{include file="$admintemplatepath/footernavigation.template"}<br>
+{include file="$admintemplatepath/footer.template"}<br>
<br>
_______________________________________________<br>
pLog-svn mailing list<br>
<a href="mailto:pLog-svn@devel.lifetype.net" target="_blank">pLog-svn@devel.lifetype.net</a><br>
<a href="http://limedaley.com/mailman/listinfo/plog-svn" target="_blank">http://limedaley.com/mailman/listinfo/plog-svn</a><br>
</blockquote></blockquote>
<br>
<br>
</blockquote>
<br></div></div><div>
-- <br>
Jon Daley<br>
<a href="http://jon.limedaley.com" target="_blank">http://jon.limedaley.com</a><br>
~~<br></div>
And when it rains on your parade, look up rather than down.<br>
Without the rain, there would be no rainbow.<br>
-- Jerry Chin<div><div></div><div><br>
_______________________________________________<br>
pLog-svn mailing list<br>
<a href="mailto:pLog-svn@devel.lifetype.net" target="_blank">pLog-svn@devel.lifetype.net</a><br>
<a href="http://limedaley.com/mailman/listinfo/plog-svn" target="_blank">http://limedaley.com/mailman/listinfo/plog-svn</a><br>
</div></div></blockquote></div><br><br><br></div></div></div>
</blockquote></div><br></div>