@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage sensei |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'LSX_Sensei' ) ) : |
|
| 13 | +if ( ! class_exists('LSX_Sensei')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * The LSX Sensei integration class |
@@ -35,57 +35,57 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | global $woothemes_sensei; |
| 37 | 37 | |
| 38 | - add_action( 'wp_enqueue_scripts', array( $this, 'lsx_sensei_scripts_add_styles' ) ); |
|
| 38 | + add_action('wp_enqueue_scripts', array($this, 'lsx_sensei_scripts_add_styles')); |
|
| 39 | 39 | |
| 40 | - remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
| 41 | - add_action( 'sensei_before_main_content', array( $this, 'lsx_sensei_theme_wrapper_start' ) ); |
|
| 40 | + remove_action('sensei_before_main_content', array($woothemes_sensei->frontend, 'sensei_output_content_wrapper'), 10); |
|
| 41 | + add_action('sensei_before_main_content', array($this, 'lsx_sensei_theme_wrapper_start')); |
|
| 42 | 42 | |
| 43 | - remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
| 44 | - add_action( 'sensei_after_main_content', array( $this, 'lsx_sensei_theme_wrapper_end' ) ); |
|
| 43 | + remove_action('sensei_after_main_content', array($woothemes_sensei->frontend, 'sensei_output_content_wrapper_end'), 10); |
|
| 44 | + add_action('sensei_after_main_content', array($this, 'lsx_sensei_theme_wrapper_end')); |
|
| 45 | 45 | |
| 46 | - add_filter( 'get_the_archive_title', array( $this, 'lsx_sensei_modify_archive_title' ), 99, 1 ); |
|
| 46 | + add_filter('get_the_archive_title', array($this, 'lsx_sensei_modify_archive_title'), 99, 1); |
|
| 47 | 47 | |
| 48 | 48 | // LSX |
| 49 | - add_filter( 'lsx_global_header_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 49 | + add_filter('lsx_global_header_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 50 | 50 | // LSX Banners - Plugin, Placeholders |
| 51 | - add_filter( 'lsx_banner_plugin_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 51 | + add_filter('lsx_banner_plugin_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 52 | 52 | // LSX Banners - Banner |
| 53 | - add_filter( 'lsx_banner_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 53 | + add_filter('lsx_banner_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 54 | 54 | |
| 55 | - add_filter( 'course_archive_title', array( $this, 'lsx_sensei_archive_title' ), 10, 1 ); |
|
| 56 | - add_filter( 'sensei_lesson_archive_title', array( $this, 'lsx_sensei_archive_title' ), 10, 1 ); |
|
| 55 | + add_filter('course_archive_title', array($this, 'lsx_sensei_archive_title'), 10, 1); |
|
| 56 | + add_filter('sensei_lesson_archive_title', array($this, 'lsx_sensei_archive_title'), 10, 1); |
|
| 57 | 57 | |
| 58 | - add_filter( 'course_category_title', array( $this, 'lsx_sensei_category_title' ), 10, 1 ); |
|
| 58 | + add_filter('course_category_title', array($this, 'lsx_sensei_category_title'), 10, 1); |
|
| 59 | 59 | |
| 60 | - add_action( 'sensei_course_content_inside_after', array( $this, 'lsx_sensei_add_buttons' ), 9 ); |
|
| 60 | + add_action('sensei_course_content_inside_after', array($this, 'lsx_sensei_add_buttons'), 9); |
|
| 61 | 61 | |
| 62 | - add_filter( 'sensei_wc_single_add_to_cart_button_text', array( $this, 'lsx_sensei_add_to_cart_text' ) ); |
|
| 62 | + add_filter('sensei_wc_single_add_to_cart_button_text', array($this, 'lsx_sensei_add_to_cart_text')); |
|
| 63 | 63 | |
| 64 | - add_action( 'lsx_content_wrap_before', array( $this, 'lsx_sensei_results_header' ) ); |
|
| 64 | + add_action('lsx_content_wrap_before', array($this, 'lsx_sensei_results_header')); |
|
| 65 | 65 | |
| 66 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_course_breadcrumb_filter' ), 40, 1 ); |
|
| 67 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_course_breadcrumb_filter' ), 40, 1 ); |
|
| 66 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_course_breadcrumb_filter'), 40, 1); |
|
| 67 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_course_breadcrumb_filter'), 40, 1); |
|
| 68 | 68 | |
| 69 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_lesson_breadcrumb_filter' ), 40, 1 ); |
|
| 70 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_lesson_breadcrumb_filter' ), 40, 1 ); |
|
| 69 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_lesson_breadcrumb_filter'), 40, 1); |
|
| 70 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_lesson_breadcrumb_filter'), 40, 1); |
|
| 71 | 71 | |
| 72 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_module_breadcrumb_filter' ), 40, 1 ); |
|
| 73 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_module_breadcrumb_filter' ), 40, 1 ); |
|
| 72 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_module_breadcrumb_filter'), 40, 1); |
|
| 73 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_module_breadcrumb_filter'), 40, 1); |
|
| 74 | 74 | |
| 75 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_learner_breadcrumb_filter' ), 40, 1 ); |
|
| 76 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_learner_breadcrumb_filter' ), 40, 1 ); |
|
| 75 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_learner_breadcrumb_filter'), 40, 1); |
|
| 76 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_learner_breadcrumb_filter'), 40, 1); |
|
| 77 | 77 | |
| 78 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_quiz_breadcrumb_filter' ), 40, 1 ); |
|
| 79 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_quiz_breadcrumb_filter' ), 40, 1 ); |
|
| 78 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_quiz_breadcrumb_filter'), 40, 1); |
|
| 79 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_quiz_breadcrumb_filter'), 40, 1); |
|
| 80 | 80 | |
| 81 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_messages_breadcrumb_filter' ), 40, 1 ); |
|
| 82 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_messages_breadcrumb_filter' ), 40, 1 ); |
|
| 81 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_messages_breadcrumb_filter'), 40, 1); |
|
| 82 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_messages_breadcrumb_filter'), 40, 1); |
|
| 83 | 83 | |
| 84 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_results_breadcrumb_filter' ), 40, 1 ); |
|
| 85 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_results_breadcrumb_filter' ), 40, 1 ); |
|
| 84 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_results_breadcrumb_filter'), 40, 1); |
|
| 85 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_results_breadcrumb_filter'), 40, 1); |
|
| 86 | 86 | |
| 87 | - add_action( 'sensei_archive_before_message_loop', array( $this, 'lsx_sensei_back_message_button' ) ); |
|
| 88 | - add_action( 'sensei_content_message_after', array( $this, 'lsx_sensei_view_message_button' ) ); |
|
| 87 | + add_action('sensei_archive_before_message_loop', array($this, 'lsx_sensei_back_message_button')); |
|
| 88 | + add_action('sensei_content_message_after', array($this, 'lsx_sensei_view_message_button')); |
|
| 89 | 89 | |
| 90 | 90 | } |
| 91 | 91 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @subpackage sensei |
| 97 | 97 | */ |
| 98 | 98 | public function lsx_sensei_scripts_add_styles() { |
| 99 | - wp_enqueue_style( 'sensei-lsx', get_template_directory_uri() . '/assets/css/sensei/sensei.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 100 | - wp_style_add_data( 'sensei-lsx', 'rtl', 'replace' ); |
|
| 99 | + wp_enqueue_style('sensei-lsx', get_template_directory_uri() . '/assets/css/sensei/sensei.css', array('lsx_main'), LSX_VERSION); |
|
| 100 | + wp_style_add_data('sensei-lsx', 'rtl', 'replace'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function lsx_sensei_theme_wrapper_start() { |
| 110 | 110 | lsx_content_wrap_before(); |
| 111 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
| 111 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
| 112 | 112 | lsx_content_before(); |
| 113 | 113 | echo '<main id="main" class="site-main" role="main">'; |
| 114 | 114 | lsx_content_top(); |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | * @param [type] $title |
| 135 | 135 | * @return void |
| 136 | 136 | */ |
| 137 | - public function lsx_sensei_modify_archive_title( $title ) { |
|
| 138 | - if ( is_archive() && is_post_type_archive( 'course' ) ) { |
|
| 139 | - $title = __( 'Courses', 'lsx' ); |
|
| 137 | + public function lsx_sensei_modify_archive_title($title) { |
|
| 138 | + if (is_archive() && is_post_type_archive('course')) { |
|
| 139 | + $title = __('Courses', 'lsx'); |
|
| 140 | 140 | } |
| 141 | - if ( is_archive() && is_post_type_archive( 'sensei_message' ) ) { |
|
| 142 | - $title = __( 'Messages', 'lsx' ); |
|
| 141 | + if (is_archive() && is_post_type_archive('sensei_message')) { |
|
| 142 | + $title = __('Messages', 'lsx'); |
|
| 143 | 143 | } |
| 144 | - if ( is_archive() && is_post_type_archive( 'lesson' ) ) { |
|
| 145 | - $title = __( 'Lessons', 'lsx' ); |
|
| 144 | + if (is_archive() && is_post_type_archive('lesson')) { |
|
| 145 | + $title = __('Lessons', 'lsx'); |
|
| 146 | 146 | } |
| 147 | - if ( is_archive() && is_tax() ) { |
|
| 148 | - $title = single_term_title( '', false ); |
|
| 147 | + if (is_archive() && is_tax()) { |
|
| 148 | + $title = single_term_title('', false); |
|
| 149 | 149 | } |
| 150 | 150 | return $title; |
| 151 | 151 | } |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | * @package lsx |
| 157 | 157 | * @subpackage sensei |
| 158 | 158 | */ |
| 159 | - public function lsx_sensei_disable_lsx_banner( $disabled ) { |
|
| 160 | - if ( is_sensei() ) { |
|
| 159 | + public function lsx_sensei_disable_lsx_banner($disabled) { |
|
| 160 | + if (is_sensei()) { |
|
| 161 | 161 | $disabled = true; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | * @package lsx |
| 171 | 171 | * @subpackage sensei |
| 172 | 172 | */ |
| 173 | - public function lsx_sensei_archive_title( $html ) { |
|
| 174 | - $html = preg_replace( '/<header class="archive-header"><h1>([^<]+)<\/h1><\/header>/i', '<h1>$1</h1>', $html ); |
|
| 173 | + public function lsx_sensei_archive_title($html) { |
|
| 174 | + $html = preg_replace('/<header class="archive-header"><h1>([^<]+)<\/h1><\/header>/i', '<h1>$1</h1>', $html); |
|
| 175 | 175 | return $html; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @package lsx |
| 182 | 182 | * @subpackage sensei |
| 183 | 183 | */ |
| 184 | - public function lsx_sensei_category_title( $html ) { |
|
| 185 | - $html = str_replace( 'h2', 'h1', $html ); |
|
| 184 | + public function lsx_sensei_category_title($html) { |
|
| 185 | + $html = str_replace('h2', 'h1', $html); |
|
| 186 | 186 | return $html; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -192,18 +192,18 @@ discard block |
||
| 192 | 192 | * @package lsx |
| 193 | 193 | * @subpackage sensei |
| 194 | 194 | */ |
| 195 | - public function lsx_sensei_add_buttons( $course_id ) { |
|
| 195 | + public function lsx_sensei_add_buttons($course_id) { |
|
| 196 | 196 | global $post, $current_user; |
| 197 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 198 | - $course_purchasable = Sensei_WC::is_course_purchasable( $post->ID ); |
|
| 197 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 198 | + $course_purchasable = Sensei_WC::is_course_purchasable($post->ID); |
|
| 199 | 199 | |
| 200 | 200 | ?> |
| 201 | 201 | <section class="entry-actions"> |
| 202 | - <a class="button" href="<?php echo esc_url( tribe_get_event_link() ); ?>"><?php esc_html_e( 'View course', 'lsx' ); ?></a> |
|
| 202 | + <a class="button" href="<?php echo esc_url(tribe_get_event_link()); ?>"><?php esc_html_e('View course', 'lsx'); ?></a> |
|
| 203 | 203 | |
| 204 | 204 | <?php |
| 205 | - if ( ( ! $is_user_taking_course ) && $course_purchasable ) { |
|
| 206 | - Sensei_WC::the_add_to_cart_button_html( $post->ID ); |
|
| 205 | + if (( ! $is_user_taking_course) && $course_purchasable) { |
|
| 206 | + Sensei_WC::the_add_to_cart_button_html($post->ID); |
|
| 207 | 207 | } |
| 208 | 208 | ?> |
| 209 | 209 | </section> |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | * @package lsx |
| 217 | 217 | * @subpackage sensei |
| 218 | 218 | */ |
| 219 | - public function lsx_sensei_add_to_cart_text( $text ) { |
|
| 220 | - $text = esc_html__( 'Add to cart', 'lsx' ); |
|
| 219 | + public function lsx_sensei_add_to_cart_text($text) { |
|
| 220 | + $text = esc_html__('Add to cart', 'lsx'); |
|
| 221 | 221 | return $text; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -227,46 +227,46 @@ discard block |
||
| 227 | 227 | * @package lsx |
| 228 | 228 | * @subpackage layout |
| 229 | 229 | */ |
| 230 | - public function lsx_sensei_results_header( $user ) { |
|
| 230 | + public function lsx_sensei_results_header($user) { |
|
| 231 | 231 | |
| 232 | 232 | $default_size = 'sm'; |
| 233 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
| 233 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
| 234 | 234 | global $wp_query; |
| 235 | - if ( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 235 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 236 | 236 | $is_results = $wp_query->query_vars['course_results']; |
| 237 | 237 | } else { |
| 238 | 238 | $is_results = false; |
| 239 | 239 | } |
| 240 | - if ( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 240 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 241 | 241 | $is_profile = $wp_query->query_vars['learner_profile']; |
| 242 | 242 | } else { |
| 243 | 243 | $is_profile = false; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if ( is_sticky() && $is_results ) : |
|
| 247 | - $course_for_results = get_page_by_path( $is_results, OBJECT, 'course' ); |
|
| 246 | + if (is_sticky() && $is_results) : |
|
| 247 | + $course_for_results = get_page_by_path($is_results, OBJECT, 'course'); |
|
| 248 | 248 | |
| 249 | - $course_title = esc_html( $course_for_results->post_title ); |
|
| 249 | + $course_title = esc_html($course_for_results->post_title); |
|
| 250 | 250 | ?> |
| 251 | - <div class="archive-header-wrapper banner-single col-<?php echo esc_attr( $size ); ?>-12"> |
|
| 251 | + <div class="archive-header-wrapper banner-single col-<?php echo esc_attr($size); ?>-12"> |
|
| 252 | 252 | <?php lsx_global_header_inner_bottom(); ?> |
| 253 | 253 | <header class="archive-header"> |
| 254 | - <h1 class="archive-title"><?php echo wp_kses_post( $course_title ); ?></h1> |
|
| 254 | + <h1 class="archive-title"><?php echo wp_kses_post($course_title); ?></h1> |
|
| 255 | 255 | </header> |
| 256 | 256 | |
| 257 | 257 | </div> |
| 258 | 258 | <?php |
| 259 | 259 | endif; |
| 260 | 260 | |
| 261 | - if ( is_sticky() && $is_profile ) : |
|
| 261 | + if (is_sticky() && $is_profile) : |
|
| 262 | 262 | $query_var = $wp_query->query_vars['learner_profile']; |
| 263 | - $learner_user = Sensei_Learner::find_by_query_var( $query_var ); |
|
| 263 | + $learner_user = Sensei_Learner::find_by_query_var($query_var); |
|
| 264 | 264 | $learner_name = $learner_user->display_name; |
| 265 | 265 | ?> |
| 266 | - <div class="archive-header-wrapper banner-single col-<?php echo esc_attr( $size ); ?>-12"> |
|
| 266 | + <div class="archive-header-wrapper banner-single col-<?php echo esc_attr($size); ?>-12"> |
|
| 267 | 267 | <?php lsx_global_header_inner_bottom(); ?> |
| 268 | 268 | <header class="archive-header"> |
| 269 | - <h1 class="archive-title"><?php echo esc_html( $learner_name ); ?></h1> |
|
| 269 | + <h1 class="archive-title"><?php echo esc_html($learner_name); ?></h1> |
|
| 270 | 270 | </header> |
| 271 | 271 | |
| 272 | 272 | </div> |
@@ -279,21 +279,21 @@ discard block |
||
| 279 | 279 | * @param $crumbs |
| 280 | 280 | * @return array |
| 281 | 281 | */ |
| 282 | - public function lsx_sensei_course_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 283 | - if ( is_single() && ( is_singular( 'course' ) ) ) { |
|
| 282 | + public function lsx_sensei_course_breadcrumb_filter($crumbs, $id = 0) { |
|
| 283 | + if (is_single() && (is_singular('course'))) { |
|
| 284 | 284 | global $course; |
| 285 | 285 | $lesson = get_the_title(); |
| 286 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 287 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 286 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 287 | + $course_page_url = get_permalink($course_page_url); |
|
| 288 | 288 | |
| 289 | - if ( $lesson ) { |
|
| 289 | + if ($lesson) { |
|
| 290 | 290 | |
| 291 | 291 | $new_crumbs = array(); |
| 292 | 292 | $new_crumbs[0] = $crumbs[0]; |
| 293 | 293 | |
| 294 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 294 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 295 | 295 | $new_crumbs[1] = array( |
| 296 | - 0 => __( 'All Courses', 'lsx' ), |
|
| 296 | + 0 => __('All Courses', 'lsx'), |
|
| 297 | 297 | 1 => $course_page_url, |
| 298 | 298 | ); |
| 299 | 299 | $new_crumbs[2] = array( |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | ); |
| 302 | 302 | } else { |
| 303 | 303 | $new_crumbs[1] = array( |
| 304 | - 'text' => __( 'All Courses', 'lsx' ), |
|
| 304 | + 'text' => __('All Courses', 'lsx'), |
|
| 305 | 305 | 'url' => $course_page_url, |
| 306 | 306 | ); |
| 307 | 307 | $new_crumbs[2] = array( |
@@ -319,34 +319,34 @@ discard block |
||
| 319 | 319 | * @param $crumbs |
| 320 | 320 | * @return array |
| 321 | 321 | */ |
| 322 | - public function lsx_sensei_lesson_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 323 | - if ( is_single() && ( is_singular( 'lesson' ) ) ) { |
|
| 322 | + public function lsx_sensei_lesson_breadcrumb_filter($crumbs, $id = 0) { |
|
| 323 | + if (is_single() && (is_singular('lesson'))) { |
|
| 324 | 324 | global $course; |
| 325 | 325 | $lesson = get_the_title(); |
| 326 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 327 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 326 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 327 | + $course_page_url = get_permalink($course_page_url); |
|
| 328 | 328 | |
| 329 | - if ( empty( $id ) ) { |
|
| 329 | + if (empty($id)) { |
|
| 330 | 330 | $id = get_the_ID(); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( 0 < intval( $id ) ) { |
|
| 334 | - $course = intval( get_post_meta( $id, '_lesson_course', true ) ); |
|
| 335 | - $course_id = esc_url( get_permalink( $course ) ); |
|
| 336 | - $course_title = esc_html( get_the_title( $course ) ); |
|
| 337 | - if ( ! $course ) { |
|
| 333 | + if (0 < intval($id)) { |
|
| 334 | + $course = intval(get_post_meta($id, '_lesson_course', true)); |
|
| 335 | + $course_id = esc_url(get_permalink($course)); |
|
| 336 | + $course_title = esc_html(get_the_title($course)); |
|
| 337 | + if ( ! $course) { |
|
| 338 | 338 | return; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if ( $course_id ) { |
|
| 342 | + if ($course_id) { |
|
| 343 | 343 | |
| 344 | 344 | $new_crumbs = array(); |
| 345 | 345 | $new_crumbs[0] = $crumbs[0]; |
| 346 | 346 | |
| 347 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 347 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 348 | 348 | $new_crumbs[1] = array( |
| 349 | - 0 => __( 'Courses', 'lsx' ), |
|
| 349 | + 0 => __('Courses', 'lsx'), |
|
| 350 | 350 | 1 => $course_page_url, |
| 351 | 351 | ); |
| 352 | 352 | $new_crumbs[2] = array( |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | ); |
| 359 | 359 | } else { |
| 360 | 360 | $new_crumbs[1] = array( |
| 361 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 361 | + 'text' => __('Courses', 'lsx'), |
|
| 362 | 362 | 'url' => $course_page_url, |
| 363 | 363 | ); |
| 364 | 364 | $new_crumbs[2] = array( |
@@ -380,27 +380,27 @@ discard block |
||
| 380 | 380 | * @param $crumbs |
| 381 | 381 | * @return array |
| 382 | 382 | */ |
| 383 | - public function lsx_sensei_module_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 384 | - if ( ! empty( get_queried_object()->name ) ) { |
|
| 385 | - $title = apply_filters( 'sensei_module_archive_title', get_queried_object()->name ); |
|
| 383 | + public function lsx_sensei_module_breadcrumb_filter($crumbs, $id = 0) { |
|
| 384 | + if ( ! empty(get_queried_object()->name)) { |
|
| 385 | + $title = apply_filters('sensei_module_archive_title', get_queried_object()->name); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - if ( is_tax() && is_archive() && ( ! empty( $title ) ) ) { |
|
| 388 | + if (is_tax() && is_archive() && ( ! empty($title))) { |
|
| 389 | 389 | |
| 390 | 390 | $lesson = get_the_archive_title(); |
| 391 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 392 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 391 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 392 | + $course_page_url = get_permalink($course_page_url); |
|
| 393 | 393 | |
| 394 | - if ( empty( $id ) ) { |
|
| 394 | + if (empty($id)) { |
|
| 395 | 395 | $id = get_the_ID(); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | $new_crumbs = array(); |
| 399 | 399 | $new_crumbs[0] = $crumbs[0]; |
| 400 | 400 | |
| 401 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 401 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 402 | 402 | $new_crumbs[1] = array( |
| 403 | - 0 => __( 'Courses', 'lsx' ), |
|
| 403 | + 0 => __('Courses', 'lsx'), |
|
| 404 | 404 | 1 => $course_page_url, |
| 405 | 405 | ); |
| 406 | 406 | $new_crumbs[2] = array( |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | ); |
| 409 | 409 | } else { |
| 410 | 410 | $new_crumbs[1] = array( |
| 411 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 411 | + 'text' => __('Courses', 'lsx'), |
|
| 412 | 412 | 'url' => $course_page_url, |
| 413 | 413 | ); |
| 414 | 414 | $new_crumbs[2] = array( |
@@ -425,38 +425,38 @@ discard block |
||
| 425 | 425 | * @param $crumbs |
| 426 | 426 | * @return array |
| 427 | 427 | */ |
| 428 | - public function lsx_sensei_learner_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 428 | + public function lsx_sensei_learner_breadcrumb_filter($crumbs, $id = 0) { |
|
| 429 | 429 | global $wp_query; |
| 430 | 430 | |
| 431 | - if ( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 431 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 432 | 432 | $is_profile = $wp_query->query_vars['learner_profile']; |
| 433 | 433 | } else { |
| 434 | 434 | $is_profile = false; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - if ( is_sticky() && $is_profile ) { |
|
| 437 | + if (is_sticky() && $is_profile) { |
|
| 438 | 438 | |
| 439 | - if ( empty( $id ) ) { |
|
| 439 | + if (empty($id)) { |
|
| 440 | 440 | $id = get_the_ID(); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | $query_var = $wp_query->query_vars['learner_profile']; |
| 444 | - $learner_user = Sensei_Learner::find_by_query_var( $query_var ); |
|
| 444 | + $learner_user = Sensei_Learner::find_by_query_var($query_var); |
|
| 445 | 445 | $learner_name = $learner_user->display_name; |
| 446 | 446 | |
| 447 | 447 | $new_crumbs = array(); |
| 448 | 448 | $new_crumbs[0] = $crumbs[0]; |
| 449 | 449 | |
| 450 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 450 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 451 | 451 | $new_crumbs[1] = array( |
| 452 | - 0 => __( 'Learners', 'lsx' ), |
|
| 452 | + 0 => __('Learners', 'lsx'), |
|
| 453 | 453 | ); |
| 454 | 454 | $new_crumbs[2] = array( |
| 455 | 455 | 0 => $learner_name, |
| 456 | 456 | ); |
| 457 | 457 | } else { |
| 458 | 458 | $new_crumbs[1] = array( |
| 459 | - 'text' => __( 'Learners', 'lsx' ), |
|
| 459 | + 'text' => __('Learners', 'lsx'), |
|
| 460 | 460 | ); |
| 461 | 461 | $new_crumbs[2] = array( |
| 462 | 462 | 'text' => $learner_name, |
@@ -472,36 +472,36 @@ discard block |
||
| 472 | 472 | * @param $crumbs |
| 473 | 473 | * @return array |
| 474 | 474 | */ |
| 475 | - public function lsx_sensei_messages_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 476 | - if ( is_archive() && ( is_post_type_archive( 'sensei_message' ) ) ) { |
|
| 475 | + public function lsx_sensei_messages_breadcrumb_filter($crumbs, $id = 0) { |
|
| 476 | + if (is_archive() && (is_post_type_archive('sensei_message'))) { |
|
| 477 | 477 | |
| 478 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 479 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 478 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 479 | + $course_page_url = get_permalink($course_page_url); |
|
| 480 | 480 | |
| 481 | - if ( empty( $id ) ) { |
|
| 481 | + if (empty($id)) { |
|
| 482 | 482 | $id = get_the_ID(); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( $id ) { |
|
| 485 | + if ($id) { |
|
| 486 | 486 | |
| 487 | 487 | $new_crumbs = array(); |
| 488 | 488 | $new_crumbs[0] = $crumbs[0]; |
| 489 | 489 | |
| 490 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 490 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 491 | 491 | $new_crumbs[1] = array( |
| 492 | - 0 => __( 'Courses', 'lsx' ), |
|
| 492 | + 0 => __('Courses', 'lsx'), |
|
| 493 | 493 | 1 => $course_page_url, |
| 494 | 494 | ); |
| 495 | 495 | $new_crumbs[2] = array( |
| 496 | - 0 => __( 'Messages', 'lsx' ), |
|
| 496 | + 0 => __('Messages', 'lsx'), |
|
| 497 | 497 | ); |
| 498 | 498 | } else { |
| 499 | 499 | $new_crumbs[1] = array( |
| 500 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 500 | + 'text' => __('Courses', 'lsx'), |
|
| 501 | 501 | 'url' => $course_page_url, |
| 502 | 502 | ); |
| 503 | 503 | $new_crumbs[2] = array( |
| 504 | - 'text' => __( 'Messages', 'lsx' ), |
|
| 504 | + 'text' => __('Messages', 'lsx'), |
|
| 505 | 505 | ); |
| 506 | 506 | } |
| 507 | 507 | $crumbs = $new_crumbs; |
@@ -515,35 +515,35 @@ discard block |
||
| 515 | 515 | * @param $crumbs |
| 516 | 516 | * @return array |
| 517 | 517 | */ |
| 518 | - public function lsx_sensei_quiz_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 519 | - if ( ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 518 | + public function lsx_sensei_quiz_breadcrumb_filter($crumbs, $id = 0) { |
|
| 519 | + if ((is_single() && (is_singular('quiz')))) { |
|
| 520 | 520 | global $course; |
| 521 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 522 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 521 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 522 | + $course_page_url = get_permalink($course_page_url); |
|
| 523 | 523 | $lesson = get_the_title(); |
| 524 | 524 | |
| 525 | - if ( empty( $id ) ) { |
|
| 525 | + if (empty($id)) { |
|
| 526 | 526 | $id = get_the_ID(); |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - if ( 0 < intval( $id ) ) { |
|
| 529 | + if (0 < intval($id)) { |
|
| 530 | 530 | |
| 531 | - $course = intval( get_post_meta( $id, '_quiz_lesson', true ) ); |
|
| 532 | - $course_id = esc_url( get_permalink( $course ) ); |
|
| 533 | - $course_title = esc_html( get_the_title( $course ) ); |
|
| 534 | - if ( ! $course ) { |
|
| 531 | + $course = intval(get_post_meta($id, '_quiz_lesson', true)); |
|
| 532 | + $course_id = esc_url(get_permalink($course)); |
|
| 533 | + $course_title = esc_html(get_the_title($course)); |
|
| 534 | + if ( ! $course) { |
|
| 535 | 535 | return; |
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | - if ( $course_id ) { |
|
| 539 | + if ($course_id) { |
|
| 540 | 540 | |
| 541 | 541 | $new_crumbs = array(); |
| 542 | 542 | $new_crumbs[0] = $crumbs[0]; |
| 543 | 543 | |
| 544 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 544 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 545 | 545 | $new_crumbs[1] = array( |
| 546 | - 0 => __( 'Courses', 'lsx' ), |
|
| 546 | + 0 => __('Courses', 'lsx'), |
|
| 547 | 547 | 1 => $course_page_url, |
| 548 | 548 | ); |
| 549 | 549 | $new_crumbs[2] = array( |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | ); |
| 556 | 556 | } else { |
| 557 | 557 | $new_crumbs[1] = array( |
| 558 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 558 | + 'text' => __('Courses', 'lsx'), |
|
| 559 | 559 | 'url' => $course_page_url, |
| 560 | 560 | ); |
| 561 | 561 | $new_crumbs[2] = array( |
@@ -578,36 +578,36 @@ discard block |
||
| 578 | 578 | * @param $crumbs |
| 579 | 579 | * @return array |
| 580 | 580 | */ |
| 581 | - public function lsx_sensei_results_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 582 | - if ( is_sticky() ) { |
|
| 581 | + public function lsx_sensei_results_breadcrumb_filter($crumbs, $id = 0) { |
|
| 582 | + if (is_sticky()) { |
|
| 583 | 583 | global $wp_query; |
| 584 | 584 | $course_id = ''; |
| 585 | - if ( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 585 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 586 | 586 | $is_results = $wp_query->query_vars['course_results']; |
| 587 | 587 | } |
| 588 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 589 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 588 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 589 | + $course_page_url = get_permalink($course_page_url); |
|
| 590 | 590 | |
| 591 | - if ( empty( $id ) ) { |
|
| 591 | + if (empty($id)) { |
|
| 592 | 592 | $id = get_the_ID(); |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - if ( isset( $is_results ) ) { |
|
| 596 | - $course_for_results = get_page_by_path( $is_results, OBJECT, 'course' ); |
|
| 595 | + if (isset($is_results)) { |
|
| 596 | + $course_for_results = get_page_by_path($is_results, OBJECT, 'course'); |
|
| 597 | 597 | |
| 598 | - $course_id = esc_url( get_permalink( $course_for_results ) ); |
|
| 599 | - $course_title = esc_html( $course_for_results->post_title ); |
|
| 598 | + $course_id = esc_url(get_permalink($course_for_results)); |
|
| 599 | + $course_title = esc_html($course_for_results->post_title); |
|
| 600 | 600 | |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - if ( $course_id ) { |
|
| 603 | + if ($course_id) { |
|
| 604 | 604 | $new_crumbs = array(); |
| 605 | 605 | $new_crumbs[0] = $crumbs[0]; |
| 606 | 606 | |
| 607 | - if ( $is_results ) { |
|
| 608 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 607 | + if ($is_results) { |
|
| 608 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 609 | 609 | $new_crumbs[1] = array( |
| 610 | - 0 => __( 'Courses', 'lsx' ), |
|
| 610 | + 0 => __('Courses', 'lsx'), |
|
| 611 | 611 | 1 => $course_page_url, |
| 612 | 612 | ); |
| 613 | 613 | $new_crumbs[2] = array( |
@@ -615,15 +615,15 @@ discard block |
||
| 615 | 615 | 1 => $course_id, |
| 616 | 616 | ); |
| 617 | 617 | $new_crumbs[3] = array( |
| 618 | - 0 => __( 'Results', 'lsx' ), |
|
| 618 | + 0 => __('Results', 'lsx'), |
|
| 619 | 619 | ); |
| 620 | 620 | } else { |
| 621 | 621 | $new_crumbs[1] = array( |
| 622 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 622 | + 'text' => __('Courses', 'lsx'), |
|
| 623 | 623 | 'url' => $course_page_url, |
| 624 | 624 | ); |
| 625 | 625 | $new_crumbs[2] = array( |
| 626 | - 'text' => __( 'Results', 'lsx' ), |
|
| 626 | + 'text' => __('Results', 'lsx'), |
|
| 627 | 627 | ); |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -639,9 +639,9 @@ discard block |
||
| 639 | 639 | * @param [type] $message_post_id |
| 640 | 640 | * @return void |
| 641 | 641 | */ |
| 642 | - public function lsx_sensei_view_message_button( $message_post_id ) { |
|
| 643 | - $message_link = get_the_permalink( $message_post_id ); |
|
| 644 | - echo '<a href="' . esc_url_raw( $message_link ) . '" class="btn view-msg-btn">' . wp_kses_post( 'View Message', 'lsx' ) . '</a>'; |
|
| 642 | + public function lsx_sensei_view_message_button($message_post_id) { |
|
| 643 | + $message_link = get_the_permalink($message_post_id); |
|
| 644 | + echo '<a href="' . esc_url_raw($message_link) . '" class="btn view-msg-btn">' . wp_kses_post('View Message', 'lsx') . '</a>'; |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | /** |
@@ -650,9 +650,9 @@ discard block |
||
| 650 | 650 | * @param [type] $message_post_id |
| 651 | 651 | * @return void |
| 652 | 652 | */ |
| 653 | - public function lsx_sensei_back_message_button( $courses_link ) { |
|
| 653 | + public function lsx_sensei_back_message_button($courses_link) { |
|
| 654 | 654 | $courses_link = '/my-courses/'; |
| 655 | - echo '<a href="' . esc_url_raw( $courses_link ) . '" class="btn border-btn my-courses-btn">' . wp_kses_post( 'My Courses', 'lsx' ) . '</a>'; |
|
| 655 | + echo '<a href="' . esc_url_raw($courses_link) . '" class="btn border-btn my-courses-btn">' . wp_kses_post('My Courses', 'lsx') . '</a>'; |
|
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | |