-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.php
289 lines (269 loc) · 8.52 KB
/
index.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
<?php
/**
* Capsule UI entry point.
*
* @package capsule
*
* This file is part of the Capsule Theme for WordPress
* https://crowdfavorite.com/capsule/
*
* Copyright (c) 2020 Crowd Favorite, Ltd. All rights reserved.
* https://crowdfavorite.com
*
* **********************************************************************
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* **********************************************************************
*/
if (! isset($body_classes)) {
$body_classes = array();
}
global $cap_client;
$cap_servers = $cap_client ? $cap_client->get_servers() : array();
$blog_desc = get_bloginfo('description');
$title_description = ( is_home() && ! empty($blog_desc) ? ' - ' . $blog_desc : '' );
$permalink_structure = get_option('permalink_structure');
$search_permastruct = ( empty($permalink_structure) ) ? '0' : '1';
if (function_exists('cftf_is_filter') && cftf_is_filter()) {
$body_classes[] = 'filters-on';
}
$theme_url = trailingslashit(get_template_directory_uri());
$title = '';
if (is_home() || is_front_page()) {
$title = __('Home', 'capsule');
} elseif (function_exists('cftf_is_filter') && cftf_is_filter()) {
$title = __('Filter', 'capsule');
} elseif (is_search()) {
// Translators: %s is the search term.
$title = sprintf(__('Search: %s', 'capsule'), esc_html(get_query_var('s')));
} elseif (is_tag()) {
$term = get_queried_object();
// Translators: %s is the taxonomy term name.
$title = sprintf(__('#%s', 'capsule'), $term->name);
} elseif (is_tax('projects')) {
$term = get_queried_object();
// Translators: %s is the taxonomy term name.
$title = sprintf(__('@%s', 'capsule'), $term->name);
} elseif (is_tax('code')) {
$term = get_queried_object();
// Translators: %s is the taxonomy term name.
$title = sprintf(__('`%s', 'capsule'), $term->name);
} elseif (is_tax('code')) {
$term = get_queried_object();
// Translators: %s is the taxonomy term name.
$title = sprintf(__('`%s', 'capsule'), $term->name);
} elseif (is_author()) {
$author = get_queried_object();
// Translators: %s is the author name.
$title = sprintf(__('Author: %s', 'capsule'), $author->display_name);
}
$title = apply_filters('capsule_page_title', $title);
?>
<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html id="ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width" />
<title>
<?php
wp_title('|', true, 'right');
echo esc_html(get_bloginfo('name'), 1) . esc_html($title_description);
?>
</title>
<link rel="icon" href="<?php echo esc_url($theme_url); ?>ui/assets/icon/capsule-16.png" sizes="16x16">
<link rel="icon" href="<?php echo esc_url($theme_url); ?>ui/assets/icon/capsule-32.png" sizes="32x32">
<link rel="icon" href="<?php echo esc_url($theme_url); ?>ui/assets/icon/capsule-48.png" sizes="48x48">
<link rel="icon" href="<?php echo esc_url($theme_url); ?>ui/assets/icon/capsule-128.png" sizes="128x128">
<link rel="icon" href="<?php echo esc_url($theme_url); ?>ui/assets/icon/capsule-256.png" sizes="256x256">
<?php wp_head(); ?>
</head>
<body <?php body_class(implode(' ', $body_classes)); ?>>
<div class="container">
<nav class="main-nav">
<ul>
<?php do_action('capsule_main_nav_before'); ?>
<li>
<a
href="<?php echo esc_url(home_url('/')); ?>"
class="home icon capsule-icon-home"
title="<?php esc_attr_e('Home', 'capsule'); ?>"
>
<span class="sr-only"><?php esc_html_e('Home', 'capsule'); ?></span>
</a>
</li>
<li>
<a
href="<?php echo esc_url(admin_url('post-new.php')); ?>"
class="post-new-link icon capsule-icon-plus-circle"
title="<?php esc_attr_e('Post New', 'capsule'); ?>"
>
<span class="sr-only"><?php esc_html_e('Post New', 'capsule'); ?></span>
</a>
</li>
<li>
<a href="#projects" class="projects" title="<?php esc_attr_e('Projects', 'capsule'); ?>">
@
<span class="sr-only"><?php esc_html_e('Projects', 'capsule'); ?></span>
</a>
</li>
<li>
<a
href="#tags"
class="tags icon capsule-icon-numbersign"
title="<?php esc_attr_e('Tags', 'capsule'); ?>"
>
<span class="sr-only"><?php esc_html_e('Tags', 'capsule'); ?></span>
</a>
</li>
<?php if (! empty($cap_servers)) : ?>
<li>
<a
href="#servers"
class="servers icon capsule-icon-globe"
title="<?php esc_attr_e('Servers', 'capsule'); ?>"
>
<span class="sr-only"><?php esc_html_e('Servers', 'capsule'); ?></span>
</a>
</li>
<?php endif; ?>
<li>
<a
href="<?php echo esc_url(admin_url('admin.php?page=capsule')); ?>"
class="icon capsule-icon-cog-wheel"
title="<?php esc_attr_e('Capsule Help', 'capsule'); ?>"
>
<span class="sr-only"><?php esc_html_e('Capsule Help', 'capsule'); ?></span>
</a>
</li>
<?php do_action('capsule_main_nav_after'); ?>
<li><span class="spacer"></span></li>
</ul>
</nav>
<div id="wrap">
<header id="header">
<div class="inner">
<h1><?php echo esc_html($title); ?></h1>
<form
class="search clearfix"
action="<?php echo esc_url(home_url('/')); ?>"
method="get"
data-permastruct="<?php echo esc_attr($search_permastruct); ?>"
>
<a href="#" class="filter-toggle"><?php esc_html_e('Filters', 'capsule'); ?></a>
<input
type="text"
class="js-search"
name="s"
value="<?php echo esc_attr(get_query_var('s')); ?>"
placeholder="<?php esc_attr_e('Search @projects, #tags, `code, etc…', 'capsule'); ?>"
>
<input type="submit" value="<?php esc_attr_e('Search', 'capsule'); ?>">
</form>
</div>
<div class="filter clearfix">
<?php capsule_taxonomy_filter(); ?>
</div>
</header>
<div class="body">
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
if (is_singular()) {
include 'views/content.php';
} else {
include 'views/excerpt.php';
}
endwhile;
?>
<?php if ($wp_query->max_num_pages > 1) : ?>
<nav class="pagination clearfix">
<div class="nav-previous">
<?php next_posts_link(__('Older posts <span class="meta-nav">→</span>', 'capsule')); ?>
</div>
<div class="nav-next">
<?php previous_posts_link(__('<span class="meta-nav">←</span> Newer posts', 'capsule')); ?>
</div>
</nav>
<?php endif; ?>
<?php elseif (is_search()) : ?>
<p class="search-no-results-msg">
<?php esc_html_e('Nothing to see here… move along.', 'capsule'); ?>
</p>
<?php endif; ?>
</div>
</div>
</div>
<footer>
<p>
<a href="https://crowdfavorite.com/capsule/">Capsule</a> by
<a href="https://crowdfavorite.com">Crowd Favorite</a> · <?php wp_loginout(home_url()); ?>
</p>
</footer>
<div id="projects">
<h2><?php esc_html_e('Projects', 'capsule'); ?></h2>
<ul>
<?php
wp_list_categories(
array(
'show_option_none' => '<span class="none">' . __('(none)', 'capsule') . '</none>',
'taxonomy' => 'projects',
'title_li' => '',
)
);
?>
</ul>
</div>
<div id="tags">
<h2><?php esc_html_e('Tags', 'capsule'); ?></h2>
<ul>
<?php
wp_list_categories(
array(
'show_option_none' => '<span class="none">' . __('(none)', 'capsule') . '</none>',
'taxonomy' => 'post_tag',
'title_li' => '',
)
);
?>
</ul>
</div>
<div id="servers">
<h2><?php esc_html_e('Capsule Servers', 'capsule'); ?></h2>
<ul>
<?php
// Don't handle 0 server situations here because the menu item is hidden in that situation.
// $cap_servers set at top of page.
?>
<?php foreach ($cap_servers as $cap_server) : ?>
<?php $server = $cap_client->process_server($cap_server); ?>
<li>
<a href="<?php echo esc_url($server->url); ?>" target="_blank">
<i class="capsule-icon-open-in-new"></i>
<?php echo esc_html($server->post_title); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="connection-error"><?php esc_html_e('Lost connection to server.', 'capsule'); ?></div>
<?php if (! is_capsule_server() && ! current_user_can('unfiltered_html')) : ?>
<div class="permissions-error">
<?php esc_html_e('Capsule requires the unfiltered_html capability to work as expected.', 'capsule'); ?>
</div>
<?php endif; ?>
<?php wp_footer(); ?>
</body>
</html>