Skip to content

Commit

Permalink
いろいろ更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul committed Jan 28, 2012
1 parent ba0a678 commit 33c3240
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 22 deletions.
17 changes: 12 additions & 5 deletions config.inc.php
Expand Up @@ -44,8 +44,15 @@
"http://suzukix.seesaa.net/index20.rdf",//butaman
"http://heiho0zikkyou0box.blog34.fc2.com/?xml",//heihou
"http://asukachanneler.blog.fc2.com/?xml",// asukach-ler
"http://rssblog.ameba.jp/hukufukuaki/rss20.xml", // hatarakuruma
"http://karasu0504.blog.fc2.com/?xml",//karasu
"http://oblate01.blog.fc2.com/?xml",// motsuko
"http://honji37744.blog.fc2.com/?xml",// honji-
"http://zarame42715.game-ss.com/ATOM/",// zarame
"http://blog.livedoor.jp/saro01836/atom.xml",// saro
"http://01647.seesaa.net/index20.rdf",// paul

);

// フィードあたりアイテム数上限
define( "FeedItemLimit", 10);

Expand All @@ -58,14 +65,14 @@
// フィードキャッシュ有効時間(秒)
define( "CacheDuration", 60*60 );

// 未来の記事を除外する
// 未来の記事を除去する
define( "IgnoreFuture", TRUE);

// seesaaの広告を除外する
// seesaaの広告を除去する
define( "IgnoreSeesaaAds", TRUE );

// loda.jp permalinkの,最初の%3Dを=に置換する
define( "ReplaceLodaJpPermalink", TRUE );
// amebloの広告を除去する
define( "IgnoreAmebloAds", TRUE );

// ----------------------------------------------------------------------
// 実行タイミング管理
Expand Down
39 changes: 25 additions & 14 deletions generate.php
@@ -1,12 +1,15 @@
#!/usr/local/bin/php
<?php
header("Content-type: text/html; charset=utf-8");

chdir("/home/paul/public_html/asukachrss");
// ----------------------------------------------------------------------
// 設定ファイル
require_once("config.inc.php");

// ----------------------------------------------------------------------
// 実行間隔制限
// ファイルロックa
// ファイルロック
/*
前回の実行記録を調べる
前回の実行時刻よりIgnoreSpan秒経過していない場合,処理を中止する
Expand Down Expand Up @@ -109,23 +112,16 @@
// 投稿日時フォーマット
$date = $item->get_date("Y年m月j日(D) G時i分");
// 投稿日時とフィードソース名
$dateandbase = $date.'投稿 - <a href="'.$item->get_base().'">'.$item->get_feed()->get_title().'</a>';
$dateandbase = $date.'投稿 - <a href="'.$item->get_base().'">'.$item->get_feed()->get_title().'</a>';
// パーマネントリンク
$permalink = $item->get_permalink();
// パーマネントリンク加工
if ( ReplaceLodaJpPermalink )
{
if ( 0 === strpos($permalink, "http://loda.jp/" ) )
{
$permalink = str_replace( "%3D", "=", $permalink );
}
}
// $permalink = processPermalink( $item->get_permalink() );
// リストデータ追記
$listData .= '<li><a href="'.$permalink.'">'.$item->get_title().'</a><small> - '.$dateandbase.'</small></li>'."\n";
$listData .= '<li><a href="#article'.$itemCounter.'" class="linkinpage">■</a> <a href="'.$permalink.'">'.$item->get_title().'</a><small> - '.$dateandbase.'</small></li>'."\n";
// 記事データ追記
$articlesData .= <<<EOT
<div class="item">
<h2 class="title"><a href="{$permalink}" name="#article{$itemCounter}">{$item->get_title()}</a></h2>
<h2 class="title"><a href="{$permalink}" name="article{$itemCounter}">{$item->get_title()}</a></h2>
<p><small>{$dateandbase}</small></p>
<div class="content">{$item->get_content()}</div>
</div>
Expand All @@ -139,7 +135,7 @@
// ----------------------------------------------------------------------
// ファイル出力
file_put_contents( ArticlesFilename, $articlesData, LOCK_EX );
file_put_contents( ListFilename, "<ul>".$listData."</ul>", LOCK_EX );
file_put_contents( ListFilename, "<ul class=\"articlelist\">".$listData."</ul>", LOCK_EX );

// ----------------------------------------------------------------------
// 後始末
Expand All @@ -155,13 +151,28 @@
// アイテム無視条件
function ignoreItem( $item )
{
// seesaa広告除去対策
// seesaa広告除去
if ( IgnoreSeesaaAds )
{
/*
// SimplePie_ItemのAuthorはフィード統合時に削除されるらしい
if( !(FALSE === mb_strpos($item->get_author()->get_name(), "ads by Seesaa")) )
return TRUE;
*/
// タイトルを基に判定する
if( !(FALSE === mb_strpos($item->get_title(), "[PR]注目のキーワード「")) )
return TRUE;
}

// ameblo広告除去
if ( IgnoreAmebloAds )
{
// パーマネントリンクを基に判定する
if( !(FALSE === mb_strpos($item->get_permalink(), "http://rss.rssad.jp/rss/ad/")) )
return TRUE;
}

return FALSE;
}

?>
9 changes: 6 additions & 3 deletions index.php
Expand Up @@ -14,17 +14,20 @@
<link rel="stylesheet" type="text/css" href="../style/style.css" />
<title><?php echo PageTitle;?></title>
<style type="text/css">
.item { margin:5px;padding:5px; border: solid 1px};
.item { margin:5px;padding:5px; border: solid 1px; } table,th,td { border: solid 1px; }
.articlelist { list-style-type: none; }
.linkinpage { font-family: monospace; margin-right: 0.5em; }
</style>
</head>
<body>
<h1><?php echo PageTitle; ?></h1>
<p><a href="../">ウェブサイトトップへ戻る</a></p>
<p><a href="http://asuka--sen-nin.ddo.jp/checker/index.cgi">アスカチェッカー</a>配信者らのブログ新着情報を表示しています.掲載追加拒否承ります.スタイルシートデザインを募集しています.</p>
<h1>お品書き</h1>
<p>文字「<span class="linkinpage"></span>」はこのページ内にリンクしています.記事タイトル部分は各ブログ記事単体ページへリンクしています.</p>
<ul>
<li><a href="<?php echo GeneratorFilename; ?>">情報を最新の状態に更新する</a>前回の更新日時は<?php echo date("Y年m月j日(D) G時i分", $lastUpdate);?></li>
<li><a href="#Articles">記事</a>(下記リストは各ブログ記事単体ページへリンクしています)</li>
<li><a href="<?php echo GeneratorFilename; ?>">最新の情報に更新する</a>最終確認日時は<?php echo date("Y年m月j日(D) G時i分", $lastUpdate);?></li>
<li><a href="#Articles">記事</a></li>
<?php include_once(ListFilename);?>
<li><a href="#Spec">入力されているフィードほか各種仕様</a></li>
</ul>
Expand Down

0 comments on commit 33c3240

Please sign in to comment.