@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage extras |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @package lsx |
| 17 | 17 | * @subpackage extras |
| 18 | 18 | */ |
| 19 | -add_filter( 'widget_text', 'shortcode_unautop' ); |
|
| 20 | -add_filter( 'widget_text', 'do_shortcode' ); |
|
| 19 | +add_filter('widget_text', 'shortcode_unautop'); |
|
| 20 | +add_filter('widget_text', 'do_shortcode'); |
|
| 21 | 21 | |
| 22 | -if ( ! function_exists( 'lsx_kses_allowed_html' ) ) : |
|
| 22 | +if ( ! function_exists('lsx_kses_allowed_html')) : |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Enable extra attributes (srcset, sizes) in img tag. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @package lsx |
| 28 | 28 | * @subpackage extras |
| 29 | 29 | */ |
| 30 | - function lsx_kses_allowed_html( $allowedtags, $context ) { |
|
| 30 | + function lsx_kses_allowed_html($allowedtags, $context) { |
|
| 31 | 31 | $allowedtags['img']['srcset'] = true; |
| 32 | 32 | $allowedtags['img']['sizes'] = true; |
| 33 | 33 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | endif; |
| 44 | 44 | |
| 45 | -add_filter( 'wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2 ); |
|
| 45 | +add_filter('wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2); |
|
| 46 | 46 | |
| 47 | -if ( ! function_exists( 'lsx_body_class' ) ) : |
|
| 47 | +if ( ! function_exists('lsx_body_class')) : |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Add and remove body_class() classes. |
@@ -52,49 +52,49 @@ discard block |
||
| 52 | 52 | * @package lsx |
| 53 | 53 | * @subpackage extras |
| 54 | 54 | */ |
| 55 | - function lsx_body_class( $classes ) { |
|
| 55 | + function lsx_body_class($classes) { |
|
| 56 | 56 | global $post; |
| 57 | 57 | |
| 58 | - $header_layout = get_theme_mod( 'lsx_header_layout', 'inline' ); |
|
| 58 | + $header_layout = get_theme_mod('lsx_header_layout', 'inline'); |
|
| 59 | 59 | $classes[] = 'header-' . $header_layout; |
| 60 | 60 | |
| 61 | - if ( isset( $post ) ) { |
|
| 61 | + if (isset($post)) { |
|
| 62 | 62 | $classes[] = $post->post_name; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ( class_exists( 'LSX_Banners' ) || empty( apply_filters( 'lsx_banner_plugin_disable', false ) ) ) { |
|
| 66 | - $post_types = array( 'page', 'post' ); |
|
| 67 | - $post_types = apply_filters( 'lsx_allowed_post_type_banners', $post_types ); |
|
| 65 | + if (class_exists('LSX_Banners') || empty(apply_filters('lsx_banner_plugin_disable', false))) { |
|
| 66 | + $post_types = array('page', 'post'); |
|
| 67 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 68 | 68 | |
| 69 | - if ( is_singular( $post_types ) && has_post_thumbnail() ) { |
|
| 69 | + if (is_singular($post_types) && has_post_thumbnail()) { |
|
| 70 | 70 | $classes[] = 'page-has-banner'; |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( has_nav_menu( 'top-menu' ) || has_nav_menu( 'top-menu-left' ) ) { |
|
| 74 | + if (has_nav_menu('top-menu') || has_nav_menu('top-menu-left')) { |
|
| 75 | 75 | $classes[] = 'has-top-menu'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $fixed_header = get_theme_mod( 'lsx_header_fixed', false ); |
|
| 78 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
| 79 | 79 | |
| 80 | - if ( false !== $fixed_header ) { |
|
| 80 | + if (false !== $fixed_header) { |
|
| 81 | 81 | $classes[] = 'top-menu-fixed'; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $search_form = get_theme_mod( 'lsx_header_search', false ); |
|
| 84 | + $search_form = get_theme_mod('lsx_header_search', false); |
|
| 85 | 85 | |
| 86 | - if ( false !== $search_form ) { |
|
| 86 | + if (false !== $search_form) { |
|
| 87 | 87 | $classes[] = 'has-header-search'; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $preloader_content = get_theme_mod( 'lsx_preloader_content_status', false ); |
|
| 90 | + $preloader_content = get_theme_mod('lsx_preloader_content_status', false); |
|
| 91 | 91 | |
| 92 | - if ( false !== $preloader_content ) { |
|
| 92 | + if (false !== $preloader_content) { |
|
| 93 | 93 | $classes[] = 'preloader-content-enable'; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $register_enabled = get_option( 'users_can_register', false ); |
|
| 97 | - if ( ( $register_enabled ) && is_page( 'my-account' ) && is_singular() ) { |
|
| 96 | + $register_enabled = get_option('users_can_register', false); |
|
| 97 | + if (($register_enabled) && is_page('my-account') && is_singular()) { |
|
| 98 | 98 | $classes[] = 'register-enabled'; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | endif; |
| 105 | 105 | |
| 106 | -add_filter( 'body_class', 'lsx_body_class' ); |
|
| 106 | +add_filter('body_class', 'lsx_body_class'); |
|
| 107 | 107 | |
| 108 | -if ( ! function_exists( 'lsx_embed_wrap' ) ) : |
|
| 108 | +if ( ! function_exists('lsx_embed_wrap')) : |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Wrap embedded media as suggested by Readability. |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * @link https://gist.github.com/965956 |
| 117 | 117 | * @link http://www.readability.com/publishers/guidelines#publisher |
| 118 | 118 | */ |
| 119 | - function lsx_embed_wrap( $cache, $url, $attr = '', $post_id = '' ) { |
|
| 120 | - if ( false !== strpos( $cache, '<iframe' ) ) { |
|
| 119 | + function lsx_embed_wrap($cache, $url, $attr = '', $post_id = '') { |
|
| 120 | + if (false !== strpos($cache, '<iframe')) { |
|
| 121 | 121 | return '<div class="entry-content-asset">' . $cache . '</div>'; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | endif; |
| 128 | 128 | |
| 129 | -add_filter( 'embed_oembed_html', 'lsx_embed_wrap', 10, 4 ); |
|
| 129 | +add_filter('embed_oembed_html', 'lsx_embed_wrap', 10, 4); |
|
| 130 | 130 | |
| 131 | -if ( ! function_exists( 'lsx_remove_self_closing_tags' ) ) : |
|
| 131 | +if ( ! function_exists('lsx_remove_self_closing_tags')) : |
|
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * Remove unnecessary self-closing tags. |
@@ -136,17 +136,17 @@ discard block |
||
| 136 | 136 | * @package lsx |
| 137 | 137 | * @subpackage extras |
| 138 | 138 | */ |
| 139 | - function lsx_remove_self_closing_tags( $input ) { |
|
| 140 | - return str_replace( ' />', '>', $input ); |
|
| 139 | + function lsx_remove_self_closing_tags($input) { |
|
| 140 | + return str_replace(' />', '>', $input); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | endif; |
| 144 | 144 | |
| 145 | -add_filter( 'get_avatar', 'lsx_remove_self_closing_tags' ); // <img /> |
|
| 146 | -add_filter( 'comment_id_fields', 'lsx_remove_self_closing_tags' ); // <input /> |
|
| 147 | -add_filter( 'post_thumbnail_html', 'lsx_remove_self_closing_tags' ); // <img /> |
|
| 145 | +add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 146 | +add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input /> |
|
| 147 | +add_filter('post_thumbnail_html', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 148 | 148 | |
| 149 | -if ( ! function_exists( 'lsx_is_element_empty' ) ) : |
|
| 149 | +if ( ! function_exists('lsx_is_element_empty')) : |
|
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Checks if a Nav $element is empty or not. |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | * @package lsx |
| 155 | 155 | * @subpackage extras |
| 156 | 156 | */ |
| 157 | - function lsx_is_element_empty( $element ) { |
|
| 158 | - $element = trim( $element ); |
|
| 159 | - return empty( $element ) ? false : true; |
|
| 157 | + function lsx_is_element_empty($element) { |
|
| 158 | + $element = trim($element); |
|
| 159 | + return empty($element) ? false : true; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | endif; |
| 163 | 163 | |
| 164 | -if ( ! function_exists( 'lsx_get_thumbnail' ) ) : |
|
| 164 | +if ( ! function_exists('lsx_get_thumbnail')) : |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * return the responsive images. |
@@ -169,58 +169,58 @@ discard block |
||
| 169 | 169 | * @package lsx |
| 170 | 170 | * @subpackage extras |
| 171 | 171 | */ |
| 172 | - function lsx_get_thumbnail( $size, $image_src = false ) { |
|
| 173 | - if ( false === $image_src ) { |
|
| 172 | + function lsx_get_thumbnail($size, $image_src = false) { |
|
| 173 | + if (false === $image_src) { |
|
| 174 | 174 | $post_id = get_the_ID(); |
| 175 | - $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 176 | - } elseif ( false !== $image_src ) { |
|
| 177 | - if ( is_numeric( $image_src ) ) { |
|
| 175 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 176 | + } elseif (false !== $image_src) { |
|
| 177 | + if (is_numeric($image_src)) { |
|
| 178 | 178 | $post_thumbnail_id = $image_src; |
| 179 | 179 | } else { |
| 180 | - $post_thumbnail_id = lsx_get_attachment_id_from_src( $image_src ); |
|
| 180 | + $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $size = apply_filters( 'lsx_thumbnail_size', $size ); |
|
| 184 | + $size = apply_filters('lsx_thumbnail_size', $size); |
|
| 185 | 185 | $img = ''; |
| 186 | 186 | $lazy_img = ''; |
| 187 | 187 | $image_url = ''; |
| 188 | 188 | |
| 189 | - if ( 'lsx-thumbnail-single' === $size || 'lsx-thumbnail-wide' === $size || 'lsx-thumbnail-square' === $size || 'thumbnail' === $size ) { |
|
| 189 | + if ('lsx-thumbnail-single' === $size || 'lsx-thumbnail-wide' === $size || 'lsx-thumbnail-square' === $size || 'thumbnail' === $size) { |
|
| 190 | 190 | $srcset = false; |
| 191 | - $temp_img = wp_get_attachment_image_src( $post_thumbnail_id, $size ); |
|
| 192 | - if ( ! empty( $temp_img ) ) { |
|
| 193 | - $img = $temp_img[0]; |
|
| 191 | + $temp_img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 192 | + if ( ! empty($temp_img)) { |
|
| 193 | + $img = $temp_img[0]; |
|
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | 196 | $srcset = true; |
| 197 | - $img = wp_get_attachment_image_srcset( $post_thumbnail_id, $size ); |
|
| 197 | + $img = wp_get_attachment_image_srcset($post_thumbnail_id, $size); |
|
| 198 | 198 | |
| 199 | - $temp_lazy = wp_get_attachment_image_src( $post_thumbnail_id, $size ); |
|
| 200 | - if ( ! empty( $temp_lazy ) ) { |
|
| 199 | + $temp_lazy = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 200 | + if ( ! empty($temp_lazy)) { |
|
| 201 | 201 | $lazy_img = $temp_lazy[0]; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if ( empty( $img ) ) { |
|
| 204 | + if (empty($img)) { |
|
| 205 | 205 | $srcset = false; |
| 206 | - if ( ! empty( $lazy_img ) ) { |
|
| 206 | + if ( ! empty($lazy_img)) { |
|
| 207 | 207 | $img = $lazy_img; |
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if ( '' !== $img ) { |
|
| 212 | + if ('' !== $img) { |
|
| 213 | 213 | $image_url = $img; |
| 214 | - $img = '<img alt="' . the_title_attribute( 'echo=0' ) . '" class="attachment-responsive wp-post-image lsx-responsive" '; |
|
| 215 | - if ( $srcset ) { |
|
| 216 | - $img .= 'srcset="' . esc_attr( $image_url ) . '" '; |
|
| 214 | + $img = '<img alt="' . the_title_attribute('echo=0') . '" class="attachment-responsive wp-post-image lsx-responsive" '; |
|
| 215 | + if ($srcset) { |
|
| 216 | + $img .= 'srcset="' . esc_attr($image_url) . '" '; |
|
| 217 | 217 | } else { |
| 218 | - $img .= 'src="' . esc_url( $image_url ) . '" '; |
|
| 218 | + $img .= 'src="' . esc_url($image_url) . '" '; |
|
| 219 | 219 | } |
| 220 | 220 | $img .= '/>'; |
| 221 | 221 | |
| 222 | - $img = apply_filters( 'lsx_lazyload_filter_images', $img ); |
|
| 223 | - $img = apply_filters( 'lsx_lazyload_slider_images', $img, $post_thumbnail_id, $size, $srcset, $image_url ); |
|
| 222 | + $img = apply_filters('lsx_lazyload_filter_images', $img); |
|
| 223 | + $img = apply_filters('lsx_lazyload_slider_images', $img, $post_thumbnail_id, $size, $srcset, $image_url); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | return $img; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | endif; |
| 230 | 230 | |
| 231 | -if ( ! function_exists( 'lsx_thumbnail' ) ) : |
|
| 231 | +if ( ! function_exists('lsx_thumbnail')) : |
|
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * Output the Resonsive Images. |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | * @package lsx |
| 237 | 237 | * @subpackage extras |
| 238 | 238 | */ |
| 239 | - function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) { |
|
| 240 | - echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) ); |
|
| 239 | + function lsx_thumbnail($size = 'thumbnail', $image_src = false) { |
|
| 240 | + echo wp_kses_post(lsx_get_thumbnail($size, $image_src)); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | endif; |
| 244 | 244 | |
| 245 | -if ( ! function_exists( 'lsx_get_attachment_id_from_src' ) ) : |
|
| 245 | +if ( ! function_exists('lsx_get_attachment_id_from_src')) : |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Gets the attachments ID from the src. |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | * @package lsx |
| 251 | 251 | * @subpackage extras |
| 252 | 252 | */ |
| 253 | - function lsx_get_attachment_id_from_src( $image_src ) { |
|
| 254 | - $post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' ); |
|
| 253 | + function lsx_get_attachment_id_from_src($image_src) { |
|
| 254 | + $post_id = wp_cache_get($image_src, 'lsx_get_attachment_id_from_src'); |
|
| 255 | 255 | |
| 256 | - if ( false === $post_id ) { |
|
| 256 | + if (false === $post_id) { |
|
| 257 | 257 | global $wpdb; |
| 258 | - $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) ); |
|
| 259 | - wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 ); |
|
| 258 | + $post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src)); |
|
| 259 | + wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $post_id; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | endif; |
| 266 | 266 | |
| 267 | -if ( ! function_exists( 'lsx_page_banner' ) ) : |
|
| 267 | +if ( ! function_exists('lsx_page_banner')) : |
|
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | 270 | * Add Featured Image as Banner on Single Pages. |
@@ -273,30 +273,30 @@ discard block |
||
| 273 | 273 | * @subpackage extras |
| 274 | 274 | */ |
| 275 | 275 | function lsx_page_banner() { |
| 276 | - if ( true === apply_filters( 'lsx_page_banner_disable', false ) ) { |
|
| 276 | + if (true === apply_filters('lsx_page_banner_disable', false)) { |
|
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $post_types = array( 'page', 'post' ); |
|
| 281 | - $post_types = apply_filters( 'lsx_allowed_post_type_banners', $post_types ); |
|
| 280 | + $post_types = array('page', 'post'); |
|
| 281 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 282 | 282 | |
| 283 | - if ( is_singular( $post_types ) && has_post_thumbnail() ) : |
|
| 283 | + if (is_singular($post_types) && has_post_thumbnail()) : |
|
| 284 | 284 | $bg_image = ''; |
| 285 | 285 | |
| 286 | - if ( has_post_thumbnail() ) { |
|
| 287 | - $temp_bg_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); |
|
| 288 | - if ( ! empty( $temp_bg_image ) ) { |
|
| 286 | + if (has_post_thumbnail()) { |
|
| 287 | + $temp_bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); |
|
| 288 | + if ( ! empty($temp_bg_image)) { |
|
| 289 | 289 | $bg_image = $temp_bg_image[0]; |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if ( '' !== $bg_image ) : |
|
| 293 | + if ('' !== $bg_image) : |
|
| 294 | 294 | ?> |
| 295 | 295 | <div class="page-banner-wrap"> |
| 296 | 296 | <div class="page-banner"> |
| 297 | 297 | <?php lsx_banner_inner_top(); ?> |
| 298 | 298 | |
| 299 | - <div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div> |
|
| 299 | + <div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div> |
|
| 300 | 300 | |
| 301 | 301 | <div class="container"> |
| 302 | 302 | <header class="page-header"> |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | endif; |
| 317 | 317 | |
| 318 | -add_filter( 'lsx_banner_disable', 'lsx_disable_banner_for_blocks' ); |
|
| 319 | -add_filter( 'lsx_global_header_disable', 'lsx_disable_banner_for_blocks' ); |
|
| 318 | +add_filter('lsx_banner_disable', 'lsx_disable_banner_for_blocks'); |
|
| 319 | +add_filter('lsx_global_header_disable', 'lsx_disable_banner_for_blocks'); |
|
| 320 | 320 | |
| 321 | 321 | |
| 322 | -if ( ! function_exists( 'lsx_disable_banner_for_blocks' ) ) : |
|
| 322 | +if ( ! function_exists('lsx_disable_banner_for_blocks')) : |
|
| 323 | 323 | |
| 324 | 324 | /** |
| 325 | 325 | * Disable the Banner if the page is using Blocks |
@@ -330,15 +330,15 @@ discard block |
||
| 330 | 330 | * @param $disable boolean |
| 331 | 331 | * @return boolean |
| 332 | 332 | */ |
| 333 | - function lsx_disable_banner_for_blocks( $disable ) { |
|
| 333 | + function lsx_disable_banner_for_blocks($disable) { |
|
| 334 | 334 | $queried_object = get_queried_object_id(); |
| 335 | - $show_on_front = get_option( 'show_on_front' ); |
|
| 335 | + $show_on_front = get_option('show_on_front'); |
|
| 336 | 336 | |
| 337 | - if ( 'page' === $show_on_front && (int) get_option( 'page_for_posts' ) === $queried_object ) { |
|
| 337 | + if ('page' === $show_on_front && (int) get_option('page_for_posts') === $queried_object) { |
|
| 338 | 338 | return $disable; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if ( function_exists( 'has_blocks' ) && has_blocks() && ( ! is_archive() ) ) { |
|
| 341 | + if (function_exists('has_blocks') && has_blocks() && ( ! is_archive())) { |
|
| 342 | 342 | $disable = true; |
| 343 | 343 | } |
| 344 | 344 | return $disable; |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | endif; |
| 348 | 348 | |
| 349 | -add_action( 'lsx_header_after', 'lsx_page_banner' ); |
|
| 349 | +add_action('lsx_header_after', 'lsx_page_banner'); |
|
| 350 | 350 | |
| 351 | -if ( ! function_exists( 'lsx_form_submit_button' ) ) : |
|
| 351 | +if ( ! function_exists('lsx_form_submit_button')) : |
|
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | 354 | * filter the Gravity Forms button type. |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | * @param $form Object |
| 361 | 361 | * @return String |
| 362 | 362 | */ |
| 363 | - function lsx_form_submit_button( $button, $form ) { |
|
| 363 | + function lsx_form_submit_button($button, $form) { |
|
| 364 | 364 | return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>"; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | endif; |
| 368 | 368 | |
| 369 | -add_filter( 'gform_submit_button', 'lsx_form_submit_button', 10, 2 ); |
|
| 369 | +add_filter('gform_submit_button', 'lsx_form_submit_button', 10, 2); |
|
| 370 | 370 | |
| 371 | -if ( ! function_exists( 'lsx_excerpt_more' ) ) : |
|
| 371 | +if ( ! function_exists('lsx_excerpt_more')) : |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Replaces the excerpt "more" text by a link. |
@@ -376,15 +376,15 @@ discard block |
||
| 376 | 376 | * @package lsx |
| 377 | 377 | * @subpackage extras |
| 378 | 378 | */ |
| 379 | - function lsx_excerpt_more( $more ) { |
|
| 379 | + function lsx_excerpt_more($more) { |
|
| 380 | 380 | return '...'; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | endif; |
| 384 | 384 | |
| 385 | -add_filter( 'excerpt_more', 'lsx_excerpt_more' ); |
|
| 385 | +add_filter('excerpt_more', 'lsx_excerpt_more'); |
|
| 386 | 386 | |
| 387 | -if ( ! function_exists( 'lsx_the_excerpt_filter' ) ) : |
|
| 387 | +if ( ! function_exists('lsx_the_excerpt_filter')) : |
|
| 388 | 388 | |
| 389 | 389 | /** |
| 390 | 390 | * Add a continue reading link to the excerpt. |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * @package lsx |
| 393 | 393 | * @subpackage extras |
| 394 | 394 | */ |
| 395 | - function lsx_the_excerpt_filter( $excerpt ) { |
|
| 395 | + function lsx_the_excerpt_filter($excerpt) { |
|
| 396 | 396 | |
| 397 | 397 | $post_formats = array( |
| 398 | 398 | 'aside' => 'aside', |
@@ -405,23 +405,23 @@ discard block |
||
| 405 | 405 | 'audio' => 'audio', |
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | - $show_full_content = has_post_format( apply_filters( 'lsx_the_excerpt_filter_post_types', $post_formats ) ); |
|
| 408 | + $show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', $post_formats)); |
|
| 409 | 409 | |
| 410 | - if ( ! $show_full_content ) { |
|
| 411 | - if ( '' !== $excerpt && ! stristr( $excerpt, 'moretag' ) ) { |
|
| 412 | - $pagination = wp_link_pages( array( |
|
| 410 | + if ( ! $show_full_content) { |
|
| 411 | + if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) { |
|
| 412 | + $pagination = wp_link_pages(array( |
|
| 413 | 413 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 414 | 414 | 'after' => '</div></div>', |
| 415 | 415 | 'link_before' => '<span>', |
| 416 | 416 | 'link_after' => '</span>', |
| 417 | 417 | 'echo' => 0, |
| 418 | - ) ); |
|
| 418 | + )); |
|
| 419 | 419 | |
| 420 | - if ( ! empty( $pagination ) ) { |
|
| 420 | + if ( ! empty($pagination)) { |
|
| 421 | 421 | $excerpt .= $pagination; |
| 422 | 422 | } else { |
| 423 | - $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
|
| 424 | - $excerpt .= apply_filters( 'excerpt_more_p', $excerpt_more ); |
|
| 423 | + $excerpt_more = '<p><a class="moretag" href="' . esc_url(get_permalink()) . '">' . esc_html__('Read More', 'lsx') . '</a></p>'; |
|
| 424 | + $excerpt .= apply_filters('excerpt_more_p', $excerpt_more); |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | endif; |
| 433 | 433 | |
| 434 | -add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 ); |
|
| 434 | +add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20); |
|
| 435 | 435 | |
| 436 | -if ( ! function_exists( 'lsx_full_width_widget_classes' ) ) : |
|
| 436 | +if ( ! function_exists('lsx_full_width_widget_classes')) : |
|
| 437 | 437 | |
| 438 | 438 | /** |
| 439 | 439 | * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget. |
@@ -441,8 +441,8 @@ discard block |
||
| 441 | 441 | * @package lsx |
| 442 | 442 | * @subpackage extras |
| 443 | 443 | */ |
| 444 | - function lsx_full_width_widget_classes( $params ) { |
|
| 445 | - if ( is_admin() ) { |
|
| 444 | + function lsx_full_width_widget_classes($params) { |
|
| 445 | + if (is_admin()) { |
|
| 446 | 446 | return $params; |
| 447 | 447 | } |
| 448 | 448 | |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | $widget_id = $params[0]['widget_id']; |
| 452 | 452 | $widget_name = $params[0]['widget_name']; |
| 453 | 453 | |
| 454 | - if ( 'Text' === $widget_name ) { |
|
| 455 | - $wp_registered_widgets[ $widget_id ]['original_callback'] = $wp_registered_widgets[ $widget_id ]['callback']; |
|
| 456 | - $wp_registered_widgets[ $widget_id ]['callback'] = 'lsx_full_width_widget_custom_callback'; |
|
| 454 | + if ('Text' === $widget_name) { |
|
| 455 | + $wp_registered_widgets[$widget_id]['original_callback'] = $wp_registered_widgets[$widget_id]['callback']; |
|
| 456 | + $wp_registered_widgets[$widget_id]['callback'] = 'lsx_full_width_widget_custom_callback'; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | return $params; |
@@ -461,9 +461,9 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | endif; |
| 463 | 463 | |
| 464 | -add_filter( 'dynamic_sidebar_params', 'lsx_full_width_widget_classes' ); |
|
| 464 | +add_filter('dynamic_sidebar_params', 'lsx_full_width_widget_classes'); |
|
| 465 | 465 | |
| 466 | -if ( ! function_exists( 'lsx_full_width_widget_custom_callback' ) ) : |
|
| 466 | +if ( ! function_exists('lsx_full_width_widget_custom_callback')) : |
|
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | 469 | * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget. |
@@ -477,25 +477,25 @@ discard block |
||
| 477 | 477 | $original_callback_params = func_get_args(); |
| 478 | 478 | $widget_id = $original_callback_params[0]['widget_id']; |
| 479 | 479 | |
| 480 | - $original_callback = $wp_registered_widgets[ $widget_id ]['original_callback']; |
|
| 481 | - $wp_registered_widgets[ $widget_id ]['callback'] = $original_callback; |
|
| 480 | + $original_callback = $wp_registered_widgets[$widget_id]['original_callback']; |
|
| 481 | + $wp_registered_widgets[$widget_id]['callback'] = $original_callback; |
|
| 482 | 482 | |
| 483 | - $widget_id_base = $wp_registered_widgets[ $widget_id ]['callback'][0]->id_base; |
|
| 483 | + $widget_id_base = $wp_registered_widgets[$widget_id]['callback'][0]->id_base; |
|
| 484 | 484 | |
| 485 | 485 | $widget_classname = ''; |
| 486 | 486 | |
| 487 | - if ( is_callable( $original_callback ) ) { |
|
| 487 | + if (is_callable($original_callback)) { |
|
| 488 | 488 | ob_start(); |
| 489 | - call_user_func_array( $original_callback, $original_callback_params ); |
|
| 489 | + call_user_func_array($original_callback, $original_callback_params); |
|
| 490 | 490 | $widget_output = ob_get_clean(); |
| 491 | 491 | |
| 492 | - echo wp_kses_post( apply_filters( 'lsx_widget_output', $widget_output, $widget_id_base, $widget_classname, $widget_id ) ); |
|
| 492 | + echo wp_kses_post(apply_filters('lsx_widget_output', $widget_output, $widget_id_base, $widget_classname, $widget_id)); |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | endif; |
| 497 | 497 | |
| 498 | -if ( ! function_exists( 'lsx_full_width_widget_output' ) ) : |
|
| 498 | +if ( ! function_exists('lsx_full_width_widget_output')) : |
|
| 499 | 499 | |
| 500 | 500 | /** |
| 501 | 501 | * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget. |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | * @package lsx |
| 504 | 504 | * @subpackage extras |
| 505 | 505 | */ |
| 506 | - function lsx_full_width_widget_output( $widget_output, $widget_id_base, $widget_id ) { |
|
| 507 | - if ( 'text' === $widget_id_base ) { |
|
| 508 | - if ( false !== strpos( $widget_output, '<div class="lsx-full-width-alt">' ) ) { |
|
| 509 | - $widget_output = str_replace( 'class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width_alt"', $widget_output ); |
|
| 510 | - } elseif ( false !== strpos( $widget_output, '<div class="lsx-full-width">' ) ) { |
|
| 511 | - $widget_output = str_replace( 'class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width"', $widget_output ); |
|
| 506 | + function lsx_full_width_widget_output($widget_output, $widget_id_base, $widget_id) { |
|
| 507 | + if ('text' === $widget_id_base) { |
|
| 508 | + if (false !== strpos($widget_output, '<div class="lsx-full-width-alt">')) { |
|
| 509 | + $widget_output = str_replace('class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width_alt"', $widget_output); |
|
| 510 | + } elseif (false !== strpos($widget_output, '<div class="lsx-full-width">')) { |
|
| 511 | + $widget_output = str_replace('class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width"', $widget_output); |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | |
@@ -517,13 +517,13 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | endif; |
| 519 | 519 | |
| 520 | -add_filter( 'lsx_widget_output', 'lsx_full_width_widget_output', 10, 3 ); |
|
| 520 | +add_filter('lsx_widget_output', 'lsx_full_width_widget_output', 10, 3); |
|
| 521 | 521 | |
| 522 | 522 | /** |
| 523 | 523 | * Check if the content has a restricted post format that needs to show a full excerpt. |
| 524 | 524 | */ |
| 525 | 525 | function lsx_post_format_force_content_on_list() { |
| 526 | - $post_formats = apply_filters( 'lsx_post_format_force_content_on_list', |
|
| 526 | + $post_formats = apply_filters('lsx_post_format_force_content_on_list', |
|
| 527 | 527 | array( |
| 528 | 528 | 'video' => 'video', |
| 529 | 529 | 'audio' => 'audio', |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | ) |
| 533 | 533 | ); |
| 534 | 534 | $return = false; |
| 535 | - if ( ! has_post_format( $post_formats ) ) { |
|
| 535 | + if ( ! has_post_format($post_formats)) { |
|
| 536 | 536 | $return = true; |
| 537 | 537 | } |
| 538 | 538 | return $return; |
@@ -541,67 +541,67 @@ discard block |
||
| 541 | 541 | /** |
| 542 | 542 | * Remove the Hentry Class Every |
| 543 | 543 | */ |
| 544 | -function lsx_remove_hentry( $classes ) { |
|
| 545 | - if ( 'post' !== get_post_type() ) { |
|
| 546 | - $classes = array_diff( $classes, array( 'hentry' ) ); |
|
| 544 | +function lsx_remove_hentry($classes) { |
|
| 545 | + if ('post' !== get_post_type()) { |
|
| 546 | + $classes = array_diff($classes, array('hentry')); |
|
| 547 | 547 | } |
| 548 | 548 | return $classes; |
| 549 | 549 | } |
| 550 | -add_filter( 'post_class','lsx_remove_hentry' ); |
|
| 550 | +add_filter('post_class', 'lsx_remove_hentry'); |
|
| 551 | 551 | |
| 552 | 552 | /** |
| 553 | 553 | * Strip Excerpts. |
| 554 | 554 | * |
| 555 | 555 | */ |
| 556 | -function lsx_strip_excerpt( $content ) { |
|
| 557 | - if ( is_search() || is_archive() || ( is_blog_installed() && ! is_single() && ! is_page() ) ) { |
|
| 558 | - $content = strip_shortcodes( $content ); |
|
| 559 | - $content = str_replace( ']]>', ']]>', $content ); |
|
| 560 | - $content = strip_tags( $content ); |
|
| 556 | +function lsx_strip_excerpt($content) { |
|
| 557 | + if (is_search() || is_archive() || (is_blog_installed() && ! is_single() && ! is_page())) { |
|
| 558 | + $content = strip_shortcodes($content); |
|
| 559 | + $content = str_replace(']]>', ']]>', $content); |
|
| 560 | + $content = strip_tags($content); |
|
| 561 | 561 | } |
| 562 | 562 | return $content; |
| 563 | 563 | } |
| 564 | -add_filter( 'the_content', 'lsx_strip_excerpt' ); |
|
| 564 | +add_filter('the_content', 'lsx_strip_excerpt'); |
|
| 565 | 565 | |
| 566 | 566 | /** |
| 567 | 567 | * Disable Gutenberg for LSX Custom Post Tpes. |
| 568 | 568 | * |
| 569 | 569 | */ |
| 570 | -function lsx_disable_gutenberg_product_type( $is_enabled, $post_type ) { |
|
| 571 | - if ( 'testimonial' === $post_type || 'team' === $post_type || 'project' === $post_type ) { |
|
| 570 | +function lsx_disable_gutenberg_product_type($is_enabled, $post_type) { |
|
| 571 | + if ('testimonial' === $post_type || 'team' === $post_type || 'project' === $post_type) { |
|
| 572 | 572 | return false; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | return $is_enabled; |
| 576 | 576 | } |
| 577 | -add_filter( 'gutenberg_add_edit_link_for_post_type', 'lsx_disable_gutenberg_product_type', 10, 2 ); |
|
| 577 | +add_filter('gutenberg_add_edit_link_for_post_type', 'lsx_disable_gutenberg_product_type', 10, 2); |
|
| 578 | 578 | |
| 579 | 579 | /** |
| 580 | 580 | * Add the "Blog" link to the breadcrumbs |
| 581 | 581 | * @param $crumbs |
| 582 | 582 | * @return array |
| 583 | 583 | */ |
| 584 | -function lsx_breadcrumbs_blog_link( $crumbs ) { |
|
| 584 | +function lsx_breadcrumbs_blog_link($crumbs) { |
|
| 585 | 585 | |
| 586 | - $show_on_front = get_option( 'show_on_front' ); |
|
| 586 | + $show_on_front = get_option('show_on_front'); |
|
| 587 | 587 | |
| 588 | - if ( 'page' === $show_on_front && ( is_category() || is_tag() ) ) { |
|
| 588 | + if ('page' === $show_on_front && (is_category() || is_tag())) { |
|
| 589 | 589 | |
| 590 | - $blog_page = get_option( 'page_for_posts' ); |
|
| 591 | - if ( false !== $blog_page && '' !== $blog_page ) { |
|
| 590 | + $blog_page = get_option('page_for_posts'); |
|
| 591 | + if (false !== $blog_page && '' !== $blog_page) { |
|
| 592 | 592 | |
| 593 | 593 | $new_crumbs = array(); |
| 594 | 594 | $new_crumbs[0] = $crumbs[0]; |
| 595 | 595 | |
| 596 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 596 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 597 | 597 | $new_crumbs[1] = array( |
| 598 | - 0 => get_the_title( $blog_page ), |
|
| 599 | - 1 => get_permalink( $blog_page ), |
|
| 598 | + 0 => get_the_title($blog_page), |
|
| 599 | + 1 => get_permalink($blog_page), |
|
| 600 | 600 | ); |
| 601 | 601 | } else { |
| 602 | 602 | $new_crumbs[1] = array( |
| 603 | - 'text' => get_the_title( $blog_page ), |
|
| 604 | - 'url' => get_permalink( $blog_page ), |
|
| 603 | + 'text' => get_the_title($blog_page), |
|
| 604 | + 'url' => get_permalink($blog_page), |
|
| 605 | 605 | ); |
| 606 | 606 | } |
| 607 | 607 | $new_crumbs[2] = $crumbs[1]; |
@@ -611,5 +611,5 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | return $crumbs; |
| 613 | 613 | } |
| 614 | -add_filter( 'wpseo_breadcrumb_links', 'lsx_breadcrumbs_blog_link', 30, 1 ); |
|
| 615 | -add_filter( 'woocommerce_get_breadcrumb', 'lsx_breadcrumbs_blog_link', 30, 1 ); |
|
| 614 | +add_filter('wpseo_breadcrumb_links', 'lsx_breadcrumbs_blog_link', 30, 1); |
|
| 615 | +add_filter('woocommerce_get_breadcrumb', 'lsx_breadcrumbs_blog_link', 30, 1); |
|
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | * Constructor. |
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 23 | - add_action( 'widgets_init', array( $this, 'lsx_widget_area_sensei_init' ), 100 ); |
|
| 24 | - add_filter( 'body_class', array( $this, 'lsx_widget_area_sensei_is_active' ) ); |
|
| 22 | + add_action('init', array($this, 'init')); |
|
| 23 | + add_action('widgets_init', array($this, 'lsx_widget_area_sensei_init'), 100); |
|
| 24 | + add_filter('body_class', array($this, 'lsx_widget_area_sensei_is_active')); |
|
| 25 | 25 | } // End __construct() |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @return self |
| 31 | 31 | */ |
| 32 | 32 | public static function instance() { |
| 33 | - if ( ! self::$instance ) { |
|
| 33 | + if ( ! self::$instance) { |
|
| 34 | 34 | self::$instance = new self(); |
| 35 | 35 | } |
| 36 | 36 | return self::$instance; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Run our changes. |
| 41 | 41 | */ |
| 42 | 42 | public function init() { |
| 43 | - add_action( 'lsx_content_top', array( $this, 'lsx_sensei_lesson_sidebar' ) ); |
|
| 43 | + add_action('lsx_content_top', array($this, 'lsx_sensei_lesson_sidebar')); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | 52 | public function lsx_widget_area_sensei_init() { |
| 53 | - if ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) { |
|
| 54 | - register_sidebar( array( |
|
| 55 | - 'name' => esc_html__( 'LSX Sensei Sidebar', 'lsx' ), |
|
| 53 | + if (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress')) { |
|
| 54 | + register_sidebar(array( |
|
| 55 | + 'name' => esc_html__('LSX Sensei Sidebar', 'lsx'), |
|
| 56 | 56 | 'id' => 'lsx-sensei-sidebar', |
| 57 | 57 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 58 | 58 | 'after_widget' => '</aside>', |
| 59 | 59 | 'before_title' => '<h3 class="widget-title">', |
| 60 | 60 | 'after_title' => '</h3>', |
| 61 | - ) ); |
|
| 61 | + )); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function lsx_widget_area_sensei_is_active( $classes ) { |
|
| 65 | + public function lsx_widget_area_sensei_is_active($classes) { |
|
| 66 | 66 | |
| 67 | - if ( class_exists( 'Sensei_Lesson' ) && is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 67 | + if (class_exists('Sensei_Lesson') && is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 68 | 68 | $classes[] = 'lsx-sensei-sidebar-active'; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | 79 | public function lsx_sensei_lesson_sidebar() { |
| 80 | - if ( class_exists( 'Sensei_Lesson' ) && ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) ) { |
|
| 81 | - if ( ( is_single() && ( is_singular( 'lesson' ) ) ) || ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 82 | - if ( is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 80 | + if (class_exists('Sensei_Lesson') && (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress'))) { |
|
| 81 | + if ((is_single() && (is_singular('lesson'))) || (is_single() && (is_singular('quiz')))) { |
|
| 82 | + if (is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 83 | 83 | echo '<div id="secondary" class="widget-area lsx-sensei-sidebar">'; |
| 84 | - dynamic_sidebar( 'lsx-sensei-sidebar' ); |
|
| 84 | + dynamic_sidebar('lsx-sensei-sidebar'); |
|
| 85 | 85 | echo '</div>'; |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -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 |
@@ -50,57 +50,57 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | global $woothemes_sensei; |
| 52 | 52 | |
| 53 | - add_action( 'wp_enqueue_scripts', array( $this, 'lsx_sensei_scripts_add_styles' ) ); |
|
| 53 | + add_action('wp_enqueue_scripts', array($this, 'lsx_sensei_scripts_add_styles')); |
|
| 54 | 54 | |
| 55 | - remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); |
|
| 56 | - add_action( 'sensei_before_main_content', array( $this, 'lsx_sensei_theme_wrapper_start' ) ); |
|
| 55 | + remove_action('sensei_before_main_content', array($woothemes_sensei->frontend, 'sensei_output_content_wrapper'), 10); |
|
| 56 | + add_action('sensei_before_main_content', array($this, 'lsx_sensei_theme_wrapper_start')); |
|
| 57 | 57 | |
| 58 | - remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); |
|
| 59 | - add_action( 'sensei_after_main_content', array( $this, 'lsx_sensei_theme_wrapper_end' ) ); |
|
| 58 | + remove_action('sensei_after_main_content', array($woothemes_sensei->frontend, 'sensei_output_content_wrapper_end'), 10); |
|
| 59 | + add_action('sensei_after_main_content', array($this, 'lsx_sensei_theme_wrapper_end')); |
|
| 60 | 60 | |
| 61 | - add_filter( 'get_the_archive_title', array( $this, 'lsx_sensei_modify_archive_title' ), 99, 1 ); |
|
| 61 | + add_filter('get_the_archive_title', array($this, 'lsx_sensei_modify_archive_title'), 99, 1); |
|
| 62 | 62 | |
| 63 | 63 | // LSX |
| 64 | - add_filter( 'lsx_global_header_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 64 | + add_filter('lsx_global_header_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 65 | 65 | // LSX Banners - Plugin, Placeholders |
| 66 | - add_filter( 'lsx_banner_plugin_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 66 | + add_filter('lsx_banner_plugin_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 67 | 67 | // LSX Banners - Banner |
| 68 | - add_filter( 'lsx_banner_disable', array( $this, 'lsx_sensei_disable_lsx_banner' ) ); |
|
| 68 | + add_filter('lsx_banner_disable', array($this, 'lsx_sensei_disable_lsx_banner')); |
|
| 69 | 69 | |
| 70 | - add_filter( 'course_archive_title', array( $this, 'lsx_sensei_archive_title' ), 10, 1 ); |
|
| 71 | - add_filter( 'sensei_lesson_archive_title', array( $this, 'lsx_sensei_archive_title' ), 10, 1 ); |
|
| 70 | + add_filter('course_archive_title', array($this, 'lsx_sensei_archive_title'), 10, 1); |
|
| 71 | + add_filter('sensei_lesson_archive_title', array($this, 'lsx_sensei_archive_title'), 10, 1); |
|
| 72 | 72 | |
| 73 | - add_filter( 'course_category_title', array( $this, 'lsx_sensei_category_title' ), 10, 1 ); |
|
| 73 | + add_filter('course_category_title', array($this, 'lsx_sensei_category_title'), 10, 1); |
|
| 74 | 74 | |
| 75 | - add_action( 'sensei_course_content_inside_after', array( $this, 'lsx_sensei_add_buttons' ), 9 ); |
|
| 75 | + add_action('sensei_course_content_inside_after', array($this, 'lsx_sensei_add_buttons'), 9); |
|
| 76 | 76 | |
| 77 | - add_filter( 'sensei_wc_single_add_to_cart_button_text', array( $this, 'lsx_sensei_add_to_cart_text' ) ); |
|
| 77 | + add_filter('sensei_wc_single_add_to_cart_button_text', array($this, 'lsx_sensei_add_to_cart_text')); |
|
| 78 | 78 | |
| 79 | - add_action( 'lsx_content_wrap_before', array( $this, 'lsx_sensei_results_header' ) ); |
|
| 79 | + add_action('lsx_content_wrap_before', array($this, 'lsx_sensei_results_header')); |
|
| 80 | 80 | |
| 81 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_course_breadcrumb_filter' ), 40, 1 ); |
|
| 82 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_course_breadcrumb_filter' ), 40, 1 ); |
|
| 81 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_course_breadcrumb_filter'), 40, 1); |
|
| 82 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_course_breadcrumb_filter'), 40, 1); |
|
| 83 | 83 | |
| 84 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_lesson_breadcrumb_filter' ), 40, 1 ); |
|
| 85 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_lesson_breadcrumb_filter' ), 40, 1 ); |
|
| 84 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_lesson_breadcrumb_filter'), 40, 1); |
|
| 85 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_lesson_breadcrumb_filter'), 40, 1); |
|
| 86 | 86 | |
| 87 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_module_breadcrumb_filter' ), 40, 1 ); |
|
| 88 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_module_breadcrumb_filter' ), 40, 1 ); |
|
| 87 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_module_breadcrumb_filter'), 40, 1); |
|
| 88 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_module_breadcrumb_filter'), 40, 1); |
|
| 89 | 89 | |
| 90 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_learner_breadcrumb_filter' ), 40, 1 ); |
|
| 91 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_learner_breadcrumb_filter' ), 40, 1 ); |
|
| 90 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_learner_breadcrumb_filter'), 40, 1); |
|
| 91 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_learner_breadcrumb_filter'), 40, 1); |
|
| 92 | 92 | |
| 93 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_quiz_breadcrumb_filter' ), 40, 1 ); |
|
| 94 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_quiz_breadcrumb_filter' ), 40, 1 ); |
|
| 93 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_quiz_breadcrumb_filter'), 40, 1); |
|
| 94 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_quiz_breadcrumb_filter'), 40, 1); |
|
| 95 | 95 | |
| 96 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_messages_breadcrumb_filter' ), 40, 1 ); |
|
| 97 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_messages_breadcrumb_filter' ), 40, 1 ); |
|
| 96 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_messages_breadcrumb_filter'), 40, 1); |
|
| 97 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_messages_breadcrumb_filter'), 40, 1); |
|
| 98 | 98 | |
| 99 | - add_filter( 'wpseo_breadcrumb_links', array( $this, 'lsx_sensei_results_breadcrumb_filter' ), 40, 1 ); |
|
| 100 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'lsx_sensei_results_breadcrumb_filter' ), 40, 1 ); |
|
| 99 | + add_filter('wpseo_breadcrumb_links', array($this, 'lsx_sensei_results_breadcrumb_filter'), 40, 1); |
|
| 100 | + add_filter('woocommerce_get_breadcrumb', array($this, 'lsx_sensei_results_breadcrumb_filter'), 40, 1); |
|
| 101 | 101 | |
| 102 | - add_action( 'sensei_archive_before_message_loop', array( $this, 'lsx_sensei_back_message_button' ) ); |
|
| 103 | - add_action( 'sensei_content_message_after', array( $this, 'lsx_sensei_view_message_button' ) ); |
|
| 102 | + add_action('sensei_archive_before_message_loop', array($this, 'lsx_sensei_back_message_button')); |
|
| 103 | + add_action('sensei_content_message_after', array($this, 'lsx_sensei_view_message_button')); |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public static function get_instance() { |
| 114 | 114 | // If the single instance hasn't been set, set it now. |
| 115 | - if ( null === self::$instance ) { |
|
| 115 | + if (null === self::$instance) { |
|
| 116 | 116 | self::$instance = new self; |
| 117 | 117 | } |
| 118 | 118 | return self::$instance; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * @subpackage sensei |
| 126 | 126 | */ |
| 127 | 127 | public function lsx_sensei_scripts_add_styles() { |
| 128 | - wp_enqueue_style( 'sensei-lsx', get_template_directory_uri() . '/assets/css/sensei/sensei.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 129 | - wp_style_add_data( 'sensei-lsx', 'rtl', 'replace' ); |
|
| 128 | + wp_enqueue_style('sensei-lsx', get_template_directory_uri() . '/assets/css/sensei/sensei.css', array('lsx_main'), LSX_VERSION); |
|
| 129 | + wp_style_add_data('sensei-lsx', 'rtl', 'replace'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function lsx_sensei_theme_wrapper_start() { |
| 139 | 139 | lsx_content_wrap_before(); |
| 140 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
| 140 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
| 141 | 141 | lsx_content_before(); |
| 142 | 142 | echo '<main id="main" class="site-main" role="main">'; |
| 143 | 143 | lsx_content_top(); |
@@ -163,18 +163,18 @@ discard block |
||
| 163 | 163 | * @param [type] $title |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | - public function lsx_sensei_modify_archive_title( $title ) { |
|
| 167 | - if ( is_archive() && is_post_type_archive( 'course' ) ) { |
|
| 168 | - $title = __( 'Courses', 'lsx' ); |
|
| 166 | + public function lsx_sensei_modify_archive_title($title) { |
|
| 167 | + if (is_archive() && is_post_type_archive('course')) { |
|
| 168 | + $title = __('Courses', 'lsx'); |
|
| 169 | 169 | } |
| 170 | - if ( is_archive() && is_post_type_archive( 'sensei_message' ) ) { |
|
| 171 | - $title = __( 'Messages', 'lsx' ); |
|
| 170 | + if (is_archive() && is_post_type_archive('sensei_message')) { |
|
| 171 | + $title = __('Messages', 'lsx'); |
|
| 172 | 172 | } |
| 173 | - if ( is_archive() && is_post_type_archive( 'lesson' ) ) { |
|
| 174 | - $title = __( 'Lessons', 'lsx' ); |
|
| 173 | + if (is_archive() && is_post_type_archive('lesson')) { |
|
| 174 | + $title = __('Lessons', 'lsx'); |
|
| 175 | 175 | } |
| 176 | - if ( is_archive() && is_tax() ) { |
|
| 177 | - $title = single_term_title( '', false ); |
|
| 176 | + if (is_archive() && is_tax()) { |
|
| 177 | + $title = single_term_title('', false); |
|
| 178 | 178 | } |
| 179 | 179 | return $title; |
| 180 | 180 | } |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | * @package lsx |
| 186 | 186 | * @subpackage sensei |
| 187 | 187 | */ |
| 188 | - public function lsx_sensei_disable_lsx_banner( $disabled ) { |
|
| 189 | - if ( is_sensei() ) { |
|
| 188 | + public function lsx_sensei_disable_lsx_banner($disabled) { |
|
| 189 | + if (is_sensei()) { |
|
| 190 | 190 | $disabled = true; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | * @package lsx |
| 200 | 200 | * @subpackage sensei |
| 201 | 201 | */ |
| 202 | - public function lsx_sensei_archive_title( $html ) { |
|
| 203 | - $html = preg_replace( '/<header class="archive-header"><h1>([^<]+)<\/h1><\/header>/i', '<h1>$1</h1>', $html ); |
|
| 202 | + public function lsx_sensei_archive_title($html) { |
|
| 203 | + $html = preg_replace('/<header class="archive-header"><h1>([^<]+)<\/h1><\/header>/i', '<h1>$1</h1>', $html); |
|
| 204 | 204 | return $html; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * @package lsx |
| 211 | 211 | * @subpackage sensei |
| 212 | 212 | */ |
| 213 | - public function lsx_sensei_category_title( $html ) { |
|
| 214 | - $html = str_replace( 'h2', 'h1', $html ); |
|
| 213 | + public function lsx_sensei_category_title($html) { |
|
| 214 | + $html = str_replace('h2', 'h1', $html); |
|
| 215 | 215 | return $html; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -221,18 +221,18 @@ discard block |
||
| 221 | 221 | * @package lsx |
| 222 | 222 | * @subpackage sensei |
| 223 | 223 | */ |
| 224 | - public function lsx_sensei_add_buttons( $course_id ) { |
|
| 224 | + public function lsx_sensei_add_buttons($course_id) { |
|
| 225 | 225 | global $post, $current_user; |
| 226 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 227 | - if ( class_exists( 'Sensei_WC' ) ) { |
|
| 228 | - $course_purchasable = Sensei_WC::is_course_purchasable( $post->ID ); |
|
| 226 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 227 | + if (class_exists('Sensei_WC')) { |
|
| 228 | + $course_purchasable = Sensei_WC::is_course_purchasable($post->ID); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | ?> |
| 232 | 232 | <section class="entry-actions"> |
| 233 | 233 | <?php |
| 234 | - if ( ( ! $is_user_taking_course ) && $course_purchasable ) { |
|
| 235 | - Sensei_WC::the_add_to_cart_button_html( $post->ID ); |
|
| 234 | + if (( ! $is_user_taking_course) && $course_purchasable) { |
|
| 235 | + Sensei_WC::the_add_to_cart_button_html($post->ID); |
|
| 236 | 236 | } |
| 237 | 237 | ?> |
| 238 | 238 | </section> |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | * @package lsx |
| 246 | 246 | * @subpackage sensei |
| 247 | 247 | */ |
| 248 | - public function lsx_sensei_add_to_cart_text( $text ) { |
|
| 249 | - $text = esc_html__( 'Add to cart', 'lsx' ); |
|
| 248 | + public function lsx_sensei_add_to_cart_text($text) { |
|
| 249 | + $text = esc_html__('Add to cart', 'lsx'); |
|
| 250 | 250 | return $text; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,46 +256,46 @@ discard block |
||
| 256 | 256 | * @package lsx |
| 257 | 257 | * @subpackage layout |
| 258 | 258 | */ |
| 259 | - public function lsx_sensei_results_header( $user ) { |
|
| 259 | + public function lsx_sensei_results_header($user) { |
|
| 260 | 260 | |
| 261 | 261 | $default_size = 'sm'; |
| 262 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
| 262 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
| 263 | 263 | global $wp_query; |
| 264 | - if ( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 264 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 265 | 265 | $is_results = $wp_query->query_vars['course_results']; |
| 266 | 266 | } else { |
| 267 | 267 | $is_results = false; |
| 268 | 268 | } |
| 269 | - if ( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 269 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 270 | 270 | $is_profile = $wp_query->query_vars['learner_profile']; |
| 271 | 271 | } else { |
| 272 | 272 | $is_profile = false; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if ( is_sticky() && $is_results ) : |
|
| 276 | - $course_for_results = get_page_by_path( $is_results, OBJECT, 'course' ); |
|
| 275 | + if (is_sticky() && $is_results) : |
|
| 276 | + $course_for_results = get_page_by_path($is_results, OBJECT, 'course'); |
|
| 277 | 277 | |
| 278 | - $course_title = esc_html( $course_for_results->post_title ); |
|
| 278 | + $course_title = esc_html($course_for_results->post_title); |
|
| 279 | 279 | ?> |
| 280 | - <div class="archive-header-wrapper banner-single col-<?php echo esc_attr( $size ); ?>-12"> |
|
| 280 | + <div class="archive-header-wrapper banner-single col-<?php echo esc_attr($size); ?>-12"> |
|
| 281 | 281 | <?php lsx_global_header_inner_bottom(); ?> |
| 282 | 282 | <header class="archive-header"> |
| 283 | - <h1 class="archive-title"><?php echo wp_kses_post( $course_title ); ?></h1> |
|
| 283 | + <h1 class="archive-title"><?php echo wp_kses_post($course_title); ?></h1> |
|
| 284 | 284 | </header> |
| 285 | 285 | |
| 286 | 286 | </div> |
| 287 | 287 | <?php |
| 288 | 288 | endif; |
| 289 | 289 | |
| 290 | - if ( is_sticky() && $is_profile ) : |
|
| 290 | + if (is_sticky() && $is_profile) : |
|
| 291 | 291 | $query_var = $wp_query->query_vars['learner_profile']; |
| 292 | - $learner_user = Sensei_Learner::find_by_query_var( $query_var ); |
|
| 292 | + $learner_user = Sensei_Learner::find_by_query_var($query_var); |
|
| 293 | 293 | $learner_name = $learner_user->display_name; |
| 294 | 294 | ?> |
| 295 | - <div class="archive-header-wrapper banner-single col-<?php echo esc_attr( $size ); ?>-12"> |
|
| 295 | + <div class="archive-header-wrapper banner-single col-<?php echo esc_attr($size); ?>-12"> |
|
| 296 | 296 | <?php lsx_global_header_inner_bottom(); ?> |
| 297 | 297 | <header class="archive-header"> |
| 298 | - <h1 class="archive-title"><?php echo esc_html( $learner_name ); ?></h1> |
|
| 298 | + <h1 class="archive-title"><?php echo esc_html($learner_name); ?></h1> |
|
| 299 | 299 | </header> |
| 300 | 300 | |
| 301 | 301 | </div> |
@@ -308,21 +308,21 @@ discard block |
||
| 308 | 308 | * @param $crumbs |
| 309 | 309 | * @return array |
| 310 | 310 | */ |
| 311 | - public function lsx_sensei_course_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 312 | - if ( is_single() && ( is_singular( 'course' ) ) ) { |
|
| 311 | + public function lsx_sensei_course_breadcrumb_filter($crumbs, $id = 0) { |
|
| 312 | + if (is_single() && (is_singular('course'))) { |
|
| 313 | 313 | global $course; |
| 314 | 314 | $lesson = get_the_title(); |
| 315 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 316 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 315 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 316 | + $course_page_url = get_permalink($course_page_url); |
|
| 317 | 317 | |
| 318 | - if ( $lesson ) { |
|
| 318 | + if ($lesson) { |
|
| 319 | 319 | |
| 320 | 320 | $new_crumbs = array(); |
| 321 | 321 | $new_crumbs[0] = $crumbs[0]; |
| 322 | 322 | |
| 323 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 323 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 324 | 324 | $new_crumbs[1] = array( |
| 325 | - 0 => __( 'All Courses', 'lsx' ), |
|
| 325 | + 0 => __('All Courses', 'lsx'), |
|
| 326 | 326 | 1 => $course_page_url, |
| 327 | 327 | ); |
| 328 | 328 | $new_crumbs[2] = array( |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | ); |
| 331 | 331 | } else { |
| 332 | 332 | $new_crumbs[1] = array( |
| 333 | - 'text' => __( 'All Courses', 'lsx' ), |
|
| 333 | + 'text' => __('All Courses', 'lsx'), |
|
| 334 | 334 | 'url' => $course_page_url, |
| 335 | 335 | ); |
| 336 | 336 | $new_crumbs[2] = array( |
@@ -348,34 +348,34 @@ discard block |
||
| 348 | 348 | * @param $crumbs |
| 349 | 349 | * @return array |
| 350 | 350 | */ |
| 351 | - public function lsx_sensei_lesson_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 352 | - if ( is_sensei() && is_single() && ( is_singular( 'lesson' ) ) ) { |
|
| 351 | + public function lsx_sensei_lesson_breadcrumb_filter($crumbs, $id = 0) { |
|
| 352 | + if (is_sensei() && is_single() && (is_singular('lesson'))) { |
|
| 353 | 353 | global $course; |
| 354 | 354 | $lesson = get_the_title(); |
| 355 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 356 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 355 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 356 | + $course_page_url = get_permalink($course_page_url); |
|
| 357 | 357 | |
| 358 | - if ( empty( $id ) ) { |
|
| 358 | + if (empty($id)) { |
|
| 359 | 359 | $id = get_the_ID(); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if ( 0 < intval( $id ) ) { |
|
| 363 | - $course = intval( get_post_meta( $id, '_lesson_course', true ) ); |
|
| 364 | - $course_id = esc_url( get_permalink( $course ) ); |
|
| 365 | - $course_title = esc_html( get_the_title( $course ) ); |
|
| 366 | - if ( ! $course ) { |
|
| 362 | + if (0 < intval($id)) { |
|
| 363 | + $course = intval(get_post_meta($id, '_lesson_course', true)); |
|
| 364 | + $course_id = esc_url(get_permalink($course)); |
|
| 365 | + $course_title = esc_html(get_the_title($course)); |
|
| 366 | + if ( ! $course) { |
|
| 367 | 367 | return; |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if ( $course_id ) { |
|
| 371 | + if ($course_id) { |
|
| 372 | 372 | |
| 373 | 373 | $new_crumbs = array(); |
| 374 | 374 | $new_crumbs[0] = $crumbs[0]; |
| 375 | 375 | |
| 376 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 376 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 377 | 377 | $new_crumbs[1] = array( |
| 378 | - 0 => __( 'Courses', 'lsx' ), |
|
| 378 | + 0 => __('Courses', 'lsx'), |
|
| 379 | 379 | 1 => $course_page_url, |
| 380 | 380 | ); |
| 381 | 381 | $new_crumbs[2] = array( |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | ); |
| 388 | 388 | } else { |
| 389 | 389 | $new_crumbs[1] = array( |
| 390 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 390 | + 'text' => __('Courses', 'lsx'), |
|
| 391 | 391 | 'url' => $course_page_url, |
| 392 | 392 | ); |
| 393 | 393 | $new_crumbs[2] = array( |
@@ -409,27 +409,27 @@ discard block |
||
| 409 | 409 | * @param $crumbs |
| 410 | 410 | * @return array |
| 411 | 411 | */ |
| 412 | - public function lsx_sensei_module_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 413 | - if ( ! empty( get_queried_object()->name ) ) { |
|
| 414 | - $title = apply_filters( 'sensei_module_archive_title', get_queried_object()->name ); |
|
| 412 | + public function lsx_sensei_module_breadcrumb_filter($crumbs, $id = 0) { |
|
| 413 | + if ( ! empty(get_queried_object()->name)) { |
|
| 414 | + $title = apply_filters('sensei_module_archive_title', get_queried_object()->name); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - if ( is_sensei() && is_tax() && is_archive() && ( ! empty( $title ) ) ) { |
|
| 417 | + if (is_sensei() && is_tax() && is_archive() && ( ! empty($title))) { |
|
| 418 | 418 | |
| 419 | 419 | $lesson = get_the_archive_title(); |
| 420 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 421 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 420 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 421 | + $course_page_url = get_permalink($course_page_url); |
|
| 422 | 422 | |
| 423 | - if ( empty( $id ) ) { |
|
| 423 | + if (empty($id)) { |
|
| 424 | 424 | $id = get_the_ID(); |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $new_crumbs = array(); |
| 428 | 428 | $new_crumbs[0] = $crumbs[0]; |
| 429 | 429 | |
| 430 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 430 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 431 | 431 | $new_crumbs[1] = array( |
| 432 | - 0 => __( 'Courses', 'lsx' ), |
|
| 432 | + 0 => __('Courses', 'lsx'), |
|
| 433 | 433 | 1 => $course_page_url, |
| 434 | 434 | ); |
| 435 | 435 | $new_crumbs[2] = array( |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | ); |
| 438 | 438 | } else { |
| 439 | 439 | $new_crumbs[1] = array( |
| 440 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 440 | + 'text' => __('Courses', 'lsx'), |
|
| 441 | 441 | 'url' => $course_page_url, |
| 442 | 442 | ); |
| 443 | 443 | $new_crumbs[2] = array( |
@@ -454,38 +454,38 @@ discard block |
||
| 454 | 454 | * @param $crumbs |
| 455 | 455 | * @return array |
| 456 | 456 | */ |
| 457 | - public function lsx_sensei_learner_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 457 | + public function lsx_sensei_learner_breadcrumb_filter($crumbs, $id = 0) { |
|
| 458 | 458 | global $wp_query; |
| 459 | 459 | |
| 460 | - if ( isset( $wp_query->query_vars['learner_profile'] ) ) { |
|
| 460 | + if (isset($wp_query->query_vars['learner_profile'])) { |
|
| 461 | 461 | $is_profile = $wp_query->query_vars['learner_profile']; |
| 462 | 462 | } else { |
| 463 | 463 | $is_profile = false; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - if ( is_sticky() && $is_profile ) { |
|
| 466 | + if (is_sticky() && $is_profile) { |
|
| 467 | 467 | |
| 468 | - if ( empty( $id ) ) { |
|
| 468 | + if (empty($id)) { |
|
| 469 | 469 | $id = get_the_ID(); |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | $query_var = $wp_query->query_vars['learner_profile']; |
| 473 | - $learner_user = Sensei_Learner::find_by_query_var( $query_var ); |
|
| 473 | + $learner_user = Sensei_Learner::find_by_query_var($query_var); |
|
| 474 | 474 | $learner_name = $learner_user->display_name; |
| 475 | 475 | |
| 476 | 476 | $new_crumbs = array(); |
| 477 | 477 | $new_crumbs[0] = $crumbs[0]; |
| 478 | 478 | |
| 479 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 479 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 480 | 480 | $new_crumbs[1] = array( |
| 481 | - 0 => __( 'Learners', 'lsx' ), |
|
| 481 | + 0 => __('Learners', 'lsx'), |
|
| 482 | 482 | ); |
| 483 | 483 | $new_crumbs[2] = array( |
| 484 | 484 | 0 => $learner_name, |
| 485 | 485 | ); |
| 486 | 486 | } else { |
| 487 | 487 | $new_crumbs[1] = array( |
| 488 | - 'text' => __( 'Learners', 'lsx' ), |
|
| 488 | + 'text' => __('Learners', 'lsx'), |
|
| 489 | 489 | ); |
| 490 | 490 | $new_crumbs[2] = array( |
| 491 | 491 | 'text' => $learner_name, |
@@ -501,36 +501,36 @@ discard block |
||
| 501 | 501 | * @param $crumbs |
| 502 | 502 | * @return array |
| 503 | 503 | */ |
| 504 | - public function lsx_sensei_messages_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 505 | - if ( is_archive() && ( is_post_type_archive( 'sensei_message' ) ) ) { |
|
| 504 | + public function lsx_sensei_messages_breadcrumb_filter($crumbs, $id = 0) { |
|
| 505 | + if (is_archive() && (is_post_type_archive('sensei_message'))) { |
|
| 506 | 506 | |
| 507 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 508 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 507 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 508 | + $course_page_url = get_permalink($course_page_url); |
|
| 509 | 509 | |
| 510 | - if ( empty( $id ) ) { |
|
| 510 | + if (empty($id)) { |
|
| 511 | 511 | $id = get_the_ID(); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if ( $id ) { |
|
| 514 | + if ($id) { |
|
| 515 | 515 | |
| 516 | 516 | $new_crumbs = array(); |
| 517 | 517 | $new_crumbs[0] = $crumbs[0]; |
| 518 | 518 | |
| 519 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 519 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 520 | 520 | $new_crumbs[1] = array( |
| 521 | - 0 => __( 'Courses', 'lsx' ), |
|
| 521 | + 0 => __('Courses', 'lsx'), |
|
| 522 | 522 | 1 => $course_page_url, |
| 523 | 523 | ); |
| 524 | 524 | $new_crumbs[2] = array( |
| 525 | - 0 => __( 'Messages', 'lsx' ), |
|
| 525 | + 0 => __('Messages', 'lsx'), |
|
| 526 | 526 | ); |
| 527 | 527 | } else { |
| 528 | 528 | $new_crumbs[1] = array( |
| 529 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 529 | + 'text' => __('Courses', 'lsx'), |
|
| 530 | 530 | 'url' => $course_page_url, |
| 531 | 531 | ); |
| 532 | 532 | $new_crumbs[2] = array( |
| 533 | - 'text' => __( 'Messages', 'lsx' ), |
|
| 533 | + 'text' => __('Messages', 'lsx'), |
|
| 534 | 534 | ); |
| 535 | 535 | } |
| 536 | 536 | $crumbs = $new_crumbs; |
@@ -544,35 +544,35 @@ discard block |
||
| 544 | 544 | * @param $crumbs |
| 545 | 545 | * @return array |
| 546 | 546 | */ |
| 547 | - public function lsx_sensei_quiz_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 548 | - if ( ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 547 | + public function lsx_sensei_quiz_breadcrumb_filter($crumbs, $id = 0) { |
|
| 548 | + if ((is_single() && (is_singular('quiz')))) { |
|
| 549 | 549 | global $course; |
| 550 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 551 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 550 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 551 | + $course_page_url = get_permalink($course_page_url); |
|
| 552 | 552 | $lesson = get_the_title(); |
| 553 | 553 | |
| 554 | - if ( empty( $id ) ) { |
|
| 554 | + if (empty($id)) { |
|
| 555 | 555 | $id = get_the_ID(); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | - if ( 0 < intval( $id ) ) { |
|
| 558 | + if (0 < intval($id)) { |
|
| 559 | 559 | |
| 560 | - $course = intval( get_post_meta( $id, '_quiz_lesson', true ) ); |
|
| 561 | - $course_id = esc_url( get_permalink( $course ) ); |
|
| 562 | - $course_title = esc_html( get_the_title( $course ) ); |
|
| 563 | - if ( ! $course ) { |
|
| 560 | + $course = intval(get_post_meta($id, '_quiz_lesson', true)); |
|
| 561 | + $course_id = esc_url(get_permalink($course)); |
|
| 562 | + $course_title = esc_html(get_the_title($course)); |
|
| 563 | + if ( ! $course) { |
|
| 564 | 564 | return; |
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | - if ( $course_id ) { |
|
| 568 | + if ($course_id) { |
|
| 569 | 569 | |
| 570 | 570 | $new_crumbs = array(); |
| 571 | 571 | $new_crumbs[0] = $crumbs[0]; |
| 572 | 572 | |
| 573 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 573 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 574 | 574 | $new_crumbs[1] = array( |
| 575 | - 0 => __( 'Courses', 'lsx' ), |
|
| 575 | + 0 => __('Courses', 'lsx'), |
|
| 576 | 576 | 1 => $course_page_url, |
| 577 | 577 | ); |
| 578 | 578 | $new_crumbs[2] = array( |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | ); |
| 585 | 585 | } else { |
| 586 | 586 | $new_crumbs[1] = array( |
| 587 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 587 | + 'text' => __('Courses', 'lsx'), |
|
| 588 | 588 | 'url' => $course_page_url, |
| 589 | 589 | ); |
| 590 | 590 | $new_crumbs[2] = array( |
@@ -607,36 +607,36 @@ discard block |
||
| 607 | 607 | * @param $crumbs |
| 608 | 608 | * @return array |
| 609 | 609 | */ |
| 610 | - public function lsx_sensei_results_breadcrumb_filter( $crumbs, $id = 0 ) { |
|
| 611 | - if ( is_sticky() ) { |
|
| 610 | + public function lsx_sensei_results_breadcrumb_filter($crumbs, $id = 0) { |
|
| 611 | + if (is_sticky()) { |
|
| 612 | 612 | global $wp_query; |
| 613 | 613 | $course_id = ''; |
| 614 | - if ( isset( $wp_query->query_vars['course_results'] ) ) { |
|
| 614 | + if (isset($wp_query->query_vars['course_results'])) { |
|
| 615 | 615 | $is_results = $wp_query->query_vars['course_results']; |
| 616 | 616 | } |
| 617 | - $course_page_url = intval( Sensei()->settings->settings['course_page'] ); |
|
| 618 | - $course_page_url = get_permalink( $course_page_url ); |
|
| 617 | + $course_page_url = intval(Sensei()->settings->settings['course_page']); |
|
| 618 | + $course_page_url = get_permalink($course_page_url); |
|
| 619 | 619 | |
| 620 | - if ( empty( $id ) ) { |
|
| 620 | + if (empty($id)) { |
|
| 621 | 621 | $id = get_the_ID(); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - if ( isset( $is_results ) ) { |
|
| 625 | - $course_for_results = get_page_by_path( $is_results, OBJECT, 'course' ); |
|
| 624 | + if (isset($is_results)) { |
|
| 625 | + $course_for_results = get_page_by_path($is_results, OBJECT, 'course'); |
|
| 626 | 626 | |
| 627 | - $course_id = esc_url( get_permalink( $course_for_results ) ); |
|
| 628 | - $course_title = esc_html( $course_for_results->post_title ); |
|
| 627 | + $course_id = esc_url(get_permalink($course_for_results)); |
|
| 628 | + $course_title = esc_html($course_for_results->post_title); |
|
| 629 | 629 | |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - if ( $course_id ) { |
|
| 632 | + if ($course_id) { |
|
| 633 | 633 | $new_crumbs = array(); |
| 634 | 634 | $new_crumbs[0] = $crumbs[0]; |
| 635 | 635 | |
| 636 | - if ( $is_results ) { |
|
| 637 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 636 | + if ($is_results) { |
|
| 637 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 638 | 638 | $new_crumbs[1] = array( |
| 639 | - 0 => __( 'Courses', 'lsx' ), |
|
| 639 | + 0 => __('Courses', 'lsx'), |
|
| 640 | 640 | 1 => $course_page_url, |
| 641 | 641 | ); |
| 642 | 642 | $new_crumbs[2] = array( |
@@ -644,15 +644,15 @@ discard block |
||
| 644 | 644 | 1 => $course_id, |
| 645 | 645 | ); |
| 646 | 646 | $new_crumbs[3] = array( |
| 647 | - 0 => __( 'Results', 'lsx' ), |
|
| 647 | + 0 => __('Results', 'lsx'), |
|
| 648 | 648 | ); |
| 649 | 649 | } else { |
| 650 | 650 | $new_crumbs[1] = array( |
| 651 | - 'text' => __( 'Courses', 'lsx' ), |
|
| 651 | + 'text' => __('Courses', 'lsx'), |
|
| 652 | 652 | 'url' => $course_page_url, |
| 653 | 653 | ); |
| 654 | 654 | $new_crumbs[2] = array( |
| 655 | - 'text' => __( 'Results', 'lsx' ), |
|
| 655 | + 'text' => __('Results', 'lsx'), |
|
| 656 | 656 | ); |
| 657 | 657 | } |
| 658 | 658 | } |
@@ -668,9 +668,9 @@ discard block |
||
| 668 | 668 | * @param [type] $message_post_id |
| 669 | 669 | * @return void |
| 670 | 670 | */ |
| 671 | - public function lsx_sensei_view_message_button( $message_post_id ) { |
|
| 672 | - $message_link = get_the_permalink( $message_post_id ); |
|
| 673 | - echo '<a href="' . esc_url_raw( $message_link ) . '" class="btn view-msg-btn">' . wp_kses_post( 'View Message', 'lsx' ) . '</a>'; |
|
| 671 | + public function lsx_sensei_view_message_button($message_post_id) { |
|
| 672 | + $message_link = get_the_permalink($message_post_id); |
|
| 673 | + echo '<a href="' . esc_url_raw($message_link) . '" class="btn view-msg-btn">' . wp_kses_post('View Message', 'lsx') . '</a>'; |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | /** |
@@ -679,9 +679,9 @@ discard block |
||
| 679 | 679 | * @param [type] $message_post_id |
| 680 | 680 | * @return void |
| 681 | 681 | */ |
| 682 | - public function lsx_sensei_back_message_button( $courses_link ) { |
|
| 682 | + public function lsx_sensei_back_message_button($courses_link) { |
|
| 683 | 683 | $courses_link = '/my-courses/'; |
| 684 | - echo '<a href="' . esc_url_raw( $courses_link ) . '" class="btn border-btn my-courses-btn">' . wp_kses_post( 'My Courses', 'lsx' ) . '</a>'; |
|
| 684 | + echo '<a href="' . esc_url_raw($courses_link) . '" class="btn border-btn my-courses-btn">' . wp_kses_post('My Courses', 'lsx') . '</a>'; |
|
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * Constructor. |
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 22 | + add_action('init', array($this, 'init')); |
|
| 23 | 23 | } // End __construct() |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return self |
| 29 | 29 | */ |
| 30 | 30 | public static function instance() { |
| 31 | - if ( ! self::$instance ) { |
|
| 31 | + if ( ! self::$instance) { |
|
| 32 | 32 | self::$instance = new self(); |
| 33 | 33 | } |
| 34 | 34 | return self::$instance; |
@@ -42,32 +42,32 @@ discard block |
||
| 42 | 42 | global $woothemes_sensei; |
| 43 | 43 | |
| 44 | 44 | //Switching the course filters and the headers around |
| 45 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 10, 0 ); |
|
| 46 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ) ); |
|
| 47 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ) ); |
|
| 48 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 11, 0 ); |
|
| 49 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ), 12 ); |
|
| 50 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ), 12 ); |
|
| 45 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'archive_header'), 10, 0); |
|
| 46 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_sorting')); |
|
| 47 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_filters')); |
|
| 48 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'archive_header'), 11, 0); |
|
| 49 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_sorting'), 12); |
|
| 50 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_filters'), 12); |
|
| 51 | 51 | |
| 52 | 52 | // First add the thumbnail. |
| 53 | - add_action( 'sensei_course_content_inside_before', array( $this, 'get_course_thumbnail' ), 1 ); |
|
| 53 | + add_action('sensei_course_content_inside_before', array($this, 'get_course_thumbnail'), 1); |
|
| 54 | 54 | |
| 55 | 55 | // This is for our wrapper, we run it on 2, after the thumbnail we added. |
| 56 | - add_action( 'sensei_course_content_inside_before', array( $this, 'course_body_div_open' ), 1 ); |
|
| 57 | - add_action( 'sensei_course_content_inside_after', array( $this, 'course_body_div_close' ), 50 ); |
|
| 56 | + add_action('sensei_course_content_inside_before', array($this, 'course_body_div_open'), 1); |
|
| 57 | + add_action('sensei_course_content_inside_after', array($this, 'course_body_div_close'), 50); |
|
| 58 | 58 | |
| 59 | 59 | // This is for our wrapper, we run it on 2, after the thumbnail we added. |
| 60 | - add_action( 'sensei_course_content_inside_before', array( $this, 'course_body_div_results_open' ), 20 ); |
|
| 61 | - add_action( 'sensei_course_content_inside_after', array( $this, 'course_body_div_results_close' ), 49 ); |
|
| 60 | + add_action('sensei_course_content_inside_before', array($this, 'course_body_div_results_open'), 20); |
|
| 61 | + add_action('sensei_course_content_inside_after', array($this, 'course_body_div_results_close'), 49); |
|
| 62 | 62 | |
| 63 | - add_action( 'sensei_single_course_content_inside_before', array( $this, 'display_course_amount' ), 20 ); |
|
| 63 | + add_action('sensei_single_course_content_inside_before', array($this, 'display_course_amount'), 20); |
|
| 64 | 64 | |
| 65 | 65 | // removes the course image above the content |
| 66 | - remove_action( 'sensei_course_content_inside_before', array( $woothemes_sensei->course, 'course_image' ), 30, 1 ); |
|
| 66 | + remove_action('sensei_course_content_inside_before', array($woothemes_sensei->course, 'course_image'), 30, 1); |
|
| 67 | 67 | // add the course image to the left of the content |
| 68 | - add_action( 'lsx_sensei_course_content_inside_before', array( $woothemes_sensei->course, 'course_image' ), 30, 1 ); |
|
| 68 | + add_action('lsx_sensei_course_content_inside_before', array($woothemes_sensei->course, 'course_image'), 30, 1); |
|
| 69 | 69 | |
| 70 | - add_filter( 'attach_shortcode_hooks', 'lsx_attach_shortcode_hooks', 10, 1 ); |
|
| 70 | + add_filter('attach_shortcode_hooks', 'lsx_attach_shortcode_hooks', 10, 1); |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function get_course_thumbnail() { |
| 80 | 80 | ?> |
| 81 | 81 | <div class="course-thumbnail"> |
| 82 | - <?php do_action( 'lsx_sensei_course_content_inside_before', get_the_ID() ); ?> |
|
| 82 | + <?php do_action('lsx_sensei_course_content_inside_before', get_the_ID()); ?> |
|
| 83 | 83 | </div> |
| 84 | 84 | <?php |
| 85 | 85 | } |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function course_body_div_open() { |
| 93 | 93 | global $post, $current_user; |
| 94 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 94 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 95 | 95 | $user_taking_course_class = ''; |
| 96 | - if ( ! empty( $is_user_taking_course ) ) { |
|
| 96 | + if ( ! empty($is_user_taking_course)) { |
|
| 97 | 97 | $user_taking_course_class = 'currently-in-course'; |
| 98 | 98 | } |
| 99 | 99 | ?> |
| 100 | - <div class="course-body <?php echo esc_html( $user_taking_course_class ); ?>"> |
|
| 100 | + <div class="course-body <?php echo esc_html($user_taking_course_class); ?>"> |
|
| 101 | 101 | <?php |
| 102 | 102 | } |
| 103 | 103 | |
@@ -141,16 +141,16 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function display_course_amount() { |
| 143 | 143 | global $post, $current_user; |
| 144 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 145 | - $wc_post_id = absint( get_post_meta( $post->ID, '_course_woocommerce_product', true ) ); |
|
| 146 | - if ( class_exists( 'Sensei_WC' ) ) { |
|
| 147 | - $course_purchasable = Sensei_WC::is_course_purchasable( $post->ID ); |
|
| 144 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 145 | + $wc_post_id = absint(get_post_meta($post->ID, '_course_woocommerce_product', true)); |
|
| 146 | + if (class_exists('Sensei_WC')) { |
|
| 147 | + $course_purchasable = Sensei_WC::is_course_purchasable($post->ID); |
|
| 148 | 148 | $currency = get_woocommerce_currency_symbol(); |
| 149 | - $product = new WC_Product( $wc_post_id ); |
|
| 150 | - if ( ( ! empty( $product->price ) ) && ( ! $is_user_taking_course ) ) { |
|
| 151 | - echo '<span class="course-product-price price"><span>' . esc_html( $currency ) . ' </span>' . sprintf( '%0.2f', esc_html( $product->price ) ) . '</span>'; |
|
| 152 | - } elseif ( ( '' === $product->get_price() || 0 == $product->get_price() ) && $course_purchasable ) { |
|
| 153 | - echo '<span class="course-product-price price">' . wp_kses_post( 'Free!', 'lsx' ) . '</span>'; |
|
| 149 | + $product = new WC_Product($wc_post_id); |
|
| 150 | + if (( ! empty($product->price)) && ( ! $is_user_taking_course)) { |
|
| 151 | + echo '<span class="course-product-price price"><span>' . esc_html($currency) . ' </span>' . sprintf('%0.2f', esc_html($product->price)) . '</span>'; |
|
| 152 | + } elseif (('' === $product->get_price() || 0 == $product->get_price()) && $course_purchasable) { |
|
| 153 | + echo '<span class="course-product-price price">' . wp_kses_post('Free!', 'lsx') . '</span>'; |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | } |