@@ -14,99 +14,99 @@ |
||
14 | 14 | */ |
15 | 15 | class Sensei_Theme_Integration_Loader { |
16 | 16 | |
17 | - /** |
|
18 | - * @var array |
|
19 | - * Holding a reference core supported themes |
|
20 | - */ |
|
21 | - protected $themes; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var string |
|
25 | - * reference to the theme currently active on this site |
|
26 | - */ |
|
27 | - protected $active_theme; |
|
28 | - |
|
29 | - public function __construct() { |
|
30 | - |
|
31 | - $this->setup_themes(); |
|
32 | - $this->setup_currently_active_theme(); |
|
33 | - $this->possibly_load_supported_theme_wrappers(); |
|
34 | - |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Setup the theme slugs supported by Sensei Core |
|
39 | - * |
|
40 | - * @since 1.9.0 |
|
41 | - */ |
|
42 | - private function setup_themes(){ |
|
43 | - |
|
44 | - $this->themes = array( |
|
45 | - 'twentyeleven', |
|
46 | - 'twentytwelve', |
|
47 | - 'twentythirteen', |
|
48 | - 'twentyfourteen', |
|
49 | - 'twentyfifteen', |
|
50 | - 'twentysixteen', |
|
51 | - 'storefront', |
|
52 | - ); |
|
53 | - |
|
54 | - }// end setup themes |
|
55 | - |
|
56 | - /** |
|
57 | - * Setup the currently active theme |
|
58 | - * |
|
59 | - * @since 1.9.0 |
|
60 | - */ |
|
61 | - private function setup_currently_active_theme(){ |
|
62 | - |
|
63 | - $this->active_theme = get_option('template'); |
|
64 | - |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Remove default Sensei wrappers and load |
|
69 | - * supported wrappers if the current theme is |
|
70 | - * a theme we have an integration for within core. |
|
71 | - * |
|
72 | - * @since 1.9.0 |
|
73 | - */ |
|
74 | - private function possibly_load_supported_theme_wrappers(){ |
|
75 | - |
|
76 | - if ( in_array( $this->active_theme, $this->themes ) ){ |
|
77 | - |
|
78 | - // setup file and class names |
|
79 | - $supported_theme_class_file = trailingslashit( Sensei()->plugin_path ) . 'includes/theme-integrations/' . $this->active_theme . '.php'; |
|
80 | - $supported_theme_class_name = 'Sensei_'. ucfirst( $this->active_theme ); |
|
81 | - |
|
82 | - // add name of theme as body class for detailed styling. |
|
83 | - add_filter( 'body_class', 'sensei_current_theme' ); |
|
84 | - function sensei_current_theme( $classes ) { |
|
85 | - $sensei_template = get_option( 'template' ); |
|
86 | - $classes[] = 'sensei-'. $sensei_template; |
|
87 | - return $classes; |
|
88 | - } |
|
89 | - |
|
90 | - // load the file or exit if there is no file for this theme |
|
91 | - if( ! file_exists( $supported_theme_class_file ) ){ |
|
92 | - return; |
|
93 | - } |
|
94 | - include_once( $supported_theme_class_file ); |
|
95 | - include_once( 'twentytwelve.php' ); |
|
96 | - //initialize the class or exit if there is no class for this theme |
|
97 | - if( ! class_exists( $supported_theme_class_name ) ){ |
|
98 | - return; |
|
99 | - } |
|
100 | - $supported_theme = new $supported_theme_class_name; |
|
101 | - |
|
102 | - // remove default wrappers |
|
103 | - remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
104 | - remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
105 | - |
|
106 | - // load the supported theme wrappers |
|
107 | - add_action( 'sensei_before_main_content', array( $supported_theme, 'wrapper_start' ), 10 ); |
|
108 | - add_action( 'sensei_after_main_content', array( $supported_theme, 'wrapper_end' ), 10 ); |
|
109 | - } |
|
110 | - } |
|
17 | + /** |
|
18 | + * @var array |
|
19 | + * Holding a reference core supported themes |
|
20 | + */ |
|
21 | + protected $themes; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var string |
|
25 | + * reference to the theme currently active on this site |
|
26 | + */ |
|
27 | + protected $active_theme; |
|
28 | + |
|
29 | + public function __construct() { |
|
30 | + |
|
31 | + $this->setup_themes(); |
|
32 | + $this->setup_currently_active_theme(); |
|
33 | + $this->possibly_load_supported_theme_wrappers(); |
|
34 | + |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Setup the theme slugs supported by Sensei Core |
|
39 | + * |
|
40 | + * @since 1.9.0 |
|
41 | + */ |
|
42 | + private function setup_themes(){ |
|
43 | + |
|
44 | + $this->themes = array( |
|
45 | + 'twentyeleven', |
|
46 | + 'twentytwelve', |
|
47 | + 'twentythirteen', |
|
48 | + 'twentyfourteen', |
|
49 | + 'twentyfifteen', |
|
50 | + 'twentysixteen', |
|
51 | + 'storefront', |
|
52 | + ); |
|
53 | + |
|
54 | + }// end setup themes |
|
55 | + |
|
56 | + /** |
|
57 | + * Setup the currently active theme |
|
58 | + * |
|
59 | + * @since 1.9.0 |
|
60 | + */ |
|
61 | + private function setup_currently_active_theme(){ |
|
62 | + |
|
63 | + $this->active_theme = get_option('template'); |
|
64 | + |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Remove default Sensei wrappers and load |
|
69 | + * supported wrappers if the current theme is |
|
70 | + * a theme we have an integration for within core. |
|
71 | + * |
|
72 | + * @since 1.9.0 |
|
73 | + */ |
|
74 | + private function possibly_load_supported_theme_wrappers(){ |
|
75 | + |
|
76 | + if ( in_array( $this->active_theme, $this->themes ) ){ |
|
77 | + |
|
78 | + // setup file and class names |
|
79 | + $supported_theme_class_file = trailingslashit( Sensei()->plugin_path ) . 'includes/theme-integrations/' . $this->active_theme . '.php'; |
|
80 | + $supported_theme_class_name = 'Sensei_'. ucfirst( $this->active_theme ); |
|
81 | + |
|
82 | + // add name of theme as body class for detailed styling. |
|
83 | + add_filter( 'body_class', 'sensei_current_theme' ); |
|
84 | + function sensei_current_theme( $classes ) { |
|
85 | + $sensei_template = get_option( 'template' ); |
|
86 | + $classes[] = 'sensei-'. $sensei_template; |
|
87 | + return $classes; |
|
88 | + } |
|
89 | + |
|
90 | + // load the file or exit if there is no file for this theme |
|
91 | + if( ! file_exists( $supported_theme_class_file ) ){ |
|
92 | + return; |
|
93 | + } |
|
94 | + include_once( $supported_theme_class_file ); |
|
95 | + include_once( 'twentytwelve.php' ); |
|
96 | + //initialize the class or exit if there is no class for this theme |
|
97 | + if( ! class_exists( $supported_theme_class_name ) ){ |
|
98 | + return; |
|
99 | + } |
|
100 | + $supported_theme = new $supported_theme_class_name; |
|
101 | + |
|
102 | + // remove default wrappers |
|
103 | + remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
104 | + remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
105 | + |
|
106 | + // load the supported theme wrappers |
|
107 | + add_action( 'sensei_before_main_content', array( $supported_theme, 'wrapper_start' ), 10 ); |
|
108 | + add_action( 'sensei_after_main_content', array( $supported_theme, 'wrapper_end' ), 10 ); |
|
109 | + } |
|
110 | + } |
|
111 | 111 | |
112 | 112 | } /// end class |
113 | 113 | \ No newline at end of file |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @since 1.9.0 |
41 | 41 | */ |
42 | - private function setup_themes(){ |
|
42 | + private function setup_themes() { |
|
43 | 43 | |
44 | 44 | $this->themes = array( |
45 | 45 | 'twentyeleven', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @since 1.9.0 |
60 | 60 | */ |
61 | - private function setup_currently_active_theme(){ |
|
61 | + private function setup_currently_active_theme() { |
|
62 | 62 | |
63 | 63 | $this->active_theme = get_option('template'); |
64 | 64 | |
@@ -71,41 +71,41 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @since 1.9.0 |
73 | 73 | */ |
74 | - private function possibly_load_supported_theme_wrappers(){ |
|
74 | + private function possibly_load_supported_theme_wrappers() { |
|
75 | 75 | |
76 | - if ( in_array( $this->active_theme, $this->themes ) ){ |
|
76 | + if (in_array($this->active_theme, $this->themes)) { |
|
77 | 77 | |
78 | 78 | // setup file and class names |
79 | - $supported_theme_class_file = trailingslashit( Sensei()->plugin_path ) . 'includes/theme-integrations/' . $this->active_theme . '.php'; |
|
80 | - $supported_theme_class_name = 'Sensei_'. ucfirst( $this->active_theme ); |
|
79 | + $supported_theme_class_file = trailingslashit(Sensei()->plugin_path).'includes/theme-integrations/'.$this->active_theme.'.php'; |
|
80 | + $supported_theme_class_name = 'Sensei_'.ucfirst($this->active_theme); |
|
81 | 81 | |
82 | 82 | // add name of theme as body class for detailed styling. |
83 | - add_filter( 'body_class', 'sensei_current_theme' ); |
|
84 | - function sensei_current_theme( $classes ) { |
|
85 | - $sensei_template = get_option( 'template' ); |
|
86 | - $classes[] = 'sensei-'. $sensei_template; |
|
83 | + add_filter('body_class', 'sensei_current_theme'); |
|
84 | + function sensei_current_theme($classes) { |
|
85 | + $sensei_template = get_option('template'); |
|
86 | + $classes[] = 'sensei-'.$sensei_template; |
|
87 | 87 | return $classes; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // load the file or exit if there is no file for this theme |
91 | - if( ! file_exists( $supported_theme_class_file ) ){ |
|
91 | + if ( ! file_exists($supported_theme_class_file)) { |
|
92 | 92 | return; |
93 | 93 | } |
94 | - include_once( $supported_theme_class_file ); |
|
95 | - include_once( 'twentytwelve.php' ); |
|
94 | + include_once($supported_theme_class_file); |
|
95 | + include_once('twentytwelve.php'); |
|
96 | 96 | //initialize the class or exit if there is no class for this theme |
97 | - if( ! class_exists( $supported_theme_class_name ) ){ |
|
97 | + if ( ! class_exists($supported_theme_class_name)) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | $supported_theme = new $supported_theme_class_name; |
101 | 101 | |
102 | 102 | // remove default wrappers |
103 | - remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
104 | - remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
103 | + remove_action('sensei_before_main_content', array(Sensei()->frontend, 'sensei_output_content_wrapper'), 10); |
|
104 | + remove_action('sensei_after_main_content', array(Sensei()->frontend, 'sensei_output_content_wrapper_end'), 10); |
|
105 | 105 | |
106 | 106 | // load the supported theme wrappers |
107 | - add_action( 'sensei_before_main_content', array( $supported_theme, 'wrapper_start' ), 10 ); |
|
108 | - add_action( 'sensei_after_main_content', array( $supported_theme, 'wrapper_end' ), 10 ); |
|
107 | + add_action('sensei_before_main_content', array($supported_theme, 'wrapper_start'), 10); |
|
108 | + add_action('sensei_after_main_content', array($supported_theme, 'wrapper_end'), 10); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 |
@@ -13,15 +13,15 @@ |
||
13 | 13 | */ |
14 | 14 | Class Sensei_Twentyfifteen extends Sensei__S { |
15 | 15 | |
16 | - /** |
|
17 | - * Output opening wrappers |
|
18 | - * @since 1.9.0 |
|
19 | - */ |
|
20 | - public function wrapper_start(){ |
|
16 | + /** |
|
17 | + * Output opening wrappers |
|
18 | + * @since 1.9.0 |
|
19 | + */ |
|
20 | + public function wrapper_start(){ |
|
21 | 21 | |
22 | - // call the parent starting wrappers |
|
23 | - parent::wrapper_start(); |
|
22 | + // call the parent starting wrappers |
|
23 | + parent::wrapper_start(); |
|
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | 27 | } // end class |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * Output opening wrappers |
18 | 18 | * @since 1.9.0 |
19 | 19 | */ |
20 | - public function wrapper_start(){ |
|
20 | + public function wrapper_start() { |
|
21 | 21 | |
22 | 22 | // call the parent starting wrappers |
23 | 23 | parent::wrapper_start(); |