Skip to content

Commit

Permalink
記事作成処理を関数化した.
Browse files Browse the repository at this point in the history
複数出力機能を追加した.
使われていなかった設定定数を使用した.
  • Loading branch information
Paul committed Feb 22, 2012
1 parent 2f3f800 commit 1e742bc
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 154 deletions.
55 changes: 55 additions & 0 deletions Hview.php
@@ -0,0 +1,55 @@
<?php
// 設定ファイル
require_once("config.inc.php");
// 最終更新日時
$lastUpdate = intval(file_get_contents(LogFilename));
header("Content-type: text/html; charset=utf-8");
header("Expires: ".gmdate("D, j m Y H:i:s", $lastUpdate+CacheDuration)." GMT"); // Sat, 26 Jul 1997 05:00:00 GMT
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css; charset=UTF-8" />
<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; } 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>
<?php include_once("Hlist.inc.php");?>
<li><a href="#Spec">入力されているフィードほか各種仕様</a></li>
</ul>
<h1><a name="Articles">記事</a></h1>
<?php include_once("Harticles.inc.php");?>
<h1><a name="Spec">入力されているフィードほか各種仕様</a></h1>
<p>下記フィードから取得しています.</p>
<ul>
<?php
foreach ( $feedSources as $source )
{
echo '<li><a href="'.$source.'">'.$source.'</a></li>';
}
?>
</ul>
<h2>各種仕様</h2>
<ul>
<li>RSS/ATOM読込に<?php echo SIMPLEPIE_LINKBACK; ?>を利用している</li>
<li>毎日2回,5時半前と17時半前に内容を自動更新している</li>
<li>generate.phpへアクセスすることで手動更新できる.ただし,次の更新には1時間の猶予が必要</li>
<li>画像やリンクなどの要素は有効だが,Javascriptなどは無効化している.たとえば,動画埋込がここでは無効化される.無効化される要素は<a href="http://simplepie.org/wiki/reference/simplepie/strip_htmltags">SimplePie Documentation: strip_htmltags()</a>に記述されている.</li>
</ul>
</body>
</html>

55 changes: 55 additions & 0 deletions Lview.php
@@ -0,0 +1,55 @@
<?php
// 設定ファイル
require_once("config.inc.php");
// 最終更新日時
$lastUpdate = intval(file_get_contents(LogFilename));
header("Content-type: text/html; charset=utf-8");
header("Expires: ".gmdate("D, j m Y H:i:s", $lastUpdate+CacheDuration)." GMT"); // Sat, 26 Jul 1997 05:00:00 GMT
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css; charset=UTF-8" />
<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; } 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>
<?php include_once("Llist.inc.php");?>
<li><a href="#Spec">入力されているフィードほか各種仕様</a></li>
</ul>
<h1><a name="Articles">記事</a></h1>
<?php include_once("Larticles.inc.php");?>
<h1><a name="Spec">入力されているフィードほか各種仕様</a></h1>
<p>下記フィードから取得しています.</p>
<ul>
<?php
foreach ( $feedSources as $source )
{
echo '<li><a href="'.$source.'">'.$source.'</a></li>';
}
?>
</ul>
<h2>各種仕様</h2>
<ul>
<li>RSS/ATOM読込に<?php echo SIMPLEPIE_LINKBACK; ?>を利用している</li>
<li>毎日2回,5時半前と17時半前に内容を自動更新している</li>
<li>generate.phpへアクセスすることで手動更新できる.ただし,次の更新には1時間の猶予が必要</li>
<li>画像やリンクなどの要素は有効だが,Javascriptなどは無効化している.たとえば,動画埋込がここでは無効化される.無効化される要素は<a href="http://simplepie.org/wiki/reference/simplepie/strip_htmltags">SimplePie Documentation: strip_htmltags()</a>に記述されている.</li>
</ul>
</body>
</html>

44 changes: 34 additions & 10 deletions config.inc.php
Expand Up @@ -3,8 +3,32 @@
/*
rss aggregate
*/

// ----------------------------------------------------------------------
// 出力設定クラス
class OutputSpec{
var $id; // 識別子
var $viewFilename; // 閲覧ページ
var $articlesFilename; // 記事本体
var $listFilename; // 記事リスト
var $feedItemLimit; // 記事最大数
var $dontStripTag; // 除去しないタグ

function __construct ( $_id, $_viewFilename, $_articlesFilename, $_listFilename
, $_feedItemLimit, $_dontStripTag = null )
{
$this->id = $_id;
$this->viewFilename = $_viewFilename;
$this->articlesFilename = $_articlesFilename;
$this->listFilename = $_listFilename;
$this->feedItemLimit = $_feedItemLimit;
$this->dontStripTag = $_dontStripTag;
}
}

/*
記事本体,リスト,striptag,閲覧ページ
*/
// ----------------------------------------------------------------------
// 表示

Expand All @@ -23,15 +47,16 @@
// キャッシュディレクトリ(書込権限必要)
define( "CacheLocation", "cache" );

// 記事ファイル
define( "ArticlesFilename", "articles.inc.php" );

// 記事リストファイル
define( "ListFilename", "list.inc.php" );

// 実行記録ファイル
define( "LogFilename", "executelog.txt");

// ----------------------------------------------------------------------
// 出力仕様設定

$outputSpec[] = new OutputSpec("heavy", "Hview.php", "Harticles.inc.php" , "Hlist.inc.php", 10
, array( "object", "param", "embed", "iframe" ));
$outputSpec[] = new OutputSpec("light", "Lview.php", "Larticles.inc.php" , "Llist.inc.php", 20);

// ----------------------------------------------------------------------
// フィード入出力設定

Expand All @@ -52,15 +77,14 @@
"http://blog.livedoor.jp/saro01836/atom.xml",// saro
"http://01647.tumblr.com/rss",// paul
"http://nana4ch.blog.fc2.com/?xml", // nns774
"http://ux.getuploader.com/asukach_01/rss", // asukach loda ( kasagiri )
"http://leon11020.exblog.jp/index.xml", // leon11010
);
// フィードあたりアイテム数上限
define( "FeedItemLimit", 10);

// 出力フィードアイテム数上限
define( "OutputFeedItemLimit", 20 );

// ページトップへ戻るリンク
define( "LinkToPageTop", '<a href="#top">このページの上端へ戻る</a>' );
define( "LinkToPageTop", '<p><a href="#top">このページの上端へ戻る</a></p>' );

// フィードキャッシュ有効時間(秒)
define( "CacheDuration", 60*60 );
Expand Down

0 comments on commit 1e742bc

Please sign in to comment.