Websites not reading a validated feed
===

I have created a feed for a client's website. The feed comply with w3c validation, but when I use the feed url in squidoo or hubpages or even feedburner. They are saying its not a valid feed.

Below is the code. I have removed database connections from below code.

rss.class.php

	<?php

	class rssFeed
	{

	function rss($input, $stylesheet="")
	{ 
		is_array($input) ? '' : error('this function requires input to be an array');
		
		$input["encoding"] = (empty($input["encoding"])) ? "UTF-8" : stripslashes($input["encoding"]);
		$input["language"] = (empty($input["language"])) ? "en-us" : stripslashes($input["language"]);
		$input["title"] = stripslashes($input["title"]);
		$input["description"] = stripslashes($input["description"]);
		$input["link"] = stripslashes($input["link"]);
		$input["rsslink"] = stripslashes($input["rsslink"]);
		$rss = '<?xml version="1.0" encoding="' . $input["encoding"] . '"?>';
		$rss .= ($stylesheet != "" ? "\n" . '<?xml-stylesheet type="text/xsl" href="' . $stylesheet . '"?>' : "");
		$rss .= <<<__header__

	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"
		xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		>
	<channel>
	<title>{$input["title"]}</title>
	<atom:link href="{$input["rsslink"]}" rel="self" type="application/rss+xml" />
	<description>{$input["description"]}</description>
	<link>{$input["link"]}</link>
	<language>{$input["language"]}</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>

	__header__;
		foreach($input["items"] as $item)
		{
			$datetime = strtotime($item["pubDate"]);
			$datetime = date("D, d M Y H:i:s",$datetime);
			$item["description"] = strip_tags($item["description"]);
		
			$rss .= "\n<item>\n<title>" . stripslashes($item["title"]) . "</title>";
			//$rss .= "\n<description>" . trunc($item["description"], 40) . "</description>";
			$rss .= "\n<description>"."<![CDATA[" . $item["description"] . "]]>" . "</description>";
			if (!empty($item["contentEncoded"])) $rss .= "\n<content:encoded>"."<![CDATA[" . $item["description"] . "]]>" . "</content:encoded>";
			if (!empty($item["pubDate"]))  $rss .= "\n<pubDate>" . $datetime . " GMT</pubDate>";
			if (!empty($item["link"])) $rss .= "\n<link>".stripslashes($item["link"]) . "</link>";
			if (!empty($item["guid"])) $rss .= "\n<guid>".stripslashes($item["guid"]) . "</guid>";
			$rss .= "\n</item>\n";
		}
		$rss .= "\n</channel>\n</rss>";
		return $rss;
	}

	}
	?>

rss.php

	<?php
	include_once '/classes/rss.class.php';
	?>

	<?php
	$rss = new rssFeed;

		$itemsarray = array();
		foreach($jobs as $item)
		 {	
			$itemsarray[] = array(
								"title"=> htmlspecialchars($title,ENT_QUOTES,'UTF-8'), 
								"description"=> $content,
								"contentEncoded"=> $convert_text_to_html->txt2html($content),
								"pubDate"=>date("D, d M Y H:i:s O", strtotime($date)), 
								"link"=>$link,
								"guid"=>$link
			);
		 }
	}

	$rss_array = array(
		"encoding"=>"UTF-8",
		"language"=>"en-us",
		"title"=>"Website Title", // This field is mandatory
		"description"=>"Website Description", // This field is mandatory
		"link"=>"http://" . $_SERVER['HTTP_HOST'], // This field is mandatory
		"rsslink"=>"http://" . $_SERVER['HTTP_HOST'] . "/feed/rss.php",
		"items"=>$itemsarray
	);

	header("Content-type: application/xml");
	echo trim($rss->rss($rss_array, "rss.xsl"));
	?>