[\r\n]?/ism", "", $chunk);
$chunk = preg_replace("/
[\r\n]?/ism", "
", $chunk);
$chunk = preg_replace("/<\/div>[\r\n]?/ism", ": ", $chunk);
$chunk = preg_replace("/<\/span>/ism", "", $chunk);
$newest_only .= $chunk;
if ( preg_match('/href=\'(http:\/\/feedproxy.google.com.*?)\'/', $chunk, $match) ) {
$proxyurl = $match[1];
if ( false === ( $cleanurl = get_transient( md5('cleanurlof' . $proxyurl) ) ) ) {
$cleanurl = resolveUrl($proxyurl);
$cleanurl = doHardcore($cleanurl);
set_transient( md5("cleanurlof" . $proxyurl), $cleanurl, 90000 + rand(1,3600) );
} $chunk = str_replace($match[1], $cleanurl, $chunk);
/* print_r($newest_only); die; */
}
/* $chunk = preg_replace( '/<\/li>[\s\r\n]*<\/ul>/ism', '', $chunk ); */
/* $newest_only .= $chunk . "\n"; */
}
return $newest_only;
}
function resolveUrl($url) {
try {
$header = doCurlRequest($url); return $header['redirect_url']; } catch (Exception $ex) {
_log("error freeing url $url: " . $ex->getMessage()); return $url;
}
}
function curlDownload($Url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://markus-spring.info");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
if(!function_exists('_log')) {
function _log( $message ) {
if( WP_DEBUG === true ) {
if( is_array( $message ) || is_object( $message ) ) {
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
}
}
}
function doCurlRequest($url) {
$curlSession = curl_init($url);
curl_setopt($curlSession, CURLOPT_NOBODY, 1);
$curlResponse = curl_exec($curlSession);
$header = curl_getinfo($curlSession);
curl_close($curlSession);
return $header;
}
function doHardcore($url) {
try {
$parts = explode("?", $url);
$ret = $parts[0];
_log("do hardcore: [$url] -> [$ret]");
return $ret;
} catch (Exception $ex) {
_log("error in hardcore: " . $ex->getMessage());
return $url;
}
}
?>
Referer: $ref POSITIV"; */
scratch99_last_post_thumbnail_link();
}
?>