2 //YANMAH2 - Yet ANother Mobile Accelerated HatenaHaiku
3 //(c) 2014 YANMAH2 project
4 //This program is freesoftware. you can redistribute it and/or modify it under the terms of the [GNU Affero GPL v3](http://www.gnu.org/licenses/agpl.html).
6 <?php defined("HELLO") or exit(); ?>
8 if ((isset($entry_processor_mode) && ($entry_processor_mode == 'users' || $entry_processor_mode == 'keyword_users')) || (isset($entries_mode) && $entries_mode == 'favours')){
10 if (in_array("{$val->user->id}", $ustock)) return;
11 $echo = $echo . "<dt>";
12 if ($get_image == 'on' || (isset($show_icon) && $show_icon == 'yes')){
13 $echo = $echo . '<img src="' . $val->user->profile_image_url . '" width="16" height="16" class="user-icon" alt="" /> ';
15 if (preg_match("/^(id:{1})([[:alpha:]]{1}[-_a-zA-Z1234567890]{1,30}[[:alnum:]]{1})$/u", $val->keyword)) {
16 $keyword_title = $val->keyword;
18 $keyword_title = $val->target->title;
20 $echo = $echo . "<a href=\"./entries.php?user={$val->user->id}";
21 // if ($get_image == 'on') $echo = $echo . "&image=on";
22 $echo = $echo . "\" class=\"hatena-id\">{$val->user->name} (id:{$val->user->id})</a></dt>\n";
23 $echo = $echo . "<dd><a href=\"./entries.php?keyword=".rawurlencode($val->keyword);
24 // if ($get_image == 'on') $echo = $echo . "&image=on";
25 $echo = $echo . "\" class=\"keyword\">".htmlspecialchars($keyword_title)."</a></dd>\n";
26 $ustock[] = "{$val->user->id}";
29 $unix_time = strtotime($val->created_at);
30 if (isset($first_e) && $first_e != '') $first_time = $unix_time; unset($first_e);
31 $entry_body = $val->html_touch;
32 // $entry_body_text = $val->text;
33 if ($entries_mode == 'default' || $entries_mode == 'album'){
34 foreach ($dict as $dfn) {
36 // $dkey = preg_quote("{$entry_body}", '/');
37 $dmt = preg_grep("/".preg_quote("{$entry_body}", '/')."/u", $dfn);
39 if (isset($dmt["{$val->user->id}"])){ $spam = $spam + 1; return; }
41 $dict[] = array("{$val->user->id}" => "{$entry_body}");
43 if (($entries_mode == 'default' || $entries_mode == 'album') &&
44 preg_match("/(^{$http_url_regexp}$)/u", "{$val->keyword}")){ $spam = $spam + 1; return; }
45 if (preg_match("/^(id:{1})([[:alpha:]]{1}[-_a-zA-Z1234567890]{1,30}[[:alnum:]]{1})$/u", $val->keyword)) {
46 $keyword_title = $val->keyword;
48 $keyword_title = $val->target->title;
50 $entry_body = preg_replace("/^([ ]*<br>){1,}/u", "", $entry_body);
51 $entry_body = preg_replace("/(<br>){1,}$/u", "", $entry_body);
52 $entry_body = preg_replace("/<br>/u", "<br />", $entry_body);
53 $entry_body = preg_replace("/([ ]*<br \/>){3,}/u", "<br /><br />", $entry_body);
54 $entry_body = preg_replace("/<br \/>/u", "<br />\n", $entry_body);
55 // $entry_body = preg_replace("^[ ]<br \/>\n", "<br \/>\n", $entry_body);
56 // var_dump($entry_body);
57 // $entry_body = preg_replace("/([^.!?。!?…‥])\n{1}/u", "\${1}", $entry_body);
58 // $entry_body = preg_replace("/(、)\n/u", "\${1}", $entry_body);
59 // $entry_body = preg_replace("/(<br \/>){1,}$/u", "", $entry_body);
61 if (isset($disbr) && $disbr == 'no'){
62 } elseif ($entries_mode == 'friends_timeline' || $entries_mode == 'default' || $entries_mode == 'keyword_timeline'){
63 $list_mark = "-1234567890一二三四五六七八九〇1234567890・*○●◎△▲▽▼□■◇◆×>#;#;";
64 $entry_body = preg_replace("/([ ]*<br \/>){2,}/u", "<br />", $entry_body);
65 $entry_body = preg_replace("/(^[{$list_mark}]{1,}.+|^>.+)(<br \/>)/um", " \${1}\${2}<br />", $entry_body);
66 $entry_body = preg_replace("/<br \/>\n/u", "<br />", $entry_body);
67 $entry_body = preg_replace("/([^><」」』】\]]。. ]{1})<br \/>([^{$list_mark} ><「「『【\[[]{1})/u", "\${1} \${2}", $entry_body);
68 // var_dump($entry_body);
69 $entry_body = preg_replace("/([,、]{1})[ ]{1}/u", "\${1}", $entry_body);
70 $entry_body = preg_replace("/([ ]*<br \/>){2,}/u", "<br />", $entry_body);
73 $entry_body = preg_replace("/(<br \/>)/u", "\n\${1}\n", $entry_body);
74 // var_dump($entry_body_temp);
75 $entry_body = preg_replace("/\n+/u", "\n", $entry_body);
76 $entry_body = preg_replace("/\n$/u", "", $entry_body);
77 if (preg_match("/((<br \/>|\n)*>>(<br \/>|\n))(.+)((<br \/>\n)<<(<br \/>|\n)*)/us", $entry_body)) {
82 //$entry_body = $entry_body . "\n";
83 //echo htmlspecialchars(var_dump($entry_body));
85 if ($entry_processor_mode == "entries" && !preg_match('/^(kalen_t|fumobot)$/u', $val->user->id)){
86 // if ($get_image == 'on'){
87 // $see_more = "<a href=\"./entry.php?entry={$val->id}&user={$val->user->id}&keyword=" . rawurlencode($val->keyword) . "&image=on\" class=\"see-more\">(…)</a>";
89 $see_more = "<a href=\"./entry.php?entry={$val->id}&user={$val->user->id}&keyword=" . rawurlencode($val->keyword) . "\" class=\"see-more\">(…)</a>";
91 $plain_body = strip_tags($entry_body);
92 $entry_width = mb_strwidth($plain_body);
93 // if ($entries_mode == 'default' && $entry_width < 9){ $spam = $spam + 1; return; }
94 if (($entries_mode == 'default' || $entries_mode == 'album') &&
95 preg_match("/(^{$http_url_regexp}$)|(^{$http_path_regexp}$)|(^{$http_url_regexp}.+{$http_url_regexp}$)/us", $plain_body) &&
96 !preg_match("/<img[^>]+>/u", $entry_body)){ $spam = $spam + 1; return; }
97 $tranc_width = $entry_limit - ($entry_limit/3);
98 if ($entry_width > ($entry_limit)){
99 $plain_body = mb_strimwidth($plain_body, 0, $tranc_width, '', "UTF-8");
100 // $entry_body = mb_strimwidth($entry_body, 0, $tranc_width, '', "UTF-8");
102 $text_a = explode("\n", $entry_body);
103 $plain_a = explode("\n", $plain_body);
104 // var_dump($text_a);
105 $tail = count($plain_a) - 1;
106 $text_a[$tail] = $plain_a[$tail];
107 $text_a = array_slice($text_a, 0, $tail + 1);
108 /* $text_a[$tail] = strip_tags($text_a[$tail]);
109 $text_a[$tail] = preg_replace("/<.*$/u", "", $text_a[$tail]);*/
110 $entry_body = implode("\n", $text_a) . $see_more;
111 //var_dump($entry_body_temp);
115 // $entry_body = preg_replace("/(>>\n)(.+)(<<)/us", "<blockquote>\${2}</blockquote>", $entry_body);
117 $entry_body = preg_replace("/(\n|<br \/>)*>>(\n|<br \/>)/us", "<blockquote>", $entry_body);
118 $entry_body = preg_replace("/(\n|<br \/>)<<(\n|<br \/>)*/us", "</blockquote>", $entry_body);
119 $entry_body = preg_replace("/(<blockquote>|<\/blockquote>)<br \/>/u", "\${1}", $entry_body);
121 if (preg_match("/<blockquote>/u", $entry_body) && !preg_match("/<\/blockquote>/u", $entry_body)){
122 $entry_body = $entry_body."</blockquote>";
124 // $entry_body = preg_replace("/(<blockquote>)(.+)(\n<<)/us", "\${1}\${2}\n</blockquote>", $entry_body);
126 // $entry_body = nl2br($entry_body);
128 // if ($val->user->id == 'Rio_Baxxter' && $val->keyword == '地震情報'){
129 // $rio_a = explode("\n", $entry_body);
131 // foreach ($rio_a as $rio){
133 // if (preg_match("/(http:\/\/maps\.google\.co\.*[^\/]+\/){$http_path_regexp}+/", $rio)) $gmap = mb_ereg_replace("(.*)(<a href=\")(http:\/\/maps\.google\.co\.*[^\/]+\/)({$http_path_regexp}*)(q=)(-*[[:digit:]]{1,3}\.[[:digit:]]+)(,)(-*[[:digit:]]{1,3}\.[[:digit:]]+)({$http_path_regexp}*)(\">)([^<]*)(<\/a>)(.*)", "<br />\nmap:\\6:\\8", $rio);
134 // $rio_b[] = $rio.$gmap;
136 // $entry_body = implode("\n", $rio_b);
139 // if ($get_image == 'on'){
140 // // $entry_body = preg_replace("/<a href=\"\/*[^\/]*\/keyword\/([^\/\"]+)\" class=\"keyword\">/u", "<a href=\"./entries.php?keyword=\${1}&image=on\" class=\"keyword\">", $entry_body);
141 // $entry_body = preg_replace("/<a href=\"http:\/\/h[^\.]*\.hatena\.[^\/]+\/touch\/target\?word=([^\"]+)\" class=\"keyword\">/u", "<a href=\"./entries.php?keyword=\${1}&image=on\" class=\"keyword\">", $entry_body);
142 // // $entry_body = preg_replace("/<a href=\"\/*[^\/]*\/([^\/\"]+)\/\" class=\"user\">/u", "<a href=\"./entries.php?user=\${1}&image=on\" class=\"user\">", $entry_body);
143 // $entry_body = preg_replace("/<a href=\"http:\/\/h[^\.]*\.hatena\.[^\/]+\/touch\/([^\/]+)\/\" class=\"user\">/u", "<a href=\"./entries.php?user=\${1}&image=on\" class=\"user\">", $entry_body);
144 // if ($val->user->id == 'fumobot') $entry_body = preg_replace("/<a[^>]*href=\"(http:\/\/h[[:alnum:]]*\.hatena\.[^\/]+\/*)\/keyword\/([^\"]+)\"[^>]*>/u", "<a href=\"./entries.php?keyword=\${2}&image=on\" class=\"keyword\">", $entry_body);
145 // $entry_body = preg_replace("/<a[^>]*href=\"(http:\/\/h[[:alnum:]]*\.hatena\.[^\/]+\/*)\/touch\/asin\/([[:alnum:]]+)\"[^>]*>/u", "<a href=\"./entries.php?keyword=asin%3A\${2}&image=on\" class=\"keyword\">", $entry_body);
147 // $entry_body = preg_replace("/<a href=\"\/*[^\/]*\/keyword\/([^\/\"]+)\" class=\"keyword\">/u", "<a href=\"./entries.php?keyword=\${1}\" class=\"keyword\">", $entry_body);
148 $entry_body = preg_replace("/<a href=\"http:\/\/h[^\.]*\.hatena\.[^\/]+\/touch\/target\?word=([^\"]+)\" class=\"keyword\">/u", "<a href=\"./entries.php?keyword=\${1}\" class=\"keyword\">", $entry_body);
149 // $entry_body = preg_replace("/<a href=\"\/*[^\/]*\/([^\/\"]+)\/\" class=\"user\">/u", "<a href=\"./entries.php?user=\${1}\" class=\"user\">", $entry_body);
150 $entry_body = preg_replace("/<a href=\"http:\/\/h[^\.]*\.hatena\.[^\/]+\/touch\/([^\/]+)\/\" class=\"user\">/u", "<a href=\"./entries.php?user=\${1}\" class=\"user\">", $entry_body);
151 // if ($val->user->id == 'fumobot')$entry_body = preg_replace("/<a[^>]*href=\"(http:\/\/h[[:alnum:]]*\.hatena\.[^\/]+\/*)\/keyword\/([^\"]+)\"[^>]*>/u", "<a href=\"./entries.php?keyword=\${2}\" class=\"keyword\">", $entry_body);
152 $entry_body = preg_replace("/<a[^>]*href=\"(http:\/\/h[[:alnum:]]*\.hatena\.[^\/]+\/*)\/touch\/asin\/([[:alnum:]]+)\"[^>]*>/u", "<a href=\"./entries.php?keyword=asin%3A\${2}\" class=\"keyword\">", $entry_body);
154 $entry_body = preg_replace("/<div class=\"*user-map\"*><a[^>]*><img[^>]*alt=\"((map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*))\"[^>]*><\/a><\/div>/u", "\${1}", $entry_body);
156 if ($get_image != 'on'){
157 $entry_body = preg_replace("/<a[^>]*><img[^>]*class=\"*(profile-image|favicon)\"*[^>]*><\/a>/u", "", $entry_body);
158 $entry_body = preg_replace("/<div[^>]*><iframe[^>]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe><\/div>/u", "<a href=\"http://m.youtube.com/watch?v=\${1}\">YouTube(\${1})</a>", $entry_body);
160 if ($device_who == 'ktai' || $device_who == 'android-old'){
161 $entry_body = preg_replace("/<div[^>]*><iframe[^>]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe><\/div>/u", "<a href=\"http://m.youtube.com/watch?v=\${1}\"><img src=\"http://img.youtube.com/vi/\${1}/0.jpg\" alt=\"\" /></a>", $entry_body);
163 $entry_body = preg_replace("/<div[^>]*>(<iframe[^>]*src=\"http:\/\/www\.youtube\.com\/embed\/([^\"]+)\"[^>]*><\/iframe>)<\/div>/u", "\${1}", $entry_body);
167 if ($val->favorited != "0"){
168 if (isset($starisjs) && $starisjs == '1'){
171 $show_star = "<span class=\"hatena-star\"><a href=\"http://s.hatena.ne.jp/mobile/entry?uri=" . rawurlencode("http://h.hatena.ne.jp/{$val->user->id}/{$val->id}") . "\">★{$val->favorited}</a></span>";
176 if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
177 if (isset($starisjs) && $starisjs == '1'){
180 $add_star = '<input type="submit" value="☆+" title="add-star" class="add-star-button" style="vertical-align: middle;"><input type="hidden" name="posting" value="favo" /><input type="hidden" name="entry" value="' . $val->id . '" /><input type="hidden" name="return" value="' . htmlspecialchars($self_anchor_possibly_with_pagenum, ENT_QUOTES);
181 if (isset($entry_processor_mode) && $entry_processor_mode != 'entry') $add_star = $add_star . '&reftime=-'.$first_time . ',0'. '#'.$val->id;
182 $add_star = $add_star . '" /> ';
188 /*if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
189 $headend = "</form><br />";
193 if ($entries_mode == 'keyword_timeline'){
195 } elseif (mb_ereg_match("^{$http_url_regexp}$",htmlspecialchars($val->keyword, ENT_QUOTES))){
196 $entry_kw = "URL:%KEYWORD%</span>{$headend}\n";
197 // var_dump($entry_body);
198 } elseif (preg_match("/^asin:[[:alnum:]]+$/u", $val->keyword)){
199 $entry_kw = "ASIN:%KEYWORD%</span>{$headend}\n";
200 } elseif (!isset($val->keyword)){
201 $entry_kw = "</span>{$headend}\n";
202 /*} elseif (mb_strpos($entry_body, "{$val->keyword}=") !== FALSE) {
203 //var_dump($val["keyword"]);
204 $entry_body = str_replace("{$val->keyword}=","%KEYWORD%</span>{$headend}\n<span class=\"entry-body\">\n",$entry_body);*/
205 } elseif (preg_match("/^(id:{1})(.+)/u", $val->keyword) == 0) {
206 // var_dump($entry_body);
207 $entry_kw = "%KEYWORD%</span>{$headend}\n";
209 $entry_kw = "%KEYWORD%</span>{$headend}\n";
211 //var_dump($entry_body);
212 if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
213 $replying = '<a href="./entry.php?entry=' . $val->id . '&user=' . $val->user->id . '&keyword=' . rawurlencode($val->keyword) . '" class="replying">Re</a> ';
218 // var_dump($entry_body);
219 //公式モバイル版における各エントリへのリンク URL 生成
220 //$refer_link = $haiku_official_url . $val->user->id . '/' . $val->id;
221 $refer_link = "http://{$haiku_host}/" . $val->user->id . "/" . $val->id;
223 if (preg_match("/[0-2][0-9]:[0-9]{2}:[0-9]{2}/u", $val->keyword)){
224 $dating = date("Y-m-d H:i:s", $unix_time);
226 $day = date("Ymd", $unix_time);
227 $time = date("H:i", $unix_time);
228 $year = date("Y", $unix_time);
229 $today = date("Ymd");
232 $dating = date("Y-m-d", $unix_time).' '.$time;
233 } elseif ($day == $today){
235 } elseif ($day == $today-1){
236 $dating = '昨日 '.$time;
237 } elseif ($day == $today-2){
238 $dating = '一昨日 '.$time;
239 } elseif ($day <= $today-3 && $day >= $today-6){
240 $wdaynum = getdate($unix_time);
241 $wdaylabel = array('日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日');
242 $dating = $wdaylabel[$wdaynum['wday']].' '.$time;
244 $dating = date("Y-m-d", $unix_time).' '.$time;
247 $entry_body_a = explode("\n", $entry_body);
248 $entry_body_b = array();
249 foreach ($entry_body_a as $line){
250 if ($get_image != 'on'){
251 if (preg_match("/<a[^>]*href=\".+(youtube|ugomemo|nicovideo).+\"[^>]*><img/u", $line)){
252 $line = preg_replace("/<img[^>]*alt=\"([^>\"]*)\"[^>]*>/ui", "\${1}", $line);
255 $line = preg_replace("/<img[^>]*src=\"([^>\"]*)\"[^>]*>/uie", "parse_url('\\1', PHP_URL_HOST) . '(' . basename('\\1') . ')';", $line);
259 if (preg_match("/<a[^>]*href=\".+(youtube|ugomemo|nicovideo).+\"[^>]*><img/u", $line)){
260 $line = preg_replace("/<a[^>]*href=\"({$http_url_regexp})\"[^>]*>(<img[^>]*src=\")({$http_url_regexp})(\"[^>]*>)/ue", "'<a href=\"\\1\">\\2{$mobile_gateway_for_images}'.rawurlencode(rawurldecode('\\3')).'\\4';", $line);
261 } elseif (preg_match("/<a[^>]*href=\"({$http_url_regexp})\"[^>]*>(<img[^>]*src=\")({$http_url_regexp})(\"[^>]*>)/u", $line)){
262 $line = preg_replace("/<a[^>]*href=\"(http:{$http_path_regexp})\"[^>]*>(<img[^>]*src=\")({$http_url_regexp})(\"[^>]*>)/ue", "'<a href=\"{$mobile_gateway}'.rawurlencode(rawurldecode('\\3')).'\">\\2{$mobile_gateway_for_images}'.rawurlencode(rawurldecode('\\3')).'\\4';", $line);
264 // if (!preg_match("/<a[^>]*href=\"(http:\/\/d\.hatena\.(ne\.jp|com)\/keyword\/{$http_dir_regexp})\"[^>]*>([^<]+)<\/a>/ue", $line)){
265 if (mb_check_encoding(urldecode($line), 'UTF-8')){
266 $line = preg_replace("/<a[^>]*href=\"(http:{$http_path_regexp})\"[^>]*>([^<]+)<\/a>/ue", "'<a href=\"{$mobile_gateway}'.rawurlencode(rawurldecode('\\1')).'\">'.rawurldecode('\\2').'</a>';", $line);
269 $line = mb_ereg_replace('\\\("|\'|\\\)', "\\1", $line);
270 $entry_body_b[] = $line;
272 $entry_body = implode("\n", $entry_body_b);
274 // var_dump($entry_body);
276 if ($get_image == 'on'){
277 $entry_body = preg_replace("/(map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*)/u", "<a href=\"http://www.google.co.jp/m/local?site=local&q=\${2}%2C\${3}\" class=\"to-map\"><img src=\"http://maps.google.com/maps/api/staticmap?maptype=mobile&markers=\${2}%2C\${3}&sensor=false&size=140x140&zoom=13\" width=\"140\" height=\"140\" /></a><br />[ココ]<a href=\"http://c.hatena.ne.jp/s/nearby?lat=\${2}&lon=\${3}\" class=\"to-coco\">この地点の近くのスポット</a>", $entry_body);
279 $entry_body = preg_replace("/(map):(-*[[:digit:]]{1,3}\.*[[:digit:]]*):(-*[[:digit:]]{1,3}\.*[[:digit:]]*)/u", "<a href=\"http://www.google.co.jp/m/local?site=local&q=\${2}%2C\${3}\" class=\"to-map\">\${1}:\${2}:\${3}</a><br />[ココ]<a href=\"http://c.hatena.ne.jp/s/nearby?lat=\${2}&lon=\${3}\" class=\"to-coco\">この地点の近くのスポット</a>", $entry_body);
282 $echo = $echo . "<div class=\"entry\"";
283 if (!isset($eprocessor_sub_mode) || $eprocessor_sub_mode != 'presult'){
284 $echo = $echo . " id=\"{$val->id}\"";
288 if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
289 if (isset($starisjs) && $starisjs == '1'){
291 $echo = $echo . '<form method="post" action="';
292 $echo = $echo . './post.php';
293 // if ($device_who == 'android' && preg_match("/(1\.6)|(1\.5)/", $_SERVER['HTTP_USER_AGENT'])) $echo = $echo . $self_anchor_possibly_with_pagenum;
294 // if (isset($entry_processor_mode) && $entry_processor_mode != 'entry') $echo = $echo . '&reftime=-'.$first_time . ',0'. '#'.$val->id;
295 $echo = $echo . '" class="star-form">';
298 $echo = $echo . "<span class=\"entry-head\">";
299 if ($get_image == 'on' || (isset($show_icon) && $show_icon == 'yes')){
300 $echo = $echo . '<img src="' . $val->user->profile_image_url . '" width="16" height="16" class="user-icon" alt="" /> ';
304 if (!isset($val->keyword)){
305 $entry_body = ' ' . $add_star . $show_star . $entry_body;
307 if ($entries_mode == 'keyword_timeline'){
308 $entry_kw = $add_star . $show_star . '</span>' . $headend . "\n";
310 // if ($get_image == 'on'){
311 // $entry_kw = str_replace("%KEYWORD%","<a href=\"./entries.php?keyword=" . rawurlencode($val->keyword) . "&image=on\" class=\"keyword\">". htmlspecialchars($val->target->title, ENT_QUOTES) . "</a> {$add_star}{$show_star}",$entry_kw);
313 $entry_kw = str_replace("%KEYWORD%","<a href=\"./entries.php?keyword=" . rawurlencode($val->keyword) . "\" class=\"keyword\">". htmlspecialchars($val->target->title, ENT_QUOTES) . "</a> {$add_star}{$show_star}",$entry_kw);
317 if (preg_match('/^(id:{1}[a-zA-Z]{1}[-_a-zA-Z1234567890]{1,30}[a-zA-Z1234567890]{1})$/u',$val->keyword) >= 1){
318 // if ($get_image == 'on'){
319 // $entry_kw = "<a href=\"./entries.php?keyword=" . rawurlencode($val->keyword) . "&image=on\" class=\"keyword\">" . htmlspecialchars($val->target->word, ENT_QUOTES) . "</a> {$add_star}{$show_star}</span>{$headend}\n";
321 $entry_kw = "<a href=\"./entries.php?keyword=" . rawurlencode($val->keyword) . "\" class=\"keyword\">" . htmlspecialchars($val->target->word, ENT_QUOTES) . "</a> {$add_star}{$show_star}</span>{$headend}\n";
326 if ($val->in_reply_to_status_id != ''){
328 // if ($get_image == 'on'){
329 // $reply_to = "<span class=\"reply-to reply\"><a href=\"./entry.php?entry={$val->in_reply_to_status_id}&user={$val->in_reply_to_user_id}&keyword=" . rawurlencode($val->keyword) . "&image=on\" class=\"hatena-id\">[← " . $val->in_reply_to_user_id . " へ</a></span>";
331 $reply_to = "<span class=\"reply-to reply\"><a href=\"./entry.php?entry={$val->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 . " へ</a></span>";
333 if (mb_substr_count($entry_body, '<br />') < 1){
334 if (preg_match('/\[画像\(.+\)\]/u', $entry_body) || preg_match('/<img[^>]+\/>/u', $entry_body)){
335 $reply_to = $reply_to."<br />\n";
337 $reply_to = $reply_to.' ';
340 $reply_to = $reply_to."<br />\n";
342 $entry_body = $reply_to.$entry_body;
345 if (isset($reply_from)){
348 if (isset($in_reply)){
351 if (isset($val->replies[0]->id)){
353 foreach($val->replies as $replies){
354 // if ($get_image == 'on'){
355 // $in_reply = $in_reply . " <a href=\"./entry.php?entry={$replies->id}&user={$replies->user->id}&keyword=" . rawurlencode($val->keyword) . "&image=on\" class=\"hatena-id\">[← {$replies->user->id} から</a> ";
357 $in_reply = $in_reply . " <a href=\"./entry.php?entry={$replies->id}&user={$replies->user->id}&keyword=" . rawurlencode($val->keyword) . "\" class=\"hatena-id\">[← {$replies->user->id} から</a> ";
360 $reply_from = "<span class=\"reply-from reply\">{$in_reply}</span>";
365 // $entry_body = preg_replace("/(<a[^>]+>)([^<]+)(<\/a>)/ue", "'\\1'.urldecode('\\2').'\\3';", $entry_body);
366 // var_dump($entry_body);
367 $entry_body = mb_ereg_replace('\\\("|\'|\\\)', "\\1", $entry_body);
368 // var_dump($entry_body);
369 // $entry_body = $entry_body . "<br />\n";
370 $echo = $echo . "{$dating} ";
371 $echo = $echo . $entry_kw;
372 $echo = $echo . "<p class=\"entry-body\">\n";
373 $echo = $echo . $entry_body;
374 $echo = $echo . "</p>\n";
375 $echo = $echo . "<span class=\"dating\">";
376 $echo = $echo . "by <a href=\"./entries.php?user=";
377 $echo = $echo . $val->user->id;
378 // if ($get_image == 'on') $echo = $echo . "&image=on";
379 $echo = $echo . "\" class=\"hatena-id\" title=\"id:{$val->user->screen_name}\">";
380 $echo = $echo . htmlspecialchars($val->user->name, ENT_QUOTES);
381 $echo = $echo . '</a> ';
383 if ($entry_processor_mode == 'entry'){
384 $echo = $echo . 'from ' . $val->source . ' ';
386 $echo = $echo . "{$replying}{$reply_from} <a href=\"{$refer_link}\" class=\"to-original-link\"> † </a>";
387 $echo = $echo . '</span>';
388 if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
389 if (isset($starisjs) && $starisjs == '1'){
391 $echo = $echo . "</form>";
394 $echo = $echo . "</div><hr />\n";