FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cherryframework4/lib/class-cherry-framework.php at develop · CherryFramework/cherryframework4 · GitHub
CherryFramework
/
cherryframework4
Public
Notifications
You must be signed in to change notification settings
Fork
30
Star
55
Code
Issues
23
Pull requests
3
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cherryframework4
/
lib
/
class-cherry-framework.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
370 lines (283 loc) · 12.3 KB
Breadcrumbs
cherryframework4
/
lib
/
class-cherry-framework.php
Copy path
File metadata and controls
370 lines (283 loc) · 12.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
/**
* Cherry Framework - The most delicious WordPress framework.
*
* @package Cherry_Framework
* @version 4.0.0
* @author Cherry Team <support@cherryframework.com>
* @copyright Copyright (c) 2012 - 2015, Cherry Team
* @link http://www.cherryframework.com/
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
// If this file is called directly, abort.
if
( !
defined
(
'
WPINC
'
) ) {
die;
}
if
( !
class_exists
(
'
Cherry_Framework
'
) ) {
/**
* The Cherry_Framework class launches the framework.
*
* It's the organizational structure behind the entire framework.
* This class should be loaded and initialized before anything
* else within the theme is called to properly use the framework.
*
* @since 4.0.0
*/
class
Cherry_Framework {
/**
* Constructor method for the Cherry_Framework class.
* This method adds other methods of the class to specific hooks within WordPress.
* It controls the load order of the required files for running the framework.
*
* @since 4.0.0
* @author Justin Tadlock <justin@justintadlock.com>
* @author Cherry Team <support@cherryframework.com>
*/
function
__construct
() {
// Global variables.
global
$
cherry
,
$
cherry_registered_static_areas
,
$
cherry_registered_statics
;
// Set up an empty class for the global $cherry object.
$
cherry
=
new
stdClass
;
// Set up a stores the static areas.
$
cherry_registered_static_areas
=
array
();
// Set up a stores the registered static elements.
$
cherry_registered_statics
=
array
();
// Define framework, parent theme, and child theme constants.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
constants
'
),
1
);
// Load the core functions/classes required by the rest of the framework.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
core
'
),
2
);
// Initialize the framework's default actions and filters.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
default_filters
'
),
3
);
// Language functions and translations setup.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
l10n
'
),
4
);
// Handle theme supported features.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
theme_support
'
),
5
);
// Load the framework includes.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
includes
'
),
12
);
// Load the framework public files.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
load_public
'
),
13
);
// Load the framework extensions.
add_action
(
'
after_setup_theme
'
,
array
(
$
this
,
'
extensions
'
),
14
);
// Load admin files.
add_action
(
'
wp_loaded
'
,
array
(
$
this
,
'
admin
'
) );
}
/**
* Defines the constant paths for use within the core framework, parent theme, and child theme.
*
* @since 4.0.0
*/
function
constants
() {
/**
* Fires before definitions the constant.
*
* @since 4.0.0
*/
do_action
(
'
cherry_constants_before
'
);
/** Sets the framework version number. */
$
template
=
get_template
();
$
framework
=
wp_get_theme
(
$
template
);
define
(
'
CHERRY_VERSION
'
,
$
framework
->
get
(
'
Version
'
) );
/** Sets the path to the parent theme directory. */
define
(
'
PARENT_DIR
'
,
get_template_directory
() );
/** Sets the path to the parent theme directory URI. */
define
(
'
PARENT_URI
'
,
get_template_directory_uri
() );
/** Sets the path to the child theme directory. */
define
(
'
CHILD_DIR
'
,
get_stylesheet_directory
() );
/** Sets the path to the child theme directory URI. */
define
(
'
CHILD_URI
'
,
get_stylesheet_directory_uri
() );
/** Sets the path to the core framework directory. */
define
(
'
CHERRY_DIR
'
,
trailingslashit
(
PARENT_DIR
) .
basename
(
dirname
(
__FILE__
) ) );
/** Sets the path to the core framework directory URI. */
define
(
'
CHERRY_URI
'
,
trailingslashit
(
PARENT_URI
) .
basename
(
dirname
(
__FILE__
) ) );
/** Sets the path to the core framework functions directory. */
define
(
'
CHERRY_FUNCTIONS
'
,
trailingslashit
(
CHERRY_DIR
) .
'
functions
'
);
/** Sets the path to the core framework classes directory. */
define
(
'
CHERRY_CLASSES
'
,
trailingslashit
(
CHERRY_DIR
) .
'
classes
'
);
/** Sets the path to the core framework admin directory. */
define
(
'
CHERRY_ADMIN
'
,
trailingslashit
(
CHERRY_DIR
) .
'
admin
'
);
/** Sets the path to the core framework extensions directory. */
define
(
'
CHERRY_EXTENSIONS
'
,
trailingslashit
(
CHERRY_DIR
) .
'
extensions
'
);
/** Sets the path to the theme config folder. */
define
(
'
PARENT_CONFIG_DIR
'
,
'
/init/config/
'
);
/** Sets relative path to the theme statics folder. */
define
(
'
PARENT_STATICS_DIR
'
,
'
/init/statics/
'
);
}
/**
* Loads the core framework functions. These files are needed before loading anything else in the
* framework because they have required functions for use.
*
* @since 4.0.0
*/
function
core
() {
/**
* Fires before loads the core framework functions.
*
* @since 4.0.0
*/
do_action
(
'
cherry_core_before
'
);
// Load the core framework functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
core.php
'
);
// Load the core framework internationalization functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
lang.php
'
);
if
( !
is_admin
() ) {
// Load the <head> functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
head.php
'
);
// Load the scripts functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
scripts.php
'
);
// Load the styles functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
styles.php
'
);
// Load Breadcrumbs builder.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-breadcrumbs.php
'
);
}
// Load media-related functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
media.php
'
);
// Load the sidebar functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
sidebars.php
'
);
// Class Cherry API JS
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-api-js.php
'
);
// Utility functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
utils.php
'
);
// Load the Cherry_Static class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-statics.php
'
);
// Load CSS compiler.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-css-compiler.php
'
);
// Load Google fonts enqueuer.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-google-fonts-enqueue.php
'
);
// Load abstract class for static registration.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-abstract-cherry-register-static.php
'
);
// Load WooCommerce compatibility module
require_once
(
trailingslashit
(
CHERRY_EXTENSIONS
) .
'
class-cherry-woocommerce.php
'
);
// Load Icons gateway for `Cherry Shortcodes` (only if plugin active).
if
(
in_array
(
'
cherry-shortcodes/cherry-shortcodes.php
'
,
apply_filters
(
'
active_plugins
'
,
get_option
(
'
active_plugins
'
) )
) ) {
require_once
(
trailingslashit
(
CHERRY_EXTENSIONS
) .
'
class-cherry-icons-gateway.php
'
);
}
}
/**
* Adds the default framework actions and filters.
*
* @since 4.0.0
*/
function
default_filters
() {
// Load the core filters.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
filters.php
'
);
}
/**
* Loads both the parent and child theme translation files.
*
* @since 4.0.0
*/
function
l10n
() {
global
$
cherry
;
// Get parent and child theme textdomains.
$
parent_textdomain
=
cherry_get_parent_textdomain
();
$
child_textdomain
=
cherry_get_child_textdomain
();
// Loads the parent theme translated strings.
$
cherry
->
textdomain_loaded
[
$
parent_textdomain
] =
load_theme_textdomain
(
$
parent_textdomain
,
PARENT_DIR
.
'
/languages
'
);
// Loads the child theme translated strings.
$
cherry
->
textdomain_loaded
[
$
child_textdomain
] =
load_child_theme_textdomain
(
$
child_textdomain
,
CHILD_DIR
.
'
/languages
'
);
}
/**
* Adds theme supported features.
*
* @since 4.0.0
*/
function
theme_support
() {
// Add default posts and comments RSS feed links to head.
add_theme_support
(
'
automatic-feed-links
'
);
// Enable support for Post Thumbnails.
add_theme_support
(
'
post-thumbnails
'
);
// Enable HTML5 markup structure.
add_theme_support
(
'
html5
'
,
array
(
'
comment-list
'
,
'
comment-form
'
,
'
search-form
'
,
'
gallery
'
,
'
caption
'
,
) );
}
/**
* Loads the framework files supported by themes and template-related functions/classes.
*
* @since 4.0.0
*/
function
includes
() {
// Load Cherry_Options_Framework class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-optionsframework.php
'
);
}
/**
* Load only frontend-related files.
*
* @since 4.0.5
* @return void
*/
function
load_public
() {
if
(
is_admin
() ) {
return
;
}
// Load Cherry_Wrapping class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-wrapping.php
'
);
// Load Cherry_Sidebar class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-sidebar.php
'
);
// Load the HTML attributes functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
attr.php
'
);
// Load the template functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template.php
'
);
// Load the comments functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-comments.php
'
);
// Load the general template functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-general.php
'
);
// Load the media template functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-media.php
'
);
// Load the post template functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-post.php
'
);
// Load the meta template functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-meta.php
'
);
// Load the custom functions that act independently of the theme templates.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
extras.php
'
);
// Load the structure functions.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
structure.php
'
);
// Load the custom template tags.
require_once
(
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
template-tags.php
'
);
// Load current page object class
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-current-page.php
'
);
// Load grabber for CSS printed directly to page content
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-css-grabber.php
'
);
// Load the post format functionality if post formats are supported.
require_if_theme_supports
(
'
post-formats
'
,
trailingslashit
(
CHERRY_FUNCTIONS
) .
'
post-formats.php
'
);
}
/**
* Load extensions (external projects). Extensions are projects that are included within the
* framework but are not a part of it. They are external projects developed outside of the
* framework. Themes must use add_theme_support( $extension ) to use a specific extension
* within the theme. This should be declared on 'after_setup_theme' no later than a priority of 11.
*
* @since 4.0.0
*/
function
extensions
() {
// Load if supported.
// require_if_theme_supports();
}
/**
* Load admin files for the framework.
*
* @since 4.0.0
*/
function
admin
() {
// Check if in the WordPress admin.
if
( !
is_admin
() ) {
return
;
}
// Class Cherry Page Builder
require_once
(
trailingslashit
(
CHERRY_ADMIN
) .
'
class-cherry-page-builder.php
'
);
// Load Cherry_Interface_Builder class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-interface-builder.php
'
);
// Load Cherry_Options_Framework_Admin class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-optionsframework-admin.php
'
);
// Load Cherry_Statics_Page class.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-statics-page.php
'
);
// Class Cherry Update.
require_once
(
trailingslashit
(
CHERRY_CLASSES
) .
'
class-cherry-update/class-cherry-theme-update.php
'
);
// Load the main admin file.
require_once
(
trailingslashit
(
CHERRY_ADMIN
) .
'
class-cherry-admin.php
'
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL