@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * The Template for displaying Gap Fill Line Questions. |
|
| 5 | - * |
|
| 6 | - * Override this template by copying it to yourtheme/sensei/single-quiz/question_type-gap-fill.php |
|
| 7 | - * |
|
| 8 | - * @author Automattic |
|
| 9 | - * @package Sensei |
|
| 10 | - * @category Templates |
|
| 11 | - * @version 1.9.0 |
|
| 12 | - */ |
|
| 4 | + * The Template for displaying Gap Fill Line Questions. |
|
| 5 | + * |
|
| 6 | + * Override this template by copying it to yourtheme/sensei/single-quiz/question_type-gap-fill.php |
|
| 7 | + * |
|
| 8 | + * @author Automattic |
|
| 9 | + * @package Sensei |
|
| 10 | + * @category Templates |
|
| 11 | + * @version 1.9.0 |
|
| 12 | + */ |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Get the question data with the current quiz id |
|
| 19 | - * All data is loaded in this array to keep the template clean. |
|
| 20 | - */ |
|
| 21 | - $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() ); |
|
| 17 | + /** |
|
| 18 | + * Get the question data with the current quiz id |
|
| 19 | + * All data is loaded in this array to keep the template clean. |
|
| 20 | + */ |
|
| 21 | + $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() ); |
|
| 22 | 22 | |
| 23 | 23 | ?> |
| 24 | 24 | |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | <?php |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * This action before teacher courses loop. This hook fires within the archive-course.php |
|
| 21 | - * It fires even if the current archive has no posts. |
|
| 22 | - * |
|
| 23 | - * @since 1.9.0 |
|
| 24 | - * |
|
| 25 | - */ |
|
| 26 | - do_action( 'sensei_teacher_archive_course_loop_before' ); |
|
| 19 | + /** |
|
| 20 | + * This action before teacher courses loop. This hook fires within the archive-course.php |
|
| 21 | + * It fires even if the current archive has no posts. |
|
| 22 | + * |
|
| 23 | + * @since 1.9.0 |
|
| 24 | + * |
|
| 25 | + */ |
|
| 26 | + do_action( 'sensei_teacher_archive_course_loop_before' ); |
|
| 27 | 27 | |
| 28 | - ?> |
|
| 28 | + ?> |
|
| 29 | 29 | |
| 30 | 30 | <?php if ( have_posts() ): ?> |
| 31 | 31 | |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * This action runs after including the teacher archive loop. This hook fires within the teacher-archive.php |
|
| 44 | - * It fires even if the current archive has no posts. |
|
| 45 | - * |
|
| 46 | - * @since 1.9.0 |
|
| 47 | - */ |
|
| 48 | - do_action( 'sensei_teacher_archive_course_loop_after' ); |
|
| 42 | + /** |
|
| 43 | + * This action runs after including the teacher archive loop. This hook fires within the teacher-archive.php |
|
| 44 | + * It fires even if the current archive has no posts. |
|
| 45 | + * |
|
| 46 | + * @since 1.9.0 |
|
| 47 | + */ |
|
| 48 | + do_action( 'sensei_teacher_archive_course_loop_after' ); |
|
| 49 | 49 | |
| 50 | - ?> |
|
| 50 | + ?> |
|
| 51 | 51 | |
| 52 | 52 | <?php get_sensei_footer(); ?> |
@@ -14,19 +14,19 @@ |
||
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Get the question data with the current quiz id |
|
| 19 | - * All data is loaded in this array to keep the template clean. |
|
| 20 | - */ |
|
| 21 | - $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() ); |
|
| 17 | + /** |
|
| 18 | + * Get the question data with the current quiz id |
|
| 19 | + * All data is loaded in this array to keep the template clean. |
|
| 20 | + */ |
|
| 21 | + $question_data = WooThemes_Sensei_Question::get_template_data( sensei_get_the_question_id(), get_the_ID() ); |
|
| 22 | 22 | |
| 23 | 23 | ?> |
| 24 | 24 | |
| 25 | 25 | <?php |
| 26 | 26 | |
| 27 | - Sensei_Utils::sensei_text_editor( $question_data[ 'user_answer_entry' ] , |
|
| 28 | - 'textquestion' . $question_data[ 'ID' ] , |
|
| 29 | - 'sensei_question[' . $question_data[ 'ID' ] . ']' ); |
|
| 27 | + Sensei_Utils::sensei_text_editor( $question_data[ 'user_answer_entry' ] , |
|
| 28 | + 'textquestion' . $question_data[ 'ID' ] , |
|
| 29 | + 'sensei_question[' . $question_data[ 'ID' ] . ']' ); |
|
| 30 | 30 | |
| 31 | 31 | ?> |
| 32 | 32 | |
@@ -10,91 +10,91 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Sensei_Theme_Integration_Loader { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @var array |
|
| 15 | - * Holding a reference core supported themes |
|
| 16 | - */ |
|
| 17 | - protected $themes; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - * reference to the theme currently active on this site |
|
| 22 | - */ |
|
| 23 | - protected $active_theme; |
|
| 24 | - |
|
| 25 | - public function __construct() { |
|
| 26 | - |
|
| 27 | - $this->setup_themes(); |
|
| 28 | - $this->setup_currently_active_theme(); |
|
| 29 | - $this->possibly_load_supported_theme_wrappers(); |
|
| 30 | - |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Setup the theme slugs supported by Sensei Core |
|
| 35 | - * |
|
| 36 | - * @since 1.9.0 |
|
| 37 | - */ |
|
| 38 | - private function setup_themes(){ |
|
| 39 | - |
|
| 40 | - $this->themes = array( |
|
| 41 | - 'twentyeleven', |
|
| 42 | - 'twentytwelve', |
|
| 43 | - 'twentythirteen', |
|
| 44 | - 'twentyfourteen', |
|
| 45 | - 'twentyfifteen', |
|
| 46 | - 'twentysixteen', |
|
| 47 | - 'storefront', |
|
| 48 | - ); |
|
| 49 | - |
|
| 50 | - }// end setup themes |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Setup the currently active theme |
|
| 54 | - * |
|
| 55 | - * @since 1.9.0 |
|
| 56 | - */ |
|
| 57 | - private function setup_currently_active_theme(){ |
|
| 58 | - |
|
| 59 | - $this->active_theme = get_option('template'); |
|
| 60 | - |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Remove default Sensei wrappers and load |
|
| 65 | - * supported wrappers if the current theme is |
|
| 66 | - * a theme we have an integration for within core. |
|
| 67 | - * |
|
| 68 | - * @since 1.9.0 |
|
| 69 | - */ |
|
| 70 | - private function possibly_load_supported_theme_wrappers(){ |
|
| 71 | - |
|
| 72 | - if ( in_array( $this->active_theme, $this->themes ) ){ |
|
| 73 | - |
|
| 74 | - // setup file and class names |
|
| 75 | - $supported_theme_class_file = trailingslashit( Sensei()->plugin_path ) . 'includes/theme-integrations/' . $this->active_theme . '.php'; |
|
| 76 | - $supported_theme_class_name = 'Sensei_'. ucfirst( $this->active_theme ); |
|
| 77 | - |
|
| 78 | - // load the file or exit if there is no file for this theme |
|
| 79 | - if( ! file_exists( $supported_theme_class_file ) ){ |
|
| 80 | - return; |
|
| 81 | - } |
|
| 82 | - include_once( $supported_theme_class_file ); |
|
| 83 | - include_once( 'twentytwelve.php' ); |
|
| 84 | - //initialize the class or exit if there is no class for this theme |
|
| 85 | - if( ! class_exists( $supported_theme_class_name ) ){ |
|
| 86 | - return; |
|
| 87 | - } |
|
| 88 | - $supported_theme = new $supported_theme_class_name; |
|
| 89 | - |
|
| 90 | - // remove default wrappers |
|
| 91 | - remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
| 92 | - remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
| 93 | - |
|
| 94 | - // load the supported theme wrappers |
|
| 95 | - add_action( 'sensei_before_main_content', array( $supported_theme, 'wrapper_start' ), 10 ); |
|
| 96 | - add_action( 'sensei_after_main_content', array( $supported_theme, 'wrapper_end' ), 10 ); |
|
| 97 | - } |
|
| 98 | - } |
|
| 13 | + /** |
|
| 14 | + * @var array |
|
| 15 | + * Holding a reference core supported themes |
|
| 16 | + */ |
|
| 17 | + protected $themes; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + * reference to the theme currently active on this site |
|
| 22 | + */ |
|
| 23 | + protected $active_theme; |
|
| 24 | + |
|
| 25 | + public function __construct() { |
|
| 26 | + |
|
| 27 | + $this->setup_themes(); |
|
| 28 | + $this->setup_currently_active_theme(); |
|
| 29 | + $this->possibly_load_supported_theme_wrappers(); |
|
| 30 | + |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Setup the theme slugs supported by Sensei Core |
|
| 35 | + * |
|
| 36 | + * @since 1.9.0 |
|
| 37 | + */ |
|
| 38 | + private function setup_themes(){ |
|
| 39 | + |
|
| 40 | + $this->themes = array( |
|
| 41 | + 'twentyeleven', |
|
| 42 | + 'twentytwelve', |
|
| 43 | + 'twentythirteen', |
|
| 44 | + 'twentyfourteen', |
|
| 45 | + 'twentyfifteen', |
|
| 46 | + 'twentysixteen', |
|
| 47 | + 'storefront', |
|
| 48 | + ); |
|
| 49 | + |
|
| 50 | + }// end setup themes |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Setup the currently active theme |
|
| 54 | + * |
|
| 55 | + * @since 1.9.0 |
|
| 56 | + */ |
|
| 57 | + private function setup_currently_active_theme(){ |
|
| 58 | + |
|
| 59 | + $this->active_theme = get_option('template'); |
|
| 60 | + |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Remove default Sensei wrappers and load |
|
| 65 | + * supported wrappers if the current theme is |
|
| 66 | + * a theme we have an integration for within core. |
|
| 67 | + * |
|
| 68 | + * @since 1.9.0 |
|
| 69 | + */ |
|
| 70 | + private function possibly_load_supported_theme_wrappers(){ |
|
| 71 | + |
|
| 72 | + if ( in_array( $this->active_theme, $this->themes ) ){ |
|
| 73 | + |
|
| 74 | + // setup file and class names |
|
| 75 | + $supported_theme_class_file = trailingslashit( Sensei()->plugin_path ) . 'includes/theme-integrations/' . $this->active_theme . '.php'; |
|
| 76 | + $supported_theme_class_name = 'Sensei_'. ucfirst( $this->active_theme ); |
|
| 77 | + |
|
| 78 | + // load the file or exit if there is no file for this theme |
|
| 79 | + if( ! file_exists( $supported_theme_class_file ) ){ |
|
| 80 | + return; |
|
| 81 | + } |
|
| 82 | + include_once( $supported_theme_class_file ); |
|
| 83 | + include_once( 'twentytwelve.php' ); |
|
| 84 | + //initialize the class or exit if there is no class for this theme |
|
| 85 | + if( ! class_exists( $supported_theme_class_name ) ){ |
|
| 86 | + return; |
|
| 87 | + } |
|
| 88 | + $supported_theme = new $supported_theme_class_name; |
|
| 89 | + |
|
| 90 | + // remove default wrappers |
|
| 91 | + remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
| 92 | + remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
| 93 | + |
|
| 94 | + // load the supported theme wrappers |
|
| 95 | + add_action( 'sensei_before_main_content', array( $supported_theme, 'wrapper_start' ), 10 ); |
|
| 96 | + add_action( 'sensei_after_main_content', array( $supported_theme, 'wrapper_end' ), 10 ); |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | } /// end class |
| 101 | 101 | \ No newline at end of file |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | Class Sensei_Twentyfourteen { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Output opening wrappers |
|
| 14 | - * @since 1.9.0 |
|
| 15 | - */ |
|
| 16 | - public function wrapper_start(){ |
|
| 17 | - ?> |
|
| 12 | + /** |
|
| 13 | + * Output opening wrappers |
|
| 14 | + * @since 1.9.0 |
|
| 15 | + */ |
|
| 16 | + public function wrapper_start(){ |
|
| 17 | + ?> |
|
| 18 | 18 | |
| 19 | 19 | <div id="main-content" class="main-content"> |
| 20 | 20 | <div id="primary" class="content-area"> |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | <?php } |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Output closing wrappers |
|
| 28 | - * |
|
| 29 | - * @since 1.9.0 |
|
| 30 | - */ |
|
| 31 | - public function wrapper_end(){ ?> |
|
| 26 | + /** |
|
| 27 | + * Output closing wrappers |
|
| 28 | + * |
|
| 29 | + * @since 1.9.0 |
|
| 30 | + */ |
|
| 31 | + public function wrapper_end(){ ?> |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | </div> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | </div> |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - get_sidebar(); |
|
| 40 | + get_sidebar(); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | } |
@@ -9,28 +9,28 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | Class Sensei_Twentyfifteen extends Sensei__S { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Output opening wrappers |
|
| 14 | - * @since 1.9.0 |
|
| 15 | - */ |
|
| 16 | - public function wrapper_start(){ |
|
| 12 | + /** |
|
| 13 | + * Output opening wrappers |
|
| 14 | + * @since 1.9.0 |
|
| 15 | + */ |
|
| 16 | + public function wrapper_start(){ |
|
| 17 | 17 | |
| 18 | - // output inline styles |
|
| 19 | - $this->print_styles(); |
|
| 18 | + // output inline styles |
|
| 19 | + $this->print_styles(); |
|
| 20 | 20 | |
| 21 | - // call the parent starting wrappers |
|
| 22 | - parent::wrapper_start(); |
|
| 21 | + // call the parent starting wrappers |
|
| 22 | + parent::wrapper_start(); |
|
| 23 | 23 | |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Output the style for the |
|
| 29 | - * twenty fifteen theme integration. |
|
| 30 | - * |
|
| 31 | - * @since 1.9.0 |
|
| 32 | - */ |
|
| 33 | - private function print_styles(){?> |
|
| 27 | + /** |
|
| 28 | + * Output the style for the |
|
| 29 | + * twenty fifteen theme integration. |
|
| 30 | + * |
|
| 31 | + * @since 1.9.0 |
|
| 32 | + */ |
|
| 33 | + private function print_styles(){?> |
|
| 34 | 34 | |
| 35 | 35 | <style> |
| 36 | 36 | @media screen and (min-width: 59.6875em){ |
@@ -9,24 +9,24 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | Class Sensei_Twentythirteen { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Output opening wrappers |
|
| 14 | - * @since 1.9.0 |
|
| 15 | - */ |
|
| 16 | - public function wrapper_start(){ |
|
| 17 | - ?> |
|
| 12 | + /** |
|
| 13 | + * Output opening wrappers |
|
| 14 | + * @since 1.9.0 |
|
| 15 | + */ |
|
| 16 | + public function wrapper_start(){ |
|
| 17 | + ?> |
|
| 18 | 18 | |
| 19 | 19 | <div id="primary" class="site-content"> |
| 20 | 20 | <div id="content" role="main" class="entry-content"> |
| 21 | 21 | |
| 22 | 22 | <?php } |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Output closing wrappers |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - */ |
|
| 29 | - public function wrapper_end(){ ?> |
|
| 24 | + /** |
|
| 25 | + * Output closing wrappers |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + */ |
|
| 29 | + public function wrapper_end(){ ?> |
|
| 30 | 30 | |
| 31 | 31 | </div> |
| 32 | 32 | </div> |
@@ -13,137 +13,137 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Sensei_Autoloader { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @var path to the includes directory within Sensei. |
|
| 18 | - */ |
|
| 19 | - private $include_path = 'includes'; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * @var array $class_file_map. List of classes mapped to their files |
|
| 23 | - */ |
|
| 24 | - private $class_file_map = array(); |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Constructor |
|
| 28 | - * @since 1.9.0 |
|
| 29 | - */ |
|
| 30 | - public function __construct(){ |
|
| 31 | - |
|
| 32 | - // make sure we do not override an existing autoload function |
|
| 33 | - if( function_exists('__autoload') ){ |
|
| 34 | - spl_autoload_register( '__autoload' ); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - // setup a relative path for the current autoload instance |
|
| 38 | - $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
| 39 | - |
|
| 40 | - //setup the class file map |
|
| 41 | - $this->initialize_class_file_map(); |
|
| 42 | - |
|
| 43 | - // add Sensei custom auto loader |
|
| 44 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 45 | - |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * Generate a list of Sensei class and map them the their respective |
|
| 50 | - * files within the includes directory |
|
| 51 | - * |
|
| 52 | - * @since 1.9.0 |
|
| 53 | - */ |
|
| 54 | - public function initialize_class_file_map(){ |
|
| 55 | - |
|
| 56 | - $this->class_file_map = array( |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Main Sensei class |
|
| 60 | - */ |
|
| 61 | - 'Sensei_Main' => 'class-sensei.php', |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Admin |
|
| 65 | - */ |
|
| 66 | - 'Sensei_Welcome' => 'admin/class-sensei-welcome.php' , |
|
| 67 | - 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' , |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Shortcodes |
|
| 71 | - */ |
|
| 72 | - 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
| 73 | - 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
| 74 | - 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
| 75 | - 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
| 76 | - 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
| 77 | - 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
| 78 | - 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
| 79 | - 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
| 80 | - 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
| 81 | - 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
| 82 | - 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
| 83 | - 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Built in theme integration support |
|
| 87 | - */ |
|
| 88 | - 'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php', |
|
| 89 | - 'Sensei__S' => 'theme-integrations/_s.php', |
|
| 90 | - 'Sensei_Twentyeleven' => 'theme-integrations/twentyeleven.php', |
|
| 91 | - 'Sensei_Twentytwelve' => 'theme-integrations/twentytwelve.php', |
|
| 92 | - 'Sensei_Twentythirteen' => 'theme-integrations/Twentythirteen.php', |
|
| 93 | - 'Sensei_Twentyfourteen' => 'theme-integrations/Twentyfourteen.php', |
|
| 94 | - 'Sensei_Twentyfifteen' => 'theme-integrations/Twentyfifteen.php', |
|
| 95 | - 'Sensei_Twentysixteen' => 'theme-integrations/Twentysixteen.php', |
|
| 96 | - 'Sensei_Storefront' => 'theme-integrations/Storefront.php', |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * WooCommerce |
|
| 100 | - */ |
|
| 101 | - 'Sensei_WC' => 'class-sensei-wc.php', |
|
| 102 | - |
|
| 103 | - ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Autoload all sensei files as the class names are used. |
|
| 108 | - */ |
|
| 109 | - public function autoload( $class ){ |
|
| 110 | - |
|
| 111 | - // only handle classes with the word `sensei` in it |
|
| 112 | - if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
| 113 | - |
|
| 114 | - return; |
|
| 115 | - |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - // exit if we didn't provide mapping for this class |
|
| 119 | - if( isset( $this->class_file_map[ $class ] ) ){ |
|
| 120 | - |
|
| 121 | - $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
| 122 | - require_once( $file_location); |
|
| 123 | - return; |
|
| 124 | - |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - // check for file in the main includes directory |
|
| 128 | - $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
| 129 | - if( file_exists( $class_file_path ) ){ |
|
| 130 | - |
|
| 131 | - require_once( $class_file_path ); |
|
| 132 | - return; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - // lastly check legacy types |
|
| 136 | - $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
| 137 | - $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
| 138 | - if( file_exists( $legacy_class_file_path ) ){ |
|
| 139 | - |
|
| 140 | - require_once( $legacy_class_file_path ); |
|
| 141 | - return; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - return; |
|
| 145 | - |
|
| 146 | - }// end autoload |
|
| 16 | + /** |
|
| 17 | + * @var path to the includes directory within Sensei. |
|
| 18 | + */ |
|
| 19 | + private $include_path = 'includes'; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @var array $class_file_map. List of classes mapped to their files |
|
| 23 | + */ |
|
| 24 | + private $class_file_map = array(); |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Constructor |
|
| 28 | + * @since 1.9.0 |
|
| 29 | + */ |
|
| 30 | + public function __construct(){ |
|
| 31 | + |
|
| 32 | + // make sure we do not override an existing autoload function |
|
| 33 | + if( function_exists('__autoload') ){ |
|
| 34 | + spl_autoload_register( '__autoload' ); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + // setup a relative path for the current autoload instance |
|
| 38 | + $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) ); |
|
| 39 | + |
|
| 40 | + //setup the class file map |
|
| 41 | + $this->initialize_class_file_map(); |
|
| 42 | + |
|
| 43 | + // add Sensei custom auto loader |
|
| 44 | + spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 45 | + |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * Generate a list of Sensei class and map them the their respective |
|
| 50 | + * files within the includes directory |
|
| 51 | + * |
|
| 52 | + * @since 1.9.0 |
|
| 53 | + */ |
|
| 54 | + public function initialize_class_file_map(){ |
|
| 55 | + |
|
| 56 | + $this->class_file_map = array( |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Main Sensei class |
|
| 60 | + */ |
|
| 61 | + 'Sensei_Main' => 'class-sensei.php', |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Admin |
|
| 65 | + */ |
|
| 66 | + 'Sensei_Welcome' => 'admin/class-sensei-welcome.php' , |
|
| 67 | + 'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' , |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Shortcodes |
|
| 71 | + */ |
|
| 72 | + 'Sensei_Shortcode_Loader' => 'shortcodes/class-sensei-shortcode-loader.php', |
|
| 73 | + 'Sensei_Shortcode_Interface' => 'shortcodes/interface-sensei-shortcode.php', |
|
| 74 | + 'Sensei_Shortcode_Featured_Courses' => 'shortcodes/class-sensei-shortcode-featured-courses.php', |
|
| 75 | + 'Sensei_Shortcode_User_Courses' => 'shortcodes/class-sensei-shortcode-user-courses.php', |
|
| 76 | + 'Sensei_Shortcode_Courses' => 'shortcodes/class-sensei-shortcode-courses.php', |
|
| 77 | + 'Sensei_Shortcode_Teachers' => 'shortcodes/class-sensei-shortcode-teachers.php', |
|
| 78 | + 'Sensei_Shortcode_User_Messages' => 'shortcodes/class-sensei-shortcode-user-messages.php', |
|
| 79 | + 'Sensei_Shortcode_Course_Page' => 'shortcodes/class-sensei-shortcode-course-page.php', |
|
| 80 | + 'Sensei_Shortcode_Lesson_Page' => 'shortcodes/class-sensei-shortcode-lesson-page.php', |
|
| 81 | + 'Sensei_Shortcode_Course_Categories' => 'shortcodes/class-sensei-shortcode-course-categories.php', |
|
| 82 | + 'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php', |
|
| 83 | + 'Sensei_Legacy_Shortcodes' => 'shortcodes/class-sensei-legacy-shortcodes.php', |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Built in theme integration support |
|
| 87 | + */ |
|
| 88 | + 'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php', |
|
| 89 | + 'Sensei__S' => 'theme-integrations/_s.php', |
|
| 90 | + 'Sensei_Twentyeleven' => 'theme-integrations/twentyeleven.php', |
|
| 91 | + 'Sensei_Twentytwelve' => 'theme-integrations/twentytwelve.php', |
|
| 92 | + 'Sensei_Twentythirteen' => 'theme-integrations/Twentythirteen.php', |
|
| 93 | + 'Sensei_Twentyfourteen' => 'theme-integrations/Twentyfourteen.php', |
|
| 94 | + 'Sensei_Twentyfifteen' => 'theme-integrations/Twentyfifteen.php', |
|
| 95 | + 'Sensei_Twentysixteen' => 'theme-integrations/Twentysixteen.php', |
|
| 96 | + 'Sensei_Storefront' => 'theme-integrations/Storefront.php', |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * WooCommerce |
|
| 100 | + */ |
|
| 101 | + 'Sensei_WC' => 'class-sensei-wc.php', |
|
| 102 | + |
|
| 103 | + ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Autoload all sensei files as the class names are used. |
|
| 108 | + */ |
|
| 109 | + public function autoload( $class ){ |
|
| 110 | + |
|
| 111 | + // only handle classes with the word `sensei` in it |
|
| 112 | + if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){ |
|
| 113 | + |
|
| 114 | + return; |
|
| 115 | + |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + // exit if we didn't provide mapping for this class |
|
| 119 | + if( isset( $this->class_file_map[ $class ] ) ){ |
|
| 120 | + |
|
| 121 | + $file_location = $this->include_path . $this->class_file_map[ $class ]; |
|
| 122 | + require_once( $file_location); |
|
| 123 | + return; |
|
| 124 | + |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + // check for file in the main includes directory |
|
| 128 | + $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php'; |
|
| 129 | + if( file_exists( $class_file_path ) ){ |
|
| 130 | + |
|
| 131 | + require_once( $class_file_path ); |
|
| 132 | + return; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + // lastly check legacy types |
|
| 136 | + $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes |
|
| 137 | + $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php'; |
|
| 138 | + if( file_exists( $legacy_class_file_path ) ){ |
|
| 139 | + |
|
| 140 | + require_once( $legacy_class_file_path ); |
|
| 141 | + return; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + return; |
|
| 145 | + |
|
| 146 | + }// end autoload |
|
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | new Sensei_Autoloader(); |
@@ -9,24 +9,24 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | Class Sensei_Twentythirteen { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * Output opening wrappers |
|
| 14 | - * @since 1.9.0 |
|
| 15 | - */ |
|
| 16 | - public function wrapper_start(){ |
|
| 17 | - ?> |
|
| 12 | + /** |
|
| 13 | + * Output opening wrappers |
|
| 14 | + * @since 1.9.0 |
|
| 15 | + */ |
|
| 16 | + public function wrapper_start(){ |
|
| 17 | + ?> |
|
| 18 | 18 | |
| 19 | 19 | <div id="primary" class="site-content"> |
| 20 | 20 | <div id="content" role="main" class="entry-content"> |
| 21 | 21 | |
| 22 | 22 | <?php } |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Output closing wrappers |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - */ |
|
| 29 | - public function wrapper_end(){ ?> |
|
| 24 | + /** |
|
| 25 | + * Output closing wrappers |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + */ |
|
| 29 | + public function wrapper_end(){ ?> |
|
| 30 | 30 | |
| 31 | 31 | </div> |
| 32 | 32 | </div> |