Passed
Branch master (26770f)
by Ashley
03:03 queued 38s
created
classes/class-lsx-projects-frontend.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -11,75 +11,75 @@  discard block
 block discarded – undo
11 11
 class LSX_Projects_Frontend {
12 12
 
13 13
 	public function __construct() {
14
-		if ( function_exists( 'tour_operator' ) ) {
15
-			$this->options = get_option( '_lsx-to_settings', false );
14
+		if (function_exists('tour_operator')) {
15
+			$this->options = get_option('_lsx-to_settings', false);
16 16
 		} else {
17
-			$this->options = get_option( '_lsx_settings', false );
17
+			$this->options = get_option('_lsx_settings', false);
18 18
 
19
-			if ( false === $this->options ) {
20
-				$this->options = get_option( '_lsx_lsx-settings', false );
19
+			if (false === $this->options) {
20
+				$this->options = get_option('_lsx_lsx-settings', false);
21 21
 			}
22 22
 		}
23 23
 
24
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 );
25
-		add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 );
26
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
27
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
24
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5);
25
+		add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2);
26
+		add_filter('template_include', array($this, 'single_template_include'), 99);
27
+		add_filter('template_include', array($this, 'archive_template_include'), 99);
28 28
 
29
-		if ( ! empty( $this->options['display'] ) && ! empty( $this->options['display']['projects_disable_single'] ) ) {
30
-			add_action( 'template_redirect', array( $this, 'disable_single' ) );
29
+		if ( ! empty($this->options['display']) && ! empty($this->options['display']['projects_disable_single'])) {
30
+			add_action('template_redirect', array($this, 'disable_single'));
31 31
 		}
32 32
 
33
-		if ( is_admin() ) {
34
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
33
+		if (is_admin()) {
34
+			add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2);
35 35
 		}
36 36
 
37
-		add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 );
37
+		add_filter('lsx_banner_title', array($this, 'lsx_banner_archive_title'), 15);
38 38
 
39
-		add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) );
40
-		add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) );
41
-		add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) );
39
+		add_filter('excerpt_more_p', array($this, 'change_excerpt_more'));
40
+		add_filter('excerpt_length', array($this, 'change_excerpt_length'));
41
+		add_filter('excerpt_strip_tags', array($this, 'change_excerpt_strip_tags'));
42 42
 
43
-		add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) );
44
-		add_action( 'wp_footer', array( $this, 'add_form_modal' ) );
43
+		add_filter('pre_get_posts', array($this, 'posts_per_page'));
44
+		add_action('wp_footer', array($this, 'add_form_modal'));
45 45
 	}
46 46
 
47 47
 	public function enqueue_scripts() {
48
-		$has_slick = wp_script_is( 'slick', 'queue' );
48
+		$has_slick = wp_script_is('slick', 'queue');
49 49
 
50
-		if ( ! $has_slick ) {
51
-			wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null );
52
-			wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true );
50
+		if ( ! $has_slick) {
51
+			wp_enqueue_style('slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null);
52
+			wp_enqueue_script('slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array('jquery'), null, LSX_PROJECTS_VER, true);
53 53
 		}
54 54
 
55
-		$has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' );
55
+		$has_scrolltofixed = wp_script_is('scrolltofixed', 'queue');
56 56
 
57
-		if ( ! $has_scrolltofixed ) {
58
-			wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true );
57
+		if ( ! $has_scrolltofixed) {
58
+			wp_enqueue_script('scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array('jquery'), null, LSX_PROJECTS_VER, true);
59 59
 		}
60 60
 
61
-		$has_isotope = wp_script_is( 'isotope', 'queue' );
61
+		$has_isotope = wp_script_is('isotope', 'queue');
62 62
 
63
-		if ( ! $has_isotope ) {
64
-			wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true );
63
+		if ( ! $has_isotope) {
64
+			wp_enqueue_script('isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_PROJECTS_VER, true);
65 65
 		}
66 66
 
67
-		wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true );
67
+		wp_enqueue_script('lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array('jquery', 'slick', 'scrolltofixed', 'isotope'), LSX_PROJECTS_VER, true);
68 68
 
69
-		$params = apply_filters( 'lsx_projects_js_params', array(
70
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
69
+		$params = apply_filters('lsx_projects_js_params', array(
70
+			'ajax_url' => admin_url('admin-ajax.php'),
71 71
 		));
72 72
 
73
-		wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params );
73
+		wp_localize_script('lsx-projects', 'lsx_customizer_params', $params);
74 74
 
75
-		wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER );
76
-		wp_style_add_data( 'lsx-projects', 'rtl', 'replace' );
75
+		wp_enqueue_style('lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER);
76
+		wp_style_add_data('lsx-projects', 'rtl', 'replace');
77 77
 	}
78 78
 
79 79
 	/**
80 80
 	 * Allow data params for Slick slider addon.
81 81
 	 */
82
-	public function wp_kses_allowed_html( $allowedtags, $context ) {
82
+	public function wp_kses_allowed_html($allowedtags, $context) {
83 83
 		$allowedtags['div']['data-slick'] = true;
84 84
 		return $allowedtags;
85 85
 	}
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * Single template.
89 89
 	 */
90
-	public function single_template_include( $template ) {
91
-		if ( is_main_query() && is_singular( 'project' ) ) {
92
-			if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) {
90
+	public function single_template_include($template) {
91
+		if (is_main_query() && is_singular('project')) {
92
+			if (empty(locate_template(array('single-projects.php'))) && file_exists(LSX_PROJECTS_PATH . 'templates/single-projects.php')) {
93 93
 				$template = LSX_PROJECTS_PATH . 'templates/single-projects.php';
94 94
 			}
95 95
 		}
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	/**
101 101
 	 * Archive template.
102 102
 	 */
103
-	public function archive_template_include( $template ) {
104
-		if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) {
105
-			if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) {
103
+	public function archive_template_include($template) {
104
+		if (is_main_query() && (is_post_type_archive('project') || is_tax('project-group'))) {
105
+			if (empty(locate_template(array('archive-projects.php'))) && file_exists(LSX_PROJECTS_PATH . 'templates/archive-projects.php')) {
106 106
 				$template = LSX_PROJECTS_PATH . 'templates/archive-projects.php';
107 107
 			}
108 108
 		}
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 * Removes access to single project member posts.
115 115
 	 */
116 116
 	public function disable_single() {
117
-		$queried_post_type = get_query_var( 'post_type' );
117
+		$queried_post_type = get_query_var('post_type');
118 118
 
119
-		if ( is_single() && 'project' === $queried_post_type ) {
120
-			wp_redirect( home_url(), 301 );
119
+		if (is_single() && 'project' === $queried_post_type) {
120
+			wp_redirect(home_url(), 301);
121 121
 			exit;
122 122
 		}
123 123
 	}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	/**
126 126
 	 * Handle body colours that might be change by LSX Customiser
127 127
 	 */
128
-	public function customizer_body_colours_handler( $css, $colors ) {
128
+	public function customizer_body_colours_handler($css, $colors) {
129 129
 		$css .= '
130 130
 			@import "' . LSX_PROJECTS_PATH . '/assets/css/scss/customizer-projects-body-colours";
131 131
 
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * Change the LSX Banners title for project archive.
150 150
 	 */
151
-	public function lsx_banner_archive_title( $title ) {
152
-		if ( is_main_query() && is_post_type_archive( 'project' ) ) {
153
-			$title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>';
151
+	public function lsx_banner_archive_title($title) {
152
+		if (is_main_query() && is_post_type_archive('project')) {
153
+			$title = '<h1 class="page-title">' . esc_html__('Portfolio', 'lsx-projects') . '</h1>';
154 154
 		}
155 155
 
156
-		if ( is_main_query() && is_tax( 'project-group' ) ) {
156
+		if (is_main_query() && is_tax('project-group')) {
157 157
 			$tax = get_queried_object();
158
-			$title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>';
158
+			$title = '<h1 class="page-title">' . esc_html__('Project Type', 'lsx-projects') . ': ' . apply_filters('the_title', $tax->name) . '</h1>';
159 159
 		}
160 160
 
161 161
 		return $title;
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	/**
165 165
 	 * Remove the "continue reading" when the single is disabled.
166 166
 	 */
167
-	public function change_excerpt_more( $excerpt_more ) {
167
+	public function change_excerpt_more($excerpt_more) {
168 168
 		global $post;
169 169
 
170
-		if ( 'project' === $post->post_type ) {
171
-			if ( ! empty( $this->options['display'] ) && ! empty( $this->options['display']['projects_disable_single'] ) ) {
170
+		if ('project' === $post->post_type) {
171
+			if ( ! empty($this->options['display']) && ! empty($this->options['display']['projects_disable_single'])) {
172 172
 				$excerpt_more = '';
173 173
 			}
174 174
 		}
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * Change the word count when crop the content to excerpt (homepage widget).
181 181
 	 */
182
-	public function change_excerpt_length( $excerpt_word_count ) {
182
+	public function change_excerpt_length($excerpt_word_count) {
183 183
 		global $post;
184 184
 
185
-		if ( is_front_page() && 'project' === $post->post_type ) {
185
+		if (is_front_page() && 'project' === $post->post_type) {
186 186
 			$excerpt_word_count = 20;
187 187
 		}
188 188
 
189
-		if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) {
189
+		if (is_singular('project') && ('team' === $post->post_type || 'testimonial' === $post->post_type)) {
190 190
 			$excerpt_word_count = 20;
191 191
 		}
192 192
 
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 	/**
197 197
 	 * Change the allowed tags crop the content to excerpt (homepage widget).
198 198
 	 */
199
-	public function change_excerpt_strip_tags( $allowed_tags ) {
199
+	public function change_excerpt_strip_tags($allowed_tags) {
200 200
 		global $post;
201 201
 
202
-		if ( is_front_page() && 'project' === $post->post_type ) {
202
+		if (is_front_page() && 'project' === $post->post_type) {
203 203
 			$allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>';
204 204
 		}
205 205
 
206
-		if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) {
206
+		if (is_singular('project') && ('team' === $post->post_type || 'testimonial' === $post->post_type)) {
207 207
 			$allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>';
208 208
 		}
209 209
 
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	/**
214 214
 	 * Change posts per page counter for archive.
215 215
 	 */
216
-	public function posts_per_page( $query ) {
217
-		if ( ! is_admin() && $query->is_main_query() ) {
218
-			if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) {
219
-				$query->set( 'posts_per_page', -1 );
216
+	public function posts_per_page($query) {
217
+		if ( ! is_admin() && $query->is_main_query()) {
218
+			if ($query->is_post_type_archive('project') || $query->is_tax('project-group')) {
219
+				$query->set('posts_per_page', -1);
220 220
 			}
221 221
 		}
222 222
 
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	public function add_form_modal() {
230 230
 		global $lsx_projects;
231 231
 
232
-		if ( empty( $lsx_projects->options['display'] ) || empty( $lsx_projects->options['display']['projects_modal_enable'] ) ) {
232
+		if (empty($lsx_projects->options['display']) || empty($lsx_projects->options['display']['projects_modal_enable'])) {
233 233
 			return '';
234 234
 		}
235 235
 
236
-		if ( empty( $lsx_projects->options['display']['projects_modal_cta_label'] ) || empty( $lsx_projects->options['display']['projects_modal_form_id'] ) ) {
236
+		if (empty($lsx_projects->options['display']['projects_modal_cta_label']) || empty($lsx_projects->options['display']['projects_modal_form_id'])) {
237 237
 			return '';
238 238
 		}
239 239
 
240
-		if ( ! is_single( 'project' ) ) {
240
+		if ( ! is_single('project')) {
241 241
 			return '';
242 242
 		}
243 243
 		?>
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 					<button type="button" class="close" data-dismiss="modal">&times;</button>
248 248
 
249 249
 					<div class="modal-header">
250
-						<h4 class="modal-title"><?php echo esc_html( $lsx_projects->options['display']['projects_modal_cta_label'] ); ?></h4>
250
+						<h4 class="modal-title"><?php echo esc_html($lsx_projects->options['display']['projects_modal_cta_label']); ?></h4>
251 251
 					</div>
252 252
 
253 253
 					<div class="modal-body">
254
-						<?php echo do_shortcode( '[caldera_form id="' . $lsx_projects->options['display']['projects_modal_form_id'] . '"]' ); ?>
254
+						<?php echo do_shortcode('[caldera_form id="' . $lsx_projects->options['display']['projects_modal_form_id'] . '"]'); ?>
255 255
 					</div>
256 256
 				</div>
257 257
 			</div>
Please login to merge, or discard this patch.
lsx-projects.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 // If this file is called directly, abort.
16
-if ( ! defined( 'WPINC' ) ) {
16
+if ( ! defined('WPINC')) {
17 17
 	die;
18 18
 }
19 19
 
20
-define( 'LSX_PROJECTS_PATH', plugin_dir_path( __FILE__ ) );
21
-define( 'LSX_PROJECTS_CORE', __FILE__ );
22
-define( 'LSX_PROJECTS_URL', plugin_dir_url( __FILE__ ) );
23
-define( 'LSX_PROJECTS_VER', '1.1.3' );
20
+define('LSX_PROJECTS_PATH', plugin_dir_path(__FILE__));
21
+define('LSX_PROJECTS_CORE', __FILE__);
22
+define('LSX_PROJECTS_URL', plugin_dir_url(__FILE__));
23
+define('LSX_PROJECTS_VER', '1.1.3');
24 24
 
25 25
 /* ======================= Below is the Plugin Class init ========================= */
26 26
 
Please login to merge, or discard this patch.