This repository has been archived by the owner on Oct 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKiwiticTemplate.php
376 lines (363 loc) · 22.3 KB
/
KiwiticTemplate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<?php
class KiwiticTemplate extends BaseTemplate {
function execute() {
global $wgRequest;
$request = $this->getSkin()->getRequest();
$action = $request->getVal( 'action', 'view' );
$title = $this->getSkin()->getTitle();
$curid = $this->getSkin()->getTitle()->getArticleID();
wfSuppressWarnings();
$this->html( 'headelement' );
?>
<div class="nav-wrapper navbar-fixed-top">
<?php $this->nav_menu(); ?>
</div>
<div class="content-wrapper">
<div class="liberty-sidebar">
<div class="liberty-right-fixed">
<?php $this->live_recent(); ?>
</div>
<div class="right-ads">
<ins class="adsbygoogle"
style="display:block; min-width: 15rem; width: 100%;"
data-ad-client="ca-pub-6081569795236180"
data-ad-slot="4545283356"
data-ad-format="auto">
</ins>
</div>
</div>
<div class="container-fluid liberty-content">
<div class="liberty-content-header">
<?php if ( $this->data['sitenotice'] && $_COOKIE['alertcheck'] != "yes" ) { ?>
<div class="alert alert-dismissible fade in alert-info liberty-notice" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<?php $this->html( 'sitenotice' ) ?>
</div>
<?php } ?>
<div class="header-ads">
<ins class="adsbygoogle"
style="display:block; min-width:20rem; width:100%;"
data-ad-client="ca-pub-6081569795236180"
data-ad-slot="4545283356"
data-ad-format="auto">
</ins>
</div>
<?php $this->contents_toolbox(); ?>
<div class="title">
<h1>
<?php $this->html( 'title' ) ?>
</h1>
</div>
<div class="contentSub"<?php $this->html( 'userlangattributes' ) ?>>
<?php $this->html( 'subtitle' ) ?>
</div>
</div>
<div class="liberty-content-main">
<?php if ( $title->getNamespace() != NS_SPECIAL && $action != "edit" && $action != "history") { ?>
<div class="social-buttons">
<div class="google" data-url="https://kiwki.us/wiki/<?php $this->html( 'title' ) ?>" data-text="<?php $this->html( 'title' ) ?>" title="구글플러스"><div><i class="fa fa-google-plus"></i></div></div>
<div class="twitter" data-url="https://kiwki.us/?curid=<?=$curid;?>" data-text="[<?php $this->html( 'title' ) ?>]%0A" title="트위터"><div><i class="fa fa-twitter"></i></div></div>
<div class="facebook" data-url="https://kiwki.us/wiki/<?php $this->html( 'title' ) ?>" data-text="<?php $this->html( 'title' ) ?>" title="페이스북"><div><i class="fa fa-facebook"></i></div></div>
</div>
<?php } ?>
<?php if ( $this->data['catlinks'] ) {
$this->html( 'catlinks' );
} ?>
<?php $this->html( 'bodycontent' ) ?>
</div>
<div class="bottom-ads">
</div>
<div class="liberty-footer">
<?php $this->footer(); ?>
</div>
</div>
</div>
<?php $this->login_modal(); ?>
<?php
$this->printTrail();
$this->html('debughtml');
echo Html::closeElement( 'body' );
echo Html::closeElement( 'html' );
echo "\n";
wfRestoreWarnings();
} // end of execute() method
/*************************************************************************************************/
function nav_menu() {
?>
<nav class="navbar navbar-dark">
<a class="navbar-brand" href="/"></a>
<ul class="nav navbar-nav">
<li class="nav-item">
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'Recentchanges', null ), '<span class="fa fa-refresh"></span><span class="hide-title">최근바뀜</span>', array( 'class' => 'nav-link', 'title' => '최근 변경 문서를 불러옵니다. [alt+shift+r]', 'accesskey' => 'r') ); ?>
</li>
<li class="nav-item">
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'Randompage', null ), '<span class="fa fa-random"></span><span class="hide-title">임의문서</span>', array( 'class' => 'nav-link', 'title' => '임의 문서를 불러옵니다. [alt+shift+x]', 'accesskey' => 'x' ) ); ?>
</li>
<li class="nav-item dropdown">
<span class="nav-link dropdown-toggle dropdown-toggle-fix" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="키위위키와 관련있는 외부 페이지에 접속합니다.">
<span class="fa fa-comments"></span><span class="hide-title">외부 페이지</span>
</span>
<div class="dropdown-menu" role="menu">
<a class="dropdown-item" href="https://twitter.com/our_kiwi">키위위키 트위터</a>
<a class="dropdown-item" href="https://tree.taiga.io/project/cocoa-kiwiwiki-issues-tracker">키위위키 이슈 트래커</a>
<a class="dropdown-item" href="http://status.kiwki.hoto.us">키위위키 서버 상태</a>
<a class="dropdown-item" href="http://twicewiki.net">트둥백과</a>
<a class="dropdown-item" href="https://bbs.kiwki.us/">키위위키 게시판</a>
</div>
</li>
<li class="nav-item dropdown">
<?php echo Linker::linkKnown( SpecialPage::getTitleFor( 'Specialpages', null ), '<span class="fa fa-gear"></span><span class="hide-title">도구</span>', array( 'class' => 'nav-link dropdown-toggle dropdown-toggle-fix', 'data-toggle' => 'dropdown', ' role' => 'button', 'aria-haspopup' => 'true', 'aria-expanded' => 'false', 'title' => '도구를 보여줍니다.') ); ?>
<div class="dropdown-menu" role="menu">
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'SpecialPages', null ), '특수 문서 목록', array( 'class' => 'dropdown-item', 'title' => '특수 문서 목록을 불러옵니다. [alt+shift+q]', 'accesskey' => 'q') ); ?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'upload', null ), '업로드', array( 'class' => 'dropdown-item', 'title' => '파일을 올립니다. [alt+shift+g]', 'accesskey' => 'g') ); ?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'WantedPages', null ), '필요한 문서', array( 'class' => 'dropdown-item', 'title' => '필요한 문서 목록입니다. ' ) ); ?>
<?=Linker::linkKnown( Title::makeTitle( NS_CATEGORY, '새싹글' ), '새싹글 목록', array( 'class' => 'dropdown-item' ) ); ?>
</div>
</li>
<li class="nav-item dropdown">
<?php echo Linker::linkKnown( Title::makeTitle( NS_HELP, '위키 문법' ), '<span class="fa fa-book"></span><span class="hide-title">도움말</span>', array( 'class' => 'nav-link dropdown-toggle dropdown-toggle-fix', 'data-toggle' => 'dropdown', ' role' => 'button', 'aria-haspopup' => 'true', 'aria-expanded' => 'false', 'title' => '도구를 보여줍니다.') ); ?>
<div class="dropdown-menu" role="menu">
<?=Linker::linkKnown( Title::makeTitle( NS_HELP, '위키문법' ), '위키 문법', array( 'class' => 'dropdown-item' ) ); ?>
</div>
</li>
</ul>
<?php $this->loginBox(); ?>
<?php $this->getNotification(); ?>
<?php $this->searchBox(); ?>
</nav>
<?php
}
function searchBox() {
?>
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform" class="form-inline">
<input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
<div class="input-group">
<?php echo $this->makeSearchInput( array( "class" => "form-control", "id" => "searchInput") ); ?>
<span class="input-group-btn">
<button type="submit" name="go" value="보기" id="searchGoButton" class="btn btn-secondary" type="button"><span class="fa fa-eye"></span></button>
<button type="submit" name="fulltext" value="검색" id="mw-searchButton" class="btn btn-secondary" type="button"><span class="fa fa-search"></span></button>
</span>
</div>
</form>
<?php
}
function loginBox() {
global $wgUser, $wgRequest;
?>
<div class="navbar-login">
<?php if ($wgUser->isLoggedIn()) {
if ($wgUser->getEmailAuthenticationTimestamp()) {
$email = trim($wgUser->getEmail());
$email = strtolower($email);
$email = md5($email) . "?d=identicon";
} else {
$email = "00000000000000000000000000000000?d=identicon&f=y";
}
?>
<div class="dropdown login-menu">
<a class="dropdown-toggle" type="button" id="login-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="profile-img" src="//secure.gravatar.com/avatar/<?=$email?>" />
</a>
<div class="dropdown-menu dropdown-menu-right login-dropdown-menu" aria-labelledby="login-menu">
<?=Linker::linkKnown( Title::makeTitle( NS_USER, $wgUser->getName() ), $wgUser->getName(), array( 'id' => 'pt-userpage', 'class' => 'dropdown-item', 'title' => '내 사용자 문서. [alt+shift+u]', 'accesskey' => 'u' ) ); ?>
<div class="dropdown-divider"></div>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'notifications', null ), '알림', array( 'class' => 'dropdown-item', 'title' => '알림 목록을 불러옵니다.' )); ?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() ), '내 기여 목록', array( 'class' => 'dropdown-item', 'title' => '내 기여 목록을 >불러옵니다. [alt+shift+y]', 'accesskey' => 'y' ) ); ?>
<?=Linker::linkKnown( Title::makeTitle( NS_USER_TALK, $wgUser->getName() ), '내 토론 문서', array( 'class' => 'dropdown-item', 'title' => '내 토론 문서. [alt+shift+m]', 'accesskey' => 'm' ) ); ?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'watchlist', null ), '내 주시 문서', array( 'class' => 'dropdown-item', 'title' => '주시문서를 불러옵니다. [alt+shift+l]', 'accesskey' => 'l' ) ); ?>
<div class="dropdown-divider"></div>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'preferences', null ), '환경설정', array( 'class' => 'dropdown-item', 'title' => '환경설정을 불러옵니다.' ) ); ?>
<div class="dropdown-divider view-logout"></div>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'logout', null ), '로그아웃', array( 'class' => 'dropdown-item view-logout', 'title' => '로그아웃' ) ); ?></li>
</div>
</div>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'logout', null ), '<span class="fa fa-sign-out"></span>', array( 'class' => 'hide-logout logout-btn', 'title' => '로그아웃' ) ); ?>
<?php } else { ?>
<a href="#" class="none-outline" data-toggle="modal" data-target="#login-modal">
<span class="fa fa-sign-in"></span>
</a>
<?php } ?>
</div>
<?php
}
function login_modal() {
?>
<div class="modal fade login-modal" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="login-modalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">로그인</h4>
</div>
<div class="modal-body">
<div id="modal-login-alert" class="alert alert-hidden alert-danger" role="alert">
</div>
<form id="modal-loginform" name="userlogin" class="modal-loginform" method="post" onsubmit="return LoginManage('<?php $this->html( 'title' ); ?>');">
<input class="loginText form-control" id="wpName1" tabindex="1" placeholder="사용자 계정 이름을 입력하세요" value="" name="lgname">
<label for="inputPassword" class="sr-only">Password</label>
<input class="loginPassword form-control" id="wpPassword1" tabindex="2" placeholder="비밀번호를 입력하세요" type="password" name="lgpassword">
<div class="modal-checkbox">
<input name="lgremember" type="checkbox" value="1" id="lgremember" tabindex="3">
<label for="lgremember">로그인 상태를 유지하기</label>
</div>
<input class="btn btn-success btn-block" type="submit" value="로그인" tabindex="4">
<a href="/index.php?title=<?=SpecialPage::getTitleFor( 'UserLogin', null ); ?>&type=signup&returnto=<?php $this->html( 'title' ); ?>" tabindex="5" class="btn btn-primary btn-block" type="submit"><?php $this->msg( 'userlogin-joinproject' ); ?></a>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'PasswordReset', null ), '비밀번호를 잊으셨나요?', array() ); ?>
<input type="hidden" name="action" value="login">
<input type="hidden" name="format" value="json">
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<?php
}
function live_recent() {
?>
<div class="live-recent">
<div class="live-recent-header">
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="javascript:" class="nav-link active" id="liberty-recent-tab1">최근바뀜</a>
</li>
<li class="nav-item">
<a href="javascript:" class="nav-link" id="liberty-recent-tab2">최근토론</a>
</li>
</ul>
</div>
<div class="live-recent-content">
<ul class = "live-recent-list" id="live-recent-list">
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
<li><span class="recent-item"> </span></li>
</ul>
</div>
<div class="live-recent-footer">
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'Recentchanges', null ), '<span class="label label-info">더보기</span>'); ?>
</div>
</div>
<?php
}
function contents_toolbox() {
global $wgUser;
$title = $this->getSkin()->getTitle();
$revid = $this->getSkin()->getRequest()->getText( 'oldid' );
$watched = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) ? 'unwatch' : 'watch';
$user = ( $wgUser->isLoggedIn() ) ? array_shift($userLinks) : array_pop($userLinks);
if ( $title->getNamespace() != NS_SPECIAL ) {
$companionTitle = $title->isTalkPage() ? $title->getSubjectPage() : $title->getTalkPage();
?>
<div class="content-tools">
<div class="btn-group" role="group" aria-label="content-tools">
<?=Linker::linkKnown( $title, '읽기', array( 'class' => 'btn btn-secondary tools-btn', 'title' => '문서 캐쉬를 새로 지정하여 문서를 불러옵니다. [alt+shift+p]', 'accesskey' => 'p' ), array( 'action' => 'purge' ) ); ?>
<?php
if ($revid) {
$editaction = array( 'action' => 'edit', 'oldid' => $revid );
} else {
$editaction = array( 'action' => 'edit' );
}
?>
<?=Linker::linkKnown( $title, '편집', array( 'class' => 'btn btn-secondary tools-btn', 'title' => '문서를 편집합니다. [alt+shift+e]', 'accesskey' => 'e' ), $editaction ); ?>
<?=Linker::linkKnown( $title, '추가', array( 'class' => 'btn btn-secondary tools-btn', 'title' => '새 문단을 추가합니다. [alt+shift+n]', 'accesskey' => 'n' ), array( 'action' => 'edit', 'section' => 'new' ) ); ?>
<?php
if ($companionTitle) {
if ($title->getNamespace() == NS_TALK || $title->getNamespace() == NS_PROJECT_TALK || $title->getNamespace() == NS_FILE_TALK || $title->getNamespace() == NS_TEMPLATE_TALK) {
$titlename = '본문';
} else {
$titlename = '토론';
}
echo Linker::linkKnown( $companionTitle, $titlename, array( 'class' => 'btn btn-secondary tools-btn', 'title' => $titlename.'을 불러옵니다. [alt+shift+t]', 'accesskey' => 't') );
}
?>
<?=Linker::linkKnown( $title, '기록', array( 'class' => 'btn btn-secondary tools-btn', 'title' => '문서의 편집 기록을 불러옵니다. [alt+shift+h]', 'accesskey' => 'h' ), array( 'action' => 'history' ) ); ?>
<button type="button" class="btn btn-secondary tools-btn dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right" role="menu">
<?php
if ($watched != 'watch') {
$watchname = '주시해제';
} else {
$watchname = '주시';
}
echo Linker::linkKnown( $title, $watchname, array('class' => 'dropdown-item'), array( 'action' => $mode ) );
?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'WhatLinksHere', $title ), '역링크', array('class' => 'dropdown-item') ); ?>
<?=Linker::linkKnown( SpecialPage::getTitleFor( 'Movepage', $title ), '옮기기', array( 'class' => 'dropdown-item', 'title' => '문서를 옮깁니다. [alt+shift+b]', 'accesskey' => 'b' )); ?>
<?php
if ( $title->quickUserCan( 'protect', $user ) ) { ?>
<div class="dropdown-divider"></div>
<?=Linker::linkKnown( $title, '보호', array( 'class' => 'dropdown-item', 'title' => '문서를 보호합니다. [alt+shift+s]', 'accesskey' => 's' ), array( 'action' => 'protect' ) ); ?>
<?php } ?>
<?php if ( $title->quickUserCan( 'delete', $user ) ) { ?>
<div class="dropdown-divider"></div>
<?=Linker::linkKnown( $title, '삭제', array( 'class' => 'dropdown-item', 'title' => '문서를 삭제합니다. [alt+shift+d]', 'accesskey' => 'd' ), array( 'action' => 'delete' ) ); ?>
<?php }
?>
</div>
</div>
</div>
<?php
}
}
function footer() {
foreach ( $this->getFooterLinks() as $category => $links ) {
?>
<ul class="footer-<?=$category;?>">
<?php foreach ( $links as $link ) {
?>
<li class="footer-<?=$category;?>-<?=$link;?>"><?php $this->html( $link ); ?></li>
<?php
}
?>
</ul>
<?php
}
$footericons = $this->getFooterIcons( "icononly" );
if ( count( $footericons ) > 0 ) {
?>
<ul class="footer-icons">
<?php
foreach ( $footericons as $blockName => $footerIcons ) {
?>
<li class="footer-<?=htmlspecialchars( $blockName );?>ico">
<?php
foreach ( $footerIcons as $icon ) {
echo $this->getSkin()->makeFooterIcon( $icon );
}
?>
</li>
<?php
}
?>
</ul>
<?php
}
}
function getNotification() {
$personalTools = $this->getPersonalTools();
$noti_count = $personalTools['notifications']['links']['0']['text'];
if ($noti_count != "0") {
?>
<div id="pt-notifications" class="navbar-notification">
<a href="#"><span class="label label-danger"><?=$noti_count;?></span></a>
</div>
<?php
}
}
} // end of class