このサイトのMediaWikiで利用しているSkin PHPスクリプト
現在、実際に利用中のPHPスクリプトを読み出した結果。
このプログラムは Creative Commons BY-NC-ND の条件で自由に複製、転載、利用することができます。
<?php /*********************************** * MediaWiki用 Brown_Web skin (derived from Modern template) * maintenance with MovableType * * UTF-8で保存して下さい。 ***********************************/ /* Built on 2013年9月17日 09:52 by Movable Type Pro Version 5.01 */ if( !defined( 'MEDIAWIKI' ) ) die( -1 ); /** * Inherit main code from SkinTemplate, set the CSS and template filter. * @todo document * @ingroup Skins */ class SkinBrown_Web extends SkinTemplate { /* * We don't like the default getPoweredBy, the icon clashes with the * skin L&F. */ function getPoweredBy() { global $wgVersion; return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>"; } function initPage( &$out ) { SkinTemplate::initPage( $out ); $this->skinname = 'Brown_Web'; $this->stylename = 'Brown_Web'; $this->template = 'Brown_WebTemplate'; } } /** * @todo document * @ingroup Skins */ class Brown_WebTemplate extends QuickTemplate { var $skin; /** * Template filter callback for Modern skin. * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. * * @access private */ function execute() { global $wgRequest, $wgVersion; global $wgOut; ## global $wgTitle; ## $this->skin = $skin = $this->data['skin']; $action = $wgRequest->getText( 'action' ); // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php foreach($this->data['xhtmlnamespaces'] as $tag => $ns) { ?>xmlns:<?php echo "{$tag}=\"{$ns}\" "; } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>"> <head> <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" /> <?php /*$this->html('headlinks')*/ ?> <title><?php $this->text('pagetitle') ?></title> <?php if(empty($this->data['printable']) ) { ?> <style type="text/css" media="screen, projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/common/shared.css"; @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css"; /*]]>*/</style> <?php } ?> <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /> <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]--> <!-- disable viewport for mobile device --> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,minimum-scale=1.0,user-scalable=1" /> <?php // notitleエクステンションをJavaScriptOFFで有効にするのため(headscipts を出力しない場合、ここで手動出力する) // if (isset($wgOut->parserOptions()->mHideTitle)) { // echo "\t\t<!-- Hide title (H1) element with NoTitle extention -->\n\t\t<style type=\"text/css\">h1.firstHeading, h1#firstHeading { display:none; }</style>\n"; // } // Extension:SyntaxHighlight GeSHi、NOTITLE スタイルシートの出力用に残す // (LocalSettings.php で $wgUseAjax = false を設定してスクリプト出力を抑止) echo "\t\t<!-- headscripts start -->\n"; $this->html('headscripts'); echo "\n\t\t<!-- headscripts ends -->\n"; if($this->data['pagecss' ]) { ?> <style type="text/css"><?php $this->html('pagecss' ) ?></style> <?php } if($this->data['usercss' ]) { ?> <style type="text/css"><?php $this->html('usercss' ) ?></style> <?php } if($this->data['userjs' ]) { ?> <!-- <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script> --> <?php } if($this->data['userjsprev']) { ?> <!-- <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script> --> <?php } if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?> </head> <!-- ##### BODY ##### --> <body> <div id="layout_main"> <!-- ##### Header Menu ##### --> <div id="layout_header_menu"> <?php ##### ログオンしていないユーザの場合、標準メニューを表示 ##### if(empty($this->data['loggedin'])) { ?> <ul> <li><a class="new_sec" href="/index.shtml" target="_self">Home</a></li> <li><a class="new_sec" href="/traveldia/index.html" target="_self">Travels</a> <ul> <li><a class="new_sub" href="/traveldia/index.html" target="_self">Country List</a></li> <li><a class="new_sub" href="http://www.youtube.com/user/inoue0111" target="_self">動画(YouTube)</a></li> <li><a class="new_sub_bottom" href="http://oasis-halfmoon.blogspot.com/" target="_self">編集前旅行記(Blogger)</a></li> </ul> </li> <li><a class="new_sec" href="/photo/index.html" target="_self">Photo</a> <ul> <li><a class="new_sub" href="/photo/index.html" target="_self">All Page List</a></li> <li><a class="new_sub" href="/traveldia/index.html" target="_self">Country List</a></li> <li><a class="new_sub_bottom" href="/about/index.html" target="_self">利用許諾条件</a></li> </ul> </li> <li><a class="new_sec" href="/software/index.html" target="_self">Software</a> <ul> <li><a class="new_sub" href="/software/index.html" target="_self">Software Main Page</a></li> <li><a class="new_sub" href="/cgi-bin/websvn/" target="_self">Subversion</a></li> <li><a class="new_sub" href="https://github.com/oasis3855?tab=repositories" target="_self">GitHub</a></li> <li><a class="new_sub_bottom" href="http://code.google.com/u/101092603816443690725/" target="_self">Google Code</a></li> </ul> </li> <li><a class="new" href="/links/index.html" target="_self">Links</a></li> </ul> <?php } ##### ログオン済みユーザには、MediaWikiのメニューを表示 ##### else { ?> <ul> <li><a class="new_sec" href="/index.shtml">Home</a> <ul> <li><a class="new_sub" href="/traveldia/index.html" target="_self">Travels</a></li> <li><a class="new_sub" href="/photo/index.html" target="_self">Photo</a></li> <li><a class="new_sub" href="/software/index.html" target="_self">Software</a></li> <li><a class="new_sub" href="/cgi-bin/websvn/" target="_self"> Subversion</a></li> <li><a class="new_sub" href="http://code.google.com/u/101092603816443690725/" target="_self"> Google Code</a></li> <li><a class="new_sub" href="/links/index.html" target="_self">Links</a></li> </ul> </li> </ul> <!-- ##### MediaWiki User Menu ##### --> <ul> <li><a class="new_sec" href="">User</a> <ul> <?php foreach($this->data['personal_urls'] as $key => $item) { echo("\t\t<li><a class=\"new_sub\" href=\"" . htmlspecialchars($item['href']) . "\">" . htmlspecialchars($item['text']) . "</a></li>\n"); } ?> </ul> </li> </ul> <!-- ##### MediaWiki Page Menu ##### --> <ul> <li><a class="new_sec" href="<?php $target = Title::newFromText('Special:Search'); echo $target->getFullUrl(); ?>">Search</a> <ul> <?php foreach($this->data['sidebar']['navigation'] as $key => $item) { echo("\t\t<li><a class=\"new_sub\" href=\"" . htmlspecialchars($item['href']) . "\""); echo(">" . htmlspecialchars($item['text']) . "</a></li>\n"); } ?> </ul> </li> </ul> <!-- ##### MediaWiki Tool Menu ##### --> <ul> <li><a class="new_sec" href="<?php $target = Title::newFromText('Special:SpecialPages'); echo $target->getFullUrl(); ?>">Tool</a> <ul> <li><a class="new_sub" href="<?php echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']); ?>"><?php $this->msg('whatlinkshere'); ?></a></li> <li><a class="new_sub" href="<?php echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']); ?>"><?php $this->msg('recentchangeslinked'); ?></a></li> <li><a class="new_sub" href="<?php echo htmlspecialchars($this->data['nav_urls']['upload']['href']); ?>"><?php $this->msg('upload'); ?></a></li> <li><a class="new_sub" href="<?php echo htmlspecialchars($this->data['searchaction']); ?>"><?php $this->msg('search'); ?></a></li> <li><a class="new_sub" href="<?php echo htmlspecialchars($wgTitle->getFullURL(array('action'=>'purge'))); ?>">このページ キャッシュ削除</a></li> </ul> </li> </ul> <!-- ##### MediaWiki RSS Menu ##### --> <ul> <li><a class="new_sec" href="<?php $target = Title::newFromText('Special:RecentChanges'); echo $target->getFullUrl(); ?>&feed=atom">RSS</a> <ul> <li><a class="new_sub" target="_blank" href="http://blogsearch.google.co.jp/ping?name=<?php echo $wgTitle->getPrefixedURL(); ?>&url=<?php echo urlencode($wgTitle->getFullURL()); ?>">Google ping (このページ)</a></li> <li><a class="new_sub" target="_blank" href="http://blogsearch.google.co.jp/ping?name=oasis.halfmoon.jp&url=http%3A%2F%2Foasis.halfmoon.jp%2Fmw%2F&changesURL=http%3A%2F%2Foasis.halfmoon.jp%2Fmw%2Findex.php%3Ftitle%3DSpecial%3ARecentChanges%26feed%3Drss">Google ping (dynamic rss)</a></li> <li><a class="new_sub" target="_blank" href="http://blogsearch.google.co.jp/ping?name=oasis.halfmoon.jp&url=http%3A%2F%2Foasis.halfmoon.jp%2Fmw%2F&changesURL=http%3A%2F%2Foasis.halfmoon.jp%2Fmw%2Fsitemap.xml">Google ping (sitemap.xml)</a></li> </ul> </li> </ul> <!-- ##### MediaWiki Edit Menu ##### --> <ul> <li><a class="new_sec" href="<?php echo htmlspecialchars($wgTitle->getFullURL(array('action'=>'edit'))); ?>">Edit</a> <ul> <?php foreach($this->data['content_actions'] as $key => $item) { echo("\t\t<li><a class=\"new_sub\" href=\"" . htmlspecialchars($item['href']) . "\">" . htmlspecialchars($item['text']) . "</a></li>\n"); } ?> </ul> </li> </ul> <!-- ##### MediaWiki Logout ##### --> <ul> <li><a class="new_sec" href="<?php echo htmlspecialchars($this->data['personal_urls']['logout']['href']); ?>">Logout</a></li> </ul> <?php } ##### システムメニュー表示の終了 ##### ?> </div> <!-- ##### Header Menu ##### --> <div id="layout_header_menu_line"></div> <!-- ##### Horizonal Line (Menu) ##### --> <!-- ##### heading title (H1) ##### --> <h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1> <!-- ##### Main Article ##### --> <div id="mw_content"> <?php if($this->data['newtalk'] ) { ?> <div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div> <?php } if($this->data['sitenotice']) { ?> <div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?> <div id="contentSub"><?php $this->html('subtitle') ?></div> <?php if($this->data['undelete']) { ?> <div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?> <!-- ##### BODYTEXT ##### --> <?php $this->html('bodytext') ?> <div class='mw_clear'></div> <!-- ##### CATEGORY ##### --> <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> <?php ?> </div><!-- mw_content --> <div class="clear"></div> <!-- ##### FOOTER ##### --> <?php // フッターで利用するための文字列作成 ## Copyright Info ## # include/parser/Parser.php - parse(), include/SkinTemplate.php - msgWiki() global $wgParser, $wgOut, $wgVersion, $wgUser, $wgArticle ; $parserOutput = $wgParser->parse( '[[Copyrights|Copyright (C) INOUE Hirokazu.]]', $wgTitle, $wgOut->parserOptions(), false ); ?> <div id="layout_footer"> <div id="layout_footer_left"> <p style="text-align:left;"><a href="http://validator.w3.org/"><img src="/pics/w3c-valid-xhtml10-pale.png" border="0" align="left" alt="Valid XHTML 1.0 Transitional" width="88" height="31" /></a> <?php echo $this->html('lastmod') ?> <br /> Powered by MediaWiki <?php echo $wgVersion; ?><br clear="all" /></p> </div> <div id="layout_footer_right"> <p style="text-align:right;"><a href="http://creativecommons.org/licenses/by-nc-nd/2.1/jp/"><img src="/pics/creativecommons-by-nc-nd-pale.png" border="0" align="right" alt="Creative Commons Licence : Attribution-Noncommercial-No Derivative Works" width="88" height="31" /></a> <?php echo "\t".$parserOutput->getText(); ?> <br /> <?php if(!empty($this->data['loggedin'])) { echo $this->html('viewcount'); } else { echo"\tFor <i>commercial usage</i> ? See detail at <a href=\"/about/index.html\">HERE</a>"; } ?> <br clear="all" /></p> </div> <!-- Access Counter --><img src="http://oasis.halfmoon.jp/cgi-bin/counter/client.cgi?gif" alt=" " /><!-- Access Counter --> </div> <!-- layout_footer --> <?php ##### ファイル情報(デバッグ情報)を表示 ##### echo "\t<!-- ##### DEBUG INFO ##### \n"; echo "\ttitletext : ".htmlspecialchars($this->data['titletext'])."\n"; echo "\tpagetitle : ".htmlspecialchars($this->data['pagetitle'])."\n"; echo "\ttitle : ".htmlspecialchars($this->data['title'])."\n"; echo "\tshort url : ".htmlspecialchars($this->data['content_actions']['nstab-main']['href'])."\n"; echo "\tfull url : ".htmlspecialchars($wgTitle->getFullURL())."\n"; echo "\tuser : ".htmlspecialchars($wgUser->getName())."\n"; echo "\tloggedin : ".htmlspecialchars($wgUser->isLoggedIn())."\n"; if($wgTitle->mNamespace != NS_SPECIAL) { // 特別ページは、カウンタとタイムスタンプがエラーとなる場合があるため除外 echo "\tcount : ".$wgArticle->getCount()."\n"; echo "\ttimestamp : ".$wgArticle->getTimestamp()."\n"; } echo "\n\t-->\n"; echo $this->html('reporttime'); ?> </div> <!-- layout_main --> </body> </html> <?php if(!empty($this->data['loggedin'])) { ### デバッグ用(環境変数を全て表示) echo "<!--\n<pre>\n"; echo "グローバル変数表示(デバッグ用)\n"; // echo "========================== this ==========================\n"; // print_r ($this); // echo "========================== wgOut ==========================\n"; // print_r ($wgOut); // echo "========================== wgTitle ==========================\n"; // print_r ($wgTitle); // echo "========================== wgParser ==========================\n"; // print_r ($wgParser); // echo "========================== wgVersion ==========================\n"; // print_r ($wgVersion); // echo "========================== wgRequest ==========================\n"; // print_r ($wgRequest); // echo "========================== wgArticle ==========================\n"; // print_r ($wgArticle); echo "</pre>\n-->\n"; } wfRestoreWarnings(); } // end of execute() method } // end of class ?>