This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
page.php
92 lines (87 loc) · 5.99 KB
/
page.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
<?php
/**
* Castle Page
* Last Update: 2021/04/18
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
if (@$_SERVER['HTTP_X_PJAX'] == true) {
Typecho_Response::getInstance()->setStatus(200);
echo '<title>' . Castle_Header::title($this, '', ' - ', true, false) . '</title>';
echo '<div id="moe-pjax-content"' . Castle_Header::cardTransparent() . '>';
} else {
$this->need('core/inc/header.php');
}
Typecho_Widget::widget('Widget_Security')->to($security);
?>
<div class="mdui-card moe-post-card" <?php if (Helper::options()->TocSwitch == '1') { ?> data-toc="<?php echo ($this->fields->showToc) ? 'true' : 'false'; ?>" <?php
$pageSeting = Castle_Contents::getSetting($this, 'tocPopup');
$pageSeting = (isset($pageSeting)) ? $pageSeting : [];
echo ($pageSeting === false || $pageSeting == 'false') ? ' data-popup="false"' : '';
} ?>>
<div class="mdui-card-media">
<div class="moe-card-cover-image lazyload" data-src="<?php
$cover = $this->fields->cover;
if (!empty($cover)) {
echo $cover;
} else {
Castle_Libs::randCover(true);
}
?>" style="background-image:url('');"></div>
<div class="mdui-card-media-covered">
<div class="mdui-card-primary">
<div class="mdui-card-primary-title mdui-text-truncate"><?php $this->title() ?></div>
<div class="mdui-card-primary-subtitle"><?php echo sprintf($GLOBALS['CastleLang']['page']['view'], Castle_Contents::PostView($this)); ?> | <?php echo sprintf($GLOBALS['CastleLang']['page']['comment'], $this->commentsNum); ?><?php if (Helper::options()->WordsCounterSwitch && in_array('page', Helper::options()->WordsCounterSwitch)) { ?> | <?php echo sprintf($GLOBALS['CastleLang']['page']['wordNum'], Castle_WordCounter::charactersNum($this));
} ?></div>
</div>
</div>
</div>
<div class="mdui-card-header">
<img class="mdui-card-header-avatar" src="<?php echo (Helper::options()->siteAvatar) ? Helper::options()->siteAvatar : Castle_Libs::resources('static/img/avatar.jpg'); ?>" />
<div class="mdui-card-header-title"><?php $this->author(); ?></div>
<div class="mdui-card-header-subtitle"><?php $this->date($GLOBALS['CastleLang']['page']['time']); ?></div>
<div class="mdui-card-menu">
<?php if ($this->user->hasLogin()) {
echo '<button class="mdui-btn mdui-btn-icon" mdui-menu="{target: \'#postEditMenu\', align: \'right\'}"><i class="mdui-icon material-icons">edit</i></button>';
echo '<ul class="mdui-menu" id="postEditMenu">
<li class="mdui-menu-item">
<a href="' . $this->options->adminUrl . 'write-page.php?cid=' . $this->cid . '" class="mdui-ripple" target="_blank">
<i class="mdui-menu-item-icon mdui-icon material-icons">edit</i>' . $GLOBALS['CastleLang']['page']['menu']['edit']['edit'] . '
</a>
</li>
<li class="mdui-menu-item">
<a data-delUrl="' . $security->getIndex('/action/contents-page-edit?do=delete&cid=' . $this->cid) . '" class="mdui-ripple mdui-text-color-red-accent" onclick="return CastlePost.delPost(this, \'' . $this->title . '\');">
<i class="mdui-menu-item-icon mdui-icon material-icons mdui-text-color-red-accent">delete</i>' . $GLOBALS['CastleLang']['page']['menu']['edit']['delete'] . '
</a>
</li>
</ul>';
} ?>
<?php if (Helper::options()->deviceQRSwitch && in_array('page', Helper::options()->deviceQRSwitch)) {
echo '<button class="mdui-btn mdui-btn-icon" mdui-menu="{target: \'#QRcode\', align: \'right\'}"><i class="mdui-icon material-icons"></i></button>';
echo '<div class="mdui-menu" id="QRcode">
<li class="mdui-menu-item"></li>
</div>';
} ?>
</div>
</div>
<div class="mdui-divider"></div>
<div class="moe-card-content">
<?php $this->content(); ?>
<blockquote class="moe-post-card-copy">
<?php
$text = str_replace('{author}', Castle_Libs::getUserScreenName($this->stack[0]['authorId']), $GLOBALS['CastleLang']['page']['copy']);
$text = str_replace('{link}', '<a href="' . $this->permalink . '">' . $this->permalink . '</a>', $text);
$text = str_replace('{time}', date('Y-m-d H:i:s', $this->modified), $text);
$text = str_replace('{protocol}', '<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">CC BY-NC-SA 4.0</a>', $text);
echo $text
?>
</blockquote>
</div>
</div>
<?php $this->need('core/inc/comments.php'); ?>
<?php
if (@$_SERVER['HTTP_X_PJAX'] == true) {
echo '</div>';
} else {
$this->need('core/inc/footer.php');
}
?>