Vergleich inc/class_feedgeneration.php - 1.2.2 - 1.2.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: class_feedgeneration.php 1998 2006-07-19 07:05:51Z Kilroy $

 * $Id: class_feedgeneration.php 2932 2007-03-10 05:48:55Z chris $

 */

class FeedGenerator

 */

class FeedGenerator

Zeile 16Zeile 16
	 *
* @var string
*/

	 *
* @var string
*/

	var $feed_format = 'rss0.92';

	var $feed_format = 'rss2.0';


/**
* The XML to output.


/**
* The XML to output.

Zeile 46Zeile 46
	 */
function set_feed_format($feed_format)
{

	 */
function set_feed_format($feed_format)
{

		if($feed_format == 'rss2.0')

		if($feed_format == 'atom1.0')

		{

		{

			$this->feed_format = 'rss2.0';
}
elseif($feed_format == 'atom1.0')
{
$this->feed_format = 'atom1.0';

			$this->feed_format = 'atom1.0';





		}
else
{

		}
else
{

			$this->feed_format = 'rss0.92';

			$this->feed_format = 'rss2.0';

		}
}


		}
}


Zeile 66Zeile 62
	 * @param array The channel information
*/
function set_channel($channel)

	 * @param array The channel information
*/
function set_channel($channel)

	{

	{

		$this->channel = $channel;

		$this->channel = $channel;

	}

	}


/**
* Adds an item to the RSS feed.


/**
* Adds an item to the RSS feed.

Zeile 78Zeile 74
	function add_item($item)
{
$this->items[] = $item;

	function add_item($item)
{
$this->items[] = $item;

	}



	}



	/**
* Generate and echo XML for the feed.
*

	/**
* Generate and echo XML for the feed.
*

Zeile 92Zeile 88
		{
// Ouput an Atom 1.0 formatted feed.
case "atom1.0":

		{
// Ouput an Atom 1.0 formatted feed.
case "atom1.0":

				$this->channel['date'] = date("Y-m-d\TH:i:s O", $this->channel['date']);

				$this->channel['date'] = gmdate("Y-m-d\TH:i:s\Z", $this->channel['date']);

				$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$this->xml .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$this->xml .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "\t<title><![CDATA[".htmlspecialchars_uni($this->channel['title'])."]]></title>\n";
$this->xml .= "\t<id>".$this->channel['link']."</id>\n";
$this->xml .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"".$this->channel['link']."\"/>\n";
$this->xml .= "\t<modified>".$this->channel['date']."</modified>\n";
$this->xml .= "\t<generator uri=\"http://mybboard.com\">MyBB</generator>\n";



				$this->xml .= "\t<title type=\"html\"><![CDATA[".htmlspecialchars_uni($this->channel['title'])."]]></title>\n";
$this->xml .= "\t<subtitle type=\"html\"><![CDATA[".htmlspecialchars_uni($this->channel['description'])."]]></subtitle>\n";
$this->xml .= "\t<link rel=\"self\" href=\"{$this->channel['link']}syndication.php\"/>\n";
$this->xml .= "\t<id>{$this->channel['link']}</id>\n";
$this->xml .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"{$this->channel['link']}\"/>\n";
$this->xml .= "\t<updated>{$this->channel['date']}</updated>\n";
$this->xml .= "\t<generator uri=\"http://mybboard.net\">MyBB</generator>\n";

				break;
// The default is the RSS 2.0 format.
default:
$this->channel['date'] = date("D, d M Y H:i:s O", $this->channel['date']);
$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

				break;
// The default is the RSS 2.0 format.
default:
$this->channel['date'] = date("D, d M Y H:i:s O", $this->channel['date']);
$this->xml .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

				$this->xml .= "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"	xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

				$this->xml .= "\t<channel>\n";
$this->xml .= "\t\t<title><![CDATA[".htmlspecialchars_uni($this->channel['title'])."]]></title>\n";
$this->xml .= "\t\t<link>".$this->channel['link']."</link>\n";

				$this->xml .= "\t<channel>\n";
$this->xml .= "\t\t<title><![CDATA[".htmlspecialchars_uni($this->channel['title'])."]]></title>\n";
$this->xml .= "\t\t<link>".$this->channel['link']."</link>\n";

				$this->xml .= "\t\t<description>".htmlspecialchars_uni($this->channel['description'])."</description>\n";

				$this->xml .= "\t\t<description><![CDATA[".htmlspecialchars_uni($this->channel['description'])."]]></description>\n";

				$this->xml .= "\t\t<pubDate>".$this->channel['date']."</pubDate>\n";
$this->xml .= "\t\t<generator>MyBB</generator>\n";
}

				$this->xml .= "\t\t<pubDate>".$this->channel['date']."</pubDate>\n";
$this->xml .= "\t\t<generator>MyBB</generator>\n";
}

Zeile 126Zeile 124
				// Output Atom 1.0 format feed.
case "atom1.0":
$item['date'] = date("Y-m-d\TH:i:s\Z", $item['date']);

				// Output Atom 1.0 format feed.
case "atom1.0":
$item['date'] = date("Y-m-d\TH:i:s\Z", $item['date']);

					$this->xml .= "\t<entry>\n";
if($item['author'])
{

					$this->xml .= "\t<entry xmlns=\"http://www.w3.org/2005/Atom\">\n";
if(!empty($item['author']))
{

						$this->xml .= "\t\t<author>\n";

						$this->xml .= "\t\t<author>\n";

						$this->xml .= "\t\t\t<name><![CDATA[".htmlspecialchars_uni($item['author'])."]]></name>\n";

						$this->xml .= "\t\t\t<name>".htmlspecialchars_uni($item['author'])."</name>\n";

						$this->xml .= "\t\t</author>\n";
}

						$this->xml .= "\t\t</author>\n";
}

					$this->xml .= "\t\t<title type=\"text/html\" mode=\"escaped\"><![CDATA[".htmlspecialchars_uni($item['title'])."]]></title>\n";
$this->xml .= "\t\t<link rel=\"alternate\" type=\"text/html\" href=\"".$item['link']."\" />\n";
$this->xml .= "\t\t<id>".$item['link']."</id>\n";
$this->xml .= "\t\t<modified>{$item['date']}</modified>\n";
$this->xml .= "\t\t<issued>{$item['date']}</issued>\n";
$this->xml .= "\t\t<summary type=\"text/plain\" mode=\"escaped\"><![CDATA[".strip_tags($item['description'])."]]></summary>\n";
$this->xml .= "\t\t<content type=\"text/html\" mode=\"escaped\" xml:base=\"".$item['link']."\"><![CDATA[{$item['description']}]]></content>\n";









					$this->xml .= "\t\t<published>{$item['date']}</published>\n";
if(empty($item['updated']))
{
$item['updated'] = $item['date'];
}
else
{
$item['updated'] = date("Y-m-d\TH:i:s\Z", $item['updated']);;
}
$this->xml .= "\t\t<updated>{$item['updated']}</updated>\n";
$this->xml .= "\t\t<link rel=\"alternate\" type=\"text/html\" href=\"{$item['link']}\" />\n";
$this->xml .= "\t\t<id>{$item['link']}</id>\n";
$this->xml .= "\t\t<title type=\"html\" xml:space=\"preserve\"><![CDATA[".htmlspecialchars_uni($item['title'])."]]></title>\n";
$this->xml .= "\t\t<content type=\"html\" xml:space=\"preserve\" xml:base=\"{$item['link']}\"><![CDATA[".strip_tags($item['description'])."]]></content>\n";
$this->xml .= "\t\t<draft xmlns=\"http://purl.org/atom-blog/ns#\">false</draft>\n";

					$this->xml .= "\t</entry>\n";
break;


					$this->xml .= "\t</entry>\n";
break;


Zeile 152Zeile 158
					$this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";
if($item['author'])
{

					$this->xml .= "\t\t\t<pubDate>".$item['date']."</pubDate>\n";
if($item['author'])
{

						$this->xml .= "\t\t\t<dc:creator><![CDATA[".htmlspecialchars_uni($item['author'])."]]></dc:creator>\n";

						$this->xml .= "\t\t\t<dc:creator>".htmlspecialchars_uni($item['author'])."</dc:creator>\n";

					}
$this->xml .= "\t\t\t<guid isPermaLink=\"false\">".$item['link']."</guid>\n";
$this->xml .= "\t\t\t<description><![CDATA[".strip_tags($item['description'])."]]></description>\n";
$this->xml .= "\t\t\t<content:encoded><![CDATA[".$item['description']."]]></content:encoded>\n";
$this->xml .= "\t\t</item>\n";
break;

					}
$this->xml .= "\t\t\t<guid isPermaLink=\"false\">".$item['link']."</guid>\n";
$this->xml .= "\t\t\t<description><![CDATA[".strip_tags($item['description'])."]]></description>\n";
$this->xml .= "\t\t\t<content:encoded><![CDATA[".$item['description']."]]></content:encoded>\n";
$this->xml .= "\t\t</item>\n";
break;



 
			}
}

// Now, neatly end the feed XML.
switch($this->feed_format)
{

			}
}

// Now, neatly end the feed XML.
switch($this->feed_format)
{

			case "rss2.0":
$this->xml .= "\t</channel>\n";
$this->xml .= "</rss>";
break;

 
			case "atom1.0":
$this->xml .= "</feed>";

			case "atom1.0":
$this->xml .= "</feed>";

				break;

				break;

			default:
$this->xml .= "\t</channel>\n";
$this->xml .= "</rss>";

			default:
$this->xml .= "\t</channel>\n";
$this->xml .= "</rss>";

Zeile 187Zeile 188
		// Send an appropriate header to the browser.
switch($this->feed_format)
{

		// Send an appropriate header to the browser.
switch($this->feed_format)
{

			case "rss2.0":
header("Content-Type: text/xml");
break;

 
			case "atom1.0":

			case "atom1.0":

				header("Content-Type: application/atom+xml");

				header("Content-Type: application/atom+xml; charset=utf-8");

				break;
default:

				break;
default:

				header("Content-Type: text/xml");

				header("Content-Type: text/xml; charset=utf-8");

		}

// Output the feed XML. If the feed hasn't been generated, do so.

		}

// Output the feed XML. If the feed hasn't been generated, do so.