@@ -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> |
@@ -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> |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | function sensei_all_access() { |
| 47 | 47 | |
| 48 | - $access = current_user_can( 'manage_sensei' ) || current_user_can( 'manage_sensei_grades' ); |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Filter sensei_all_access function result |
|
| 52 | - * which determinse if the current user |
|
| 53 | - * can access all of Sensei without restrictions |
|
| 54 | - * |
|
| 55 | - * @since 1.4.0 |
|
| 56 | - * @param bool $access |
|
| 57 | - */ |
|
| 48 | + $access = current_user_can( 'manage_sensei' ) || current_user_can( 'manage_sensei_grades' ); |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Filter sensei_all_access function result |
|
| 52 | + * which determinse if the current user |
|
| 53 | + * can access all of Sensei without restrictions |
|
| 54 | + * |
|
| 55 | + * @since 1.4.0 |
|
| 56 | + * @param bool $access |
|
| 57 | + */ |
|
| 58 | 58 | return apply_filters( 'sensei_all_access', $access ); |
| 59 | 59 | |
| 60 | 60 | } // End sensei_all_access() |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function sensei_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { |
| 74 | 74 | |
| 75 | - $hex = str_replace( '#', '', $color ); |
|
| 75 | + $hex = str_replace( '#', '', $color ); |
|
| 76 | 76 | |
| 77 | 77 | $c_r = hexdec( substr( $hex, 0, 2 ) ); |
| 78 | 78 | $c_g = hexdec( substr( $hex, 2, 2 ) ); |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | $color = '#'; |
| 120 | 120 | |
| 121 | 121 | foreach ($base as $k => $v) : |
| 122 | - $amount = $v / 100; |
|
| 123 | - $amount = round($amount * $factor); |
|
| 124 | - $new_decimal = $v - $amount; |
|
| 125 | - |
|
| 126 | - $new_hex_component = dechex($new_decimal); |
|
| 127 | - if(strlen($new_hex_component) < 2) : |
|
| 128 | - $new_hex_component = "0".$new_hex_component; |
|
| 129 | - endif; |
|
| 130 | - $color .= $new_hex_component; |
|
| 122 | + $amount = $v / 100; |
|
| 123 | + $amount = round($amount * $factor); |
|
| 124 | + $new_decimal = $v - $amount; |
|
| 125 | + |
|
| 126 | + $new_hex_component = dechex($new_decimal); |
|
| 127 | + if(strlen($new_hex_component) < 2) : |
|
| 128 | + $new_hex_component = "0".$new_hex_component; |
|
| 129 | + endif; |
|
| 130 | + $color .= $new_hex_component; |
|
| 131 | 131 | endforeach; |
| 132 | 132 | |
| 133 | 133 | return $color; |
@@ -148,17 +148,17 @@ discard block |
||
| 148 | 148 | $base = sensei_rgb_from_hex( $color ); |
| 149 | 149 | $color = '#'; |
| 150 | 150 | |
| 151 | - foreach ($base as $k => $v) : |
|
| 152 | - $amount = 255 - $v; |
|
| 153 | - $amount = $amount / 100; |
|
| 154 | - $amount = round($amount * $factor); |
|
| 155 | - $new_decimal = $v + $amount; |
|
| 156 | - |
|
| 157 | - $new_hex_component = dechex($new_decimal); |
|
| 158 | - if(strlen($new_hex_component) < 2) : |
|
| 159 | - $new_hex_component = "0".$new_hex_component; |
|
| 160 | - endif; |
|
| 161 | - $color .= $new_hex_component; |
|
| 151 | + foreach ($base as $k => $v) : |
|
| 152 | + $amount = 255 - $v; |
|
| 153 | + $amount = $amount / 100; |
|
| 154 | + $amount = round($amount * $factor); |
|
| 155 | + $new_decimal = $v + $amount; |
|
| 156 | + |
|
| 157 | + $new_hex_component = dechex($new_decimal); |
|
| 158 | + if(strlen($new_hex_component) < 2) : |
|
| 159 | + $new_hex_component = "0".$new_hex_component; |
|
| 160 | + endif; |
|
| 161 | + $color .= $new_hex_component; |
|
| 162 | 162 | endforeach; |
| 163 | 163 | |
| 164 | 164 | return $color; |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | * @deprecated since 1.9.0 use Sensei_WC::is_woocommerce_active() |
| 173 | 173 | */ |
| 174 | 174 | if ( ! function_exists( 'is_woocommerce_active' ) ) { |
| 175 | - function is_woocommerce_active() { |
|
| 176 | - // calling is present instead of is active here |
|
| 177 | - // as this function can override other is_woocommerce_active |
|
| 178 | - // function in other woo plugins and Sensei_WC::is_woocommerce_active |
|
| 179 | - // also check the sensei settings for enable WooCommerce support, which |
|
| 180 | - // other plugins should not check against. |
|
| 181 | - return Sensei_WC::is_woocommerce_present(); |
|
| 182 | - } |
|
| 175 | + function is_woocommerce_active() { |
|
| 176 | + // calling is present instead of is active here |
|
| 177 | + // as this function can override other is_woocommerce_active |
|
| 178 | + // function in other woo plugins and Sensei_WC::is_woocommerce_active |
|
| 179 | + // also check the sensei settings for enable WooCommerce support, which |
|
| 180 | + // other plugins should not check against. |
|
| 181 | + return Sensei_WC::is_woocommerce_present(); |
|
| 182 | + } |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -195,20 +195,20 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function sensei_do_deprecated_action( $hook_tag, $version, $alternative="" , $args = array() ){ |
| 197 | 197 | |
| 198 | - if( has_action( $hook_tag ) ){ |
|
| 198 | + if( has_action( $hook_tag ) ){ |
|
| 199 | 199 | |
| 200 | - $error_message = sprintf( __( "SENSEI: The hook '%s', has been deprecated since '%s'." , 'woothemes-sensei'), $hook_tag ,$version ); |
|
| 200 | + $error_message = sprintf( __( "SENSEI: The hook '%s', has been deprecated since '%s'." , 'woothemes-sensei'), $hook_tag ,$version ); |
|
| 201 | 201 | |
| 202 | - if( !empty( $alternative ) ){ |
|
| 202 | + if( !empty( $alternative ) ){ |
|
| 203 | 203 | |
| 204 | - $error_message .= sprintf( __("Please use '%s' instead.", 'woothemes-sensei'), $alternative ) ; |
|
| 204 | + $error_message .= sprintf( __("Please use '%s' instead.", 'woothemes-sensei'), $alternative ) ; |
|
| 205 | 205 | |
| 206 | - } |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - trigger_error( $error_message ); |
|
| 209 | - do_action( $hook_tag , $args ); |
|
| 208 | + trigger_error( $error_message ); |
|
| 209 | + do_action( $hook_tag , $args ); |
|
| 210 | 210 | |
| 211 | - } |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | 213 | }// end sensei_do_deprecated_action |
| 214 | 214 | |
@@ -238,18 +238,18 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | function sensei_user_login_url(){ |
| 240 | 240 | |
| 241 | - $my_courses_page_id = intval( Sensei()->settings->get( 'my_course_page' ) ); |
|
| 242 | - $page = get_post( $my_courses_page_id ); |
|
| 241 | + $my_courses_page_id = intval( Sensei()->settings->get( 'my_course_page' ) ); |
|
| 242 | + $page = get_post( $my_courses_page_id ); |
|
| 243 | 243 | |
| 244 | - if ( $my_courses_page_id && isset( $page->ID ) && 'page' == get_post_type( $page->ID ) ){ |
|
| 244 | + if ( $my_courses_page_id && isset( $page->ID ) && 'page' == get_post_type( $page->ID ) ){ |
|
| 245 | 245 | |
| 246 | - return get_permalink( $page->ID ); |
|
| 246 | + return get_permalink( $page->ID ); |
|
| 247 | 247 | |
| 248 | - } else { |
|
| 248 | + } else { |
|
| 249 | 249 | |
| 250 | - return wp_login_url(); |
|
| 250 | + return wp_login_url(); |
|
| 251 | 251 | |
| 252 | - } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | 254 | }// end sensei_user_login_link |
| 255 | 255 | |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | function sensei_is_login_required(){ |
| 264 | 264 | |
| 265 | - $login_required = isset( Sensei()->settings->settings['access_permission'] ) && ( true == Sensei()->settings->settings['access_permission'] ); |
|
| 265 | + $login_required = isset( Sensei()->settings->settings['access_permission'] ) && ( true == Sensei()->settings->settings['access_permission'] ); |
|
| 266 | 266 | |
| 267 | - return $login_required; |
|
| 267 | + return $login_required; |
|
| 268 | 268 | |
| 269 | 269 | } |
| 270 | 270 | \ No newline at end of file |