[geeklog-cvs] geeklog-1.3/system lib-syndication.php,1.9,1.10
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sun Jan 23 06:07:21 EST 2005
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv31343/system
Modified Files:
lib-syndication.php
Log Message:
Incorporated new framework for reading and writing feeds (RSS, RDF, Atom), provided by Michael Jervis.
Index: lib-syndication.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-syndication.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** lib-syndication.php 23 Aug 2004 19:36:35 -0000 1.9
--- lib-syndication.php 23 Jan 2005 11:07:18 -0000 1.10
***************
*** 1,3 ****
! <?php
/* Reminder: always indent with 4 spaces (no tabs). */
--- 1,3 ----
! <?php
/* Reminder: always indent with 4 spaces (no tabs). */
***************
*** 9,15 ****
// | Geeklog syndication library. |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2003 by the following authors: |
// | |
! // | Authors: Dirk Haun - dirk at haun-online.de |
// +---------------------------------------------------------------------------+
// | |
--- 9,16 ----
// | Geeklog syndication library. |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2003-2005 by the following authors: |
// | |
! // | Authors: Dirk Haun - dirk AT haun-online DOT de |
! // | Michael Jervis - mike AT fuckingbrit DOT com |
// +---------------------------------------------------------------------------+
// | |
***************
*** 599,602 ****
--- 600,605 ----
/**
* Update a feed.
+ * Re-written by Michael Jervis (mike AT fuckingbrit DOT com)
+ * to use the new architecture
*
* @param int $fid feed id
***************
*** 611,655 ****
if( $A['is_enabled'] == 1 )
{
! require_once( $_CONF['path_system'] . 'classes/' . $A['format']
! . '.feed.class.php' );
! $feed = new $A['format']();
! $feed->setFeedfile( $A['filename'] );
! $feed->setFeedformats( $A['content_length'], $A['language'],
! $A['charset'] );
! $link = '';
! $data = '';
! if( $A['type'] == 'geeklog' )
{
! if( $A['topic'] == '::all')
{
! $content = SYND_getFeedContentAll( $A['limits'], $link, $data );
}
! elseif( $A['topic'] == '::links')
{
! $content = SYND_getFeedContentLinks( $A['limits'], $link,
! $data );
}
! elseif( $A['topic'] == '::events')
{
! $content = SYND_getFeedContentEvents( $A['limits'], $link,
! $data );
}
! else // feed for a single topic only
{
! $content = SYND_getFeedContentPerTopic( $A['topic'],
! $A['limits'], $link, $data );
}
}
else
{
! $content = PLG_getFeedContent( $A['type'], $fid, $link, $data );
! }
! if( empty( $link ))
! {
! $link = $_CONF['site_url'];
}
- $feed->setFeedinfo( $link, $A['title'], $A['description'] );
- $feed->write( $content );
if( empty( $data ))
--- 614,696 ----
if( $A['is_enabled'] == 1 )
{
! // Import the feed handling classes:
! require_once( $_CONF['path_system']
! . '/classes/syndication/parserfactory.class.php' );
! require_once( $_CONF['path_system']
! . '/classes/syndication/feedparserbase.class.php' );
! // Load the actual feed handlers:
! $factory = new FeedParserFactory( $_CONF['path_system']
! . '/classes/syndication/' );
! $format = explode( '-', $A['format'] );
! $feed = $factory->writer( $format[0], $format[1] );
!
! if( $feed )
{
! $feed->encoding = $A['charset'];
! $feed->lang = $A['language'];
!
! if( $A['type'] == 'geeklog' )
{
! if( $A['topic'] == '::all')
! {
! $content = SYND_getFeedContentAll( $A['limits'], $link,
! $data );
! }
! elseif( $A['topic'] == '::links')
! {
! $content = SYND_getFeedContentLinks( $A['limits'], $link,
! $data );
! }
! elseif( $A['topic'] == '::events')
! {
! $content = SYND_getFeedContentEvents( $A['limits'], $link,
! $data );
! }
! else // feed for a single topic only
! {
! $content = SYND_getFeedContentPerTopic( $A['topic'],
! $A['limits'], $link, $data );
! }
}
! else
{
! $content = PLG_getFeedContent( $A['type'], $fid, $link, $data );
}
! if( empty( $link ))
{
! $link = $_CONF['site_url'];
}
!
! $feed->title = $A['title'];
! $feed->description = $A['description'];
! $feed->sitelink = $link;
! $feed->copyright = 'Copyright ' . strftime( '%Y' ) . ' '
! . $_CONF['site_name'];
! $feed->sitecontact = $_CONF['site_mail'];
! $feed->system = 'Geeklog ' . VERSION;
! $feed->articles = $content;
!
! if( !empty( $A['filename'] ))
{
! $filename = $A['filename'];
}
+ else
+ {
+ $pos = strrpos( $_CONF['rdf_file'], '/' );
+ $filename = substr( $_CONF['rdf_file'], $pos + 1 );
+ }
+ $path = $_CONF['rdf_file'];
+ $pos = strrpos( $path, '/' );
+ $path = substr( $path, 0, $pos + 1 );
+ $filename = $path . $filename;
+ /*{$this->_feedurl = substr_replace ($path, $_CONF['site_url'], 0,
+ strlen ($_CONF['path_html']) - 1);}*/
+ $feed->createFeed( $filename );
}
else
{
! COM_errorLog( "Unable to get a feed writer for {$format[0]} version {$format[1]}.", 1);
}
if( empty( $data ))
***************
*** 662,666 ****
}
! if ($_SYND_DEBUG) {
COM_errorLog ("update_info for feed $fid is $data", 1);
}
--- 703,708 ----
}
! if ($_SYND_DEBUG)
! {
COM_errorLog ("update_info for feed $fid is $data", 1);
}
More information about the geeklog-cvs
mailing list