@@ -49,68 +49,93 @@ function stormbringer_jquery_footer () {
49
49
*/
50
50
function stormbringer_js_libraries_footer () {
51
51
52
- if (current_theme_supports ('libraries ' )) {
52
+ if ( current_theme_supports ( 'libraries ' ) ) {
53
+
54
+ $ lang = get_theme_mod ( 'lang ' );
53
55
54
- $ lang = get_theme_mod ( 'lang ' );
55
-
56
- // Polylang language
57
- if (function_exists ('pll_current_language ' )):
58
- $ lang = pll_current_language ();
59
- endif ;
56
+ // Polylang language
57
+ if ( function_exists ( 'pll_current_language ' ) ):
58
+ $ lang = pll_current_language ();
59
+ endif ;
60
60
61
61
62
- $ libraries = get_theme_support ('libraries ' )[0 ];
62
+ $ libraries = get_theme_support ( 'libraries ' )[0 ];
63
63
64
- if (@$ libraries ['bootstrap ' ] && get_theme_mod ('libraries_bootstrap ' , true )){
65
- wp_enqueue_script ( 'bootstrap ' , '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/ ' .$ libraries ['bootstrap ' ].'/js/bootstrap.min.js ' , array ('jquery ' ), null , true );
64
+ if ( @$ libraries ['bootstrap ' ] && get_theme_mod ( 'libraries_bootstrap ' , true ) ) {
65
+ wp_enqueue_script ( 'bootstrap ' , '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/ ' . $ libraries ['bootstrap ' ] . '/js/bootstrap.min.js ' ,
66
+ array ( 'jquery ' ), null , true );
66
67
}
67
68
68
69
// Optionnal libraries
69
- if (@$ libraries ['jquery-cycle ' ] && get_theme_mod ('libraries_jquery-cycle ' , true )){
70
- wp_enqueue_script ('jquery-cycle ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery.cycle/ ' .$ libraries ['jquery-cycle ' ].'/jquery.cycle.all.min.js ' , array ('jquery ' ), null , true );
70
+ if ( @$ libraries ['jquery-cycle ' ] && get_theme_mod ( 'libraries_jquery-cycle ' , true ) ) {
71
+ wp_enqueue_script ( 'jquery-cycle ' ,
72
+ '//cdnjs.cloudflare.com/ajax/libs/jquery.cycle/ ' . $ libraries ['jquery-cycle ' ] . '/jquery.cycle.all.min.js ' , array ( 'jquery ' ), null ,
73
+ true );
71
74
}
72
75
73
- if (@$ libraries ['jquery-easing ' ] && get_theme_mod ('libraries_jquery-easing ' , true )){
74
- wp_enqueue_script ('jquery-easing ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery-easing/ ' .$ libraries ['jquery-easing ' ].'/jquery.easing.min.js ' , array ('jquery ' ), null , true );
76
+ if ( @$ libraries ['jquery-easing ' ] && get_theme_mod ( 'libraries_jquery-easing ' , true ) ) {
77
+ wp_enqueue_script ( 'jquery-easing ' ,
78
+ '//cdnjs.cloudflare.com/ajax/libs/jquery-easing/ ' . $ libraries ['jquery-easing ' ] . '/jquery.easing.min.js ' , array ( 'jquery ' ), null ,
79
+ true );
75
80
}
76
81
77
- if (@$ libraries ['jquery-mousewheel ' ] && get_theme_mod ('libraries_jquery-mousewheel ' , true ) ){
78
- wp_enqueue_script ('jquery-mousewheel ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/ ' .$ libraries ['jquery-mousewheel ' ].'/jquery.mousewheel.min.js ' , array ('jquery ' ), null , true );
82
+ if ( @$ libraries ['jquery-mousewheel ' ] && get_theme_mod ( 'libraries_jquery-mousewheel ' , true ) ) {
83
+ wp_enqueue_script ( 'jquery-mousewheel ' ,
84
+ '//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/ ' . $ libraries ['jquery-mousewheel ' ] . '/jquery.mousewheel.min.js ' ,
85
+ array ( 'jquery ' ), null , true );
79
86
}
80
87
81
- if ( @$ libraries ['jquery-validate ' ] && get_theme_mod ( 'libraries_jquery-validate ' , true ) ) {
82
- wp_enqueue_script ('jquery-validate ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery-validate/ ' .$ libraries ['jquery-validate ' ].'/jquery.validate.min.js ' , array ('jquery ' ), null , true );
88
+ if ( @$ libraries ['jquery-validate ' ] && get_theme_mod ( 'libraries_jquery-validate ' , true ) ) {
89
+ wp_enqueue_script ( 'jquery-validate ' ,
90
+ '//cdnjs.cloudflare.com/ajax/libs/jquery-validate/ ' . $ libraries ['jquery-validate ' ] . '/jquery.validate.min.js ' , array ( 'jquery ' ),
91
+ null , true );
83
92
}
84
93
85
94
if ( @$ libraries ['jquery-cookie ' ] && get_theme_mod ( 'libraries_jquery-cookie ' , true ) ) {
86
- wp_enqueue_script ('jquery-cookie ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/ ' .$ libraries ['jquery-cookie ' ].'/jquery.cookie.min.js ' , array ('jquery ' ), null , true );
95
+ wp_enqueue_script ( 'jquery-cookie ' ,
96
+ '//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/ ' . $ libraries ['jquery-cookie ' ] . '/jquery.cookie.min.js ' , array ( 'jquery ' ), null ,
97
+ true );
87
98
}
88
99
89
100
if ( @$ libraries ['jquery-lazyload ' ] && get_theme_mod ( 'libraries_jquery-lazyload ' , true ) ) {
90
- wp_enqueue_script ('jquery-lazyload ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/ ' .$ libraries ['jquery-lazyload ' ].'/jquery.lazyload.min.js ' , array ('jquery ' ), null , true );
101
+ wp_enqueue_script ( 'jquery-lazyload ' ,
102
+ '//cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/ ' . $ libraries ['jquery-lazyload ' ] . '/jquery.lazyload.min.js ' , array ( 'jquery ' ),
103
+ null , true );
91
104
}
92
105
93
106
if ( @$ libraries ['jquery-waypoints ' ] && get_theme_mod ( 'libraries_jquery-waypoints ' , true ) ) {
94
- wp_enqueue_script ('jquery-waypoints ' ,'//cdnjs.cloudflare.com/ajax/libs/waypoints/ ' .$ libraries ['jquery-waypoints ' ].'/jquery.waypoints.min.js ' , array ('jquery ' ), null , true );
107
+ wp_enqueue_script ( 'jquery-waypoints ' ,
108
+ '//cdnjs.cloudflare.com/ajax/libs/waypoints/ ' . $ libraries ['jquery-waypoints ' ] . '/jquery.waypoints.min.js ' , array ( 'jquery ' ), null ,
109
+ true );
95
110
}
96
111
97
112
if ( @$ libraries ['jquery-touchswipe ' ] && get_theme_mod ( 'libraries_jquery-touchswipe ' , true ) ) {
98
- wp_enqueue_script ('jquery-touchswipe ' ,'//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/ ' .$ libraries ['jquery-touchswipe ' ].'/jquery.touchSwipe.min.js ' , array ('jquery ' ), null , true );
113
+ wp_enqueue_script ( 'jquery-touchswipe ' ,
114
+ '//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/ ' . $ libraries ['jquery-touchswipe ' ] . '/jquery.touchSwipe.min.js ' ,
115
+ array ( 'jquery ' ), null , true );
99
116
}
100
117
101
118
if ( @$ libraries ['jquery-owlcarousel ' ] && get_theme_mod ( 'libraries_jquery-owlcarousel ' , true ) ) {
102
- wp_enqueue_script ( 'jquery-owlcarousel ' , '//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/ ' . $ libraries ['jquery-owlcarousel ' ] . '/owl.carousel.min.js ' , array ( 'jquery ' ), null , true );
119
+ wp_enqueue_script ( 'jquery-owlcarousel ' ,
120
+ '//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/ ' . $ libraries ['jquery-owlcarousel ' ] . '/owl.carousel.min.js ' , array ( 'jquery ' ), null ,
121
+ true );
103
122
}
104
123
105
- if (@$ libraries ['bootstrap-select ' ] && get_theme_mod ('libraries_bootstrap-select ' , true )){
106
- wp_enqueue_script ( 'bootstrap-select ' , '//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/ ' .$ libraries ['bootstrap-select ' ].'/js/bootstrap-select.min.js ' , array ('jquery ' , 'bootstrap ' ), null , true );
124
+ if ( @$ libraries ['bootstrap-select ' ] && get_theme_mod ( 'libraries_bootstrap-select ' , true ) ) {
125
+ wp_enqueue_script ( 'bootstrap-select ' ,
126
+ '//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/ ' . $ libraries ['bootstrap-select ' ] . '/js/bootstrap-select.min.js ' ,
127
+ array ( 'jquery ' , 'bootstrap ' ), null , true );
107
128
}
108
129
109
- if ( @$ libraries ['bootstrap-datepicker ' ] && get_theme_mod ('libraries_bootstrap-datepicker ' , true ) ){
130
+ if ( @$ libraries ['bootstrap-datepicker ' ] && get_theme_mod ( 'libraries_bootstrap-datepicker ' , true ) ) {
110
131
111
- wp_enqueue_script ( 'bootstrap-datepicker ' , '//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/ ' .$ libraries ['bootstrap-datepicker ' ].'/js/bootstrap-datepicker.min.js ' , array ('jquery ' , 'bootstrap ' ), null , true );
112
- if ($ lang != '' && $ lang != 'en ' ) {
113
- wp_enqueue_script ( 'bootstrap-datepicker- ' .$ lang , '//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/ ' .$ libraries ['bootstrap-datepicker ' ].'/locales/bootstrap-datepicker. ' .$ lang .'.min.js ' , array ( 'jquery ' , 'bootstrap ' , 'bootstrap-datepicker ' ), null , true );
132
+ wp_enqueue_script ( 'bootstrap-datepicker ' ,
133
+ '//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/ ' . $ libraries ['bootstrap-datepicker ' ] . '/js/bootstrap-datepicker.min.js ' ,
134
+ array ( 'jquery ' , 'bootstrap ' ), null , true );
135
+ if ( $ lang != '' && $ lang != 'en ' ) {
136
+ wp_enqueue_script ( 'bootstrap-datepicker- ' . $ lang ,
137
+ '//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/ ' . $ libraries ['bootstrap-datepicker ' ] . '/locales/bootstrap-datepicker. '
138
+ . $ lang . '.min.js ' , array ( 'jquery ' , 'bootstrap ' , 'bootstrap-datepicker ' ), null , true );
114
139
}
115
140
}
116
141
@@ -187,12 +212,12 @@ function stormbringer_config() {
187
212
$ stormbringer_config = [
188
213
'AJAXURL ' => admin_url ( 'admin-ajax.php ' ),
189
214
'THEME_LANG ' => get_bloginfo ( 'language ' ),
190
- 'STYLESHEET_DIRECTORY ' => get_bloginfo ( ' stylesheet_directory ' ),
191
- 'WPURL ' => get_bloginfo ( ' wpurl ' ),
192
- 'URL ' => get_bloginfo ( ' url ' ),
215
+ 'STYLESHEET_DIRECTORY ' => get_stylesheet_directory_uri ( ),
216
+ 'WPURL ' => site_url ( ),
217
+ 'URL ' => home_url ( ),
193
218
'LANGUAGE ' => $ language ,
194
219
'STYLESHEET_URL ' => get_bloginfo ( 'stylesheet_url ' ),
195
- 'TEMPLATE_URL ' => get_bloginfo ( ' template_url ' ),
220
+ 'TEMPLATE_URL ' => get_template_directory_uri ( ),
196
221
'ENV ' => current_user_can ( 'administrator ' ) ? 'development ' : 'production ' ,
197
222
];
198
223
echo 'var stormbringer_config = ' . json_encode ( $ stormbringer_config , JSON_PRETTY_PRINT ) . "; \n" ;
0 commit comments