1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Flynt\Init; |
4
|
|
|
|
5
|
|
|
require_once __DIR__ . '/Utils/FileLoader.php'; |
6
|
|
|
|
7
|
|
|
use Flynt; |
8
|
|
|
use Flynt\Utils\Asset; |
9
|
|
|
use Flynt\Utils\Feature; |
10
|
|
|
use Flynt\Utils\FileLoader; |
11
|
|
|
use Flynt\Utils\StringHelpers; |
12
|
|
|
|
13
|
|
|
FileLoader::loadPhpFiles('inc/Utils'); |
14
|
|
|
|
15
|
|
|
add_action('after_setup_theme', __NAMESPACE__ . '\\initTheme'); |
16
|
|
|
add_action('after_setup_theme', __NAMESPACE__ . '\\loadFeatures', 100); |
17
|
|
|
|
18
|
|
|
function initTheme() |
19
|
|
|
{ |
20
|
|
|
// initialize plugin defaults |
21
|
|
|
Flynt\initDefaults(); |
22
|
|
|
|
23
|
|
|
// Set to true to load all assets from a CDN if there is one specified |
24
|
|
|
Asset::loadFromCdn(false); |
25
|
|
|
|
26
|
|
|
// WP Stuff |
27
|
|
|
add_theme_support('title-tag'); |
28
|
|
|
add_theme_support('post-thumbnails'); |
29
|
|
|
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio')); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
function loadFeatures() |
33
|
|
|
{ |
34
|
|
|
$basePath = get_template_directory() . '/dist/Features'; |
35
|
|
|
|
36
|
|
|
if (!is_dir($basePath)) { |
37
|
|
|
trigger_error( |
38
|
|
|
"Failed loading Features! {$basePath} does not exist! Did you run `flynt start` yet?", |
39
|
|
|
E_USER_WARNING |
40
|
|
|
); |
41
|
|
|
return; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
Feature::register('flynt-youtube-no-cookie-embed', $basePath); |
45
|
|
|
|
46
|
|
|
// register all components in 'Components' folder |
47
|
|
|
Feature::register('flynt-components', $basePath, [get_template_directory() . '/dist/Components/']); |
48
|
|
|
|
49
|
|
|
// register all custom post types |
50
|
|
|
Feature::register('flynt-custom-post-types', $basePath, [[ |
51
|
|
|
'dir' => get_template_directory() . '/config/customPostTypes/', |
52
|
|
|
'fileName' => 'config.json' |
53
|
|
|
]]); |
54
|
|
|
|
55
|
|
|
// register all custom taxonomies |
56
|
|
|
Feature::register('flynt-custom-taxonomies', $basePath, [[ |
57
|
|
|
'dir' => get_template_directory() . '/config/customTaxonomies/' |
58
|
|
|
]]); |
59
|
|
|
|
60
|
|
|
// initialize ACF Field Groups and Option Pages |
61
|
|
|
Feature::register('flynt-acf', $basePath, [[ |
62
|
|
|
'FieldLoader', |
63
|
|
|
'FieldGroupComposer', |
64
|
|
|
'OptionPages', |
65
|
|
|
'FlexibleContentToggle', |
66
|
|
|
'GoogleMaps' |
67
|
|
|
]]); |
68
|
|
|
|
69
|
|
|
// enable admin notices |
70
|
|
|
Feature::register('flynt-admin-notices', $basePath); |
71
|
|
|
|
72
|
|
|
// use timber rendering |
73
|
|
|
Feature::register('flynt-timber-loader', $basePath); |
74
|
|
|
|
75
|
|
|
// load jQuery in footer by default |
76
|
|
|
Feature::register('flynt-jquery', $basePath); |
77
|
|
|
|
78
|
|
|
// clean up some things |
79
|
|
|
Feature::register('flynt-clean-head', $basePath); |
80
|
|
|
Feature::register('flynt-clean-rss', $basePath); |
81
|
|
|
Feature::register('flynt-mime-types', $basePath); |
82
|
|
|
Feature::register('flynt-remove-editor', $basePath); |
83
|
|
|
Feature::register('flynt-tiny-mce', $basePath); |
84
|
|
|
Feature::register('flynt-base-style', $basePath); |
85
|
|
|
|
86
|
|
|
// add components previews |
87
|
|
|
Feature::register('flynt-admin-component-preview', $basePath); |
88
|
|
|
|
89
|
|
|
// google analytics |
90
|
|
|
Feature::register('flynt-google-analytics', $basePath); |
91
|
|
|
|
92
|
|
|
// hide protected posts |
93
|
|
|
Feature::register('flynt-hide-protected-posts', $basePath); |
94
|
|
|
|
95
|
|
|
// move yoast seo plugin box to the bottom of the backend interface |
96
|
|
|
Feature::register('flynt-yoast-to-bottom', $basePath); |
97
|
|
|
|
98
|
|
|
Feature::register('flynt-password-form', $basePath); |
99
|
|
|
Feature::register('flynt-external-script-loader', $basePath); |
100
|
|
|
Feature::register('flynt-lodash', $basePath); |
101
|
|
|
Feature::register('flynt-component-log-server', $basePath); |
102
|
|
|
|
103
|
|
|
do_action('Flynt/afterRegisterFeatures', $basePath); |
104
|
|
|
} |
105
|
|
|
|