END;
$cache = new FileCache();
$key = 'getContent:RandomContent:BuzzerStarNet';
if (!$content = $cache->fetch($key)) {
$content = $this->get_html('https://www.buzzerstar.net/api.php?r=1');
$cache->store($key,$content,3600*24); // 1 tag cache
}
$ResultsArray = explode("\n",$content);
$count = count($ResultsArray);
for ( $ArrayCount=0; $ArrayCount<=2; $ArrayCount++ ) {
$rand_f1 = rand(1,8);
$rand_f2 = rand(10,60);
list($shortcode,$headline,$keywords,$linkingcode,$sentences) = explode('###', $ResultsArray[$ArrayCount]);
//echo "RA: $ResultsArray[$ArrayCount]
";
$RelatedMoreContent .=<<
$headline
$sentences
Keywords of Article: $keywords
END;
} // for
$RelatedMoreContent .=<<
END;
return $RelatedMoreContent;
}
public function get_html($url) {#new
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
public function GetNewRelatedContent($searchInputFromShowPHP){
$search = new Search();
$SearchContent = $search->SphinxSearch( $searchInputFromShowPHP );
//echo "Sphinx in: $searchInputFromShowPHP";
//print_r($SearchContent);
$re = '/# Split sentences on whitespace between them.
(?<= # Begin positive lookbehind.
[.!?] # Either an end of sentence punct,
| [.!?][\'"] # or end of sentence punct and quote.
) # End positive lookbehind.
(?
END;
$imageRetArray = $this->getScreenResolutionFromUA($startpage);
$x = $imageRetArray["x"];
$y = $imageRetArray["y"];
$fontsize = $imageRetArray["fontsize"];
$picQuality = $imageRetArray["picQuality"];
for ( $ArrayCount=1; $ArrayCount<=7; $ArrayCount++ ) {
$rand_f1 = rand(1,8);
$rand_f2 = rand(10,60);
list( $headline,$shortcode,$article1,$pic_desc) = explode('#####', $SearchContent[$ArrayCount] );
if (strlen($headline)<10){
break 1;
}
$shortcode = trim($shortcode);
$headline = trim($headline);
$pic_desc = trim($pic_desc);
//$article = substr($article1,0,125).' ...';
$articleLink = "https://www.buzzerstar.com/".$this->makeArticleLink($shortcode);
$sentences = preg_split($re, $article1, -1, PREG_SPLIT_NO_EMPTY);
$RelatedMoreContent .=<<
$headline
$sentences[0] $sentences[1]
END;
}
$RelatedMoreContent .=<<
END;
return $RelatedMoreContent;
}
public function getIndexNewInlineCSS(){
$css = new Minifier();
$buffer = "";
$buffer .= file_get_contents("/home/www/wwwbuzzerstar/cssv3/main.min.css");
$buffer .= file_get_contents("/home/www/wwwbuzzerstar/cssv3/jssocials.min.css");
$buffer .= file_get_contents("/home/www/wwwbuzzerstar/cssv3/jssocials-theme-classic.min.css");
// Minifier anwenden
$buffer = $css->minifyCSS($buffer);
//Remove comments
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
//Remove space after colons
$buffer = str_replace(": ", ":", $buffer);
//Remove whitespace
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return "";
}
//http://darcyclarke.me/development/get-image-for-youtube-or-vimeo-videos-from-url/
public function getLinks($text){
if(filter_var($text, FILTER_VALIDATE_URL))
{
//echo "Yes it is url";
//exit; // die well
return array(1,$text);
//} else {
//echo "No it is not url";
//return array(0,0);
// my else codes goes
}
$regex = "((https?|ftp)\:\/\/)?"; // SCHEME
$regex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; // User and Pass
$regex .= "([a-z0-9-.]*)\.([a-z]{2,3})"; // Host or IP
$regex .= "(\:[0-9]{2,5})?"; // Port
$regex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?"; // Path
$regex .= "(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?"; // GET Query
$regex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?"; // Anchor
if(preg_match("/^$regex$/", $text))
{
return array(1,$text);
}
// The Regular Expression filter
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\/\S*)?/";
// Check if there is a url in the text
if(preg_match($reg_exUrl, $text, $url)) {
return array(1, $url[0]);
// make the urls hyper links
// echo preg_replace($reg_exUrl, "