Completed
Push — master ( 3e9b97...4fb7fa )
by Fernando
02:38
created

sensei.php ➔ lsx_sensei_disable_lsx_banner()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * LSX functions and definitions - Sensei.
4
 *
5
 * @package    lsx
6
 * @subpackage sensei
7
 */
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
global $woothemes_sensei;
14
15 View Code Duplication
if ( ! function_exists( 'lsx_sensei_scripts_add_styles' ) ) :
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
17
	/**
18
	 * Sensei enqueue styles.
19
	 *
20
	 * @package    lsx
21
	 * @subpackage sensei
22
	 */
23
	function lsx_sensei_scripts_add_styles() {
24
		wp_enqueue_style( 'sensei-lsx', get_template_directory_uri() . '/assets/css/sensei.css', array( 'lsx_main' ), LSX_VERSION );
25
		wp_style_add_data( 'sensei-lsx', 'rtl', 'replace' );
26
	}
27
28
	add_action( 'wp_enqueue_scripts', 'lsx_sensei_scripts_add_styles' );
29
30
endif;
31
32 View Code Duplication
if ( ! function_exists( 'lsx_sensei_theme_wrapper_start' ) ) :
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
34
	/**
35
	 * Sensei wrapper start.
36
	 *
37
	 * @package    lsx
38
	 * @subpackage sensei
39
	 */
40
	function lsx_sensei_theme_wrapper_start() {
41
		lsx_content_wrap_before();
42
		echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">';
43
		lsx_content_before();
44
		echo '<main id="main" class="site-main" role="main">';
45
		lsx_content_top();
46
	}
47
48
	remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
49
	add_action( 'sensei_before_main_content', 'lsx_sensei_theme_wrapper_start' );
50
51
endif;
52
53 View Code Duplication
if ( ! function_exists( 'lsx_sensei_theme_wrapper_end' ) ) :
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
55
	/**
56
	 * Sensei wrapper end.
57
	 *
58
	 * @package    lsx
59
	 * @subpackage sensei
60
	 */
61
	function lsx_sensei_theme_wrapper_end() {
62
		lsx_content_bottom();
63
		echo '</main>';
64
		lsx_content_after();
65
		echo '</div>';
66
		lsx_content_wrap_after();
67
	}
68
69
	remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
70
	add_action( 'sensei_after_main_content', 'lsx_sensei_theme_wrapper_end' );
71
72
endif;
73
74
if ( ! function_exists( 'lsx_sensei_disable_lsx_banner' ) ) :
75
76
	/**
77
	 * Disable LSX Banners in some Sensei pages.
78
	 *
79
	 * @package    lsx
80
	 * @subpackage sensei
81
	 */
82
	function lsx_sensei_disable_lsx_banner( $disabled ) {
83
		if ( is_sensei() ) {
84
			$disabled = true;
85
		}
86
87
		return $disabled;
88
	}
89
90
	// LSX
91
	add_filter( 'lsx_global_header_disable', 'lsx_sensei_disable_lsx_banner' );
92
	// LSX Banners - Plugin, Placeholders
93
	add_filter( 'lsx_banner_plugin_disable', 'lsx_sensei_disable_lsx_banner' );
94
	// LSX Banners - Banner
95
	add_filter( 'lsx_banner_disable', 'lsx_sensei_disable_lsx_banner' );
96
97
endif;
98
99
if ( ! function_exists( 'lsx_sensei_archive_title' ) ) :
100
101
	/**
102
	 * Filters the archive title.
103
	 *
104
	 * @package    lsx
105
	 * @subpackage sensei
106
	 */
107
	function lsx_sensei_archive_title( $html ) {
108
		$html = preg_replace( '/<header class="archive-header"><h1>([^<]+)<\/h1><\/header>/i', '<h1>$1</h1>', $html );
109
		return $html;
110
	}
111
112
	add_filter( 'course_archive_title', 'lsx_sensei_archive_title', 10, 1 );
113
	add_filter( 'sensei_lesson_archive_title', 'lsx_sensei_archive_title', 10, 1 );
114
115
endif;
116
117
if ( ! function_exists( 'lsx_sensei_category_title' ) ) :
118
119
	/**
120
	 * Filters the archive title.
121
	 *
122
	 * @package    lsx
123
	 * @subpackage sensei
124
	 */
125
	function lsx_sensei_category_title( $html ) {
126
		$html = str_replace( 'h2', 'h1', $html );
127
		return $html;
128
	}
129
130
	add_filter( 'course_category_title', 'lsx_sensei_category_title', 10, 1 );
131
132
endif;
133
134
// Switching the course filters and the headers around
135
remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 10, 0 );
136
remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ) );
137
remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ) );
138
add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 11, 0 );
139
add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ),12 );
140
add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ),12 );
141