更新情報
タグのhrefに指定されているファイルを保持する配列
$hrefFileList = array();
{
// ファイルポインタをオープン
$file = fopen("shared/inc/inc_information.html", "r");
// HTMLタグと とを格納する一時バッファ
$tempBuffer = array();
// 最終更新日保持変数
$lastUpdated = "";
while ($line = fgets($file)) {
// 文字列の後ろの改行(\n)を削除
$line = trim($line);
// 先頭#の文章又は空行を飛ばす
if (preg_match('/^#.*/', $line) || $line == "" ) {
continue;
}
// コメント開始検知
if (preg_match('//', $line) ) {
// コメントフラグOFF
$commentOut = false;
}
// コメントフラグONの際にコメントを飛ばす
if ($commentOut == true) {
continue;
}
// $lineを出力する
if (strpos ($line, "renew-type01") !== false) {
// 出力ON
$isRead = true;
// と を格納する一時バッファを初期化
$tempBuffer = array();
}
// お知らせ関連アイコン発見時にお知らせフラグON
if ( (strpos ($line, " renew-ico01") !== false || strpos ($line, "renew-ico02") !== false) ){
$infoFlg = true;
}
// 更新アイコン発見時にお知らせフラグOFF
if ( (strpos ($line, " renew-ico03") !== false) ){
$infoFlg = false;
}
// 出力ONの場合
if ($isRead) {
// タグの場合
if (preg_match('/^.*/', $line)) {
// href="xxx/yyy/zzz.html" の xxx/yyy/zzz.html を取得する
// →$matches[1] に xxx/yyy/zzz.html が格納される
preg_match("/href=\"?(.+?)\"/", $line, $matches);
// $matches[1] に値がある場合
if (isset($matches[1])) {
// herfのリンクファイルを取得
$hrefFile = $matches[1];
// 初回検出の場合
if (!in_array($hrefFile, $hrefFileList)) {
// 追加
array_push($hrefFileList, $hrefFile);
// 2回目以降検出の場合
} else {
// $hrefFile が / で終わっている場合は、index.htmlを付ける
if (preg_match('/^.+\/$/', $hrefFile)) {
$hrefFile = $hrefFile . "index.html";
}
// 対象ファイル
$targetFile = $_SERVER['DOCUMENT_ROOT'] . $hrefFile;
// ファイルが存在する場合
if (file_exists($targetFile)) {
// お知らせフラグが立っている場合のみ最終更新日をセット
if ( $infoFlg !== false ){
// 該当ファイルのタイムスタンプ文言を取得する
$lastUpdated = "(最終更新日:". date("Y/m/d", filemtime($targetFile)).")";
$infoFlg = false;
}
}
}
}
}
// タグの場合で、最終更新日保持変数に値が設定されている場合
if (preg_match('/^.*<\/dd>$/', $line) && $lastUpdated != "") {
// タグの前にタイムスタンプ文言を差し込む
$line = str_replace(" ", $lastUpdated . "", $line);
// 最終更新日保持変数を初期化
$lastUpdated = "";
}
// $lineをバッファに格納
array_push($tempBuffer, $line);
}
// 出力ON時に を検出した場合
if ($isRead && $line == "") {
// 出力OFF
$isRead = false;
// $tempBufferをHTML格納用バッファに格納する
$buffer = array_merge($buffer, $tempBuffer);
// 処理件数を加算
++$count;
// 処理件数が10の場合は処理終了
if ($count == 10) {
break;
}
}
}
// ファイルポインタをクローズ
fclose($file);
// その年のHTML取得
$result = implode("\n", $buffer);
// 出力
if (count($buffer) > 0) {
echo <<
- ~
タグのhrefに指定されているファイルを保持する配列
$hrefFileList = array();
{
// ファイルポインタをオープン
$file = fopen("shared/inc/inc_information.html", "r");
// HTMLタグと とを格納する一時バッファ
$tempBuffer = array();
// 最終更新日保持変数
$lastUpdated = "";
while ($line = fgets($file)) {
// 文字列の後ろの改行(\n)を削除
$line = trim($line);
// 先頭#の文章又は空行を飛ばす
if (preg_match('/^#.*/', $line) || $line == "" ) {
continue;
}
// コメント開始検知
if (preg_match('//', $line) ) {
// コメントフラグOFF
$commentOut = false;
}
// コメントフラグONの際にコメントを飛ばす
if ($commentOut == true) {
continue;
}
// $lineを出力する
if (strpos ($line, "renew-type02") !== false) {
// 出力ON
$isRead = true;
// と を格納する一時バッファを初期化
$tempBuffer = array();
}
// お知らせ関連アイコン発見時にお知らせフラグON
if ( (strpos ($line, " renew-ico01") !== false || strpos ($line, "renew-ico02") !== false) ){
$infoFlg = true;
}
// 更新アイコン発見時にお知らせフラグOFF
if ( (strpos ($line, " renew-ico03") !== false) ){
$infoFlg = false;
}
// 出力ONの場合
if ($isRead) {
// タグの場合
if (preg_match('/^.*/', $line)) {
// href="xxx/yyy/zzz.html" の xxx/yyy/zzz.html を取得する
// →$matches[1] に xxx/yyy/zzz.html が格納される
preg_match("/href=\"?(.+?)\"/", $line, $matches);
// $matches[1] に値がある場合
if (isset($matches[1])) {
// herfのリンクファイルを取得
$hrefFile = $matches[1];
// 初回検出の場合
if (!in_array($hrefFile, $hrefFileList)) {
// 追加
array_push($hrefFileList, $hrefFile);
// 2回目以降検出の場合
} else {
// $hrefFile が / で終わっている場合は、index.htmlを付ける
if (preg_match('/^.+\/$/', $hrefFile)) {
$hrefFile = $hrefFile . "index.html";
}
// 対象ファイル
$targetFile = $_SERVER['DOCUMENT_ROOT'] . $hrefFile;
// ファイルが存在する場合
if (file_exists($targetFile)) {
// お知らせフラグが立っている場合のみ最終更新日をセット
if ( $infoFlg !== false ){
// 該当ファイルのタイムスタンプ文言を取得する
$lastUpdated = "(最終更新日:". date("Y/m/d", filemtime($targetFile)).")";
$infoFlg = false;
}
}
}
}
}
// タグの場合で、最終更新日保持変数に値が設定されている場合
if (preg_match('/^.*<\/dd>$/', $line) && $lastUpdated != "") {
// タグの前にタイムスタンプ文言を差し込む
$line = str_replace(" ", $lastUpdated . "", $line);
// 最終更新日保持変数を初期化
$lastUpdated = "";
}
// $lineをバッファに格納
array_push($tempBuffer, $line);
}
// 出力ON時に を検出した場合
if ($isRead && $line == "") {
// 出力OFF
$isRead = false;
// $tempBufferをHTML格納用バッファに格納する
$buffer = array_merge($buffer, $tempBuffer);
// 処理件数を加算
++$count;
// 処理件数が10の場合は処理終了
if ($count == 10) {
break;
}
}
}
// ファイルポインタをクローズ
fclose($file);
// その年のHTML取得
$result = implode("\n", $buffer);
// 出力
if (count($buffer) > 0) {
echo <<
- ~
タグのhrefに指定されているファイルを保持する配列
$hrefFileList = array();
{
// ファイルポインタをオープン
$file = fopen("shared/inc/inc_information.html", "r");
// HTMLタグと とを格納する一時バッファ
$tempBuffer = array();
// 最終更新日保持変数
$lastUpdated = "";
while ($line = fgets($file)) {
// 文字列の後ろの改行(\n)を削除
$line = trim($line);
// 先頭#の文章又は空行を飛ばす
if (preg_match('/^#.*/', $line) || $line == "" ) {
continue;
}
// コメント開始検知
if (preg_match('//', $line) ) {
// コメントフラグOFF
$commentOut = false;
}
// コメントフラグONの際にコメントを飛ばす
if ($commentOut == true) {
continue;
}
// $lineを出力する
if (strpos ($line, "renew-type03") !== false) {
// 出力ON
$isRead = true;
// と を格納する一時バッファを初期化
$tempBuffer = array();
}
// お知らせ関連アイコン発見時にお知らせフラグON
if ( (strpos ($line, " renew-ico01") !== false || strpos ($line, "renew-ico02") !== false) ){
$infoFlg = true;
}
// 更新アイコン発見時にお知らせフラグOFF
if ( (strpos ($line, " renew-ico03") !== false) ){
$infoFlg = false;
}
// 出力ONの場合
if ($isRead) {
// タグの場合
if (preg_match('/^.*/', $line)) {
// href="xxx/yyy/zzz.html" の xxx/yyy/zzz.html を取得する
// →$matches[1] に xxx/yyy/zzz.html が格納される
preg_match("/href=\"?(.+?)\"/", $line, $matches);
// $matches[1] に値がある場合
if (isset($matches[1])) {
// herfのリンクファイルを取得
$hrefFile = $matches[1];
// 初回検出の場合
if (!in_array($hrefFile, $hrefFileList)) {
// 追加
array_push($hrefFileList, $hrefFile);
// 2回目以降検出の場合
} else {
// $hrefFile が / で終わっている場合は、index.htmlを付ける
if (preg_match('/^.+\/$/', $hrefFile)) {
$hrefFile = $hrefFile . "index.html";
}
// 対象ファイル
$targetFile = $_SERVER['DOCUMENT_ROOT'] . $hrefFile;
// ファイルが存在する場合
if (file_exists($targetFile)) {
// お知らせフラグが立っている場合のみ最終更新日をセット
if ( $infoFlg !== false ){
// 該当ファイルのタイムスタンプ文言を取得する
$lastUpdated = "(最終更新日:". date("Y/m/d", filemtime($targetFile)).")";
$infoFlg = false;
}
}
}
}
}
// タグの場合で、最終更新日保持変数に値が設定されている場合
if (preg_match('/^.*<\/dd>$/', $line) && $lastUpdated != "") {
// タグの前にタイムスタンプ文言を差し込む
$line = str_replace(" ", $lastUpdated . "", $line);
// 最終更新日保持変数を初期化
$lastUpdated = "";
}
// $lineをバッファに格納
array_push($tempBuffer, $line);
}
// 出力ON時に を検出した場合
if ($isRead && $line == "") {
// 出力OFF
$isRead = false;
// $tempBufferをHTML格納用バッファに格納する
$buffer = array_merge($buffer, $tempBuffer);
// 処理件数を加算
++$count;
// 処理件数が10の場合は処理終了
if ($count == 10) {
break;
}
}
}
// ファイルポインタをクローズ
fclose($file);
// その年のHTML取得
$result = implode("\n", $buffer);
// 出力
if (count($buffer) > 0) {
echo <<
- ~