This repository has been archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
137 lines (113 loc) · 3.39 KB
/
functions.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
<?php
/**
* @file
* Theme bootstrap.
*/
/**
* Check if Tinsta theme can run on current environment.
*/
$tinsta_supports_failcheck = [
'php' => version_compare(phpversion(), '5.4.0', '<'),
'wp' => version_compare(get_bloginfo('version'), '4.6.0', '<'),
'phar' => !extension_loaded('phar'),
// @TODO add check if wp-content is writeable
];
if (count(array_filter($tinsta_supports_failcheck))) {
if (is_admin()) {
add_action('admin_notices', '_tinsta_check_notices_admin');
function _tinsta_check_notices_admin()
{
global $tinsta_supports_failcheck;
echo '<div class="error">';
if ($tinsta_supports_failcheck['php']) {
echo '<p>';
printf(__('Tinsta theme requires PHP >= 5.4.0, but you have %s. Upgrade it or contact your hosting provider. Otherwise the theme will not work.',
'tinsta'), phpversion());
echo '</p>';
}
if ($tinsta_supports_failcheck['wp']) {
global $wp_version;
echo '<p>';
printf(__('Tinsta theme requires WordPress >= 4.4.0, but you have %s. Upgrade it or contact your hosting provider. Otherwise the theme will not work.',
'tinsta'), $wp_version);
echo '</p>';
}
if ($tinsta_supports_failcheck['phar']) {
echo '<p>';
_e('Tinsta theme requires Phar support for PHP, but you don\'t have it enabled. Enable Phar for PHP or contact your hosting provider. Otherwise the theme will not work.',
'tinsta');
echo '</p>';
}
echo '<p>';
_e('Meanwhile, maintenance message is displayed on yor front-end.', 'tinsta');
echo '</p>';
echo '</div>';
}
} else {
add_action('template_redirect', '_tinsta_check_notices_frontend');
function _tinsta_check_notices_frontend()
{
wp_die(__('The site is under maintenance. We are working to get it back as soon as possible.', 'tinsta'), '',
['response' => '503']);
}
}
return false;
}
/**
* Path to static css files.
*/
if (!defined('TINSTA_STYLESHEET_CACHE_DIR')) {
define('TINSTA_STYLESHEET_CACHE_DIR', '/cache/tinsta/css');
}
/**
* Third-Party integrations.
*/
if (!defined('TINSTA_INTEGRATIONS')) {
define('TINSTA_INTEGRATIONS', true);
}
/**
* Tinsta's core functions.
*/
require __DIR__ . '/includes/functions.php';
/**
* Base theme setup.
*/
require __DIR__ . '/includes/theme.php';
/**
* Admin panel related setup.
*/
if (is_admin()) {
require __DIR__ . '/includes/admin/admin.php';
} /**
* Front End related setup.
*/ else {
require __DIR__ . '/includes/frontend/frontend.php';
}
/**
* Login/Register related setup.
*/
if (tinsta_is_login_page()) {
require __DIR__ . '/includes/frontend/login.php';
}
/**
* Customizer related setup.
*/
if (is_customize_preview()) {
require __DIR__ . '/includes/admin/customizer.php';
}
/**
* Setup integrations with other themes and plugins.
*/
if (TINSTA_INTEGRATIONS) {
foreach ((array)get_option('active_plugins', []) as $active_plugin) {
$plugin_slug = dirname($active_plugin);
$integration_include = __DIR__ . '/includes/integrations/' . dirname($active_plugin) . '.php';
if ($active_plugin && file_exists($integration_include)) {
include $integration_include;
}
}
if (!defined('TINSTA_POST_WIDGETS_REPLACE_CONTENT')) {
define('TINSTA_POST_WIDGETS_REPLACE_CONTENT', true);
require __DIR__ . '/includes/integrations/-no-layouting-plugin.php';
}
}