Vergleich inc/class_feedparser.php - 1.8.0 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 34Zeile 34
	/**
* Parses a feed with the specified filename (or URL)
*

	/**
* Parses a feed with the specified filename (or URL)
*

	 * @param string The path or URL of the feed

	 * @param string $feed The path or URL of the feed

	 * @return boolean True if parsing was a success, false if failure
*/
function parse_feed($feed)
{

	 * @return boolean True if parsing was a success, false if failure
*/
function parse_feed($feed)
{

		// Include the XML parser
require_once MYBB_ROOT."inc/class_xml.php";


 
		// Load the feed we want to parse
$contents = fetch_remote_file($feed);


		// Load the feed we want to parse
$contents = fetch_remote_file($feed);


Zeile 53Zeile 50
			$contents = substr($contents, strpos($contents, "<"));
}
if(strrpos($contents, ">")+1 !== strlen($contents))

			$contents = substr($contents, strpos($contents, "<"));
}
if(strrpos($contents, ">")+1 !== strlen($contents))

		{

		{

			$contents = substr($contents, 0, strrpos($contents, ">")+1);

			$contents = substr($contents, 0, strrpos($contents, ">")+1);

		}


		}


		// Could not load the feed, return an error
if(!$contents)
{

		// Could not load the feed, return an error
if(!$contents)
{

Zeile 65Zeile 62
		}

// Parse the feed and get the tree

		}

// Parse the feed and get the tree

		$parser = new XMLParser($contents);
$tree = $parser->get_tree();

		$parser = create_xml_parser($contents);
$tree = $parser->get_tree();


// If the feed is invalid, throw back an error
if($tree == false)


// If the feed is invalid, throw back an error
if($tree == false)

Zeile 90Zeile 87
			$this->error = "unknown_feed_type";
return false;
}

			$this->error = "unknown_feed_type";
return false;
}

 

return true;

	}

/**
* Parses an XML structure in the format of an RSS feed
*

	}

/**
* Parses an XML structure in the format of an RSS feed
*

	 * @param array PHP XML parser structure

	 * @param array $feed_contents PHP XML parser structure

	 * @return boolean true
*/
function parse_rss($feed_contents)

	 * @return boolean true
*/
function parse_rss($feed_contents)

Zeile 103Zeile 102
		foreach(array('title', 'link', 'description', 'pubdate') as $value)
{
if(!isset($feed_contents['channel'][$value]['value']))

		foreach(array('title', 'link', 'description', 'pubdate') as $value)
{
if(!isset($feed_contents['channel'][$value]['value']))

			{

			{

				$feed_contents['channel'][$value]['value'] = '';
}
}

				$feed_contents['channel'][$value]['value'] = '';
}
}

Zeile 138Zeile 137
				$item['title'] = $feed_item['title']['value'];
}


				$item['title'] = $feed_item['title']['value'];
}


			if(array_key_exists("description", $feed_item))

			if(isset($feed_item['description']['value']))

			{
$item['description'] = $feed_item['description']['value'];

			{
$item['description'] = $feed_item['description']['value'];

 
			}
else
{
$item['description'] = '';

			}

if(array_key_exists("link", $feed_item))

			}

if(array_key_exists("link", $feed_item))

Zeile 196Zeile 199
	/**
* Convert all array keys within an array to lowercase
*

	/**
* Convert all array keys within an array to lowercase
*

	 * @param array The array to be converted

	 * @param array $array The array to be converted

	 * @return array The converted array
*/
function keys_to_lowercase($array)

	 * @return array The converted array
*/
function keys_to_lowercase($array)

Zeile 220Zeile 223
	/**
* Converts an RSS date stamp in to a unix timestamp
*

	/**
* Converts an RSS date stamp in to a unix timestamp
*

	 * @param string The RSS date

	 * @param string $date The RSS date

	 * @return integer The unix timestamp (if successful), 0 if unsuccessful
*/
function get_rss_timestamp($date)

	 * @return integer The unix timestamp (if successful), 0 if unsuccessful
*/
function get_rss_timestamp($date)