質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,514 +10,512 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
|
13
|
+
<? require_once('http://abc.jp/common/sp/blogrss.php?u=http://abc.jp/news/?feed=rss2&n=1&o=D/T/S&w=0&tc=0&ec=100&f=01'); ?>
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
「blogrss.php」
|
18
|
+
|
19
|
+
```<?php
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
/*------------------------------------------------------------------------
|
24
|
+
|
25
|
+
名称 :ブログRSS情報取得(blogrss.php)
|
26
|
+
|
27
|
+
説明 :ブログRSS情報を取得し、整形出力する。
|
28
|
+
|
29
|
+
: ※1 RSS1.0/RSS2.0 対応
|
30
|
+
|
31
|
+
:
|
32
|
+
|
33
|
+
パラメータ :$u RSSフィードURL(設定時、環境設定より優先)
|
34
|
+
|
35
|
+
:$n 表示記事数(0の場合、すべて表示)
|
36
|
+
|
37
|
+
:$o 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
38
|
+
|
39
|
+
:$w ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
40
|
+
|
41
|
+
:$bc ブログ名称表示文字数(0の場合、すべて表示)
|
42
|
+
|
43
|
+
:$tc タイトル表示文字数(0の場合、すべて表示)
|
44
|
+
|
45
|
+
:$ec 記事内容表示文字数(0の場合、すべて表示)
|
46
|
+
|
47
|
+
:$f 環境設定ファイル(config_XX.phpのXXを指定)
|
48
|
+
|
49
|
+
:
|
50
|
+
|
51
|
+
履歴 :2008/03/19 新規作成
|
52
|
+
|
53
|
+
:2008/10/15 修正(環境設定ファイルパラメータ/複数ブログ複数記事読込み)
|
54
|
+
|
55
|
+
:
|
56
|
+
|
57
|
+
------------------------------------------------------------------------*/
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
/*------------------------------------------------------------------------
|
64
|
+
|
65
|
+
パラメータ取得
|
66
|
+
|
67
|
+
------------------------------------------------------------------------*/
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
// RSSフィードURL
|
72
|
+
|
73
|
+
$inRss_url = $_GET['u'];
|
74
|
+
|
75
|
+
// SereneBach-カテゴリ別RSSフィードURL対応
|
76
|
+
|
77
|
+
if ($_GET['cid']) {
|
78
|
+
|
79
|
+
$inRss_url .= '&cid=' . $_GET['cid'];
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
// 表示記事数(0の場合、すべて表示)
|
86
|
+
|
87
|
+
$inNum = $_GET['n'];
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
// 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
92
|
+
|
93
|
+
$inOutData = $_GET['o'];
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
98
|
+
|
99
|
+
$inWindowSize = $_GET['0'];
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
// ブログ名称表示文字数(0の場合、すべて表示)
|
104
|
+
|
105
|
+
$inBlogNmCharCount = $_GET['bc'];
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
// タイトル表示文字数(0の場合、すべて表示)
|
110
|
+
|
111
|
+
$inTitleCharCount = $_GET['tc'];
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
// 記事内容表示文字数(0の場合、すべて表示)
|
116
|
+
|
117
|
+
$inEntryCharCount = $_GET['ec'];
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
// RSS設定読込み
|
122
|
+
|
123
|
+
require_once("./Lib/RSS.php");
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
// 環境設定読込み
|
128
|
+
|
129
|
+
$inConfigId = $_GET['f'];
|
130
|
+
|
131
|
+
if (!empty($inConfigId)) {
|
132
|
+
|
133
|
+
$inConfigFile = './config_' . $inConfigId . '.php';
|
134
|
+
|
135
|
+
} else {
|
136
|
+
|
137
|
+
$inConfigFile = './config_01.php';
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
require_once($inConfigFile);
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
/*------------------------------------------------------------------------
|
148
|
+
|
149
|
+
関数
|
150
|
+
|
151
|
+
------------------------------------------------------------------------*/
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
// 日付ソート
|
156
|
+
|
157
|
+
function cmp ($a, $b) {
|
158
|
+
|
159
|
+
$a = (isset($a['pubdate'])) ? strtotime($a['pubdate']) : strtotime(str_replace("T", " ", substr($a['dc:date'], 0, 19)));
|
160
|
+
|
161
|
+
$b = (isset($b['pubdate'])) ? strtotime($b['pubdate']) : strtotime(str_replace("T", " ", substr($b['dc:date'], 0, 19)));
|
162
|
+
|
163
|
+
if ($a == $b) return 0;
|
164
|
+
|
165
|
+
return ($a > $b) ? -1 : 1;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
/*------------------------------------------------------------------------
|
174
|
+
|
175
|
+
処理
|
176
|
+
|
177
|
+
------------------------------------------------------------------------*/
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
// パラメータ(RSSフィードURL)に値がある場合、優先する
|
182
|
+
|
183
|
+
if (!empty($inRss_url)) {
|
184
|
+
|
185
|
+
$RSS_URL = array();
|
186
|
+
|
187
|
+
$RSS_URL[] = $inRss_url;
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
// RSSフィードURL数取得(0:単一 1:複数)
|
194
|
+
|
195
|
+
if( count($RSS_URL) > 1 ) {
|
196
|
+
|
197
|
+
$rss_Flg = 1;
|
198
|
+
|
199
|
+
} else {
|
200
|
+
|
201
|
+
$rss_Flg = 0;
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
// RSS取得・解析
|
208
|
+
|
209
|
+
$ch = array();
|
210
|
+
|
211
|
+
$items = array();
|
212
|
+
|
213
|
+
$Rss_Count = 0;
|
214
|
+
|
215
|
+
foreach ($RSS_URL as $k=>$url) {
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
$r =& new XML_RSS($url);
|
220
|
+
|
221
|
+
if (PEAR::isError($r)) continue;
|
222
|
+
|
223
|
+
$r->parse();
|
224
|
+
|
225
|
+
if ($r->getChannelInfo()) $ch[$k] = $r->getChannelInfo();
|
226
|
+
|
227
|
+
$ch[$k]['items'] = $r->getItems();
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
// RSS操作
|
232
|
+
|
233
|
+
if (( $rss_Flg == 0 ) || ( $RSS_TYPE == 1 )) {
|
234
|
+
|
235
|
+
$items = array_merge($items, $ch[$k]['items']);
|
236
|
+
|
237
|
+
} else {
|
238
|
+
|
239
|
+
$items = array_merge($items, array_slice($ch[$k]['items'], 0, 1));
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
for ($j=$Rss_Count; $j<count($items); $j++) {
|
244
|
+
|
245
|
+
$items[$j]['btitle'] = $ch[$k]['title'];
|
246
|
+
|
247
|
+
$items[$j]['bdescription'] = $ch[$k]['description'];
|
248
|
+
|
249
|
+
$items[$j]['blink'] = $ch[$k]['link'];
|
250
|
+
|
251
|
+
$Rss_Count = $Rss_Count + 1;
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
// 日付ソート・記事数取得
|
262
|
+
|
263
|
+
$entry_Count = count($items);
|
264
|
+
|
265
|
+
if( $rss_Flg == 1 ) {
|
266
|
+
|
267
|
+
usort($items, "cmp");
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
// マーク画像タグ設定
|
274
|
+
|
275
|
+
if( $MARKIMG != "" ) {
|
276
|
+
|
277
|
+
$markimg_Tag = '<img src="' . $MARKIMG . '" class="rss_markimg">';
|
278
|
+
|
279
|
+
} else {
|
280
|
+
|
281
|
+
$markimg_Tag = "";
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
// 出力データ設定(全体)-Start
|
288
|
+
|
289
|
+
$str = "\n" . '<div class="blogrss_data">' . "\n";
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
for ($i=0; $i<$inNum; $i++) {
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
// ブログ名称
|
298
|
+
|
299
|
+
$v = strip_tags($items[$i]['btitle']);
|
300
|
+
|
301
|
+
$blog_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
302
|
+
|
303
|
+
if(( mb_strlen($blog_Title, $CODE) > $inBlogNmCharCount ) && ( $inBlogNmCharCount != 0 )) {
|
304
|
+
|
305
|
+
$blog_Title = mb_substr($blog_Title, 0, $inBlogNmCharCount, $CODE);
|
306
|
+
|
307
|
+
$blog_Title .= "...";
|
308
|
+
|
309
|
+
}
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
// ブログ説明
|
314
|
+
|
315
|
+
$v = strip_tags($items[$i]['bdescription']);
|
316
|
+
|
317
|
+
$blog_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
// ブログURL
|
322
|
+
|
323
|
+
$blog_Url = htmlspecialchars($items[$i]['blink']);
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
// 記事タイトル
|
328
|
+
|
329
|
+
$v = strip_tags($items[$i]['title']);
|
330
|
+
|
331
|
+
$entry_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
332
|
+
|
333
|
+
if(( mb_strlen($entry_Title, $CODE) > $inTitleCharCount ) && ( $inTitleCharCount != 0 )) {
|
334
|
+
|
335
|
+
$entry_Title = mb_substr($entry_Title, 0, $inTitleCharCount, $CODE);
|
336
|
+
|
337
|
+
$entry_Title .= "...";
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
// 記事内容
|
344
|
+
|
345
|
+
$v = strip_tags($items[$i]['description']);
|
346
|
+
|
347
|
+
$entry_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
348
|
+
|
349
|
+
$delList = array(" ", " ", "\n",);
|
350
|
+
|
351
|
+
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
352
|
+
|
353
|
+
if(( mb_strlen($entry_Desc, $CODE) > $inEntryCharCount ) && ( $inEntryCharCount != 0 )) {
|
354
|
+
|
355
|
+
$delList = array("...");
|
356
|
+
|
357
|
+
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
358
|
+
|
359
|
+
$entry_Desc = mb_substr($entry_Desc, 0, $inEntryCharCount, $CODE);
|
360
|
+
|
361
|
+
$entry_Desc .= "...";
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
// 記事URL
|
368
|
+
|
369
|
+
$entry_Url = htmlspecialchars($items[$i]['link']);
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
// 記事投稿日
|
374
|
+
|
375
|
+
$v = (isset($items[$i]['pubdate'])) ? strtotime($items[$i]['pubdate']) : strtotime(str_replace("T", " ", substr($items[$i]['dc:date'], 0, 19)));
|
376
|
+
|
377
|
+
$entry_Chk_Date = date("Ymd", $v);
|
378
|
+
|
379
|
+
$entry_Date = date($DATETYPE, $v);
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
// NEW画像タグ設定
|
384
|
+
|
385
|
+
if(( $VISDAY <= $entry_Chk_Date ) && ( $NEWVISPERIOD != "" ) && ( $NEWIMG != "" )) {
|
386
|
+
|
387
|
+
$newimg_Tag = '<img src="' . $NEWIMG . '" class="rss_newimg">';
|
388
|
+
|
389
|
+
} else {
|
390
|
+
|
391
|
+
$newimg_Tag = "";
|
392
|
+
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
// ウインドウサイズ設定
|
398
|
+
|
399
|
+
if( $inWindowSize == 0 ) {
|
400
|
+
|
401
|
+
$windowsize1_Tag = "";
|
402
|
+
|
403
|
+
$windowsize2_Tag = "";
|
404
|
+
|
405
|
+
} else {
|
406
|
+
|
407
|
+
$matches = explode( "/", $inWindowSize );
|
408
|
+
|
409
|
+
$windowsize1_Tag = "target=\"_blank\" ";
|
410
|
+
|
411
|
+
$windowsize2_Tag = "target=\"_blank\" onclick=\"window.open('" . $blog_Url . "', '', 'width=" . $matches[0] . ",height=" . $matches[1] . ",scrollbars=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,location=yes,resizable=yes');return false;\"";
|
412
|
+
|
413
|
+
}
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
// 記事数が表示記事数に満たない場合
|
418
|
+
|
419
|
+
if( $entry_Count > $i ) {
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
// 出力データ設定(アイテム)-Start
|
424
|
+
|
425
|
+
$str .= '<div class="rss_items">' . "\n";
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
// 出力データ設定1(D:記事投稿日 T:記事タイトル)
|
430
|
+
|
431
|
+
$str .= '<div class="rss_items_box">' . "\n" . $markimg_Tag . "\n";
|
432
|
+
|
433
|
+
$matches = explode( "/", $inOutData );
|
434
|
+
|
435
|
+
foreach( $matches as $entry_Data ) {
|
436
|
+
|
437
|
+
switch( $entry_Data ) {
|
438
|
+
|
439
|
+
case "D":
|
440
|
+
|
441
|
+
$str .= '<div class="rss_items_date">' . $entry_Date . '</div>' . "\n";
|
442
|
+
|
443
|
+
break;
|
444
|
+
|
445
|
+
case "T":
|
446
|
+
|
447
|
+
if (( $rss_Flg == 1 ) && ( $VISBLOG == 1 )) {
|
448
|
+
|
449
|
+
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2><p class="rss_blog_title"> - <a href="' . $blog_Url . '" title="' . $blog_Desc . '" ' . $windowsize2_Tag . ' >' . $blog_Title . '</a></p>'. $newimg_Tag . "\n";
|
450
|
+
|
451
|
+
} else {
|
452
|
+
|
453
|
+
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2>'. $newimg_Tag . "\n";
|
454
|
+
|
455
|
+
}
|
456
|
+
|
457
|
+
break;
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
}
|
462
|
+
|
463
|
+
$str .= '</div>' . "\n";
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
// 出力データ設定2(S:記事内容)
|
468
|
+
|
469
|
+
$matches = explode( "/", $inOutData );
|
470
|
+
|
471
|
+
foreach( $matches as $entry_Data ) {
|
472
|
+
|
473
|
+
switch( $entry_Data ) {
|
474
|
+
|
475
|
+
case "S":
|
476
|
+
|
477
|
+
$str .= '<p class="rss_items_desc">' . $entry_Desc . '</p>' . "\n";
|
478
|
+
|
479
|
+
break;
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
// 出力データ設定(アイテム)-End
|
490
|
+
|
491
|
+
$str .= '</div>' . "\n";
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
}
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
}
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
// 出力データ設定(全体)-End
|
504
|
+
|
505
|
+
$str .= '</div>' . "\n";
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
// データ出力
|
510
|
+
|
511
|
+
echo mb_convert_encoding($str, $CODE, "UTF-8,EUC-JP,SJIS");
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
?>
|
518
|
+
|
519
|
+
|
14
520
|
|
15
521
|
```
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
「blogrss.php」
|
20
|
-
|
21
|
-
```<?php
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
/*------------------------------------------------------------------------
|
26
|
-
|
27
|
-
名称 :ブログRSS情報取得(blogrss.php)
|
28
|
-
|
29
|
-
説明 :ブログRSS情報を取得し、整形出力する。
|
30
|
-
|
31
|
-
: ※1 RSS1.0/RSS2.0 対応
|
32
|
-
|
33
|
-
:
|
34
|
-
|
35
|
-
パラメータ :$u RSSフィードURL(設定時、環境設定より優先)
|
36
|
-
|
37
|
-
:$n 表示記事数(0の場合、すべて表示)
|
38
|
-
|
39
|
-
:$o 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
40
|
-
|
41
|
-
:$w ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
42
|
-
|
43
|
-
:$bc ブログ名称表示文字数(0の場合、すべて表示)
|
44
|
-
|
45
|
-
:$tc タイトル表示文字数(0の場合、すべて表示)
|
46
|
-
|
47
|
-
:$ec 記事内容表示文字数(0の場合、すべて表示)
|
48
|
-
|
49
|
-
:$f 環境設定ファイル(config_XX.phpのXXを指定)
|
50
|
-
|
51
|
-
:
|
52
|
-
|
53
|
-
履歴 :2008/03/19 新規作成
|
54
|
-
|
55
|
-
:2008/10/15 修正(環境設定ファイルパラメータ/複数ブログ複数記事読込み)
|
56
|
-
|
57
|
-
:
|
58
|
-
|
59
|
-
------------------------------------------------------------------------*/
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
/*------------------------------------------------------------------------
|
66
|
-
|
67
|
-
パラメータ取得
|
68
|
-
|
69
|
-
------------------------------------------------------------------------*/
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
// RSSフィードURL
|
74
|
-
|
75
|
-
$inRss_url = $_GET['u'];
|
76
|
-
|
77
|
-
// SereneBach-カテゴリ別RSSフィードURL対応
|
78
|
-
|
79
|
-
if ($_GET['cid']) {
|
80
|
-
|
81
|
-
$inRss_url .= '&cid=' . $_GET['cid'];
|
82
|
-
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
// 表示記事数(0の場合、すべて表示)
|
88
|
-
|
89
|
-
$inNum = $_GET['n'];
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
// 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
94
|
-
|
95
|
-
$inOutData = $_GET['o'];
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
// ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
100
|
-
|
101
|
-
$inWindowSize = $_GET['0'];
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
// ブログ名称表示文字数(0の場合、すべて表示)
|
106
|
-
|
107
|
-
$inBlogNmCharCount = $_GET['bc'];
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
// タイトル表示文字数(0の場合、すべて表示)
|
112
|
-
|
113
|
-
$inTitleCharCount = $_GET['tc'];
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
// 記事内容表示文字数(0の場合、すべて表示)
|
118
|
-
|
119
|
-
$inEntryCharCount = $_GET['ec'];
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
// RSS設定読込み
|
124
|
-
|
125
|
-
require_once("./Lib/RSS.php");
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
// 環境設定読込み
|
130
|
-
|
131
|
-
$inConfigId = $_GET['f'];
|
132
|
-
|
133
|
-
if (!empty($inConfigId)) {
|
134
|
-
|
135
|
-
$inConfigFile = './config_' . $inConfigId . '.php';
|
136
|
-
|
137
|
-
} else {
|
138
|
-
|
139
|
-
$inConfigFile = './config_01.php';
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
require_once($inConfigFile);
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
/*------------------------------------------------------------------------
|
150
|
-
|
151
|
-
関数
|
152
|
-
|
153
|
-
------------------------------------------------------------------------*/
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
// 日付ソート
|
158
|
-
|
159
|
-
function cmp ($a, $b) {
|
160
|
-
|
161
|
-
$a = (isset($a['pubdate'])) ? strtotime($a['pubdate']) : strtotime(str_replace("T", " ", substr($a['dc:date'], 0, 19)));
|
162
|
-
|
163
|
-
$b = (isset($b['pubdate'])) ? strtotime($b['pubdate']) : strtotime(str_replace("T", " ", substr($b['dc:date'], 0, 19)));
|
164
|
-
|
165
|
-
if ($a == $b) return 0;
|
166
|
-
|
167
|
-
return ($a > $b) ? -1 : 1;
|
168
|
-
|
169
|
-
}
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
/*------------------------------------------------------------------------
|
176
|
-
|
177
|
-
処理
|
178
|
-
|
179
|
-
------------------------------------------------------------------------*/
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
// パラメータ(RSSフィードURL)に値がある場合、優先する
|
184
|
-
|
185
|
-
if (!empty($inRss_url)) {
|
186
|
-
|
187
|
-
$RSS_URL = array();
|
188
|
-
|
189
|
-
$RSS_URL[] = $inRss_url;
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
// RSSフィードURL数取得(0:単一 1:複数)
|
196
|
-
|
197
|
-
if( count($RSS_URL) > 1 ) {
|
198
|
-
|
199
|
-
$rss_Flg = 1;
|
200
|
-
|
201
|
-
} else {
|
202
|
-
|
203
|
-
$rss_Flg = 0;
|
204
|
-
|
205
|
-
}
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
// RSS取得・解析
|
210
|
-
|
211
|
-
$ch = array();
|
212
|
-
|
213
|
-
$items = array();
|
214
|
-
|
215
|
-
$Rss_Count = 0;
|
216
|
-
|
217
|
-
foreach ($RSS_URL as $k=>$url) {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
$r =& new XML_RSS($url);
|
222
|
-
|
223
|
-
if (PEAR::isError($r)) continue;
|
224
|
-
|
225
|
-
$r->parse();
|
226
|
-
|
227
|
-
if ($r->getChannelInfo()) $ch[$k] = $r->getChannelInfo();
|
228
|
-
|
229
|
-
$ch[$k]['items'] = $r->getItems();
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
// RSS操作
|
234
|
-
|
235
|
-
if (( $rss_Flg == 0 ) || ( $RSS_TYPE == 1 )) {
|
236
|
-
|
237
|
-
$items = array_merge($items, $ch[$k]['items']);
|
238
|
-
|
239
|
-
} else {
|
240
|
-
|
241
|
-
$items = array_merge($items, array_slice($ch[$k]['items'], 0, 1));
|
242
|
-
|
243
|
-
}
|
244
|
-
|
245
|
-
for ($j=$Rss_Count; $j<count($items); $j++) {
|
246
|
-
|
247
|
-
$items[$j]['btitle'] = $ch[$k]['title'];
|
248
|
-
|
249
|
-
$items[$j]['bdescription'] = $ch[$k]['description'];
|
250
|
-
|
251
|
-
$items[$j]['blink'] = $ch[$k]['link'];
|
252
|
-
|
253
|
-
$Rss_Count = $Rss_Count + 1;
|
254
|
-
|
255
|
-
}
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
}
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
// 日付ソート・記事数取得
|
264
|
-
|
265
|
-
$entry_Count = count($items);
|
266
|
-
|
267
|
-
if( $rss_Flg == 1 ) {
|
268
|
-
|
269
|
-
usort($items, "cmp");
|
270
|
-
|
271
|
-
}
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
// マーク画像タグ設定
|
276
|
-
|
277
|
-
if( $MARKIMG != "" ) {
|
278
|
-
|
279
|
-
$markimg_Tag = '<img src="' . $MARKIMG . '" class="rss_markimg">';
|
280
|
-
|
281
|
-
} else {
|
282
|
-
|
283
|
-
$markimg_Tag = "";
|
284
|
-
|
285
|
-
}
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
// 出力データ設定(全体)-Start
|
290
|
-
|
291
|
-
$str = "\n" . '<div class="blogrss_data">' . "\n";
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
for ($i=0; $i<$inNum; $i++) {
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
// ブログ名称
|
300
|
-
|
301
|
-
$v = strip_tags($items[$i]['btitle']);
|
302
|
-
|
303
|
-
$blog_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
304
|
-
|
305
|
-
if(( mb_strlen($blog_Title, $CODE) > $inBlogNmCharCount ) && ( $inBlogNmCharCount != 0 )) {
|
306
|
-
|
307
|
-
$blog_Title = mb_substr($blog_Title, 0, $inBlogNmCharCount, $CODE);
|
308
|
-
|
309
|
-
$blog_Title .= "...";
|
310
|
-
|
311
|
-
}
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
// ブログ説明
|
316
|
-
|
317
|
-
$v = strip_tags($items[$i]['bdescription']);
|
318
|
-
|
319
|
-
$blog_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
// ブログURL
|
324
|
-
|
325
|
-
$blog_Url = htmlspecialchars($items[$i]['blink']);
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
// 記事タイトル
|
330
|
-
|
331
|
-
$v = strip_tags($items[$i]['title']);
|
332
|
-
|
333
|
-
$entry_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
334
|
-
|
335
|
-
if(( mb_strlen($entry_Title, $CODE) > $inTitleCharCount ) && ( $inTitleCharCount != 0 )) {
|
336
|
-
|
337
|
-
$entry_Title = mb_substr($entry_Title, 0, $inTitleCharCount, $CODE);
|
338
|
-
|
339
|
-
$entry_Title .= "...";
|
340
|
-
|
341
|
-
}
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
// 記事内容
|
346
|
-
|
347
|
-
$v = strip_tags($items[$i]['description']);
|
348
|
-
|
349
|
-
$entry_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
350
|
-
|
351
|
-
$delList = array(" ", " ", "\n",);
|
352
|
-
|
353
|
-
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
354
|
-
|
355
|
-
if(( mb_strlen($entry_Desc, $CODE) > $inEntryCharCount ) && ( $inEntryCharCount != 0 )) {
|
356
|
-
|
357
|
-
$delList = array("...");
|
358
|
-
|
359
|
-
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
360
|
-
|
361
|
-
$entry_Desc = mb_substr($entry_Desc, 0, $inEntryCharCount, $CODE);
|
362
|
-
|
363
|
-
$entry_Desc .= "...";
|
364
|
-
|
365
|
-
}
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
// 記事URL
|
370
|
-
|
371
|
-
$entry_Url = htmlspecialchars($items[$i]['link']);
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
// 記事投稿日
|
376
|
-
|
377
|
-
$v = (isset($items[$i]['pubdate'])) ? strtotime($items[$i]['pubdate']) : strtotime(str_replace("T", " ", substr($items[$i]['dc:date'], 0, 19)));
|
378
|
-
|
379
|
-
$entry_Chk_Date = date("Ymd", $v);
|
380
|
-
|
381
|
-
$entry_Date = date($DATETYPE, $v);
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
// NEW画像タグ設定
|
386
|
-
|
387
|
-
if(( $VISDAY <= $entry_Chk_Date ) && ( $NEWVISPERIOD != "" ) && ( $NEWIMG != "" )) {
|
388
|
-
|
389
|
-
$newimg_Tag = '<img src="' . $NEWIMG . '" class="rss_newimg">';
|
390
|
-
|
391
|
-
} else {
|
392
|
-
|
393
|
-
$newimg_Tag = "";
|
394
|
-
|
395
|
-
}
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
// ウインドウサイズ設定
|
400
|
-
|
401
|
-
if( $inWindowSize == 0 ) {
|
402
|
-
|
403
|
-
$windowsize1_Tag = "";
|
404
|
-
|
405
|
-
$windowsize2_Tag = "";
|
406
|
-
|
407
|
-
} else {
|
408
|
-
|
409
|
-
$matches = explode( "/", $inWindowSize );
|
410
|
-
|
411
|
-
$windowsize1_Tag = "target=\"_blank\" ";
|
412
|
-
|
413
|
-
$windowsize2_Tag = "target=\"_blank\" onclick=\"window.open('" . $blog_Url . "', '', 'width=" . $matches[0] . ",height=" . $matches[1] . ",scrollbars=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,location=yes,resizable=yes');return false;\"";
|
414
|
-
|
415
|
-
}
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
// 記事数が表示記事数に満たない場合
|
420
|
-
|
421
|
-
if( $entry_Count > $i ) {
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
// 出力データ設定(アイテム)-Start
|
426
|
-
|
427
|
-
$str .= '<div class="rss_items">' . "\n";
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
// 出力データ設定1(D:記事投稿日 T:記事タイトル)
|
432
|
-
|
433
|
-
$str .= '<div class="rss_items_box">' . "\n" . $markimg_Tag . "\n";
|
434
|
-
|
435
|
-
$matches = explode( "/", $inOutData );
|
436
|
-
|
437
|
-
foreach( $matches as $entry_Data ) {
|
438
|
-
|
439
|
-
switch( $entry_Data ) {
|
440
|
-
|
441
|
-
case "D":
|
442
|
-
|
443
|
-
$str .= '<div class="rss_items_date">' . $entry_Date . '</div>' . "\n";
|
444
|
-
|
445
|
-
break;
|
446
|
-
|
447
|
-
case "T":
|
448
|
-
|
449
|
-
if (( $rss_Flg == 1 ) && ( $VISBLOG == 1 )) {
|
450
|
-
|
451
|
-
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2><p class="rss_blog_title"> - <a href="' . $blog_Url . '" title="' . $blog_Desc . '" ' . $windowsize2_Tag . ' >' . $blog_Title . '</a></p>'. $newimg_Tag . "\n";
|
452
|
-
|
453
|
-
} else {
|
454
|
-
|
455
|
-
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2>'. $newimg_Tag . "\n";
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
break;
|
460
|
-
|
461
|
-
}
|
462
|
-
|
463
|
-
}
|
464
|
-
|
465
|
-
$str .= '</div>' . "\n";
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
// 出力データ設定2(S:記事内容)
|
470
|
-
|
471
|
-
$matches = explode( "/", $inOutData );
|
472
|
-
|
473
|
-
foreach( $matches as $entry_Data ) {
|
474
|
-
|
475
|
-
switch( $entry_Data ) {
|
476
|
-
|
477
|
-
case "S":
|
478
|
-
|
479
|
-
$str .= '<p class="rss_items_desc">' . $entry_Desc . '</p>' . "\n";
|
480
|
-
|
481
|
-
break;
|
482
|
-
|
483
|
-
}
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
}
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
// 出力データ設定(アイテム)-End
|
492
|
-
|
493
|
-
$str .= '</div>' . "\n";
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
}
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
}
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
// 出力データ設定(全体)-End
|
506
|
-
|
507
|
-
$str .= '</div>' . "\n";
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
// データ出力
|
512
|
-
|
513
|
-
echo mb_convert_encoding($str, $CODE, "UTF-8,EUC-JP,SJIS");
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
?>
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
```
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,7 +10,9 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
<? require_once('http://abc.jp/common/sp/blogrss.php?u=http://abc.jp/news/?feed=rss2&n=1&o=D/T/S&w=0&tc=0&ec=100&f=01'); ?>
|
13
|
+
```<? require_once('http://abc.jp/common/sp/blogrss.php?u=http://abc.jp/news/?feed=rss2&n=1&o=D/T/S&w=0&tc=0&ec=100&f=01'); ?>
|
14
|
+
|
15
|
+
```
|
14
16
|
|
15
17
|
|
16
18
|
|
@@ -518,6 +520,4 @@
|
|
518
520
|
|
519
521
|
|
520
522
|
|
521
|
-
コード
|
522
|
-
|
523
523
|
```
|
1
情報の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,3 +11,513 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
<? require_once('http://abc.jp/common/sp/blogrss.php?u=http://abc.jp/news/?feed=rss2&n=1&o=D/T/S&w=0&tc=0&ec=100&f=01'); ?>
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
「blogrss.php」
|
18
|
+
|
19
|
+
```<?php
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
/*------------------------------------------------------------------------
|
24
|
+
|
25
|
+
名称 :ブログRSS情報取得(blogrss.php)
|
26
|
+
|
27
|
+
説明 :ブログRSS情報を取得し、整形出力する。
|
28
|
+
|
29
|
+
: ※1 RSS1.0/RSS2.0 対応
|
30
|
+
|
31
|
+
:
|
32
|
+
|
33
|
+
パラメータ :$u RSSフィードURL(設定時、環境設定より優先)
|
34
|
+
|
35
|
+
:$n 表示記事数(0の場合、すべて表示)
|
36
|
+
|
37
|
+
:$o 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
38
|
+
|
39
|
+
:$w ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
40
|
+
|
41
|
+
:$bc ブログ名称表示文字数(0の場合、すべて表示)
|
42
|
+
|
43
|
+
:$tc タイトル表示文字数(0の場合、すべて表示)
|
44
|
+
|
45
|
+
:$ec 記事内容表示文字数(0の場合、すべて表示)
|
46
|
+
|
47
|
+
:$f 環境設定ファイル(config_XX.phpのXXを指定)
|
48
|
+
|
49
|
+
:
|
50
|
+
|
51
|
+
履歴 :2008/03/19 新規作成
|
52
|
+
|
53
|
+
:2008/10/15 修正(環境設定ファイルパラメータ/複数ブログ複数記事読込み)
|
54
|
+
|
55
|
+
:
|
56
|
+
|
57
|
+
------------------------------------------------------------------------*/
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
/*------------------------------------------------------------------------
|
64
|
+
|
65
|
+
パラメータ取得
|
66
|
+
|
67
|
+
------------------------------------------------------------------------*/
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
// RSSフィードURL
|
72
|
+
|
73
|
+
$inRss_url = $_GET['u'];
|
74
|
+
|
75
|
+
// SereneBach-カテゴリ別RSSフィードURL対応
|
76
|
+
|
77
|
+
if ($_GET['cid']) {
|
78
|
+
|
79
|
+
$inRss_url .= '&cid=' . $_GET['cid'];
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
// 表示記事数(0の場合、すべて表示)
|
86
|
+
|
87
|
+
$inNum = $_GET['n'];
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
// 出力データ[D/T/S](D:記事投稿日 T:記事タイトル S:記事内容)
|
92
|
+
|
93
|
+
$inOutData = $_GET['o'];
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// ウインドウサイズ[横/縦](0の場合、親ウインドウに表示)
|
98
|
+
|
99
|
+
$inWindowSize = $_GET['0'];
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
// ブログ名称表示文字数(0の場合、すべて表示)
|
104
|
+
|
105
|
+
$inBlogNmCharCount = $_GET['bc'];
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
// タイトル表示文字数(0の場合、すべて表示)
|
110
|
+
|
111
|
+
$inTitleCharCount = $_GET['tc'];
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
// 記事内容表示文字数(0の場合、すべて表示)
|
116
|
+
|
117
|
+
$inEntryCharCount = $_GET['ec'];
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
// RSS設定読込み
|
122
|
+
|
123
|
+
require_once("./Lib/RSS.php");
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
// 環境設定読込み
|
128
|
+
|
129
|
+
$inConfigId = $_GET['f'];
|
130
|
+
|
131
|
+
if (!empty($inConfigId)) {
|
132
|
+
|
133
|
+
$inConfigFile = './config_' . $inConfigId . '.php';
|
134
|
+
|
135
|
+
} else {
|
136
|
+
|
137
|
+
$inConfigFile = './config_01.php';
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
require_once($inConfigFile);
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
/*------------------------------------------------------------------------
|
148
|
+
|
149
|
+
関数
|
150
|
+
|
151
|
+
------------------------------------------------------------------------*/
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
// 日付ソート
|
156
|
+
|
157
|
+
function cmp ($a, $b) {
|
158
|
+
|
159
|
+
$a = (isset($a['pubdate'])) ? strtotime($a['pubdate']) : strtotime(str_replace("T", " ", substr($a['dc:date'], 0, 19)));
|
160
|
+
|
161
|
+
$b = (isset($b['pubdate'])) ? strtotime($b['pubdate']) : strtotime(str_replace("T", " ", substr($b['dc:date'], 0, 19)));
|
162
|
+
|
163
|
+
if ($a == $b) return 0;
|
164
|
+
|
165
|
+
return ($a > $b) ? -1 : 1;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
/*------------------------------------------------------------------------
|
174
|
+
|
175
|
+
処理
|
176
|
+
|
177
|
+
------------------------------------------------------------------------*/
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
// パラメータ(RSSフィードURL)に値がある場合、優先する
|
182
|
+
|
183
|
+
if (!empty($inRss_url)) {
|
184
|
+
|
185
|
+
$RSS_URL = array();
|
186
|
+
|
187
|
+
$RSS_URL[] = $inRss_url;
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
// RSSフィードURL数取得(0:単一 1:複数)
|
194
|
+
|
195
|
+
if( count($RSS_URL) > 1 ) {
|
196
|
+
|
197
|
+
$rss_Flg = 1;
|
198
|
+
|
199
|
+
} else {
|
200
|
+
|
201
|
+
$rss_Flg = 0;
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
// RSS取得・解析
|
208
|
+
|
209
|
+
$ch = array();
|
210
|
+
|
211
|
+
$items = array();
|
212
|
+
|
213
|
+
$Rss_Count = 0;
|
214
|
+
|
215
|
+
foreach ($RSS_URL as $k=>$url) {
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
$r =& new XML_RSS($url);
|
220
|
+
|
221
|
+
if (PEAR::isError($r)) continue;
|
222
|
+
|
223
|
+
$r->parse();
|
224
|
+
|
225
|
+
if ($r->getChannelInfo()) $ch[$k] = $r->getChannelInfo();
|
226
|
+
|
227
|
+
$ch[$k]['items'] = $r->getItems();
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
// RSS操作
|
232
|
+
|
233
|
+
if (( $rss_Flg == 0 ) || ( $RSS_TYPE == 1 )) {
|
234
|
+
|
235
|
+
$items = array_merge($items, $ch[$k]['items']);
|
236
|
+
|
237
|
+
} else {
|
238
|
+
|
239
|
+
$items = array_merge($items, array_slice($ch[$k]['items'], 0, 1));
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
for ($j=$Rss_Count; $j<count($items); $j++) {
|
244
|
+
|
245
|
+
$items[$j]['btitle'] = $ch[$k]['title'];
|
246
|
+
|
247
|
+
$items[$j]['bdescription'] = $ch[$k]['description'];
|
248
|
+
|
249
|
+
$items[$j]['blink'] = $ch[$k]['link'];
|
250
|
+
|
251
|
+
$Rss_Count = $Rss_Count + 1;
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
// 日付ソート・記事数取得
|
262
|
+
|
263
|
+
$entry_Count = count($items);
|
264
|
+
|
265
|
+
if( $rss_Flg == 1 ) {
|
266
|
+
|
267
|
+
usort($items, "cmp");
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
// マーク画像タグ設定
|
274
|
+
|
275
|
+
if( $MARKIMG != "" ) {
|
276
|
+
|
277
|
+
$markimg_Tag = '<img src="' . $MARKIMG . '" class="rss_markimg">';
|
278
|
+
|
279
|
+
} else {
|
280
|
+
|
281
|
+
$markimg_Tag = "";
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
// 出力データ設定(全体)-Start
|
288
|
+
|
289
|
+
$str = "\n" . '<div class="blogrss_data">' . "\n";
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
for ($i=0; $i<$inNum; $i++) {
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
// ブログ名称
|
298
|
+
|
299
|
+
$v = strip_tags($items[$i]['btitle']);
|
300
|
+
|
301
|
+
$blog_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
302
|
+
|
303
|
+
if(( mb_strlen($blog_Title, $CODE) > $inBlogNmCharCount ) && ( $inBlogNmCharCount != 0 )) {
|
304
|
+
|
305
|
+
$blog_Title = mb_substr($blog_Title, 0, $inBlogNmCharCount, $CODE);
|
306
|
+
|
307
|
+
$blog_Title .= "...";
|
308
|
+
|
309
|
+
}
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
// ブログ説明
|
314
|
+
|
315
|
+
$v = strip_tags($items[$i]['bdescription']);
|
316
|
+
|
317
|
+
$blog_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
// ブログURL
|
322
|
+
|
323
|
+
$blog_Url = htmlspecialchars($items[$i]['blink']);
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
// 記事タイトル
|
328
|
+
|
329
|
+
$v = strip_tags($items[$i]['title']);
|
330
|
+
|
331
|
+
$entry_Title = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
332
|
+
|
333
|
+
if(( mb_strlen($entry_Title, $CODE) > $inTitleCharCount ) && ( $inTitleCharCount != 0 )) {
|
334
|
+
|
335
|
+
$entry_Title = mb_substr($entry_Title, 0, $inTitleCharCount, $CODE);
|
336
|
+
|
337
|
+
$entry_Title .= "...";
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
// 記事内容
|
344
|
+
|
345
|
+
$v = strip_tags($items[$i]['description']);
|
346
|
+
|
347
|
+
$entry_Desc = mb_convert_encoding($v, $CODE, "UTF-8,EUC-JP,SJIS");
|
348
|
+
|
349
|
+
$delList = array(" ", " ", "\n",);
|
350
|
+
|
351
|
+
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
352
|
+
|
353
|
+
if(( mb_strlen($entry_Desc, $CODE) > $inEntryCharCount ) && ( $inEntryCharCount != 0 )) {
|
354
|
+
|
355
|
+
$delList = array("...");
|
356
|
+
|
357
|
+
$entry_Desc = str_replace($delList, "", $entry_Desc);
|
358
|
+
|
359
|
+
$entry_Desc = mb_substr($entry_Desc, 0, $inEntryCharCount, $CODE);
|
360
|
+
|
361
|
+
$entry_Desc .= "...";
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
// 記事URL
|
368
|
+
|
369
|
+
$entry_Url = htmlspecialchars($items[$i]['link']);
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
// 記事投稿日
|
374
|
+
|
375
|
+
$v = (isset($items[$i]['pubdate'])) ? strtotime($items[$i]['pubdate']) : strtotime(str_replace("T", " ", substr($items[$i]['dc:date'], 0, 19)));
|
376
|
+
|
377
|
+
$entry_Chk_Date = date("Ymd", $v);
|
378
|
+
|
379
|
+
$entry_Date = date($DATETYPE, $v);
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
// NEW画像タグ設定
|
384
|
+
|
385
|
+
if(( $VISDAY <= $entry_Chk_Date ) && ( $NEWVISPERIOD != "" ) && ( $NEWIMG != "" )) {
|
386
|
+
|
387
|
+
$newimg_Tag = '<img src="' . $NEWIMG . '" class="rss_newimg">';
|
388
|
+
|
389
|
+
} else {
|
390
|
+
|
391
|
+
$newimg_Tag = "";
|
392
|
+
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
// ウインドウサイズ設定
|
398
|
+
|
399
|
+
if( $inWindowSize == 0 ) {
|
400
|
+
|
401
|
+
$windowsize1_Tag = "";
|
402
|
+
|
403
|
+
$windowsize2_Tag = "";
|
404
|
+
|
405
|
+
} else {
|
406
|
+
|
407
|
+
$matches = explode( "/", $inWindowSize );
|
408
|
+
|
409
|
+
$windowsize1_Tag = "target=\"_blank\" ";
|
410
|
+
|
411
|
+
$windowsize2_Tag = "target=\"_blank\" onclick=\"window.open('" . $blog_Url . "', '', 'width=" . $matches[0] . ",height=" . $matches[1] . ",scrollbars=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,location=yes,resizable=yes');return false;\"";
|
412
|
+
|
413
|
+
}
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
// 記事数が表示記事数に満たない場合
|
418
|
+
|
419
|
+
if( $entry_Count > $i ) {
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
// 出力データ設定(アイテム)-Start
|
424
|
+
|
425
|
+
$str .= '<div class="rss_items">' . "\n";
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
// 出力データ設定1(D:記事投稿日 T:記事タイトル)
|
430
|
+
|
431
|
+
$str .= '<div class="rss_items_box">' . "\n" . $markimg_Tag . "\n";
|
432
|
+
|
433
|
+
$matches = explode( "/", $inOutData );
|
434
|
+
|
435
|
+
foreach( $matches as $entry_Data ) {
|
436
|
+
|
437
|
+
switch( $entry_Data ) {
|
438
|
+
|
439
|
+
case "D":
|
440
|
+
|
441
|
+
$str .= '<div class="rss_items_date">' . $entry_Date . '</div>' . "\n";
|
442
|
+
|
443
|
+
break;
|
444
|
+
|
445
|
+
case "T":
|
446
|
+
|
447
|
+
if (( $rss_Flg == 1 ) && ( $VISBLOG == 1 )) {
|
448
|
+
|
449
|
+
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2><p class="rss_blog_title"> - <a href="' . $blog_Url . '" title="' . $blog_Desc . '" ' . $windowsize2_Tag . ' >' . $blog_Title . '</a></p>'. $newimg_Tag . "\n";
|
450
|
+
|
451
|
+
} else {
|
452
|
+
|
453
|
+
$str .= '<h2 class="rss_items_title"><a href="' . $entry_Url . '" title="' . $entry_Desc . '" ' . $windowsize1_Tag . ' >' . $entry_Title . '</a></h2>'. $newimg_Tag . "\n";
|
454
|
+
|
455
|
+
}
|
456
|
+
|
457
|
+
break;
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
}
|
462
|
+
|
463
|
+
$str .= '</div>' . "\n";
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
// 出力データ設定2(S:記事内容)
|
468
|
+
|
469
|
+
$matches = explode( "/", $inOutData );
|
470
|
+
|
471
|
+
foreach( $matches as $entry_Data ) {
|
472
|
+
|
473
|
+
switch( $entry_Data ) {
|
474
|
+
|
475
|
+
case "S":
|
476
|
+
|
477
|
+
$str .= '<p class="rss_items_desc">' . $entry_Desc . '</p>' . "\n";
|
478
|
+
|
479
|
+
break;
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
// 出力データ設定(アイテム)-End
|
490
|
+
|
491
|
+
$str .= '</div>' . "\n";
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
}
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
}
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
// 出力データ設定(全体)-End
|
504
|
+
|
505
|
+
$str .= '</div>' . "\n";
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
// データ出力
|
510
|
+
|
511
|
+
echo mb_convert_encoding($str, $CODE, "UTF-8,EUC-JP,SJIS");
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
?>
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
コード
|
522
|
+
|
523
|
+
```
|