Adopt it to the new proposals for the agreement between Google and VG Media

pull/313/head
Michael Vogel 2015-09-26 11:55:59 +02:00
parent 39cdc9c4aa
commit 99dc8f2deb
1 changed files with 32 additions and 2 deletions

View File

@ -26,13 +26,43 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
if (!leistungsschutzrecht_is_member_site($siteinfo["url"])) if (!leistungsschutzrecht_is_member_site($siteinfo["url"]))
return; return;
$siteinfo["title"] = $siteinfo["url"]; //$siteinfo["title"] = $siteinfo["url"];
unset($siteinfo["text"]); $siteinfo["text"] = leistungsschutzrecht_cuttext($siteinfo["text"]);
unset($siteinfo["image"]); unset($siteinfo["image"]);
unset($siteinfo["images"]); unset($siteinfo["images"]);
unset($siteinfo["keywords"]); unset($siteinfo["keywords"]);
} }
function leistungsschutzrecht_cuttext($text) {
$text = str_replace(array("\r", "\n"), array(" ", " "), $text);
do {
$oldtext = $text;
$text = str_replace(" ", " ", $text);
} while ($oldtext != $text);
$words = explode(" ", $text);
$text = "";
$count = 0;
$limit = 7;
foreach ($words as $word) {
if ($text != "")
$text .= " ";
$text .= $word;
if (++$count >= $limit) {
if (sizeof($words) > $limit)
$text .= " ...";
break;
}
}
return $text;
}
function leistungsschutzrecht_fetchsites() { function leistungsschutzrecht_fetchsites() {
require_once("include/network.php"); require_once("include/network.php");