@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Pagination - Posts |
|
| 4 | - * |
|
| 5 | - * @author WooThemes |
|
| 6 | - * @package Sensei/Templates |
|
| 7 | - * @version 1.1.0 |
|
| 8 | - */ |
|
| 3 | + * Pagination - Posts |
|
| 4 | + * |
|
| 5 | + * @author WooThemes |
|
| 6 | + * @package Sensei/Templates |
|
| 7 | + * @version 1.1.0 |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 11 | 11 | |
@@ -15,19 +15,19 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | <?php |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * This action before course archive loop. This hook fires within the archive-course.php |
|
| 20 | - * It fires even if the current archive has no posts. |
|
| 21 | - * |
|
| 22 | - * @since 1.9.0 |
|
| 23 | - * |
|
| 24 | - * @hooked Sensei_Course::course_archive_sorting 20 |
|
| 25 | - * @hooked Sensei_Course::course_archive_filters 20 |
|
| 26 | - * @hooked Sensei_Templates::deprecated_archive_hook 80 |
|
| 27 | - */ |
|
| 28 | - do_action( 'sensei_archive_before_course_loop' ); |
|
| 29 | - |
|
| 30 | - ?> |
|
| 18 | + /** |
|
| 19 | + * This action before course archive loop. This hook fires within the archive-course.php |
|
| 20 | + * It fires even if the current archive has no posts. |
|
| 21 | + * |
|
| 22 | + * @since 1.9.0 |
|
| 23 | + * |
|
| 24 | + * @hooked Sensei_Course::course_archive_sorting 20 |
|
| 25 | + * @hooked Sensei_Course::course_archive_filters 20 |
|
| 26 | + * @hooked Sensei_Templates::deprecated_archive_hook 80 |
|
| 27 | + */ |
|
| 28 | + do_action( 'sensei_archive_before_course_loop' ); |
|
| 29 | + |
|
| 30 | + ?> |
|
| 31 | 31 | |
| 32 | 32 | <?php if ( have_posts() ): ?> |
| 33 | 33 | |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | <?php |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * This action runs after including the course archive loop. This hook fires within the archive-course.php |
|
| 46 | - * It fires even if the current archive has no posts. |
|
| 47 | - * |
|
| 48 | - * @since 1.9.0 |
|
| 49 | - */ |
|
| 50 | - do_action( 'sensei_archive_after_course_loop' ); |
|
| 44 | + /** |
|
| 45 | + * This action runs after including the course archive loop. This hook fires within the archive-course.php |
|
| 46 | + * It fires even if the current archive has no posts. |
|
| 47 | + * |
|
| 48 | + * @since 1.9.0 |
|
| 49 | + */ |
|
| 50 | + do_action( 'sensei_archive_after_course_loop' ); |
|
| 51 | 51 | |
| 52 | - ?> |
|
| 52 | + ?> |
|
| 53 | 53 | |
| 54 | 54 | <?php get_sensei_footer(); ?> |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The Template for displaying all access restriction error messages. |
|
| 4 | - * |
|
| 5 | - * Override this template by copying it to yourtheme/sensei/no-permissions.php |
|
| 6 | - * |
|
| 7 | - * @author Automattic |
|
| 8 | - * @package Sensei |
|
| 9 | - * @category Templates |
|
| 10 | - * @version 1.9.0 |
|
| 11 | - */ |
|
| 3 | + * The Template for displaying all access restriction error messages. |
|
| 4 | + * |
|
| 5 | + * Override this template by copying it to yourtheme/sensei/no-permissions.php |
|
| 6 | + * |
|
| 7 | + * @author Automattic |
|
| 8 | + * @package Sensei |
|
| 9 | + * @category Templates |
|
| 10 | + * @version 1.9.0 |
|
| 11 | + */ |
|
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <?php get_sensei_header(); ?> |
| 15 | 15 | |
| 16 | 16 | <?php |
| 17 | 17 | /** |
| 18 | - * This action fires inside the no-permissions.php file. It |
|
| 19 | - * is place above before all the content. |
|
| 20 | - * |
|
| 21 | - * @since 1.9.0 |
|
| 22 | - * @param $post_id |
|
| 23 | - */ |
|
| 18 | + * This action fires inside the no-permissions.php file. It |
|
| 19 | + * is place above before all the content. |
|
| 20 | + * |
|
| 21 | + * @since 1.9.0 |
|
| 22 | + * @param $post_id |
|
| 23 | + */ |
|
| 24 | 24 | do_action('sensei_no_permissions_before_content', get_the_ID() ); |
| 25 | 25 | ?> |
| 26 | 26 | |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | </header> |
| 34 | 34 | |
| 35 | 35 | <?php |
| 36 | - /** |
|
| 37 | - * This action fires inside the no-permissions.php file. It |
|
| 38 | - * is place just before the content. |
|
| 39 | - * |
|
| 40 | - * @since 1.9.0 |
|
| 41 | - * @param $post_id |
|
| 42 | - */ |
|
| 43 | - do_action('sensei_no_permissions_inside_before_content', get_the_ID() ); |
|
| 44 | - ?> |
|
| 36 | + /** |
|
| 37 | + * This action fires inside the no-permissions.php file. It |
|
| 38 | + * is place just before the content. |
|
| 39 | + * |
|
| 40 | + * @since 1.9.0 |
|
| 41 | + * @param $post_id |
|
| 42 | + */ |
|
| 43 | + do_action('sensei_no_permissions_inside_before_content', get_the_ID() ); |
|
| 44 | + ?> |
|
| 45 | 45 | |
| 46 | 46 | <section class="entry fix"> |
| 47 | 47 | |
@@ -60,26 +60,26 @@ discard block |
||
| 60 | 60 | </section> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - /** |
|
| 64 | - * This action fires inside the no-permissions.php file. It |
|
| 65 | - * is place just after the content. |
|
| 66 | - * |
|
| 67 | - * @since 1.9.0 |
|
| 68 | - * @param $post_id |
|
| 69 | - */ |
|
| 70 | - do_action('sensei_no_permissions_inside_after_content', get_the_ID() ); |
|
| 71 | - ?> |
|
| 63 | + /** |
|
| 64 | + * This action fires inside the no-permissions.php file. It |
|
| 65 | + * is place just after the content. |
|
| 66 | + * |
|
| 67 | + * @since 1.9.0 |
|
| 68 | + * @param $post_id |
|
| 69 | + */ |
|
| 70 | + do_action('sensei_no_permissions_inside_after_content', get_the_ID() ); |
|
| 71 | + ?> |
|
| 72 | 72 | |
| 73 | 73 | </article><!-- .no-permissions --> |
| 74 | 74 | |
| 75 | 75 | <?php |
| 76 | 76 | /** |
| 77 | - * This action fires inside the no-permissions.php file. It |
|
| 78 | - * is placed outside after the content. |
|
| 79 | - * |
|
| 80 | - * @since 1.9.0 |
|
| 81 | - * @param $post_id |
|
| 82 | - */ |
|
| 77 | + * This action fires inside the no-permissions.php file. It |
|
| 78 | + * is placed outside after the content. |
|
| 79 | + * |
|
| 80 | + * @since 1.9.0 |
|
| 81 | + * @param $post_id |
|
| 82 | + */ |
|
| 83 | 83 | do_action('sensei_no_permissions_after_content', get_the_ID() ); |
| 84 | 84 | ?> |
| 85 | 85 | |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | 3 | /** |
| 4 | - * The Template for displaying Multi Line Questions. |
|
| 5 | - * |
|
| 6 | - * Override this template by copying it to yourtheme/sensei/single-quiz/question_type-multi-line.php |
|
| 7 | - * |
|
| 8 | - * @author Automattic |
|
| 9 | - * @package Sensei |
|
| 10 | - * @category Templates |
|
| 11 | - * @version 1.9.0 |
|
| 12 | - */ |
|
| 4 | + * The Template for displaying Multi Line Questions. |
|
| 5 | + * |
|
| 6 | + * Override this template by copying it to yourtheme/sensei/single-quiz/question_type-multi-line.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 | |
| 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 | |
@@ -15,91 +15,91 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Sensei_Shortcode_User_Messages implements Sensei_Shortcode_Interface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var WP_Query |
|
| 20 | - * messages for the current user |
|
| 21 | - */ |
|
| 22 | - protected $messages_query; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Setup the shortcode object |
|
| 26 | - * |
|
| 27 | - * @since 1.9.0 |
|
| 28 | - * @param array $attributes |
|
| 29 | - * @param string $content |
|
| 30 | - * @param string $shortcode the shortcode that was called for this instance |
|
| 31 | - */ |
|
| 32 | - public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | - |
|
| 34 | - $this->setup_messages_query(); |
|
| 35 | - |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * create the messages query . |
|
| 40 | - * |
|
| 41 | - * @return mixed |
|
| 42 | - */ |
|
| 43 | - public function setup_messages_query(){ |
|
| 44 | - |
|
| 45 | - $user = wp_get_current_user(); |
|
| 46 | - |
|
| 47 | - $args = array( |
|
| 48 | - 'post_type' => 'sensei_message', |
|
| 49 | - 'posts_per_page' => 500, |
|
| 50 | - 'orderby' => 'date', |
|
| 51 | - 'order' => 'DESC', |
|
| 52 | - 'post_status' => 'publish', |
|
| 53 | - 'meta_query' => array( |
|
| 54 | - array( |
|
| 55 | - 'key' => '_sender', |
|
| 56 | - 'value' => $user->user_login, |
|
| 57 | - 'compare' => '=', |
|
| 58 | - ), |
|
| 59 | - ), |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - $this->messages_query = new WP_Query( $args ); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Rendering the shortcode this class is responsible for. |
|
| 67 | - * |
|
| 68 | - * @return string $content |
|
| 69 | - */ |
|
| 70 | - public function render(){ |
|
| 71 | - |
|
| 72 | - if( !is_user_logged_in() ){ |
|
| 73 | - |
|
| 74 | - Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
| 75 | - |
|
| 76 | - } elseif( 0 == $this->messages_query->post_count ){ |
|
| 77 | - |
|
| 78 | - Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
| 82 | - || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
| 83 | - |
|
| 84 | - // don't show anything if messages are disable |
|
| 85 | - if( $messages_disabled_in_settings ){ |
|
| 86 | - return ''; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - //set the wp_query to the current messages query |
|
| 90 | - global $wp_query; |
|
| 91 | - $wp_query = $this->messages_query; |
|
| 92 | - |
|
| 93 | - ob_start(); |
|
| 94 | - Sensei()->notices->print_notices(); |
|
| 95 | - Sensei_Templates::get_part('loop', 'message'); |
|
| 96 | - $messages_html = ob_get_clean(); |
|
| 97 | - |
|
| 98 | - // set back the global query |
|
| 99 | - wp_reset_query(); |
|
| 100 | - |
|
| 101 | - return $messages_html; |
|
| 102 | - |
|
| 103 | - }// end render |
|
| 18 | + /** |
|
| 19 | + * @var WP_Query |
|
| 20 | + * messages for the current user |
|
| 21 | + */ |
|
| 22 | + protected $messages_query; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Setup the shortcode object |
|
| 26 | + * |
|
| 27 | + * @since 1.9.0 |
|
| 28 | + * @param array $attributes |
|
| 29 | + * @param string $content |
|
| 30 | + * @param string $shortcode the shortcode that was called for this instance |
|
| 31 | + */ |
|
| 32 | + public function __construct( $attributes, $content, $shortcode ){ |
|
| 33 | + |
|
| 34 | + $this->setup_messages_query(); |
|
| 35 | + |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * create the messages query . |
|
| 40 | + * |
|
| 41 | + * @return mixed |
|
| 42 | + */ |
|
| 43 | + public function setup_messages_query(){ |
|
| 44 | + |
|
| 45 | + $user = wp_get_current_user(); |
|
| 46 | + |
|
| 47 | + $args = array( |
|
| 48 | + 'post_type' => 'sensei_message', |
|
| 49 | + 'posts_per_page' => 500, |
|
| 50 | + 'orderby' => 'date', |
|
| 51 | + 'order' => 'DESC', |
|
| 52 | + 'post_status' => 'publish', |
|
| 53 | + 'meta_query' => array( |
|
| 54 | + array( |
|
| 55 | + 'key' => '_sender', |
|
| 56 | + 'value' => $user->user_login, |
|
| 57 | + 'compare' => '=', |
|
| 58 | + ), |
|
| 59 | + ), |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + $this->messages_query = new WP_Query( $args ); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Rendering the shortcode this class is responsible for. |
|
| 67 | + * |
|
| 68 | + * @return string $content |
|
| 69 | + */ |
|
| 70 | + public function render(){ |
|
| 71 | + |
|
| 72 | + if( !is_user_logged_in() ){ |
|
| 73 | + |
|
| 74 | + Sensei()->notices->add_notice( __('Please login to view your messages.','woothemes-sensei') , 'alert' ); |
|
| 75 | + |
|
| 76 | + } elseif( 0 == $this->messages_query->post_count ){ |
|
| 77 | + |
|
| 78 | + Sensei()->notices->add_notice( __( 'You do not have any messages.', 'woothemes-sensei') , 'alert' ); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $messages_disabled_in_settings = ! ( ! isset( Sensei()->settings->settings['messages_disable'] ) |
|
| 82 | + || ! Sensei()->settings->settings['messages_disable'] ) ; |
|
| 83 | + |
|
| 84 | + // don't show anything if messages are disable |
|
| 85 | + if( $messages_disabled_in_settings ){ |
|
| 86 | + return ''; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + //set the wp_query to the current messages query |
|
| 90 | + global $wp_query; |
|
| 91 | + $wp_query = $this->messages_query; |
|
| 92 | + |
|
| 93 | + ob_start(); |
|
| 94 | + Sensei()->notices->print_notices(); |
|
| 95 | + Sensei_Templates::get_part('loop', 'message'); |
|
| 96 | + $messages_html = ob_get_clean(); |
|
| 97 | + |
|
| 98 | + // set back the global query |
|
| 99 | + wp_reset_query(); |
|
| 100 | + |
|
| 101 | + return $messages_html; |
|
| 102 | + |
|
| 103 | + }// end render |
|
| 104 | 104 | |
| 105 | 105 | }// end class |
| 106 | 106 | \ No newline at end of file |
@@ -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,29 +9,29 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | Class 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 | <div id="primary" class="content-area"> |
| 18 | 18 | <main id="main" class="site-main" role="main"> |
| 19 | 19 | |
| 20 | 20 | <?php } |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Output closing wrappers |
|
| 24 | - * |
|
| 25 | - * @since 1.9.0 |
|
| 26 | - */ |
|
| 27 | - public function wrapper_end(){ ?> |
|
| 22 | + /** |
|
| 23 | + * Output closing wrappers |
|
| 24 | + * |
|
| 25 | + * @since 1.9.0 |
|
| 26 | + */ |
|
| 27 | + public function wrapper_end(){ ?> |
|
| 28 | 28 | |
| 29 | 29 | </main> <!-- main-site --> |
| 30 | 30 | </div> <!-- content-area --> |
| 31 | 31 | |
| 32 | 32 | <?php |
| 33 | 33 | |
| 34 | - get_sidebar(); |
|
| 34 | + get_sidebar(); |
|
| 35 | 35 | |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | } // end class |