diff --git a/www/index.php b/www/index.php index ad55f17..e168b2e 100644 --- a/www/index.php +++ b/www/index.php @@ -19,14 +19,57 @@ return strip_tags($res); } + /* カテゴリーかの確認 */ + function iscategory (string $url): bool { + $chk = explode("=", $url); + if (isset($chk[0])) $chk = explode("?", $chk[0]); + return isset($chk[0]) && $chk[0] == "list_news_category.pl"; + } + /* 記事かの確認 */ function isarticle (string $url): bool { $chk = explode("=", $url); - if (isset($chk[0]) && $chk[0] == "view_news.pl?id" && isset($chk[1]) && isset($chk[2])) { - $chk2 = explode("&", $chk[1]); - if (isset($chk2[1]) && $chk2[1] == "media_id") return true; - } - return false; + return isset($chk[0]) && $chk[0] == "view_news.pl?id" && isset($chk[1]) && isset($chk[2]); + } + + /* カテゴリーだけが残るまで消す */ + function rmcbloat (string $body): string { + //$res = preg_replace('/(.*?)
/s', "", $body); + $res = preg_replace('/(.*?)/s', "", $body); + $res = preg_replace('/(.*?)<\/html>/s', "", $res); + $res = preg_replace('/
(.*?)<\/div>/s', "", $res); + $res = preg_replace('/