forked from MrMaz/infinity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
231 lines (197 loc) · 5.22 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
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
<?php
/**
* Infinity Theme: theme functions
*
* @author Marshall Sorenson <[email protected]>
* @link http://infinity.presscrew.com/
* @copyright Copyright (C) 2010-2011 Marshall Sorenson
* @license http://www.gnu.org/licenses/gpl.html GPLv2 or later
* @package Infinity
* @since 1.0
*/
//
// Read only onfiguration constants
//
// DO NOT EDIT these constants for any reason
//
/**
* Infinity version number
*/
define( 'INFINITY_VERSION', '1.0b3' );
/**
* Infinity version id number
*
* Examples:
* 1.0 = 100
* 1.5.3 = 153
* 2.6 = 260
*/
define( 'INFINITY_VERSION_ID', 100 );
/**
* Infinity theme name (slug)
*/
define( 'INFINITY_NAME', 'infinity' );
/**
* Infinity theme directory path
*/
define( 'INFINITY_THEME_DIR', realpath( get_theme_root( INFINITY_NAME ) ) . '/' . INFINITY_NAME );
/**
* Infinity theme directory url
*/
define( 'INFINITY_THEME_URL', get_theme_root_uri( INFINITY_NAME ) . '/' . INFINITY_NAME );
/**
* Infinity "base" (includes) directory path
*/
define( 'INFINITY_BASE_DIR', INFINITY_THEME_DIR . '/base' );
/**
* Infinity "base" (includes) url
*/
define( 'INFINITY_BASE_URL', INFINITY_THEME_URL . '/base' );
/**
* ICE directory path
*/
define( 'INFINITY_ICE_DIR', INFINITY_BASE_DIR . '/ice' );
/**
* ICE directory URL
*/
define( 'INFINITY_ICE_URL', INFINITY_BASE_URL . '/ice' );
/**
* Infinity's ICE implementation directory path
*/
define( 'INFINITY_ICEXT_DIR', INFINITY_BASE_DIR . '/icext' );
/**
* Infinity's ICE implementation url
*/
define( 'INFINITY_ICEXT_URL', INFINITY_BASE_URL . '/icext' );
/**
* Infinity admin directory relative path
*/
define( 'INFINITY_ADMIN_REL', 'dashboard' );
/**
* Infinity admin directory absolute path
*/
define( 'INFINITY_ADMIN_DIR', INFINITY_THEME_DIR . '/' . INFINITY_ADMIN_REL );
/**
* Infinity admin directory url
*/
define( 'INFINITY_ADMIN_URL', INFINITY_THEME_URL . '/' . INFINITY_ADMIN_REL );
/**
* Infinity AJAX url
*/
define( 'INFINITY_AJAX_URL', admin_url( 'admin-ajax.php' ) );
/**
* Infinity languages directory path
*/
define( 'INFINITY_LANGUAGES_DIR', INFINITY_THEME_DIR . '/languages' );
/**
* Infinity text domain
*/
define( 'INFINITY_TEXT_DOMAIN', INFINITY_NAME . '-theme' );
/**
* Infinity text domain alias (for code completion)
*/
define( 'infinity_text_domain', INFINITY_TEXT_DOMAIN );
/**
* Infinity admin page name
*/
define( 'INFINITY_ADMIN_PAGE', INFINITY_NAME . '-theme' );
/**
* Infinity admin templates relative directory path
*/
define( 'INFINITY_ADMIN_TPLS_REL', INFINITY_ADMIN_REL . '/templates' );
/**
* Infinity admin templates absolute directory path
*/
define( 'INFINITY_ADMIN_TPLS_DIR', INFINITY_ADMIN_DIR . '/templates' );
/**
* Infinity admin documentation directory path
*/
define( 'INFINITY_ADMIN_DOCS_DIR', INFINITY_ADMIN_DIR . '/docs' );
/**
* Infinity development mode
*/
if ( !defined( 'INFINITY_DEV_MODE' ) ) {
define( 'INFINITY_DEV_MODE', false );
}
/**
* ICE exports caching toggle
*/
if ( !defined( 'ICE_CACHE_EXPORTS' ) ) {
define( 'ICE_CACHE_EXPORTS', !INFINITY_DEV_MODE );
}
/**
* Infinity error handling
*/
if ( !defined( 'INFINITY_ERROR_HANDLING' ) ) {
define( 'INFINITY_ERROR_HANDLING', INFINITY_DEV_MODE );
}
/**
* ICE error handling
*/
if ( !defined( 'ICE_ERROR_HANDLING' ) ) {
define( 'ICE_ERROR_HANDLING', INFINITY_ERROR_HANDLING );
}
/**
* Infinity error reporting
*/
if ( !defined( 'INFINITY_ERROR_REPORTING' ) ) {
define( 'INFINITY_ERROR_REPORTING', INFINITY_DEV_MODE );
}
/**
* ICE error reporting
*/
if ( !defined( 'ICE_ERROR_REPORTING' ) ) {
define( 'ICE_ERROR_REPORTING', INFINITY_ERROR_REPORTING );
}
/**
* Load the ICE lib loader
*/
require_once( INFINITY_ICE_DIR . '/loader.php' );
// initialize ICE
ICE_Loader::init( INFINITY_ICE_URL );
// initialize enqueuer and configure actions
if ( is_admin() ) {
ICE_Enqueue::instance()
->styles_on_action( 'load-toplevel_page_' . INFINITY_ADMIN_PAGE )
->scripts_on_action( 'load-toplevel_page_' . INFINITY_ADMIN_PAGE );
} else {
ICE_Enqueue::instance()
->styles_on_action( 'wp_enqueue_scripts' )
->scripts_on_action( 'wp_enqueue_scripts' );
}
// load Infinity API
require_once( INFINITY_ICEXT_DIR . '/scheme.php' );
require_once( INFINITY_ICEXT_DIR . '/sections.php' );
require_once( INFINITY_ICEXT_DIR . '/options.php' );
require_once( INFINITY_ICEXT_DIR . '/features.php' );
require_once( INFINITY_ICEXT_DIR . '/widgets.php' );
require_once( INFINITY_ICEXT_DIR . '/screens.php' );
require_once( INFINITY_ICEXT_DIR . '/shortcodes.php' );
require_once( INFINITY_ICEXT_DIR . '/i18n.php' );
// initialize scheme
infinity_scheme_init();
// initialize components
infinity_sections_init();
infinity_options_init();
infinity_screens_init();
infinity_features_init();
infinity_widgets_init();
infinity_shortcodes_init();
// finalize scheme
infinity_scheme_finalize();
if ( is_admin() ) {
// init admin only components screens
infinity_sections_init_screen();
infinity_options_init_screen();
infinity_screens_init_screen();
infinity_widgets_init_screen();
// load admin functionality
require_once( INFINITY_ADMIN_DIR . '/loader.php' );
} else {
// init blog components screens
infinity_features_init_screen();
infinity_shortcodes_init_screen();
}
// load theme setup
require_once( INFINITY_BASE_DIR . '/setup.php' );
?>