\content|og\:image"\<\/span\> \content)=\<\/span\>\"([^#].+?)"/';
}
else {
$url_regex_pattern = '/(href|src)=\<\/span\>\"(?!\<\?php)([^#][^\<]+?)"/';
}
$output = preg_replace($url_regex_pattern, "$1="$2"", $output);
$fix_for_relative_urls = '/\/';
$output = preg_replace($fix_for_relative_urls, "", $output);
// Look at the actual code, not the Chrome Inspect Element! Noticing that HTML entities were being used was the key here
$php_includes = '/include\<\/span\>\\(\<\/span\>\'(.+?)\.php'/';
$output = preg_replace($php_includes, "include('$1.php'", $output);
// Turn include path into link
$output = str_replace("/CENSORED/chonoles/public_html/site/php", "/CENSORED/chonoles/public_html/site/php", $output);
// html5shiv
$output = str_replace("http://math.uchicago.edu/~chonoles/site/js/html5shiv-printshiv.js", "http://math.uchicago.edu/~chonoles/site/js/html5shiv-printshiv.js", $output);
// star hack
$output = str_replace("http://math.uchicago.edu/~chonoles/site/css/star-hack.css", "http://math.uchicago.edu/~chonoles/site/css/star-hack.css", $output);
// CC license in head element - using the surrounding spaces to differentiate from other uses of this URL
if($page == 'begin' || $lang == 'html') $output = str_replace(" http://creativecommons.org/licenses/by/4.0/", " http://creativecommons.org/licenses/by/4.0/", $output);
// fixing code links in footer
if($page == 'footer' || $lang == 'html') $output = str_replace("&lang", "&lang", $output);
// blank background image
if($page == 'stylesheet') $output = str_replace("url(http://math.uchicago.edu/~chonoles/site/img/blank.png)", "url(http://math.uchicago.edu/~chonoles/site/img/blank.png)", $output);
echo $output;
include('end.php');
?>