Skip to content

Commit 41402ff

Browse files
committed
Theme check
1 parent 6c05e13 commit 41402ff

18 files changed

+96
-63
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* Fix gallery shortcode compatibility with jetpack tiled gallery
3939
* Gravity Forms: remove obsolete scss
4040
* Gravity Forms: ajax forms javascript non-render blocking
41-
* Use new wordpress functions: the_archive_title, the_archive_description, the_posts_pagination
41+
* Use new WordPress functions: the_archive_title, the_archive_description, the_posts_pagination
4242
* Fix <time> in ISO 8601 format
4343
* Remove custom breadcrumb function in favor of Yoast SEO breadcrumb function
4444

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It includes many functions from:
88
* Bones (https://github.com/eddiemachado/bones)
99
* Alien Ship (https://github.com/mindctrl/alienship)
1010
* Roots (https://github.com/retlehs/roots)
11-
* Wordpress Bootstrap (https://github.com/320press/wordpress-bootstrap)
11+
* WordpPress Bootstrap (https://github.com/320press/wordpress-bootstrap)
1212

1313
Features
1414
-----------

form-login.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</div>
4747

4848
<?php
49-
do_action('login_form'); // Wordpress hook
49+
do_action('login_form'); // WordPress hook
5050
do_action_ref_array('tml_login_form', array(&$template)); // TML hook
5151
?>
5252

form-lostpassword.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222

2323
<?php
24-
do_action('lostpassword_form'); // Wordpress hook
24+
do_action('lostpassword_form'); // WordPress hook
2525
do_action_ref_array('tml_lostpassword_form', array(&$template)); // TML hook
2626
?>
2727
<div class="form-group">

form-register.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</div>
2929

3030
<?php
31-
do_action('register_form'); // Wordpress hook
31+
do_action('register_form'); // WordPress hook
3232
do_action_ref_array('tml_register_form', array(&$template)); //TML hook
3333
?>
3434

form-resetpass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</div>
3232

3333
<?php
34-
do_action('resetpassword_form'); // Wordpress hook
34+
do_action('resetpassword_form'); // WordPress hook
3535
do_action_ref_array('tml_resetpassword_form', array($template)); // TML hook
3636
?>
3737
<div class="form-actions">

inc/admin/customizer.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ function stormbringer_customize_register( $wp_customize ) {
118118
'libraries_'.$librarie_name.'',
119119
array(
120120
'default' => '1',
121-
//'transport' => 'postMessage',
122-
//'sanitize_callback' => 'sanitize_text_field'
121+
'transport' => 'refresh',
122+
'sanitize_callback' => 'absint'
123123
)
124124
);
125125
$wp_customize->add_control(
@@ -242,8 +242,8 @@ function stormbringer_customize_register( $wp_customize ) {
242242
'cuztom',
243243
array(
244244
'default' => 0,
245-
//'transport' => 'postMessage',
246-
//'sanitize_callback' => 'sanitize_text_field'
245+
'transport' => 'postMessage',
246+
'sanitize_callback' => 'absint'
247247
)
248248
);
249249
$wp_customize->add_control(
@@ -264,7 +264,12 @@ function stormbringer_customize_register( $wp_customize ) {
264264
) );
265265

266266
// Preprocessor
267-
$wp_customize->add_setting('bootstrap_preprocessor', ['default' => 'scss']);
267+
$wp_customize->add_setting('bootstrap_preprocessor', [
268+
'default' => 'scss',
269+
'transport' => 'postMessage',
270+
'sanitize_callback' => 'absint'
271+
]
272+
);
268273
$wp_customize->add_control('bootstrap_preprocessor', array(
269274
'label' => __('Preprocessor', 'stormbringer'),
270275
'section' => 'bootstrap',

inc/front/bodyclass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function stormbringer_body_class( $classes = '' ) {
1919
global $current_user;
2020

2121
$classes[] = 'wordpress';
22-
$classes[] = 'dir-'.get_bloginfo( 'text_direction' );
22+
$classes[] = 'dir-'.(is_rtl()?'rtl':'notrtl');
2323
$classes[] = 'locale-'.get_locale();
2424
$classes[] = ( is_child_theme() ? 'child-theme' : 'parent-theme' );
2525

inc/front/scripts.php

+58-33
Original file line numberDiff line numberDiff line change
@@ -49,68 +49,93 @@ function stormbringer_jquery_footer () {
4949
*/
5050
function stormbringer_js_libraries_footer() {
5151

52-
if(current_theme_supports('libraries')) {
52+
if ( current_theme_supports( 'libraries' ) ) {
53+
54+
$lang = get_theme_mod( 'lang' );
5355

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;
6060

6161

62-
$libraries = get_theme_support('libraries')[0];
62+
$libraries = get_theme_support( 'libraries' )[0];
6363

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 );
6667
}
6768

6869
// 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 );
7174
}
7275

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 );
7580
}
7681

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 );
7986
}
8087

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 );
8392
}
8493

8594
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 );
8798
}
8899

89100
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 );
91104
}
92105

93106
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 );
95110
}
96111

97112
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 );
99116
}
100117

101118
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 );
103122
}
104123

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 );
107128
}
108129

109-
if(@$libraries['bootstrap-datepicker'] && get_theme_mod('libraries_bootstrap-datepicker', true) ){
130+
if ( @$libraries['bootstrap-datepicker'] && get_theme_mod( 'libraries_bootstrap-datepicker', true ) ) {
110131

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 );
114139
}
115140
}
116141

@@ -187,12 +212,12 @@ function stormbringer_config() {
187212
$stormbringer_config = [
188213
'AJAXURL' => admin_url( 'admin-ajax.php' ),
189214
'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(),
193218
'LANGUAGE' => $language,
194219
'STYLESHEET_URL' => get_bloginfo( 'stylesheet_url' ),
195-
'TEMPLATE_URL' => get_bloginfo( 'template_url' ),
220+
'TEMPLATE_URL' => get_template_directory_uri(),
196221
'ENV' => current_user_can( 'administrator' ) ? 'development' : 'production',
197222
];
198223
echo 'var stormbringer_config = ' . json_encode( $stormbringer_config, JSON_PRETTY_PRINT ) . ";\n";

inc/front/styles.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ function stormbringer_preprocessor() {
1313

1414
}
1515
else {
16-
$to_cache = array( STYLESHEETPATH . '/less/application.less' => '' );
17-
Less_Cache::$cache_dir = STYLESHEETPATH . '/css/';
16+
$to_cache = array( get_stylesheet_directory() . '/less/application.less' => '' );
17+
Less_Cache::$cache_dir = get_stylesheet_directory() . '/css/';
1818
$css_file_name = Less_Cache::Get( $to_cache );
1919
wp_register_style( 'theme', get_stylesheet_directory_uri() . '/'.$cssfile, array(), null, null );
2020
wp_enqueue_style( 'theme' );
@@ -45,7 +45,7 @@ function stormbringer_preprocessor() {
4545

4646
}
4747

48-
add_action( 'wp_enqueue_scripts', 'stormbringer_preprocessor', 100);
48+
add_action( 'wp_enqueue_scripts', 'stormbringer_preprocessor');
4949

5050

5151
function stormbringer_livereload(){
@@ -71,7 +71,7 @@ function stormbringer_livereload(){
7171
if ( ! is_admin() ) {
7272
if ( current_user_can( 'administrator' ) || $_GET['scsscompile'] == '1' ) {
7373
if ( defined( 'LIVERELOAD' ) && LIVERELOAD == true ) {
74-
$livereloadurl = get_bloginfo( 'url' ) . ':35729';
74+
$livereloadurl = home_url() . ':35729';
7575
if ( defined( 'LIVERELOAD_URL' ) ) {
7676
$livereloadurl = LIVERELOAD_URL;
7777
}
@@ -126,4 +126,4 @@ function stormbringer_css() {
126126
}
127127

128128
}
129-
add_action( 'wp_enqueue_scripts', 'stormbringer_css' );
129+
add_action( 'wp_enqueue_scripts', 'stormbringer_css', 99999 );

inc/init.php

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ function stormbringer_meta() {
3535
*/
3636
function stormbringer_support() {
3737

38+
// Declare support for title theme feature.
39+
add_theme_support( 'title-tag' );
40+
41+
// Add default posts and comments RSS feed links to head
42+
add_theme_support( 'automatic-feed-links' );
43+
44+
// Enable support for Post Thumbnails
45+
add_theme_support( 'post-thumbnails' );
46+
3847
locate_template( 'inc/front/thumbnails.php', true ); // Thumbnails for Bootstrap
3948
locate_template( 'inc/admin/customizer.php', true ); // Customizer
4049

inc/plugins/gravityforms.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function stormbringer_gform_validation_message($message, $form)
1010
{
1111
$oldmessage = strip_tags($message);
1212
$message = '<div class="alert alert-error fade in">';
13-
$message .= '<a class="close" data-dismiss="alert">×</a>';
13+
$message .= '<a class="close" data-dismiss="alert">&times;</a>';
1414
$message .= '<strong>' . $oldmessage . '</strong>';
1515
$message .= '</div>';
1616
return $message;

inc/plugins/thememylogin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ function stormbringer_tml_template( $useTemplate, $templates ) {
177177
if($template=='profile-form.php')$template='form-profile.php';
178178
if($template=='lostpassword-form.php')$template='form-lostpassword.php';
179179
if($template=='resetpass-form.php')$template='form-resetpass.php';
180-
if (file_exists( TEMPLATEPATH . '/' . $template )) {
181-
$useTemplate = TEMPLATEPATH . '/' . $template ;
180+
if (file_exists( get_template_directory() . '/' . $template )) {
181+
$useTemplate = get_template_directory() . '/' . $template ;
182182
break;
183183
}
184184
}

page-styles.php

-6
Original file line numberDiff line numberDiff line change
@@ -2890,12 +2890,6 @@ class="btn btn-*"&gt;</code> buttons in this case, but that CSS property is not
28902890

28912891
<h2 id="glyphicons-glyphs">Available glyphs</h2>
28922892

2893-
<p>Includes 200 glyphs in font format from the Glyphicon Halflings set.
2894-
<a href="http://glyphicons.com/">Glyphicons</a> Halflings are normally not available for free, but their
2895-
creator has
2896-
made them available for Bootstrap free of cost. As a thank you, we only ask that you include a link back
2897-
to
2898-
<a href="http://glyphicons.com/">Glyphicons</a> whenever possible.</p>
28992893

29002894
<div class="bs-glyphicons">
29012895
<ul class="bs-glyphicons-list">

sidebar-blog.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php dynamic_sidebar('sidebar_blog'); ?>
1313
<?php else : ?>
1414
<div class="alert alert-warning fade in">
15-
<a class="close" data-dismiss="alert">×</a>
15+
<a class="close" data-dismiss="alert">&times;</a>
1616
<p><?php _e('Enable widgets in Sidebar Blog', 'stormbringer'); ?></p>
1717
</div>
1818
<?php endif; ?>

sidebar-home.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php dynamic_sidebar('sidebar_home'); ?>
1313
<?php else : ?>
1414
<div class="alert alert-warning fade in">
15-
<a class="close" data-dismiss="alert">×</a>
15+
<a class="close" data-dismiss="alert">&times;</a>
1616
<p><?php _e('Enable widgets in Sidebar Home', 'stormbringer'); ?></p>
1717
</div>
1818
<?php endif; ?>

sidebar-shop.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php dynamic_sidebar('sidebar_shop'); ?>
1313
<?php else : ?>
1414
<div class="alert alert-warning fade in">
15-
<a class="close" data-dismiss="alert">×</a>
15+
<a class="close" data-dismiss="alert">&times;</a>
1616
<p><?php _e('Enable widgets in Sidebar Shop', 'stormbringer'); ?></p>
1717
</div>
1818
<?php endif; ?>

sidebar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php dynamic_sidebar('sidebar_main'); ?>
1313
<?php else : ?>
1414
<div class="alert alert-warning fade in">
15-
<a class="close" data-dismiss="alert">×</a>
15+
<a class="close" data-dismiss="alert">&times;</a>
1616
<p><?php _e('Enable widgets in Sidebar', 'stormbringer'); ?></p>
1717
</div>
1818
<?php endif; ?>

0 commit comments

Comments
 (0)