user->id}", $ustock)) return; $echo = $echo . "
"; if ($get_image == 'on' || (isset($show_icon) && $show_icon == 'yes')){ $echo = $echo . ' '; } if (preg_match("/^(id:{1})([[:alpha:]]{1}[-_a-zA-Z1234567890]{1,30}[[:alnum:]]{1})$/u", $val->keyword)) { $keyword_title = $val->keyword; } else { $keyword_title = $val->target->title; } $echo = $echo . "user->id}"; $echo = $echo . "\" class=\"hatena-id\">{$val->user->name} (id:{$val->user->id})
\n"; $echo = $echo . "
keyword); $echo = $echo . "\" class=\"keyword\">".htmlspecialchars($keyword_title)."
\n"; $ustock[] = "{$val->user->id}"; } else { //タイムスタンプ-0 $unix_time = strtotime($val->created_at); if (isset($first_e) && $first_e != '') $first_time = $unix_time; unset($first_e); $entry_body = $val->html_touch; if ($entries_mode == 'default' || $entries_mode == 'album'){ foreach ($dict as $dfn) { // var_dump($dfn); $dmt = preg_grep("/".preg_quote("{$entry_body}", '/')."/u", $dfn); // var_dump($dmt); if (isset($dmt["{$val->user->id}"])){ $spam = $spam + 1; return; } } $dict[] = array("{$val->user->id}" => "{$entry_body}"); } // if (($entries_mode == 'default' || $entries_mode == 'album') && // preg_match("/(^{$http_url_regexp}$)/u", "{$val->keyword}")){ $spam = $spam + 1; return; } if (preg_match("/^(id:{1})([[:alpha:]]{1}[-_a-zA-Z1234567890]{1,30}[[:alnum:]]{1})$/u", $val->keyword)) { $keyword_title = $val->keyword; } else { $keyword_title = $val->target->title; } $entry_body = preg_replace("/^([  ]*
){1,}/u", "", $entry_body); $entry_body = preg_replace("/(
){1,}$/u", "", $entry_body); $entry_body = preg_replace("/
/u", "
", $entry_body); $entry_body = preg_replace("/([  ]*
){3,}/u", "

", $entry_body); $entry_body = preg_replace("/
/u", "
\n", $entry_body); //改行削減 if (isset($disbr) && $disbr == 'no'){ } elseif ($entries_mode == 'friends_timeline' || $entries_mode == 'default' || $entries_mode == 'keyword_timeline'){ $list_mark = "-1234567890一二三四五六七八九〇1234567890・*○●◎△▲▽▼□■◇◆×>#;#;"; $entry_body = preg_replace("/([  ]*
){2,}/u", "
", $entry_body); $entry_body = preg_replace("/(^[{$list_mark}]{1,}.+|^>.+)(
)/um", " \${1}\${2}
", $entry_body); $entry_body = preg_replace("/
\n/u", "
", $entry_body); $entry_body = preg_replace("/([^><」」』】\]]。.  ]{1})
([^{$list_mark}  ><「「『【\[[]{1})/u", "\${1} \${2}", $entry_body); // var_dump($entry_body); $entry_body = preg_replace("/([,、]{1})[ ]{1}/u", "\${1}", $entry_body); $entry_body = preg_replace("/([  ]*
){2,}/u", "
", $entry_body); } // $entry_body = preg_replace("/(
)/u", "\n\${1}\n", $entry_body); $entry_body = preg_replace("/\n+/u", "\n", $entry_body); $entry_body = preg_replace("/\n$/u", "", $entry_body); if (preg_match("/((
|\n)*>>(
|\n))(.+)((
\n)<<(
|\n)*)/us", $entry_body)) { $bquote = "1"; } else { $bquote = "0"; } //文字数制限 if ($entry_processor_mode == "entries" && !preg_match('/^(kalen_t|fumobot)$/u', $val->user->id) && $entries_mode != 'user_timeline' && $entries_mode != 'keyword_timeline'){ $see_more = "id}&user={$val->user->id}&keyword=" . rawurlencode($val->keyword) . "\" class=\"see-more\">(…)"; $plain_body = strip_tags($entry_body); $entry_width = mb_strwidth($plain_body); if (($entries_mode == 'default' || $entries_mode == 'album') && preg_match("/(^{$http_url_regexp}$)|(^{$http_path_regexp}$)|(^{$http_url_regexp}.+{$http_url_regexp}$)/us", $plain_body) && !preg_match("/]+>/u", $entry_body)){ $spam = $spam + 1; return; } $tranc_width = $entry_limit - ($entry_limit/3); if ($entry_width > ($entry_limit)){ $plain_body = mb_strimwidth($plain_body, 0, $tranc_width, '', "UTF-8"); $text_a = explode("\n", $entry_body); $plain_a = explode("\n", $plain_body); // var_dump($text_a); $tail = count($plain_a) - 1; $text_a[$tail] = $plain_a[$tail]; $text_a = array_slice($text_a, 0, $tail + 1); $entry_body = implode("\n", $text_a) . $see_more; //var_dump($entry_body_temp); } } //引用記法 if ($bquote == 1) { $entry_body = preg_replace("/(\n|
)*>>(\n|
)/us", "
", $entry_body); $entry_body = preg_replace("/(\n|
)<<(\n|
)*/us", "
", $entry_body); $entry_body = preg_replace("/(
|<\/blockquote>)
/u", "\${1}", $entry_body); } if (preg_match("/
/u", $entry_body) && !preg_match("/<\/blockquote>/u", $entry_body)){ $entry_body = $entry_body."
"; } $entry_body = preg_replace("//u", "", $entry_body); $entry_body = preg_replace("//u", "", $entry_body); $entry_body = preg_replace("/]*href=\"(http:\/\/h[[:alnum:]]*\.hatena\.[^\/]+\/*)\/touch\/asin\/([[:alnum:]]+)\"[^>]*>/u", "", $entry_body); $entry_body = preg_replace("/
]*>]*alt=\"((map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*))\"[^>]*><\/a><\/div>/u", "\${1}", $entry_body); if ($get_image != 'on'){ $entry_body = preg_replace("/]*>]*class=\"*(profile-image|favicon)\"*[^>]*><\/a>/u", "", $entry_body); $entry_body = preg_replace("/]*>]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe><\/div>/u", "YouTube(\${1})", $entry_body); } else { if ($device_who == 'ktai' || $device_who == 'android-old'){ $entry_body = preg_replace("/]*>]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe><\/div>/u", "\"\"", $entry_body); } else { $entry_body = preg_replace("/]*>(]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe>)<\/div>/u", "\${1}", $entry_body); } } //はてなスター if ($val->favorited != "0"){ if (isset($starisjs) && $starisjs == '1'){ $show_star = ''; } else { $show_star = "user->id}/{$val->id}") . "\">★{$val->favorited}"; } } else { $show_star = ""; } if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){ if (isset($starisjs) && $starisjs == '1'){ $add_star = ''; } else { $add_star = ' '; } } else { $add_star = ''; } //キーワードの前処理 $headend = "
"; if ($entries_mode == 'keyword_timeline'){ $entry_kw = ''; } elseif (mb_ereg_match("^{$http_url_regexp}$",htmlspecialchars($val->keyword, ENT_QUOTES))){ $entry_kw = "URL:%KEYWORD%{$headend}\n"; // var_dump($entry_body); } elseif (preg_match("/^asin:[[:alnum:]]+$/u", $val->keyword)){ $entry_kw = "ASIN:%KEYWORD%{$headend}\n"; } elseif (!isset($val->keyword)){ $entry_kw = "{$headend}\n"; } elseif (preg_match("/^(id:{1})(.+)/u", $val->keyword) == 0) { // var_dump($entry_body); $entry_kw = "%KEYWORD%{$headend}\n"; } else { $entry_kw = "%KEYWORD%{$headend}\n"; } //var_dump($entry_body); if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){ $replying = 'Re '; } else { $replying = ''; } // // var_dump($entry_body); //公式モバイル版における各エントリへのリンク URL 生成 $refer_link = "http://{$haiku_host}/" . $val->user->id . "/" . $val->id; //タイムスタンプ if (preg_match("/[0-2][0-9]:[0-9]{2}:[0-9]{2}/u", $val->keyword)){ $dating = date("Y-m-d H:i:s", $unix_time); } else { $day = date("Ymd", $unix_time); $time = date("H:i", $unix_time); $year = date("Y", $unix_time); $today = date("Ymd"); $tyear = date("Y"); if ($year < $tyear){ $dating = date("Y-m-d", $unix_time).' '.$time; } elseif ($day == $today){ $dating = ''.$time; } elseif ($day == $today-1){ $dating = '昨日 '.$time; } elseif ($day == $today-2){ $dating = '一昨日 '.$time; } elseif ($day <= $today-3 && $day >= $today-6){ $wdaynum = getdate($unix_time); $wdaylabel = array('日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'); $dating = $wdaylabel[$wdaynum['wday']].' '.$time; } else { $dating = date("Y-m-d", $unix_time).' '.$time; } } $entry_body_a = explode("\n", $entry_body); $entry_body_b = array(); foreach ($entry_body_a as $line){ if ($get_image == 'on' && $mobile_gateway_for_images != ''){ if (preg_match("/]*href=\".+(youtube|ugomemo|nicovideo).+\"[^>]*>]*href=\"({$http_url_regexp})\"[^>]*>(]*src=\")({$http_url_regexp})(\"[^>]*>)/ue", "'\\2{$mobile_gateway_for_images}'.rawurlencode(rawurldecode('\\3')).'\\4';", $line); } elseif (preg_match("/]*href=\"({$http_url_regexp})\"[^>]*>(]*src=\")({$http_url_regexp})(\"[^>]*>)/u", $line)){ $line = preg_replace("/]*href=\"(http:{$http_path_regexp})\"[^>]*>(]*src=\")({$http_url_regexp})(\"[^>]*>)/ue", "'\\2{$mobile_gateway_for_images}'.rawurlencode(rawurldecode('\\3')).'\\4';", $line); } } if (mb_check_encoding(urldecode($line), 'UTF-8')){ $line = preg_replace("/]*href=\"(http:{$http_path_regexp})\"[^>]*>([^<]+)<\/a>/ue", "''.rawurldecode('\\2').'';", $line); } else { } if ($get_image != 'on'){ if (preg_match("/]*href=\".+(youtube|ugomemo|nicovideo).+\"[^>]*>]*alt=\"([^>\"]*)\"[^>]*>/ui", "\${1}", $line); } else { $line = preg_replace("/]*src=\"([^>\"]*)\"[^>]*>/uie", "parse_url('\\1', PHP_URL_HOST) . '(' . basename('\\1') . ')';", $line); } } $line = mb_ereg_replace('\\\("|\'|\\\)', "\\1", $line); $entry_body_b[] = $line; } $entry_body = implode("\n", $entry_body_b); // var_dump($entry_body); //map 記法の処理 if ($get_image == 'on'){ $entry_body = preg_replace("/(map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*)/u", "
", $entry_body); } else { $entry_body = preg_replace("/(map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*)/u", "\${1}:\${2}:\${3}
", $entry_body); } //表示 $echo = $echo . "
id}\""; } $echo = $echo . ">"; if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){ if (isset($starisjs) && $starisjs == '1'){ } else { $echo = $echo . '
'; } } $echo = $echo . ""; if ($get_image == 'on' || (isset($show_icon) && $show_icon == 'yes')){ $echo = $echo . ' '; } //キーワードの処理 if (!isset($val->keyword)){ $entry_body = ' ' . $add_star . $show_star . $entry_body; } if ($entries_mode == 'keyword_timeline'){ $entry_kw = $add_star . $show_star . '' . $headend . "\n"; } else { $entry_kw = str_replace("%KEYWORD%","keyword) . "\" class=\"keyword\">". htmlspecialchars($val->target->title, ENT_QUOTES) . " {$add_star}{$show_star}",$entry_kw); //id キーワードの処理 if (preg_match('/^(id:{1}[a-zA-Z]{1}[-_a-zA-Z1234567890]{1,30}[a-zA-Z1234567890]{1})$/u',$val->keyword) >= 1){ $entry_kw = "keyword) . "\" class=\"keyword\">" . htmlspecialchars($val->target->word, ENT_QUOTES) . " {$add_star}{$show_star}{$headend}\n"; } } //Reply-to if ($val->in_reply_to_status_id != ''){ // echo "..."; $reply_to = "in_reply_to_status_id}&user={$val->in_reply_to_user_id}&keyword=" . rawurlencode($val->keyword) . "\" class=\"hatena-id\">[← " . $val->in_reply_to_user_id . " へ"; if (mb_substr_count($entry_body, '
') < 1){ if (preg_match('/\[画像\(.+\)\]/u', $entry_body) || preg_match('/]+\/>/u', $entry_body)){ $reply_to = $reply_to."
\n"; } else { $reply_to = $reply_to.' '; } } else { $reply_to = $reply_to."
\n"; } $entry_body = $reply_to.$entry_body; } //Reply-from if (isset($reply_from)){ unset($reply_from); } if (isset($in_reply)){ unset($in_reply); } if (isset($val->replies[0]->id)){ $in_reply = ''; foreach($val->replies as $replies){ $in_reply = $in_reply . " id}&user={$replies->user->id}&keyword=" . rawurlencode($val->keyword) . "\" class=\"hatena-id\">[← {$replies->user->id} から "; } $reply_from = "{$in_reply}"; } else { $reply_from = ''; } // $entry_body = mb_ereg_replace('\\\("|\'|\\\)', "\\1", $entry_body); // var_dump($entry_body); $echo = $echo . "{$dating} "; $echo = $echo . $entry_kw; if ($get_image == 'on'){ $echo = $echo . "

"; } else { $echo = $echo . "

"; } $echo = $echo . $entry_body; $echo = $echo . "

\n"; $echo = $echo . ""; $echo = $echo . "by user->id; $echo = $echo . "\" class=\"hatena-id\" title=\"id:{$val->user->screen_name}\">"; $echo = $echo . htmlspecialchars($val->user->name, ENT_QUOTES); $echo = $echo . ' '; $echo = $echo . ' '; if ($entry_processor_mode == 'entry'){ $echo = $echo . 'from ' . $val->source . ' '; } $echo = $echo . "{$replying}{$reply_from}  † "; $echo = $echo . ''; if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){ if (isset($starisjs) && $starisjs == '1'){ } else { $echo = $echo . ""; } } $echo = $echo . "

\n"; } ?>