//error_reporting(E_ALL ^ E_NOTICE);\r
ini_set("display_errors", 1);\r
@set_time_limit(120);\r
+libxml_use_internal_errors(true); \r
+\r
\r
// Deal with magic quotes\r
if (get_magic_quotes_gpc()) {\r
$html .= $item->get_description();\r
} else {\r
$readability->clean($content_block, 'select');\r
- if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block);\r
+ // get base URL\r
+ $base_url = get_base_url($readability->dom);\r
+ if (!$base_url) $base_url = $effective_url;\r
+ // rewrite URLs\r
+ if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block);\r
// footnotes\r
if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) {\r
$readability->addFootnotes($content_block);\r