Passed
Push — master ( 75f7ea...1391ba )
by Chris
03:01
created
classes/class-lsx-projects-admin.php 2 patches
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 	public function __construct() {
14 14
 		$this->load_classes();
15 15
 
16
-		add_action( 'init', array( $this, 'post_type_setup' ) );
17
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
18
-		add_filter( 'cmb2_admin_init', array( $this, 'field_setup' ) );
19
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_services_metaboxes' ) );
20
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_testimonials_metaboxes' ) );
21
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_team_metaboxes' ) );
22
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_woocommerce_metaboxes' ) );
23
-		add_action( 'cmb_save_custom', array( $this, 'post_relations' ), 3, 20 );
24
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
25
-
26
-		add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 );
27
-		add_filter( 'enter_title_here', array( $this, 'change_title_text' ) );
16
+		add_action('init', array($this, 'post_type_setup'));
17
+		add_action('init', array($this, 'taxonomy_setup'));
18
+		add_filter('cmb2_admin_init', array($this, 'field_setup'));
19
+		add_filter('cmb2_admin_init', array($this, 'projects_services_metaboxes'));
20
+		add_filter('cmb2_admin_init', array($this, 'projects_testimonials_metaboxes'));
21
+		add_filter('cmb2_admin_init', array($this, 'projects_team_metaboxes'));
22
+		add_filter('cmb2_admin_init', array($this, 'projects_woocommerce_metaboxes'));
23
+		add_action('cmb_save_custom', array($this, 'post_relations'), 3, 20);
24
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
25
+
26
+		add_filter('type_url_form_media', array($this, 'change_attachment_field_button'), 20, 1);
27
+		add_filter('enter_title_here', array($this, 'change_title_text'));
28 28
 	}
29 29
 
30 30
 	/**
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function post_type_setup() {
45 45
 		$labels = array(
46
-			'name'               => esc_html_x( 'Projects', 'post type general name', 'lsx-projects' ),
47
-			'singular_name'      => esc_html_x( 'Project', 'post type singular name', 'lsx-projects' ),
48
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-projects' ),
49
-			'add_new_item'       => esc_html__( 'Add New Project', 'lsx-projects' ),
50
-			'edit_item'          => esc_html__( 'Edit Project', 'lsx-projects' ),
51
-			'new_item'           => esc_html__( 'New Project', 'lsx-projects' ),
52
-			'all_items'          => esc_html__( 'All Projects', 'lsx-projects' ),
53
-			'view_item'          => esc_html__( 'View Project', 'lsx-projects' ),
54
-			'search_items'       => esc_html__( 'Search Projects', 'lsx-projects' ),
55
-			'not_found'          => esc_html__( 'No projects found', 'lsx-projects' ),
56
-			'not_found_in_trash' => esc_html__( 'No projects found in Trash', 'lsx-projects' ),
46
+			'name'               => esc_html_x('Projects', 'post type general name', 'lsx-projects'),
47
+			'singular_name'      => esc_html_x('Project', 'post type singular name', 'lsx-projects'),
48
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-projects'),
49
+			'add_new_item'       => esc_html__('Add New Project', 'lsx-projects'),
50
+			'edit_item'          => esc_html__('Edit Project', 'lsx-projects'),
51
+			'new_item'           => esc_html__('New Project', 'lsx-projects'),
52
+			'all_items'          => esc_html__('All Projects', 'lsx-projects'),
53
+			'view_item'          => esc_html__('View Project', 'lsx-projects'),
54
+			'search_items'       => esc_html__('Search Projects', 'lsx-projects'),
55
+			'not_found'          => esc_html__('No projects found', 'lsx-projects'),
56
+			'not_found_in_trash' => esc_html__('No projects found in Trash', 'lsx-projects'),
57 57
 			'parent_item_colon'  => '',
58
-			'menu_name'          => esc_html_x( 'Projects', 'admin menu', 'lsx-projects' ),
58
+			'menu_name'          => esc_html_x('Projects', 'admin menu', 'lsx-projects'),
59 59
 		);
60 60
 
61 61
 		$args = array(
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 				'excerpt',
81 81
 			),
82 82
 			'show_in_rest'       => true,
83
-			'supports'           => array( 'editor', 'title', 'excerpt', 'thumbnail' ),
83
+			'supports'           => array('editor', 'title', 'excerpt', 'thumbnail'),
84 84
 		);
85 85
 
86
-		register_post_type( 'project', $args );
86
+		register_post_type('project', $args);
87 87
 	}
88 88
 
89 89
 	/**
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function taxonomy_setup() {
93 93
 		$labels = array(
94
-			'name'              => esc_html_x( 'Project Groups', 'taxonomy general name', 'lsx-projects' ),
95
-			'singular_name'     => esc_html_x( 'Group', 'taxonomy singular name', 'lsx-projects' ),
96
-			'search_items'      => esc_html__( 'Search Groups', 'lsx-projects' ),
97
-			'all_items'         => esc_html__( 'All Groups', 'lsx-projects' ),
98
-			'parent_item'       => esc_html__( 'Parent Group', 'lsx-projects' ),
99
-			'parent_item_colon' => esc_html__( 'Parent Group:', 'lsx-projects' ),
100
-			'edit_item'         => esc_html__( 'Edit Group', 'lsx-projects' ),
101
-			'update_item'       => esc_html__( 'Update Group', 'lsx-projects' ),
102
-			'add_new_item'      => esc_html__( 'Add New Group', 'lsx-projects' ),
103
-			'new_item_name'     => esc_html__( 'New Group Name', 'lsx-projects' ),
104
-			'menu_name'         => esc_html__( 'Groups', 'lsx-projects' ),
94
+			'name'              => esc_html_x('Project Groups', 'taxonomy general name', 'lsx-projects'),
95
+			'singular_name'     => esc_html_x('Group', 'taxonomy singular name', 'lsx-projects'),
96
+			'search_items'      => esc_html__('Search Groups', 'lsx-projects'),
97
+			'all_items'         => esc_html__('All Groups', 'lsx-projects'),
98
+			'parent_item'       => esc_html__('Parent Group', 'lsx-projects'),
99
+			'parent_item_colon' => esc_html__('Parent Group:', 'lsx-projects'),
100
+			'edit_item'         => esc_html__('Edit Group', 'lsx-projects'),
101
+			'update_item'       => esc_html__('Update Group', 'lsx-projects'),
102
+			'add_new_item'      => esc_html__('Add New Group', 'lsx-projects'),
103
+			'new_item_name'     => esc_html__('New Group Name', 'lsx-projects'),
104
+			'menu_name'         => esc_html__('Groups', 'lsx-projects'),
105 105
 		);
106 106
 
107 107
 		$args = array(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			),
116 116
 		);
117 117
 
118
-		register_taxonomy( 'project-group', array( 'project' ), $args );
118
+		register_taxonomy('project-group', array('project'), $args);
119 119
 	}
120 120
 
121 121
 	/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$cmb = new_cmb2_box(
128 128
 			array(
129 129
 				'id'           => $prefix . '_project',
130
-				'title'        => __( 'General', 'lsx-projects' ),
130
+				'title'        => __('General', 'lsx-projects'),
131 131
 				'object_types' => 'project',
132 132
 				'context'      => 'normal',
133 133
 				'priority'     => 'low',
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 		$cmb->add_field(
139 139
 			array(
140
-				'name'         => esc_html__( 'Featured:', 'lsx-projects' ),
140
+				'name'         => esc_html__('Featured:', 'lsx-projects'),
141 141
 				'id'           => $prefix . 'featured',
142 142
 				'type'         => 'checkbox',
143 143
 				'value'        => 1,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 		$cmb->add_field(
150 150
 			array(
151
-				'name'         => esc_html__( 'Client:', 'lsx-projects' ),
151
+				'name'         => esc_html__('Client:', 'lsx-projects'),
152 152
 				'id'           => $prefix . 'client',
153 153
 				'type'         => 'text',
154 154
 				'show_in_rest' => true,
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 
158 158
 		$cmb->add_field(
159 159
 			array(
160
-				'name'         => esc_html__( 'Client logo:', 'lsx-projects' ),
160
+				'name'         => esc_html__('Client logo:', 'lsx-projects'),
161 161
 				'id'           => $prefix . 'client_logo',
162 162
 				'type'         => 'image',
163
-				'desc'         => esc_html__( 'Recommended image size: 320 x 50~60', 'lsx-projects' ),
163
+				'desc'         => esc_html__('Recommended image size: 320 x 50~60', 'lsx-projects'),
164 164
 				'options'      => array(
165 165
 					'url' => false, // Hide the text input for the url.
166 166
 				),
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$cmb->add_field(
175 175
 			array(
176
-				'name'         => esc_html__( 'URL for the finished project:', 'lsx-projects' ),
176
+				'name'         => esc_html__('URL for the finished project:', 'lsx-projects'),
177 177
 				'id'           => $prefix . 'url',
178 178
 				'type'         => 'text',
179 179
 				'show_in_rest' => true,
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
 
201 201
 		$cmb->add_field(
202 202
 			array(
203
-				'name'         => esc_html__( 'Services related to this project:', 'lsx-projects' ),
203
+				'name'         => esc_html__('Services related to this project:', 'lsx-projects'),
204 204
 				'id'           => 'page_to_project',
205 205
 				'type'         => 'post_search_ajax',
206 206
 				'show_in_rest' => true,
207 207
 				'limit'        => 15,
208 208
 				'sortable'     => true,
209 209
 				'query_args'   => array(
210
-					'post_type'      => array( 'page' ),
211
-					'post_status'    => array( 'publish' ),
210
+					'post_type'      => array('page'),
211
+					'post_status'    => array('publish'),
212 212
 					'nopagin'        => true,
213 213
 					'posts_per_page' => '50',
214 214
 					'orderby'        => 'title',
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 			)
235 235
 		);
236 236
 
237
-		if ( class_exists( 'LSX_Testimonials' ) ) {
237
+		if (class_exists('LSX_Testimonials')) {
238 238
 			$cmb->add_field(
239 239
 				array(
240
-					'name'         => esc_html__( 'Testimonials related to this project:', 'lsx-projects' ),
240
+					'name'         => esc_html__('Testimonials related to this project:', 'lsx-projects'),
241 241
 					'id'           => 'testimonial_to_project',
242 242
 					'type'         => 'post_search_ajax',
243 243
 					'show_in_rest' => true,
244 244
 					'limit'        => 15,
245 245
 					'sortable'     => true,
246 246
 					'query_args'   => array(
247
-						'post_type'      => array( 'testimonials' ),
248
-						'post_status'    => array( 'publish' ),
247
+						'post_type'      => array('testimonials'),
248
+						'post_status'    => array('publish'),
249 249
 						'nopagin'        => true,
250 250
 						'posts_per_page' => '50',
251 251
 						'orderby'        => 'title',
@@ -272,18 +272,18 @@  discard block
 block discarded – undo
272 272
 			)
273 273
 		);
274 274
 
275
-		if ( class_exists( 'LSX_Team' ) ) {
275
+		if (class_exists('LSX_Team')) {
276 276
 			$cmb->add_field(
277 277
 				array(
278
-					'name'         => esc_html__( 'Team members involved with this project:', 'lsx-projects' ),
278
+					'name'         => esc_html__('Team members involved with this project:', 'lsx-projects'),
279 279
 					'id'           => 'team_to_project',
280 280
 					'type'         => 'post_search_ajax',
281 281
 					'show_in_rest' => true,
282 282
 					'limit'        => 15,
283 283
 					'sortable'     => true,
284 284
 					'query_args'   => array(
285
-						'post_type'      => array( 'team' ),
286
-						'post_status'    => array( 'publish' ),
285
+						'post_type'      => array('team'),
286
+						'post_status'    => array('publish'),
287 287
 						'nopagin'        => true,
288 288
 						'posts_per_page' => '50',
289 289
 						'orderby'        => 'title',
@@ -310,18 +310,18 @@  discard block
 block discarded – undo
310 310
 			)
311 311
 		);
312 312
 
313
-		if ( class_exists( 'woocommerce' ) ) {
313
+		if (class_exists('woocommerce')) {
314 314
 			$cmb->add_field(
315 315
 				array(
316
-					'name'         => esc_html__( 'Products used for this project:', 'lsx-projects' ),
316
+					'name'         => esc_html__('Products used for this project:', 'lsx-projects'),
317 317
 					'id'           => 'product_to_project',
318 318
 					'type'         => 'post_search_ajax',
319 319
 					'show_in_rest' => true,
320 320
 					'limit'        => 15,
321 321
 					'sortable'     => true,
322 322
 					'query_args'   => array(
323
-						'post_type'      => array( 'product' ),
324
-						'post_status'    => array( 'publish' ),
323
+						'post_type'      => array('product'),
324
+						'post_status'    => array('publish'),
325 325
 						'nopagin'        => true,
326 326
 						'posts_per_page' => '50',
327 327
 						'orderby'        => 'title',
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	/**
336 336
 	 * Sets up the "post relations".
337 337
 	 */
338
-	public function post_relations( $post_id, $field, $value ) {
338
+	public function post_relations($post_id, $field, $value) {
339 339
 		$connections = array(
340 340
 			// 'project_to_project',
341 341
 
@@ -352,31 +352,31 @@  discard block
 block discarded – undo
352 352
 			'team_to_project',
353 353
 		);
354 354
 
355
-		if ( in_array( $field['id'], $connections ) ) {
356
-			$this->save_related_post( $connections, $post_id, $field, $value );
355
+		if (in_array($field['id'], $connections)) {
356
+			$this->save_related_post($connections, $post_id, $field, $value);
357 357
 		}
358 358
 	}
359 359
 
360 360
 	/**
361 361
 	 * Save the reverse post relation.
362 362
 	 */
363
-	public function save_related_post( $connections, $post_id, $field, $value ) {
364
-		$ids = explode( '_to_', $field['id'] );
363
+	public function save_related_post($connections, $post_id, $field, $value) {
364
+		$ids = explode('_to_', $field['id']);
365 365
 		$relation = $ids[1] . '_to_' . $ids[0];
366 366
 
367
-		if ( in_array( $relation, $connections ) ) {
368
-			$previous_values = get_post_meta( $post_id, $field['id'], false );
367
+		if (in_array($relation, $connections)) {
368
+			$previous_values = get_post_meta($post_id, $field['id'], false);
369 369
 
370
-			if ( ! empty( $previous_values ) ) {
371
-				foreach ( $previous_values as $v ) {
372
-					delete_post_meta( $v, $relation, $post_id );
370
+			if ( ! empty($previous_values)) {
371
+				foreach ($previous_values as $v) {
372
+					delete_post_meta($v, $relation, $post_id);
373 373
 				}
374 374
 			}
375 375
 
376
-			if ( is_array( $value ) ) {
377
-				foreach ( $value as $v ) {
378
-					if ( ! empty( $v ) ) {
379
-						add_post_meta( $v, $relation, $post_id );
376
+			if (is_array($value)) {
377
+				foreach ($value as $v) {
378
+					if ( ! empty($v)) {
379
+						add_post_meta($v, $relation, $post_id);
380 380
 					}
381 381
 				}
382 382
 			}
@@ -385,30 +385,30 @@  discard block
 block discarded – undo
385 385
 
386 386
 	public function assets() {
387 387
 		//wp_enqueue_media();
388
-		wp_enqueue_script( 'media-upload' );
389
-		wp_enqueue_script( 'thickbox' );
390
-		wp_enqueue_style( 'thickbox' );
388
+		wp_enqueue_script('media-upload');
389
+		wp_enqueue_script('thickbox');
390
+		wp_enqueue_style('thickbox');
391 391
 
392
-		wp_enqueue_script( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/js/lsx-projects-admin.min.js', array( 'jquery' ), LSX_PROJECTS_VER, true );
393
-		wp_enqueue_style( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/css/lsx-projects-admin.css', array(), LSX_PROJECTS_VER );
392
+		wp_enqueue_script('lsx-projects-admin', LSX_PROJECTS_URL . 'assets/js/lsx-projects-admin.min.js', array('jquery'), LSX_PROJECTS_VER, true);
393
+		wp_enqueue_style('lsx-projects-admin', LSX_PROJECTS_URL . 'assets/css/lsx-projects-admin.css', array(), LSX_PROJECTS_VER);
394 394
 	}
395 395
 
396 396
 	/**
397 397
 	 * Change the "Insert into Post" button text when media modal is used for feature images
398 398
 	 */
399
-	public function change_attachment_field_button( $html ) {
400
-		if ( isset( $_GET['feature_image_text_button'] ) ) {
401
-			$html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-projects' ) ), $html );
399
+	public function change_attachment_field_button($html) {
400
+		if (isset($_GET['feature_image_text_button'])) {
401
+			$html = str_replace('value="Insert into Post"', sprintf('value="%s"', esc_html__('Select featured image', 'lsx-projects')), $html);
402 402
 		}
403 403
 
404 404
 		return $html;
405 405
 	}
406 406
 
407
-	public function change_title_text( $title ) {
407
+	public function change_title_text($title) {
408 408
 		$screen = get_current_screen();
409 409
 
410
-		if ( 'project' === $screen->post_type ) {
411
-			$title = esc_attr__( 'Enter project title', 'lsx-projects' );
410
+		if ('project' === $screen->post_type) {
411
+			$title = esc_attr__('Enter project title', 'lsx-projects');
412 412
 		}
413 413
 
414 414
 		return $title;
Please login to merge, or discard this patch.
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -10,409 +10,409 @@
 block discarded – undo
10 10
  */
11 11
 class LSX_Projects_Admin {
12 12
 
13
-	public function __construct() {
14
-		$this->load_classes();
15
-
16
-		add_action( 'init', array( $this, 'post_type_setup' ) );
17
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
18
-		add_filter( 'cmb2_admin_init', array( $this, 'field_setup' ) );
19
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_services_metaboxes' ) );
20
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_testimonials_metaboxes' ) );
21
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_team_metaboxes' ) );
22
-		add_filter( 'cmb2_admin_init', array( $this, 'projects_woocommerce_metaboxes' ) );
23
-		add_action( 'cmb_save_custom', array( $this, 'post_relations' ), 3, 20 );
24
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
25
-
26
-		add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 );
27
-		add_filter( 'enter_title_here', array( $this, 'change_title_text' ) );
28
-	}
29
-
30
-	/**
31
-	 * Loads the admin subclasses
32
-	 */
33
-	private function load_classes() {
34
-		require_once LSX_PROJECTS_PATH . 'classes/admin/class-settings.php';
35
-		$this->settings = \lsx\projects\classes\admin\Settings::get_instance();
36
-
37
-		require_once LSX_PROJECTS_PATH . 'classes/admin/class-settings-theme.php';
38
-		$this->settings_theme = \lsx\projects\classes\admin\Settings_Theme::get_instance();
39
-	}
40
-
41
-	/**
42
-	 * Register the Project and Product Tag post type
43
-	 */
44
-	public function post_type_setup() {
45
-		$labels = array(
46
-			'name'               => esc_html_x( 'Projects', 'post type general name', 'lsx-projects' ),
47
-			'singular_name'      => esc_html_x( 'Project', 'post type singular name', 'lsx-projects' ),
48
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-projects' ),
49
-			'add_new_item'       => esc_html__( 'Add New Project', 'lsx-projects' ),
50
-			'edit_item'          => esc_html__( 'Edit Project', 'lsx-projects' ),
51
-			'new_item'           => esc_html__( 'New Project', 'lsx-projects' ),
52
-			'all_items'          => esc_html__( 'All Projects', 'lsx-projects' ),
53
-			'view_item'          => esc_html__( 'View Project', 'lsx-projects' ),
54
-			'search_items'       => esc_html__( 'Search Projects', 'lsx-projects' ),
55
-			'not_found'          => esc_html__( 'No projects found', 'lsx-projects' ),
56
-			'not_found_in_trash' => esc_html__( 'No projects found in Trash', 'lsx-projects' ),
57
-			'parent_item_colon'  => '',
58
-			'menu_name'          => esc_html_x( 'Projects', 'admin menu', 'lsx-projects' ),
59
-		);
60
-
61
-		$args = array(
62
-			'labels'             => $labels,
63
-			'public'             => true,
64
-			'publicly_queryable' => true,
65
-			'show_ui'            => true,
66
-			'show_in_menu'       => true,
67
-			'menu_icon'          => 'dashicons-portfolio',
68
-			'query_var'          => true,
69
-			'rewrite'            => array(
70
-				'slug' => 'portfolio',
71
-			),
72
-			'capability_type'    => 'post',
73
-			'has_archive'        => 'portfolio',
74
-			'hierarchical'       => false,
75
-			'menu_position'      => null,
76
-			'supports'           => array(
77
-				'title',
78
-				'editor',
79
-				'thumbnail',
80
-				'excerpt',
81
-			),
82
-			'show_in_rest'       => true,
83
-			'supports'           => array( 'editor', 'title', 'excerpt', 'thumbnail' ),
84
-		);
85
-
86
-		register_post_type( 'project', $args );
87
-	}
88
-
89
-	/**
90
-	 * Register the Group taxonomy
91
-	 */
92
-	public function taxonomy_setup() {
93
-		$labels = array(
94
-			'name'              => esc_html_x( 'Project Groups', 'taxonomy general name', 'lsx-projects' ),
95
-			'singular_name'     => esc_html_x( 'Group', 'taxonomy singular name', 'lsx-projects' ),
96
-			'search_items'      => esc_html__( 'Search Groups', 'lsx-projects' ),
97
-			'all_items'         => esc_html__( 'All Groups', 'lsx-projects' ),
98
-			'parent_item'       => esc_html__( 'Parent Group', 'lsx-projects' ),
99
-			'parent_item_colon' => esc_html__( 'Parent Group:', 'lsx-projects' ),
100
-			'edit_item'         => esc_html__( 'Edit Group', 'lsx-projects' ),
101
-			'update_item'       => esc_html__( 'Update Group', 'lsx-projects' ),
102
-			'add_new_item'      => esc_html__( 'Add New Group', 'lsx-projects' ),
103
-			'new_item_name'     => esc_html__( 'New Group Name', 'lsx-projects' ),
104
-			'menu_name'         => esc_html__( 'Groups', 'lsx-projects' ),
105
-		);
106
-
107
-		$args = array(
108
-			'hierarchical'      => true,
109
-			'labels'            => $labels,
110
-			'show_ui'           => true,
111
-			'show_admin_column' => true,
112
-			'query_var'         => true,
113
-			'rewrite'           => array(
114
-				'slug' => 'portfolio-group',
115
-			),
116
-		);
117
-
118
-		register_taxonomy( 'project-group', array( 'project' ), $args );
119
-	}
120
-
121
-	/**
122
-	 * Add metabox with custom fields to the Project post type
123
-	 */
124
-	public function field_setup() {
125
-		$prefix = 'lsx_project_';
126
-
127
-		$cmb = new_cmb2_box(
128
-			array(
129
-				'id'           => $prefix . '_project',
130
-				'title'        => __( 'General', 'lsx-projects' ),
131
-				'object_types' => 'project',
132
-				'context'      => 'normal',
133
-				'priority'     => 'low',
134
-				'show_names'   => true,
135
-			)
136
-		);
137
-
138
-		$cmb->add_field(
139
-			array(
140
-				'name'         => esc_html__( 'Featured:', 'lsx-projects' ),
141
-				'id'           => $prefix . 'featured',
142
-				'type'         => 'checkbox',
143
-				'value'        => 1,
144
-				'default'      => 0,
145
-				'show_in_rest' => true,
146
-			)
147
-		);
148
-
149
-		$cmb->add_field(
150
-			array(
151
-				'name'         => esc_html__( 'Client:', 'lsx-projects' ),
152
-				'id'           => $prefix . 'client',
153
-				'type'         => 'text',
154
-				'show_in_rest' => true,
155
-			)
156
-		);
157
-
158
-		$cmb->add_field(
159
-			array(
160
-				'name'         => esc_html__( 'Client logo:', 'lsx-projects' ),
161
-				'id'           => $prefix . 'client_logo',
162
-				'type'         => 'image',
163
-				'desc'         => esc_html__( 'Recommended image size: 320 x 50~60', 'lsx-projects' ),
164
-				'options'      => array(
165
-					'url' => false, // Hide the text input for the url.
166
-				),
167
-				'text'         => array(
168
-					'add_upload_file_text' => 'Choose Image',
169
-				),
170
-				'show_in_rest' => true,
171
-			)
172
-		);
173
-
174
-		$cmb->add_field(
175
-			array(
176
-				'name'         => esc_html__( 'URL for the finished project:', 'lsx-projects' ),
177
-				'id'           => $prefix . 'url',
178
-				'type'         => 'text',
179
-				'show_in_rest' => true,
180
-			)
181
-		);
182
-
183
-	}
184
-
185
-	/**
186
-	 * Project Services Metaboxes.
187
-	 */
188
-	public function projects_services_metaboxes() {
189
-		$prefix = 'lsx_project_';
190
-
191
-		$cmb = new_cmb2_box(
192
-			array(
193
-				'id'           => $prefix . '_project',
194
-				'object_types' => 'projects',
195
-				'context'      => 'normal',
196
-				'priority'     => 'low',
197
-				'show_names'   => true,
198
-			)
199
-		);
200
-
201
-		$cmb->add_field(
202
-			array(
203
-				'name'         => esc_html__( 'Services related to this project:', 'lsx-projects' ),
204
-				'id'           => 'page_to_project',
205
-				'type'         => 'post_search_ajax',
206
-				'show_in_rest' => true,
207
-				'limit'        => 15,
208
-				'sortable'     => true,
209
-				'query_args'   => array(
210
-					'post_type'      => array( 'page' ),
211
-					'post_status'    => array( 'publish' ),
212
-					'nopagin'        => true,
213
-					'posts_per_page' => '50',
214
-					'orderby'        => 'title',
215
-					'order'          => 'ASC',
216
-				),
217
-			)
218
-		);
219
-	}
220
-
221
-	/**
222
-	 * Project Testimonials Metaboxes.
223
-	 */
224
-	public function projects_testimonials_metaboxes() {
225
-		$prefix = 'lsx_project_';
226
-
227
-		$cmb = new_cmb2_box(
228
-			array(
229
-				'id'           => $prefix . '_project',
230
-				'object_types' => 'projects',
231
-				'context'      => 'normal',
232
-				'priority'     => 'low',
233
-				'show_names'   => true,
234
-			)
235
-		);
236
-
237
-		if ( class_exists( 'LSX_Testimonials' ) ) {
238
-			$cmb->add_field(
239
-				array(
240
-					'name'         => esc_html__( 'Testimonials related to this project:', 'lsx-projects' ),
241
-					'id'           => 'testimonial_to_project',
242
-					'type'         => 'post_search_ajax',
243
-					'show_in_rest' => true,
244
-					'limit'        => 15,
245
-					'sortable'     => true,
246
-					'query_args'   => array(
247
-						'post_type'      => array( 'testimonials' ),
248
-						'post_status'    => array( 'publish' ),
249
-						'nopagin'        => true,
250
-						'posts_per_page' => '50',
251
-						'orderby'        => 'title',
252
-						'order'          => 'ASC',
253
-					),
254
-				)
255
-			);
256
-		}
257
-	}
258
-
259
-	/**
260
-	 * Project Team Metaboxes.
261
-	 */
262
-	public function projects_team_metaboxes() {
263
-		$prefix = 'lsx_project_';
264
-
265
-		$cmb = new_cmb2_box(
266
-			array(
267
-				'id'           => $prefix . '_project',
268
-				'object_types' => 'project',
269
-				'context'      => 'normal',
270
-				'priority'     => 'low',
271
-				'show_names'   => true,
272
-			)
273
-		);
274
-
275
-		if ( class_exists( 'LSX_Team' ) ) {
276
-			$cmb->add_field(
277
-				array(
278
-					'name'         => esc_html__( 'Team members involved with this project:', 'lsx-projects' ),
279
-					'id'           => 'team_to_project',
280
-					'type'         => 'post_search_ajax',
281
-					'show_in_rest' => true,
282
-					'limit'        => 15,
283
-					'sortable'     => true,
284
-					'query_args'   => array(
285
-						'post_type'      => array( 'team' ),
286
-						'post_status'    => array( 'publish' ),
287
-						'nopagin'        => true,
288
-						'posts_per_page' => '50',
289
-						'orderby'        => 'title',
290
-						'order'          => 'ASC',
291
-					),
292
-				)
293
-			);
294
-		}
295
-	}
296
-
297
-	/**
298
-	 * Project Woocommerce Metaboxes.
299
-	 */
300
-	public function projects_woocommerce_metaboxes() {
301
-		$prefix = 'lsx_project_';
302
-
303
-		$cmb = new_cmb2_box(
304
-			array(
305
-				'id'           => $prefix . '_project',
306
-				'object_types' => 'projects',
307
-				'context'      => 'normal',
308
-				'priority'     => 'low',
309
-				'show_names'   => true,
310
-			)
311
-		);
312
-
313
-		if ( class_exists( 'woocommerce' ) ) {
314
-			$cmb->add_field(
315
-				array(
316
-					'name'         => esc_html__( 'Products used for this project:', 'lsx-projects' ),
317
-					'id'           => 'product_to_project',
318
-					'type'         => 'post_search_ajax',
319
-					'show_in_rest' => true,
320
-					'limit'        => 15,
321
-					'sortable'     => true,
322
-					'query_args'   => array(
323
-						'post_type'      => array( 'product' ),
324
-						'post_status'    => array( 'publish' ),
325
-						'nopagin'        => true,
326
-						'posts_per_page' => '50',
327
-						'orderby'        => 'title',
328
-						'order'          => 'ASC',
329
-					),
330
-				)
331
-			);
332
-		}
333
-	}
334
-
335
-	/**
336
-	 * Sets up the "post relations".
337
-	 */
338
-	public function post_relations( $post_id, $field, $value ) {
339
-		$connections = array(
340
-			// 'project_to_project',
341
-
342
-			'page_to_project',
343
-			'project_to_page',
344
-
345
-			'project_to_service',
346
-			'service_to_project',
347
-
348
-			'project_to_testimonial',
349
-			'testimonial_to_project',
350
-
351
-			'project_to_team',
352
-			'team_to_project',
353
-		);
354
-
355
-		if ( in_array( $field['id'], $connections ) ) {
356
-			$this->save_related_post( $connections, $post_id, $field, $value );
357
-		}
358
-	}
359
-
360
-	/**
361
-	 * Save the reverse post relation.
362
-	 */
363
-	public function save_related_post( $connections, $post_id, $field, $value ) {
364
-		$ids = explode( '_to_', $field['id'] );
365
-		$relation = $ids[1] . '_to_' . $ids[0];
366
-
367
-		if ( in_array( $relation, $connections ) ) {
368
-			$previous_values = get_post_meta( $post_id, $field['id'], false );
369
-
370
-			if ( ! empty( $previous_values ) ) {
371
-				foreach ( $previous_values as $v ) {
372
-					delete_post_meta( $v, $relation, $post_id );
373
-				}
374
-			}
375
-
376
-			if ( is_array( $value ) ) {
377
-				foreach ( $value as $v ) {
378
-					if ( ! empty( $v ) ) {
379
-						add_post_meta( $v, $relation, $post_id );
380
-					}
381
-				}
382
-			}
383
-		}
384
-	}
385
-
386
-	public function assets() {
387
-		//wp_enqueue_media();
388
-		wp_enqueue_script( 'media-upload' );
389
-		wp_enqueue_script( 'thickbox' );
390
-		wp_enqueue_style( 'thickbox' );
391
-
392
-		wp_enqueue_script( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/js/lsx-projects-admin.min.js', array( 'jquery' ), LSX_PROJECTS_VER, true );
393
-		wp_enqueue_style( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/css/lsx-projects-admin.css', array(), LSX_PROJECTS_VER );
394
-	}
395
-
396
-	/**
397
-	 * Change the "Insert into Post" button text when media modal is used for feature images
398
-	 */
399
-	public function change_attachment_field_button( $html ) {
400
-		if ( isset( $_GET['feature_image_text_button'] ) ) {
401
-			$html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-projects' ) ), $html );
402
-		}
403
-
404
-		return $html;
405
-	}
406
-
407
-	public function change_title_text( $title ) {
408
-		$screen = get_current_screen();
409
-
410
-		if ( 'project' === $screen->post_type ) {
411
-			$title = esc_attr__( 'Enter project title', 'lsx-projects' );
412
-		}
413
-
414
-		return $title;
415
-	}
13
+     public function __construct() {
14
+          $this->load_classes();
15
+
16
+          add_action( 'init', array( $this, 'post_type_setup' ) );
17
+          add_action( 'init', array( $this, 'taxonomy_setup' ) );
18
+          add_filter( 'cmb2_admin_init', array( $this, 'field_setup' ) );
19
+          add_filter( 'cmb2_admin_init', array( $this, 'projects_services_metaboxes' ) );
20
+          add_filter( 'cmb2_admin_init', array( $this, 'projects_testimonials_metaboxes' ) );
21
+          add_filter( 'cmb2_admin_init', array( $this, 'projects_team_metaboxes' ) );
22
+          add_filter( 'cmb2_admin_init', array( $this, 'projects_woocommerce_metaboxes' ) );
23
+          add_action( 'cmb_save_custom', array( $this, 'post_relations' ), 3, 20 );
24
+          add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
25
+
26
+          add_filter( 'type_url_form_media', array( $this, 'change_attachment_field_button' ), 20, 1 );
27
+          add_filter( 'enter_title_here', array( $this, 'change_title_text' ) );
28
+     }
29
+
30
+     /**
31
+      * Loads the admin subclasses
32
+      */
33
+     private function load_classes() {
34
+          require_once LSX_PROJECTS_PATH . 'classes/admin/class-settings.php';
35
+          $this->settings = \lsx\projects\classes\admin\Settings::get_instance();
36
+
37
+          require_once LSX_PROJECTS_PATH . 'classes/admin/class-settings-theme.php';
38
+          $this->settings_theme = \lsx\projects\classes\admin\Settings_Theme::get_instance();
39
+     }
40
+
41
+     /**
42
+      * Register the Project and Product Tag post type
43
+      */
44
+     public function post_type_setup() {
45
+          $labels = array(
46
+               'name'               => esc_html_x( 'Projects', 'post type general name', 'lsx-projects' ),
47
+               'singular_name'      => esc_html_x( 'Project', 'post type singular name', 'lsx-projects' ),
48
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-projects' ),
49
+               'add_new_item'       => esc_html__( 'Add New Project', 'lsx-projects' ),
50
+               'edit_item'          => esc_html__( 'Edit Project', 'lsx-projects' ),
51
+               'new_item'           => esc_html__( 'New Project', 'lsx-projects' ),
52
+               'all_items'          => esc_html__( 'All Projects', 'lsx-projects' ),
53
+               'view_item'          => esc_html__( 'View Project', 'lsx-projects' ),
54
+               'search_items'       => esc_html__( 'Search Projects', 'lsx-projects' ),
55
+               'not_found'          => esc_html__( 'No projects found', 'lsx-projects' ),
56
+               'not_found_in_trash' => esc_html__( 'No projects found in Trash', 'lsx-projects' ),
57
+               'parent_item_colon'  => '',
58
+               'menu_name'          => esc_html_x( 'Projects', 'admin menu', 'lsx-projects' ),
59
+          );
60
+
61
+          $args = array(
62
+               'labels'             => $labels,
63
+               'public'             => true,
64
+               'publicly_queryable' => true,
65
+               'show_ui'            => true,
66
+               'show_in_menu'       => true,
67
+               'menu_icon'          => 'dashicons-portfolio',
68
+               'query_var'          => true,
69
+               'rewrite'            => array(
70
+                    'slug' => 'portfolio',
71
+               ),
72
+               'capability_type'    => 'post',
73
+               'has_archive'        => 'portfolio',
74
+               'hierarchical'       => false,
75
+               'menu_position'      => null,
76
+               'supports'           => array(
77
+                    'title',
78
+                    'editor',
79
+                    'thumbnail',
80
+                    'excerpt',
81
+               ),
82
+               'show_in_rest'       => true,
83
+               'supports'           => array( 'editor', 'title', 'excerpt', 'thumbnail' ),
84
+          );
85
+
86
+          register_post_type( 'project', $args );
87
+     }
88
+
89
+     /**
90
+      * Register the Group taxonomy
91
+      */
92
+     public function taxonomy_setup() {
93
+          $labels = array(
94
+               'name'              => esc_html_x( 'Project Groups', 'taxonomy general name', 'lsx-projects' ),
95
+               'singular_name'     => esc_html_x( 'Group', 'taxonomy singular name', 'lsx-projects' ),
96
+               'search_items'      => esc_html__( 'Search Groups', 'lsx-projects' ),
97
+               'all_items'         => esc_html__( 'All Groups', 'lsx-projects' ),
98
+               'parent_item'       => esc_html__( 'Parent Group', 'lsx-projects' ),
99
+               'parent_item_colon' => esc_html__( 'Parent Group:', 'lsx-projects' ),
100
+               'edit_item'         => esc_html__( 'Edit Group', 'lsx-projects' ),
101
+               'update_item'       => esc_html__( 'Update Group', 'lsx-projects' ),
102
+               'add_new_item'      => esc_html__( 'Add New Group', 'lsx-projects' ),
103
+               'new_item_name'     => esc_html__( 'New Group Name', 'lsx-projects' ),
104
+               'menu_name'         => esc_html__( 'Groups', 'lsx-projects' ),
105
+          );
106
+
107
+          $args = array(
108
+               'hierarchical'      => true,
109
+               'labels'            => $labels,
110
+               'show_ui'           => true,
111
+               'show_admin_column' => true,
112
+               'query_var'         => true,
113
+               'rewrite'           => array(
114
+                    'slug' => 'portfolio-group',
115
+               ),
116
+          );
117
+
118
+          register_taxonomy( 'project-group', array( 'project' ), $args );
119
+     }
120
+
121
+     /**
122
+      * Add metabox with custom fields to the Project post type
123
+      */
124
+     public function field_setup() {
125
+          $prefix = 'lsx_project_';
126
+
127
+          $cmb = new_cmb2_box(
128
+               array(
129
+                    'id'           => $prefix . '_project',
130
+                    'title'        => __( 'General', 'lsx-projects' ),
131
+                    'object_types' => 'project',
132
+                    'context'      => 'normal',
133
+                    'priority'     => 'low',
134
+                    'show_names'   => true,
135
+               )
136
+          );
137
+
138
+          $cmb->add_field(
139
+               array(
140
+                    'name'         => esc_html__( 'Featured:', 'lsx-projects' ),
141
+                    'id'           => $prefix . 'featured',
142
+                    'type'         => 'checkbox',
143
+                    'value'        => 1,
144
+                    'default'      => 0,
145
+                    'show_in_rest' => true,
146
+               )
147
+          );
148
+
149
+          $cmb->add_field(
150
+               array(
151
+                    'name'         => esc_html__( 'Client:', 'lsx-projects' ),
152
+                    'id'           => $prefix . 'client',
153
+                    'type'         => 'text',
154
+                    'show_in_rest' => true,
155
+               )
156
+          );
157
+
158
+          $cmb->add_field(
159
+               array(
160
+                    'name'         => esc_html__( 'Client logo:', 'lsx-projects' ),
161
+                    'id'           => $prefix . 'client_logo',
162
+                    'type'         => 'image',
163
+                    'desc'         => esc_html__( 'Recommended image size: 320 x 50~60', 'lsx-projects' ),
164
+                    'options'      => array(
165
+                         'url' => false, // Hide the text input for the url.
166
+                    ),
167
+                    'text'         => array(
168
+                         'add_upload_file_text' => 'Choose Image',
169
+                    ),
170
+                    'show_in_rest' => true,
171
+               )
172
+          );
173
+
174
+          $cmb->add_field(
175
+               array(
176
+                    'name'         => esc_html__( 'URL for the finished project:', 'lsx-projects' ),
177
+                    'id'           => $prefix . 'url',
178
+                    'type'         => 'text',
179
+                    'show_in_rest' => true,
180
+               )
181
+          );
182
+
183
+     }
184
+
185
+     /**
186
+      * Project Services Metaboxes.
187
+      */
188
+     public function projects_services_metaboxes() {
189
+          $prefix = 'lsx_project_';
190
+
191
+          $cmb = new_cmb2_box(
192
+               array(
193
+                    'id'           => $prefix . '_project',
194
+                    'object_types' => 'projects',
195
+                    'context'      => 'normal',
196
+                    'priority'     => 'low',
197
+                    'show_names'   => true,
198
+               )
199
+          );
200
+
201
+          $cmb->add_field(
202
+               array(
203
+                    'name'         => esc_html__( 'Services related to this project:', 'lsx-projects' ),
204
+                    'id'           => 'page_to_project',
205
+                    'type'         => 'post_search_ajax',
206
+                    'show_in_rest' => true,
207
+                    'limit'        => 15,
208
+                    'sortable'     => true,
209
+                    'query_args'   => array(
210
+                         'post_type'      => array( 'page' ),
211
+                         'post_status'    => array( 'publish' ),
212
+                         'nopagin'        => true,
213
+                         'posts_per_page' => '50',
214
+                         'orderby'        => 'title',
215
+                         'order'          => 'ASC',
216
+                    ),
217
+               )
218
+          );
219
+     }
220
+
221
+     /**
222
+      * Project Testimonials Metaboxes.
223
+      */
224
+     public function projects_testimonials_metaboxes() {
225
+          $prefix = 'lsx_project_';
226
+
227
+          $cmb = new_cmb2_box(
228
+               array(
229
+                    'id'           => $prefix . '_project',
230
+                    'object_types' => 'projects',
231
+                    'context'      => 'normal',
232
+                    'priority'     => 'low',
233
+                    'show_names'   => true,
234
+               )
235
+          );
236
+
237
+          if ( class_exists( 'LSX_Testimonials' ) ) {
238
+               $cmb->add_field(
239
+                    array(
240
+                         'name'         => esc_html__( 'Testimonials related to this project:', 'lsx-projects' ),
241
+                         'id'           => 'testimonial_to_project',
242
+                         'type'         => 'post_search_ajax',
243
+                         'show_in_rest' => true,
244
+                         'limit'        => 15,
245
+                         'sortable'     => true,
246
+                         'query_args'   => array(
247
+                              'post_type'      => array( 'testimonials' ),
248
+                              'post_status'    => array( 'publish' ),
249
+                              'nopagin'        => true,
250
+                              'posts_per_page' => '50',
251
+                              'orderby'        => 'title',
252
+                              'order'          => 'ASC',
253
+                         ),
254
+                    )
255
+               );
256
+          }
257
+     }
258
+
259
+     /**
260
+      * Project Team Metaboxes.
261
+      */
262
+     public function projects_team_metaboxes() {
263
+          $prefix = 'lsx_project_';
264
+
265
+          $cmb = new_cmb2_box(
266
+               array(
267
+                    'id'           => $prefix . '_project',
268
+                    'object_types' => 'project',
269
+                    'context'      => 'normal',
270
+                    'priority'     => 'low',
271
+                    'show_names'   => true,
272
+               )
273
+          );
274
+
275
+          if ( class_exists( 'LSX_Team' ) ) {
276
+               $cmb->add_field(
277
+                    array(
278
+                         'name'         => esc_html__( 'Team members involved with this project:', 'lsx-projects' ),
279
+                         'id'           => 'team_to_project',
280
+                         'type'         => 'post_search_ajax',
281
+                         'show_in_rest' => true,
282
+                         'limit'        => 15,
283
+                         'sortable'     => true,
284
+                         'query_args'   => array(
285
+                              'post_type'      => array( 'team' ),
286
+                              'post_status'    => array( 'publish' ),
287
+                              'nopagin'        => true,
288
+                              'posts_per_page' => '50',
289
+                              'orderby'        => 'title',
290
+                              'order'          => 'ASC',
291
+                         ),
292
+                    )
293
+               );
294
+          }
295
+     }
296
+
297
+     /**
298
+      * Project Woocommerce Metaboxes.
299
+      */
300
+     public function projects_woocommerce_metaboxes() {
301
+          $prefix = 'lsx_project_';
302
+
303
+          $cmb = new_cmb2_box(
304
+               array(
305
+                    'id'           => $prefix . '_project',
306
+                    'object_types' => 'projects',
307
+                    'context'      => 'normal',
308
+                    'priority'     => 'low',
309
+                    'show_names'   => true,
310
+               )
311
+          );
312
+
313
+          if ( class_exists( 'woocommerce' ) ) {
314
+               $cmb->add_field(
315
+                    array(
316
+                         'name'         => esc_html__( 'Products used for this project:', 'lsx-projects' ),
317
+                         'id'           => 'product_to_project',
318
+                         'type'         => 'post_search_ajax',
319
+                         'show_in_rest' => true,
320
+                         'limit'        => 15,
321
+                         'sortable'     => true,
322
+                         'query_args'   => array(
323
+                              'post_type'      => array( 'product' ),
324
+                              'post_status'    => array( 'publish' ),
325
+                              'nopagin'        => true,
326
+                              'posts_per_page' => '50',
327
+                              'orderby'        => 'title',
328
+                              'order'          => 'ASC',
329
+                         ),
330
+                    )
331
+               );
332
+          }
333
+     }
334
+
335
+     /**
336
+      * Sets up the "post relations".
337
+      */
338
+     public function post_relations( $post_id, $field, $value ) {
339
+          $connections = array(
340
+               // 'project_to_project',
341
+
342
+               'page_to_project',
343
+               'project_to_page',
344
+
345
+               'project_to_service',
346
+               'service_to_project',
347
+
348
+               'project_to_testimonial',
349
+               'testimonial_to_project',
350
+
351
+               'project_to_team',
352
+               'team_to_project',
353
+          );
354
+
355
+          if ( in_array( $field['id'], $connections ) ) {
356
+               $this->save_related_post( $connections, $post_id, $field, $value );
357
+          }
358
+     }
359
+
360
+     /**
361
+      * Save the reverse post relation.
362
+      */
363
+     public function save_related_post( $connections, $post_id, $field, $value ) {
364
+          $ids = explode( '_to_', $field['id'] );
365
+          $relation = $ids[1] . '_to_' . $ids[0];
366
+
367
+          if ( in_array( $relation, $connections ) ) {
368
+               $previous_values = get_post_meta( $post_id, $field['id'], false );
369
+
370
+               if ( ! empty( $previous_values ) ) {
371
+                    foreach ( $previous_values as $v ) {
372
+                         delete_post_meta( $v, $relation, $post_id );
373
+                    }
374
+               }
375
+
376
+               if ( is_array( $value ) ) {
377
+                    foreach ( $value as $v ) {
378
+                         if ( ! empty( $v ) ) {
379
+                              add_post_meta( $v, $relation, $post_id );
380
+                         }
381
+                    }
382
+               }
383
+          }
384
+     }
385
+
386
+     public function assets() {
387
+          //wp_enqueue_media();
388
+          wp_enqueue_script( 'media-upload' );
389
+          wp_enqueue_script( 'thickbox' );
390
+          wp_enqueue_style( 'thickbox' );
391
+
392
+          wp_enqueue_script( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/js/lsx-projects-admin.min.js', array( 'jquery' ), LSX_PROJECTS_VER, true );
393
+          wp_enqueue_style( 'lsx-projects-admin', LSX_PROJECTS_URL . 'assets/css/lsx-projects-admin.css', array(), LSX_PROJECTS_VER );
394
+     }
395
+
396
+     /**
397
+      * Change the "Insert into Post" button text when media modal is used for feature images
398
+      */
399
+     public function change_attachment_field_button( $html ) {
400
+          if ( isset( $_GET['feature_image_text_button'] ) ) {
401
+               $html = str_replace( 'value="Insert into Post"', sprintf( 'value="%s"', esc_html__( 'Select featured image', 'lsx-projects' ) ), $html );
402
+          }
403
+
404
+          return $html;
405
+     }
406
+
407
+     public function change_title_text( $title ) {
408
+          $screen = get_current_screen();
409
+
410
+          if ( 'project' === $screen->post_type ) {
411
+               $title = esc_attr__( 'Enter project title', 'lsx-projects' );
412
+          }
413
+
414
+          return $title;
415
+     }
416 416
 }
417 417
 
418 418
 $lsx_projects_admin = new LSX_Projects_Admin();
Please login to merge, or discard this patch.
includes/functions.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@  discard block
 block discarded – undo
13 13
  * Add our action to init to set up our vars first.
14 14
  */
15 15
 function lsx_projects_load_plugin_textdomain() {
16
-	load_plugin_textdomain( 'lsx-projects', false, basename( LSX_PROJECTS_PATH ) . '/languages' );
16
+	load_plugin_textdomain('lsx-projects', false, basename(LSX_PROJECTS_PATH) . '/languages');
17 17
 }
18
-add_action( 'init', 'lsx_projects_load_plugin_textdomain' );
18
+add_action('init', 'lsx_projects_load_plugin_textdomain');
19 19
 
20 20
 /**
21 21
  * Wraps the output class in a function to be called in templates
22 22
  */
23
-function lsx_projects( $args ) {
23
+function lsx_projects($args) {
24 24
 	$lsx_projects = new LSX_Projects;
25
-	echo wp_kses_post( $lsx_projects->output( $args ) );
25
+	echo wp_kses_post($lsx_projects->output($args));
26 26
 }
27 27
 
28 28
 /**
29 29
  * Shortcode
30 30
  */
31
-function lsx_projects_shortcode( $atts ) {
31
+function lsx_projects_shortcode($atts) {
32 32
 	$lsx_projects = new LSX_Projects;
33
-	return $lsx_projects->output( $atts );
33
+	return $lsx_projects->output($atts);
34 34
 }
35
-add_shortcode( 'lsx_projects', 'lsx_projects_shortcode' );
35
+add_shortcode('lsx_projects', 'lsx_projects_shortcode');
36 36
 
37 37
 /**
38 38
  * Wraps the output class in a function to be called in templates
39 39
  */
40 40
 function lsx_groups_list() {
41
-	do_action( 'lsx_groups_list' );
41
+	do_action('lsx_groups_list');
42 42
 }
43 43
 
44 44
 function lsx_child_group_list() {
45
-	do_action( 'lsx_child_group_list' );
45
+	do_action('lsx_child_group_list');
46 46
 }
47 47
 
48 48
 function lsx_projects_list() {
49
-	do_action( 'lsx_projects_list' );
49
+	do_action('lsx_projects_list');
50 50
 }
51 51
 
52 52
 function lsx_projects_sidebar() {
53
-	do_action( 'lsx_projects_sidebar' );
53
+	do_action('lsx_projects_sidebar');
54 54
 }
55 55
 
56 56
 function lsx_projects_single_tag() {
57
-	do_action( 'lsx_projects_single_tag' );
57
+	do_action('lsx_projects_single_tag');
58 58
 }
59 59
 
60 60
 /**
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function projects_get_options() {
68 68
 	$options = array();
69
-	if ( function_exists( 'tour_operator' ) ) {
70
-		$options = get_option( '_lsx-to_settings', false );
69
+	if (function_exists('tour_operator')) {
70
+		$options = get_option('_lsx-to_settings', false);
71 71
 	} else {
72
-		$options = get_option( '_lsx_settings', false );
72
+		$options = get_option('_lsx_settings', false);
73 73
 
74
-		if ( false === $options ) {
75
-			$options = get_option( '_lsx_lsx-settings', false );
74
+		if (false === $options) {
75
+			$options = get_option('_lsx_lsx-settings', false);
76 76
 		}
77 77
 	}
78 78
 
79 79
 	// If there are new CMB2 options available, then use those.
80
-	$new_options = get_option( 'lsx_projects_options', false );
81
-	if ( false !== $new_options ) {
80
+	$new_options = get_option('lsx_projects_options', false);
81
+	if (false !== $new_options) {
82 82
 		$options['display'] = $new_options;
83 83
 	}
84 84
 	return $options;
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
  * @param  mixed  $default Optional default value
92 92
  * @return mixed           Option value
93 93
  */
94
-function projects_get_option( $key = '', $default = false ) {
94
+function projects_get_option($key = '', $default = false) {
95 95
 	$options = array();
96 96
 	$value   = $default;
97
-	if ( function_exists( 'tour_operator' ) ) {
98
-		$options = get_option( '_lsx-to_settings', false );
97
+	if (function_exists('tour_operator')) {
98
+		$options = get_option('_lsx-to_settings', false);
99 99
 	} else {
100
-		$options = get_option( '_lsx_settings', false );
100
+		$options = get_option('_lsx_settings', false);
101 101
 
102
-		if ( false === $options ) {
103
-			$options = get_option( '_lsx_lsx-settings', false );
102
+		if (false === $options) {
103
+			$options = get_option('_lsx_lsx-settings', false);
104 104
 		}
105 105
 	}
106 106
 
107 107
 	// If there are new CMB2 options available, then use those.
108
-	$new_options = get_option( 'lsx_projects_options', false );
109
-	if ( false !== $new_options ) {
108
+	$new_options = get_option('lsx_projects_options', false);
109
+	if (false !== $new_options) {
110 110
 		$options['display'] = $new_options;
111 111
 	}
112 112
 
113
-	if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) {
114
-		$value = $options['display'][ $key ];
113
+	if (isset($options['display']) && isset($options['display'][$key])) {
114
+		$value = $options['display'][$key];
115 115
 	}
116 116
 	return $value;
117 117
 }
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * Add our action to init to set up our vars first.
14 14
  */
15 15
 function lsx_projects_load_plugin_textdomain() {
16
-	load_plugin_textdomain( 'lsx-projects', false, basename( LSX_PROJECTS_PATH ) . '/languages' );
16
+     load_plugin_textdomain( 'lsx-projects', false, basename( LSX_PROJECTS_PATH ) . '/languages' );
17 17
 }
18 18
 add_action( 'init', 'lsx_projects_load_plugin_textdomain' );
19 19
 
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
  * Wraps the output class in a function to be called in templates
22 22
  */
23 23
 function lsx_projects( $args ) {
24
-	$lsx_projects = new LSX_Projects;
25
-	echo wp_kses_post( $lsx_projects->output( $args ) );
24
+     $lsx_projects = new LSX_Projects;
25
+     echo wp_kses_post( $lsx_projects->output( $args ) );
26 26
 }
27 27
 
28 28
 /**
29 29
  * Shortcode
30 30
  */
31 31
 function lsx_projects_shortcode( $atts ) {
32
-	$lsx_projects = new LSX_Projects;
33
-	return $lsx_projects->output( $atts );
32
+     $lsx_projects = new LSX_Projects;
33
+     return $lsx_projects->output( $atts );
34 34
 }
35 35
 add_shortcode( 'lsx_projects', 'lsx_projects_shortcode' );
36 36
 
@@ -38,23 +38,23 @@  discard block
 block discarded – undo
38 38
  * Wraps the output class in a function to be called in templates
39 39
  */
40 40
 function lsx_groups_list() {
41
-	do_action( 'lsx_groups_list' );
41
+     do_action( 'lsx_groups_list' );
42 42
 }
43 43
 
44 44
 function lsx_child_group_list() {
45
-	do_action( 'lsx_child_group_list' );
45
+     do_action( 'lsx_child_group_list' );
46 46
 }
47 47
 
48 48
 function lsx_projects_list() {
49
-	do_action( 'lsx_projects_list' );
49
+     do_action( 'lsx_projects_list' );
50 50
 }
51 51
 
52 52
 function lsx_projects_sidebar() {
53
-	do_action( 'lsx_projects_sidebar' );
53
+     do_action( 'lsx_projects_sidebar' );
54 54
 }
55 55
 
56 56
 function lsx_projects_single_tag() {
57
-	do_action( 'lsx_projects_single_tag' );
57
+     do_action( 'lsx_projects_single_tag' );
58 58
 }
59 59
 
60 60
 /**
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
  * @return mixed           Option value
66 66
  */
67 67
 function projects_get_options() {
68
-	$options = array();
69
-	if ( function_exists( 'tour_operator' ) ) {
70
-		$options = get_option( '_lsx-to_settings', false );
71
-	} else {
72
-		$options = get_option( '_lsx_settings', false );
68
+     $options = array();
69
+     if ( function_exists( 'tour_operator' ) ) {
70
+          $options = get_option( '_lsx-to_settings', false );
71
+     } else {
72
+          $options = get_option( '_lsx_settings', false );
73 73
 
74
-		if ( false === $options ) {
75
-			$options = get_option( '_lsx_lsx-settings', false );
76
-		}
77
-	}
74
+          if ( false === $options ) {
75
+               $options = get_option( '_lsx_lsx-settings', false );
76
+          }
77
+     }
78 78
 
79
-	// If there are new CMB2 options available, then use those.
80
-	$new_options = get_option( 'lsx_projects_options', false );
81
-	if ( false !== $new_options ) {
82
-		$options['display'] = $new_options;
83
-	}
84
-	return $options;
79
+     // If there are new CMB2 options available, then use those.
80
+     $new_options = get_option( 'lsx_projects_options', false );
81
+     if ( false !== $new_options ) {
82
+          $options['display'] = $new_options;
83
+     }
84
+     return $options;
85 85
 }
86 86
 
87 87
 /**
@@ -92,26 +92,26 @@  discard block
 block discarded – undo
92 92
  * @return mixed           Option value
93 93
  */
94 94
 function projects_get_option( $key = '', $default = false ) {
95
-	$options = array();
96
-	$value   = $default;
97
-	if ( function_exists( 'tour_operator' ) ) {
98
-		$options = get_option( '_lsx-to_settings', false );
99
-	} else {
100
-		$options = get_option( '_lsx_settings', false );
95
+     $options = array();
96
+     $value   = $default;
97
+     if ( function_exists( 'tour_operator' ) ) {
98
+          $options = get_option( '_lsx-to_settings', false );
99
+     } else {
100
+          $options = get_option( '_lsx_settings', false );
101 101
 
102
-		if ( false === $options ) {
103
-			$options = get_option( '_lsx_lsx-settings', false );
104
-		}
105
-	}
102
+          if ( false === $options ) {
103
+               $options = get_option( '_lsx_lsx-settings', false );
104
+          }
105
+     }
106 106
 
107
-	// If there are new CMB2 options available, then use those.
108
-	$new_options = get_option( 'lsx_projects_options', false );
109
-	if ( false !== $new_options ) {
110
-		$options['display'] = $new_options;
111
-	}
107
+     // If there are new CMB2 options available, then use those.
108
+     $new_options = get_option( 'lsx_projects_options', false );
109
+     if ( false !== $new_options ) {
110
+          $options['display'] = $new_options;
111
+     }
112 112
 
113
-	if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) {
114
-		$value = $options['display'][ $key ];
115
-	}
116
-	return $value;
113
+     if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) {
114
+          $value = $options['display'][ $key ];
115
+     }
116
+     return $value;
117 117
 }
Please login to merge, or discard this patch.
templates/content-archive-projects.php 3 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,53 +9,53 @@
 block discarded – undo
9 9
 
10 10
 	$groups = '';
11 11
 	$groups_class = '';
12
-	$terms = get_the_terms( get_the_ID(), 'project-group' );
12
+	$terms = get_the_terms(get_the_ID(), 'project-group');
13 13
 
14
-	if ( $terms && ! is_wp_error( $terms ) ) {
14
+	if ($terms && ! is_wp_error($terms)) {
15 15
 		$groups = array();
16 16
 		$groups_class = array();
17 17
 
18
-		foreach ( $terms as $term ) {
19
-			$groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
18
+		foreach ($terms as $term) {
19
+			$groups[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>';
20 20
 			$groups_class[] = 'filter-' . $term->slug;
21 21
 		}
22 22
 
23
-		$groups = join( ', ', $groups );
24
-		$groups_class = join( ' ', $groups_class );
23
+		$groups = join(', ', $groups);
24
+		$groups_class = join(' ', $groups_class);
25 25
 	}
26 26
 ?>
27 27
 
28
-<div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr( $groups_class ); ?>">
28
+<div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr($groups_class); ?>">
29 29
 	<article class="lsx-projects-slot">
30
-		<?php if ( ! empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) : ?>
31
-			<?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?>
32
-				<a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure></a>
30
+		<?php if ( ! empty(lsx_get_thumbnail('lsx-thumbnail-single'))) : ?>
31
+			<?php if ( ! isset($lsx_projects_frontend->options['display']) || ! isset($lsx_projects_frontend->options['display']['team_disable_single'])) : ?>
32
+				<a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail('lsx-thumbnail-single'); ?></figure></a>
33 33
 			<?php else : ?>
34
-				<figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure>
34
+				<figure class="lsx-projects-avatar"><?php lsx_thumbnail('lsx-thumbnail-single'); ?></figure>
35 35
 			<?php endif; ?>
36 36
 		<?php endif; ?>
37 37
 
38 38
 		<?php
39
-		if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) {
40
-			if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) {
41
-				echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' );
39
+		if (empty(lsx_get_thumbnail('lsx-thumbnail-single'))) {
40
+			if ( ! empty(projects_get_option('projects_placeholder'))) {
41
+				echo wp_kses_post('<img src="' . projects_get_option('projects_placeholder') . '" width="auto" alt="placeholder" />');
42 42
 			}
43 43
 		}
44 44
 		?>
45 45
 
46 46
 		<h5 class="lsx-projects-title">
47
-			<?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?>
47
+			<?php if ( ! isset($lsx_projects_frontend->options['display']) || ! isset($lsx_projects_frontend->options['display']['team_disable_single'])) : ?>
48 48
 				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
49 49
 			<?php else : ?>
50 50
 				<?php the_title(); ?>
51 51
 			<?php endif; ?>
52 52
 		</h5>
53 53
 
54
-		<?php if ( ! empty( $groups ) ) : ?>
55
-			<p class="lsx-projects-groups"><?php echo wp_kses_post( $groups ); ?></p>
54
+		<?php if ( ! empty($groups)) : ?>
55
+			<p class="lsx-projects-groups"><?php echo wp_kses_post($groups); ?></p>
56 56
 		<?php endif; ?>
57 57
 
58 58
 		<!--<div class="lsx-projects-content"><?php the_excerpt(); ?></div>-->
59
-		<div class="lsx-projects-content"><a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-projects' ); ?></a></div>
59
+		<div class="lsx-projects-content"><a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e('View more', 'lsx-projects'); ?></a></div>
60 60
 	</article>
61 61
 </div>
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 
7 7
 <?php
8
-	global $lsx_projects_frontend;
8
+     global $lsx_projects_frontend;
9 9
 
10
-	$groups = '';
11
-	$groups_class = '';
12
-	$terms = get_the_terms( get_the_ID(), 'project-group' );
10
+     $groups = '';
11
+     $groups_class = '';
12
+     $terms = get_the_terms( get_the_ID(), 'project-group' );
13 13
 
14
-	if ( $terms && ! is_wp_error( $terms ) ) {
15
-		$groups = array();
16
-		$groups_class = array();
14
+     if ( $terms && ! is_wp_error( $terms ) ) {
15
+          $groups = array();
16
+          $groups_class = array();
17 17
 
18
-		foreach ( $terms as $term ) {
19
-			$groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
20
-			$groups_class[] = 'filter-' . $term->slug;
21
-		}
18
+          foreach ( $terms as $term ) {
19
+               $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
20
+               $groups_class[] = 'filter-' . $term->slug;
21
+          }
22 22
 
23
-		$groups = join( ', ', $groups );
24
-		$groups_class = join( ' ', $groups_class );
25
-	}
23
+          $groups = join( ', ', $groups );
24
+          $groups_class = join( ' ', $groups_class );
25
+     }
26 26
 ?>
27 27
 
28 28
 <div class="col-xs-12 col-sm-6 col-md-4 lsx-projects-column <?php echo esc_attr( $groups_class ); ?>">
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 		<?php endif; ?>
37 37
 
38 38
 		<?php
39
-		if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) {
40
-			if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) {
41
-				echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' );
42
-			}
43
-		}
44
-		?>
39
+          if ( empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) {
40
+               if ( ! empty( projects_get_option( 'projects_placeholder' ) ) ) {
41
+                    echo wp_kses_post( '<img src="' . projects_get_option( 'projects_placeholder' ) . '" width="auto" alt="placeholder" />' );
42
+               }
43
+          }
44
+          ?>
45 45
 
46 46
 		<h5 class="lsx-projects-title">
47 47
 			<?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,11 @@  discard block
 block discarded – undo
30 30
 		<?php if ( ! empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) : ?>
31 31
 			<?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?>
32 32
 				<a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure></a>
33
-			<?php else : ?>
34
-				<figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure>
33
+			<?php else {
34
+     : ?>
35
+				<figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' );
36
+}
37
+?></figure>
35 38
 			<?php endif; ?>
36 39
 		<?php endif; ?>
37 40
 
@@ -46,8 +49,11 @@  discard block
 block discarded – undo
46 49
 		<h5 class="lsx-projects-title">
47 50
 			<?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?>
48 51
 				<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
49
-			<?php else : ?>
50
-				<?php the_title(); ?>
52
+			<?php else {
53
+     : ?>
54
+				<?php the_title();
55
+}
56
+?>
51 57
 			<?php endif; ?>
52 58
 		</h5>
53 59
 
Please login to merge, or discard this patch.
templates/content-single-projects.php 2 patches
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -5,41 +5,41 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 
7 7
 <?php
8
-	$client = get_post_meta( get_the_ID(), 'lsx_project_client', true );
9
-	$client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true );
10
-	$url = get_post_meta( get_the_ID(), 'lsx_project_url', true );
8
+	$client = get_post_meta(get_the_ID(), 'lsx_project_client', true);
9
+	$client_logo = get_post_meta(get_the_ID(), 'lsx_project_client_logo', true);
10
+	$url = get_post_meta(get_the_ID(), 'lsx_project_url', true);
11 11
 
12 12
 	global $lsx_projects;
13 13
 
14 14
 	$button_label = '';
15 15
 	$button_cf_id = '';
16 16
 
17
-	if ( ! empty( projects_get_option( 'projects_modal_enable' ) ) ) {
18
-		if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) {
19
-			$button_label = projects_get_option( 'projects_modal_cta_label' );
20
-			$button_cf_id = projects_get_option( 'projects_modal_form_id' );
17
+	if ( ! empty(projects_get_option('projects_modal_enable'))) {
18
+		if ( ! empty(projects_get_option('projects_modal_cta_label')) && ! empty(projects_get_option('projects_modal_form_id'))) {
19
+			$button_label = projects_get_option('projects_modal_cta_label');
20
+			$button_cf_id = projects_get_option('projects_modal_form_id');
21 21
 		}
22 22
 	}
23 23
 
24
-	if ( ! empty( $client_logo ) ) {
25
-		$client_logo = wp_get_attachment_image_src( $client_logo, 'full' );
24
+	if ( ! empty($client_logo)) {
25
+		$client_logo = wp_get_attachment_image_src($client_logo, 'full');
26 26
 
27
-		if ( is_array( $client_logo ) ) {
27
+		if (is_array($client_logo)) {
28 28
 			$client_logo = '<img src="' . $client_logo[0] . '">';
29 29
 		}
30 30
 	}
31 31
 
32 32
 	$groups = '';
33
-	$terms = get_the_terms( get_the_ID(), 'project-group' );
33
+	$terms = get_the_terms(get_the_ID(), 'project-group');
34 34
 
35
-	if ( $terms && ! is_wp_error( $terms ) ) {
35
+	if ($terms && ! is_wp_error($terms)) {
36 36
 		$groups = array();
37 37
 
38
-		foreach ( $terms as $term ) {
39
-			$groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
38
+		foreach ($terms as $term) {
39
+			$groups[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>';
40 40
 		}
41 41
 
42
-		$groups = join( ', ', $groups );
42
+		$groups = join(', ', $groups);
43 43
 	}
44 44
 
45 45
 	// Connections
@@ -48,22 +48,22 @@  discard block
 block discarded – undo
48 48
 
49 49
 	// Connection Projects
50 50
 
51
-	if ( $terms && ! is_wp_error( $terms ) ) {
51
+	if ($terms && ! is_wp_error($terms)) {
52 52
 		$groups_ = array();
53 53
 
54
-		foreach ( $terms as $term ) {
54
+		foreach ($terms as $term) {
55 55
 			$groups_[] = $term->term_id;
56 56
 		}
57 57
 
58
-		if ( count( $groups_ ) > 0 ) {
58
+		if (count($groups_) > 0) {
59 59
 			$connection_project['post_type'] = 'project';
60
-			$connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' );
60
+			$connection_project['title'] = esc_html__('Related Projects', 'lsx-projects');
61 61
 			//$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false );
62 62
 			$connection_project['posts'] = array();
63 63
 
64 64
 			$args = array(
65 65
 				'post_type'              => 'project',
66
-				'post__not_in'           => array( get_the_ID() ),
66
+				'post__not_in'           => array(get_the_ID()),
67 67
 				'no_found_rows'          => true,
68 68
 				'ignore_sticky_posts'    => 1,
69 69
 				'update_post_meta_cache' => false,
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 				),
76 76
 			);
77 77
 
78
-			$projects_ = new \WP_Query( $args );
78
+			$projects_ = new \WP_Query($args);
79 79
 
80
-			if ( $projects_->have_posts() ) {
81
-				while ( $projects_->have_posts() ) {
80
+			if ($projects_->have_posts()) {
81
+				while ($projects_->have_posts()) {
82 82
 					$projects_->the_post();
83 83
 					$connection_project['posts'][] = get_the_ID();
84 84
 					wp_reset_postdata();
85 85
 				}
86 86
 			}
87 87
 
88
-			if ( ! empty( $connection_project['posts'] ) ) {
89
-				$post_ids = join( ',', $connection_project['posts'] );
88
+			if ( ! empty($connection_project['posts'])) {
89
+				$post_ids = join(',', $connection_project['posts']);
90 90
 				$connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]';
91 91
 				$connections[] = $connection_project;
92 92
 			}
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 
96 96
 	// Connection Products
97 97
 
98
-	if ( class_exists( 'WooCommerce' ) ) {
98
+	if (class_exists('WooCommerce')) {
99 99
 		$connection_product['post_type'] = 'product';
100
-		$connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>';
101
-		$connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false );
100
+		$connection_product['title'] = esc_html__('Related Products', 'lsx-projects') . ' <small>' . esc_html__('Products used to build this project', 'lsx-projects') . '</small>';
101
+		$connection_product['posts'] = get_post_meta(get_the_ID(), 'product_to_project', false);
102 102
 
103
-		if ( ! empty( $connection_product['posts'] ) ) {
103
+		if ( ! empty($connection_product['posts'])) {
104 104
 			$connection_product['small_list_html'] = '';
105 105
 
106 106
 			$args = array(
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
 				'update_post_meta_cache' => false,
114 114
 			);
115 115
 
116
-			$connection_product['posts_obj'] = new \WP_Query( $args );
116
+			$connection_product['posts_obj'] = new \WP_Query($args);
117 117
 
118
-			if ( $connection_product['posts_obj']->have_posts() ) {
118
+			if ($connection_product['posts_obj']->have_posts()) {
119 119
 				$connection_product['small_list_html'] = array();
120 120
 
121
-				while ( $connection_product['posts_obj']->have_posts() ) {
121
+				while ($connection_product['posts_obj']->have_posts()) {
122 122
 					$connection_product['posts_obj']->the_post();
123
-					$connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
123
+					$connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title('', '', false) . '</a>';
124 124
 					wp_reset_postdata();
125 125
 				}
126 126
 
127 127
 				$connection_product['posts_obj']->rewind_posts();
128
-				$connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] );
128
+				$connection_product['small_list_html'] = join(', ', $connection_product['small_list_html']);
129 129
 			}
130 130
 
131 131
 			$connections[] = $connection_product;
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
 
137 137
 	$connection_service['post_type'] = 'page';
138 138
 	// $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' );
139
-	$connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false );
139
+	$connection_service['pages'] = get_post_meta(get_the_ID(), 'page_to_project', false);
140 140
 
141
-	if ( ! empty( $connection_service['pages'] ) ) {
142
-		$post_ids = join( ',', $connection_service['pages'] );
141
+	if ( ! empty($connection_service['pages'])) {
142
+		$post_ids = join(',', $connection_service['pages']);
143 143
 		//$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]';
144 144
 		$connection_service['small_list_html'] = '';
145 145
 
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 			'update_post_meta_cache' => false,
154 154
 		);
155 155
 
156
-		$services_ = new \WP_Query( $args );
156
+		$services_ = new \WP_Query($args);
157 157
 
158
-		if ( $services_->have_posts() ) {
158
+		if ($services_->have_posts()) {
159 159
 			$connection_service['small_list_html'] = array();
160 160
 
161
-			while ( $services_->have_posts() ) {
161
+			while ($services_->have_posts()) {
162 162
 				$services_->the_post();
163
-				$connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
163
+				$connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title('', '', false) . '</a>';
164 164
 				wp_reset_postdata();
165 165
 			}
166 166
 
167
-			$connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] );
167
+			$connection_service['small_list_html'] = join(', ', $connection_service['small_list_html']);
168 168
 		}
169 169
 
170 170
 		$connections[] = $connection_service;
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 
175 175
 	$connection_testimonial['post_type'] = 'testimonial';
176 176
 	// $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' );
177
-	$connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false );
177
+	$connection_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_project', false);
178 178
 
179
-	if ( ! empty( $connection_testimonial['posts'] ) ) {
180
-		$post_ids = join( ',', $connection_testimonial['posts'] );
179
+	if ( ! empty($connection_testimonial['posts'])) {
180
+		$post_ids = join(',', $connection_testimonial['posts']);
181 181
 		$connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]';
182 182
 		$connections[] = $connection_testimonial;
183 183
 	}
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 
187 187
 	$connection_team['post_type'] = 'team';
188 188
 	// $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' );
189
-	$connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false );
189
+	$connection_team['posts'] = get_post_meta(get_the_ID(), 'team_to_project', false);
190 190
 
191
-	if ( ! empty( $connection_team['posts'] ) ) {
192
-		$post_ids = join( ',', $connection_team['posts'] );
191
+	if ( ! empty($connection_team['posts'])) {
192
+		$post_ids = join(',', $connection_team['posts']);
193 193
 		$connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]';
194 194
 		$connection_team['small_list_html'] = '';
195 195
 
@@ -203,19 +203,19 @@  discard block
 block discarded – undo
203 203
 			'update_post_meta_cache' => false,
204 204
 		);
205 205
 
206
-		$team_ = new \WP_Query( $args );
206
+		$team_ = new \WP_Query($args);
207 207
 
208
-		if ( $team_->have_posts() ) {
208
+		if ($team_->have_posts()) {
209 209
 			global $lsx_team;
210 210
 			$connection_team['small_list_html'] = array();
211 211
 
212
-			while ( $team_->have_posts() ) {
212
+			while ($team_->have_posts()) {
213 213
 				$team_->the_post();
214
-				$connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>';
214
+				$connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail(get_the_ID(), 'lsx-team-archive') . '</a>';
215 215
 				wp_reset_postdata();
216 216
 			}
217 217
 
218
-			$connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] );
218
+			$connection_team['small_list_html'] = join(' ', $connection_team['small_list_html']);
219 219
 		}
220 220
 
221 221
 		$connections[] = $connection_team;
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 		<div class="col-xs-12 col-sm-7 col-md-8">
233 233
 			<div class="entry-content"><?php the_content(); ?></div>
234 234
 
235
-			<?php if ( count( $connections ) > 0 ) : ?>
236
-				<?php foreach ( $connections as $i => $connection ) : ?>
235
+			<?php if (count($connections) > 0) : ?>
236
+				<?php foreach ($connections as $i => $connection) : ?>
237 237
 					<?php
238
-						if ( 'testimonial' === $connection['post_type'] ) {
238
+						if ('testimonial' === $connection['post_type']) {
239 239
 							echo '<div class="tab-pane-fake">';
240
-							echo do_shortcode( $connection['shortcode'] );
240
+							echo do_shortcode($connection['shortcode']);
241 241
 							echo '</div>';
242 242
 						}
243 243
 					?>
@@ -248,83 +248,83 @@  discard block
 block discarded – undo
248 248
 		<div class="col-xs-12 col-sm-5 col-md-4">
249 249
 			<div class="entry-fixed-sidebar-wrapper">
250 250
 				<div class="entry-fixed-sidebar">
251
-					<?php if ( ! empty( $client_logo ) ) : ?>
252
-						<div class="entry-meta-single"><?php echo wp_kses_post( $client_logo ); ?></div>
253
-					<?php elseif ( ! empty( $client ) ) : ?>
254
-						<div class="entry-meta-single"><?php echo esc_html( $client ); ?></div>
251
+					<?php if ( ! empty($client_logo)) : ?>
252
+						<div class="entry-meta-single"><?php echo wp_kses_post($client_logo); ?></div>
253
+					<?php elseif ( ! empty($client)) : ?>
254
+						<div class="entry-meta-single"><?php echo esc_html($client); ?></div>
255 255
 					<?php endif; ?>
256 256
 
257
-					<?php if ( ! empty( $groups ) ) : ?>
258
-						<div class="entry-meta-key"><?php esc_html_e( 'Industry:', 'lsx-projects' ); ?></div>
259
-						<div class="entry-meta-value"><?php echo wp_kses_post( $groups ); ?></div>
257
+					<?php if ( ! empty($groups)) : ?>
258
+						<div class="entry-meta-key"><?php esc_html_e('Industry:', 'lsx-projects'); ?></div>
259
+						<div class="entry-meta-value"><?php echo wp_kses_post($groups); ?></div>
260 260
 					<?php endif; ?>
261 261
 
262
-					<?php if ( ! empty( $connection_service['small_list_html'] ) ) : ?>
263
-						<div class="entry-meta-key"><?php esc_html_e( 'Services:', 'lsx-projects' ); ?></div>
264
-						<div class="entry-meta-value"><?php echo wp_kses_post( $connection_service['small_list_html'] ); ?></div>
262
+					<?php if ( ! empty($connection_service['small_list_html'])) : ?>
263
+						<div class="entry-meta-key"><?php esc_html_e('Services:', 'lsx-projects'); ?></div>
264
+						<div class="entry-meta-value"><?php echo wp_kses_post($connection_service['small_list_html']); ?></div>
265 265
 					<?php endif; ?>
266 266
 
267
-					<?php if ( ! empty( $connection_product['small_list_html'] ) ) : ?>
267
+					<?php if ( ! empty($connection_product['small_list_html'])) : ?>
268 268
 						<!--
269
-						<div class="entry-meta-key"><?php esc_html_e( 'Products used:', 'lsx-projects' ); ?></div>
270
-						<div class="entry-meta-value"><?php echo wp_kses_post( $connection_product['small_list_html'] ); ?></div>
269
+						<div class="entry-meta-key"><?php esc_html_e('Products used:', 'lsx-projects'); ?></div>
270
+						<div class="entry-meta-value"><?php echo wp_kses_post($connection_product['small_list_html']); ?></div>
271 271
 						-->
272 272
 					<?php endif; ?>
273 273
 
274
-					<?php if ( ! empty( $connection_team['small_list_html'] ) ) : ?>
275
-						<div class="entry-meta-key"><?php esc_html_e( 'Team members involved:', 'lsx-projects' ); ?></div>
276
-						<div class="entry-meta-value entry-meta-value-team"><?php echo wp_kses_post( $connection_team['small_list_html'] ); ?></div>
274
+					<?php if ( ! empty($connection_team['small_list_html'])) : ?>
275
+						<div class="entry-meta-key"><?php esc_html_e('Team members involved:', 'lsx-projects'); ?></div>
276
+						<div class="entry-meta-value entry-meta-value-team"><?php echo wp_kses_post($connection_team['small_list_html']); ?></div>
277 277
 					<?php endif; ?>
278 278
 
279
-					<?php if ( ! empty( $url ) ) : ?>
280
-						<div class="entry-meta-single"><a href="<?php echo esc_url( $url ); ?>" target="_blank" rel="nofollow" class="btn btn-block secondary-btn"><?php esc_html_e( 'See website', 'lsx-projects' ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div>
279
+					<?php if ( ! empty($url)) : ?>
280
+						<div class="entry-meta-single"><a href="<?php echo esc_url($url); ?>" target="_blank" rel="nofollow" class="btn btn-block secondary-btn"><?php esc_html_e('See website', 'lsx-projects'); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div>
281 281
 					<?php endif; ?>
282 282
 
283
-					<?php if ( ! empty( $button_label ) ) : ?>
284
-						<div class="entry-meta-single"><a href="#lsx-project-contact" data-toggle="modal" class="btn btn-block cta-btn"><?php echo esc_html( $button_label ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div>
283
+					<?php if ( ! empty($button_label)) : ?>
284
+						<div class="entry-meta-single"><a href="#lsx-project-contact" data-toggle="modal" class="btn btn-block cta-btn"><?php echo esc_html($button_label); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></div>
285 285
 					<?php endif; ?>
286 286
 				</div>
287 287
 			</div>
288 288
 		</div>
289 289
 	</div>
290 290
 
291
-	<?php if ( count( $connections ) > 0 ) : ?>
292
-		<?php foreach ( $connections as $i => $connection ) : ?>
291
+	<?php if (count($connections) > 0) : ?>
292
+		<?php foreach ($connections as $i => $connection) : ?>
293 293
 			<?php
294 294
 				// Team is now visible on detail box
295 295
 				// Services is now visible on detail box
296 296
 				// Testimonials is now visible below the content
297
-				if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) {
297
+				if (in_array($connection['post_type'], array('team', 'testimonial', 'service'))) {
298 298
 					continue;
299 299
 				}
300 300
 			?>
301
-			<?php if ( 'page' !== $connection['post_type'] ) { ?>
301
+			<?php if ('page' !== $connection['post_type']) { ?>
302 302
 				<div class="lsx-projects-section lsx-full-width">
303 303
 					<div class="row">
304 304
 						<div class="col-xs-12">
305
-							<h3 class="lsx-title"><?php echo wp_kses_post( $connection['title'] ); ?></h3>
305
+							<h3 class="lsx-title"><?php echo wp_kses_post($connection['title']); ?></h3>
306 306
 
307 307
 							<?php
308
-								if ( 'product' === $connection['post_type'] ) {
309
-									if ( $connection_product['posts_obj']->have_posts() ) {
308
+								if ('product' === $connection['post_type']) {
309
+									if ($connection_product['posts_obj']->have_posts()) {
310 310
 										// @codingStandardsIgnoreLine
311
-										echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
311
+										echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
312 312
 
313
-										while ( $connection_product['posts_obj']->have_posts() ) {
313
+										while ($connection_product['posts_obj']->have_posts()) {
314 314
 											$connection_product['posts_obj']->the_post();
315 315
 
316
-											wc_get_template( 'content-widget-product.php', array(
316
+											wc_get_template('content-widget-product.php', array(
317 317
 												'show_rating' => false,
318
-											) );
318
+											));
319 319
 
320 320
 											wp_reset_postdata();
321 321
 										}
322 322
 
323 323
 										// @codingStandardsIgnoreLine
324
-										echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
324
+										echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
325 325
 									}
326 326
 								} else {
327
-									echo do_shortcode( $connection['shortcode'] );
327
+									echo do_shortcode($connection['shortcode']);
328 328
 								}
329 329
 							?>
330 330
 						</div>
Please login to merge, or discard this patch.
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -5,221 +5,221 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 
7 7
 <?php
8
-	$client = get_post_meta( get_the_ID(), 'lsx_project_client', true );
9
-	$client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true );
10
-	$url = get_post_meta( get_the_ID(), 'lsx_project_url', true );
11
-
12
-	global $lsx_projects;
13
-
14
-	$button_label = '';
15
-	$button_cf_id = '';
16
-
17
-	if ( ! empty( projects_get_option( 'projects_modal_enable' ) ) ) {
18
-		if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) {
19
-			$button_label = projects_get_option( 'projects_modal_cta_label' );
20
-			$button_cf_id = projects_get_option( 'projects_modal_form_id' );
21
-		}
22
-	}
23
-
24
-	if ( ! empty( $client_logo ) ) {
25
-		$client_logo = wp_get_attachment_image_src( $client_logo, 'full' );
26
-
27
-		if ( is_array( $client_logo ) ) {
28
-			$client_logo = '<img src="' . $client_logo[0] . '">';
29
-		}
30
-	}
31
-
32
-	$groups = '';
33
-	$terms = get_the_terms( get_the_ID(), 'project-group' );
34
-
35
-	if ( $terms && ! is_wp_error( $terms ) ) {
36
-		$groups = array();
37
-
38
-		foreach ( $terms as $term ) {
39
-			$groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
40
-		}
41
-
42
-		$groups = join( ', ', $groups );
43
-	}
44
-
45
-	// Connections
46
-
47
-	$connections = array();
48
-
49
-	// Connection Projects
50
-
51
-	if ( $terms && ! is_wp_error( $terms ) ) {
52
-		$groups_ = array();
53
-
54
-		foreach ( $terms as $term ) {
55
-			$groups_[] = $term->term_id;
56
-		}
57
-
58
-		if ( count( $groups_ ) > 0 ) {
59
-			$connection_project['post_type'] = 'project';
60
-			$connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' );
61
-			//$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false );
62
-			$connection_project['posts'] = array();
63
-
64
-			$args = array(
65
-				'post_type'              => 'project',
66
-				'post__not_in'           => array( get_the_ID() ),
67
-				'no_found_rows'          => true,
68
-				'ignore_sticky_posts'    => 1,
69
-				'update_post_meta_cache' => false,
70
-				'tax_query' => array(
71
-					array(
72
-						'taxonomy' => 'project-group',
73
-						'terms'    => $groups_,
74
-					),
75
-				),
76
-			);
77
-
78
-			$projects_ = new \WP_Query( $args );
79
-
80
-			if ( $projects_->have_posts() ) {
81
-				while ( $projects_->have_posts() ) {
82
-					$projects_->the_post();
83
-					$connection_project['posts'][] = get_the_ID();
84
-					wp_reset_postdata();
85
-				}
86
-			}
87
-
88
-			if ( ! empty( $connection_project['posts'] ) ) {
89
-				$post_ids = join( ',', $connection_project['posts'] );
90
-				$connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]';
91
-				$connections[] = $connection_project;
92
-			}
93
-		}
94
-	}
95
-
96
-	// Connection Products
97
-
98
-	if ( class_exists( 'WooCommerce' ) ) {
99
-		$connection_product['post_type'] = 'product';
100
-		$connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>';
101
-		$connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false );
102
-
103
-		if ( ! empty( $connection_product['posts'] ) ) {
104
-			$connection_product['small_list_html'] = '';
105
-
106
-			$args = array(
107
-				'post_type'              => 'product',
108
-				'post__in'               => $connection_product['posts'],
109
-				'orderby'                => 'post__in',
110
-				'no_found_rows'          => true,
111
-				'ignore_sticky_posts'    => 1,
112
-				'update_post_term_cache' => false,
113
-				'update_post_meta_cache' => false,
114
-			);
115
-
116
-			$connection_product['posts_obj'] = new \WP_Query( $args );
117
-
118
-			if ( $connection_product['posts_obj']->have_posts() ) {
119
-				$connection_product['small_list_html'] = array();
120
-
121
-				while ( $connection_product['posts_obj']->have_posts() ) {
122
-					$connection_product['posts_obj']->the_post();
123
-					$connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
124
-					wp_reset_postdata();
125
-				}
126
-
127
-				$connection_product['posts_obj']->rewind_posts();
128
-				$connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] );
129
-			}
130
-
131
-			$connections[] = $connection_product;
132
-		}
133
-	}
134
-
135
-	// Connection Services
136
-
137
-	$connection_service['post_type'] = 'page';
138
-	// $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' );
139
-	$connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false );
140
-
141
-	if ( ! empty( $connection_service['pages'] ) ) {
142
-		$post_ids = join( ',', $connection_service['pages'] );
143
-		//$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]';
144
-		$connection_service['small_list_html'] = '';
145
-
146
-		$args = array(
147
-			'post_type'              => 'page',
148
-			'post__in'               => $connection_service['pages'],
149
-			'orderby'                => 'post__in',
150
-			'no_found_rows'          => true,
151
-			'ignore_sticky_posts'    => 1,
152
-			'update_post_term_cache' => false,
153
-			'update_post_meta_cache' => false,
154
-		);
155
-
156
-		$services_ = new \WP_Query( $args );
157
-
158
-		if ( $services_->have_posts() ) {
159
-			$connection_service['small_list_html'] = array();
160
-
161
-			while ( $services_->have_posts() ) {
162
-				$services_->the_post();
163
-				$connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
164
-				wp_reset_postdata();
165
-			}
166
-
167
-			$connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] );
168
-		}
169
-
170
-		$connections[] = $connection_service;
171
-	}
172
-
173
-	// Connection Testimonials
174
-
175
-	$connection_testimonial['post_type'] = 'testimonial';
176
-	// $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' );
177
-	$connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false );
178
-
179
-	if ( ! empty( $connection_testimonial['posts'] ) ) {
180
-		$post_ids = join( ',', $connection_testimonial['posts'] );
181
-		$connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]';
182
-		$connections[] = $connection_testimonial;
183
-	}
184
-
185
-	// Connection Team
186
-
187
-	$connection_team['post_type'] = 'team';
188
-	// $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' );
189
-	$connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false );
190
-
191
-	if ( ! empty( $connection_team['posts'] ) ) {
192
-		$post_ids = join( ',', $connection_team['posts'] );
193
-		$connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]';
194
-		$connection_team['small_list_html'] = '';
195
-
196
-		$args = array(
197
-			'post_type'              => 'team',
198
-			'post__in'               => $connection_team['posts'],
199
-			'orderby'                => 'post__in',
200
-			'no_found_rows'          => true,
201
-			'ignore_sticky_posts'    => 1,
202
-			'update_post_term_cache' => false,
203
-			'update_post_meta_cache' => false,
204
-		);
205
-
206
-		$team_ = new \WP_Query( $args );
207
-
208
-		if ( $team_->have_posts() ) {
209
-			global $lsx_team;
210
-			$connection_team['small_list_html'] = array();
211
-
212
-			while ( $team_->have_posts() ) {
213
-				$team_->the_post();
214
-				$connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>';
215
-				wp_reset_postdata();
216
-			}
217
-
218
-			$connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] );
219
-		}
220
-
221
-		$connections[] = $connection_team;
222
-	}
8
+     $client = get_post_meta( get_the_ID(), 'lsx_project_client', true );
9
+     $client_logo = get_post_meta( get_the_ID(), 'lsx_project_client_logo', true );
10
+     $url = get_post_meta( get_the_ID(), 'lsx_project_url', true );
11
+
12
+     global $lsx_projects;
13
+
14
+     $button_label = '';
15
+     $button_cf_id = '';
16
+
17
+     if ( ! empty( projects_get_option( 'projects_modal_enable' ) ) ) {
18
+          if ( ! empty( projects_get_option( 'projects_modal_cta_label' ) ) && ! empty( projects_get_option( 'projects_modal_form_id' ) ) ) {
19
+               $button_label = projects_get_option( 'projects_modal_cta_label' );
20
+               $button_cf_id = projects_get_option( 'projects_modal_form_id' );
21
+          }
22
+     }
23
+
24
+     if ( ! empty( $client_logo ) ) {
25
+          $client_logo = wp_get_attachment_image_src( $client_logo, 'full' );
26
+
27
+          if ( is_array( $client_logo ) ) {
28
+               $client_logo = '<img src="' . $client_logo[0] . '">';
29
+          }
30
+     }
31
+
32
+     $groups = '';
33
+     $terms = get_the_terms( get_the_ID(), 'project-group' );
34
+
35
+     if ( $terms && ! is_wp_error( $terms ) ) {
36
+          $groups = array();
37
+
38
+          foreach ( $terms as $term ) {
39
+               $groups[] = '<a href="' . get_term_link( $term ) . '">' . $term->name . '</a>';
40
+          }
41
+
42
+          $groups = join( ', ', $groups );
43
+     }
44
+
45
+     // Connections
46
+
47
+     $connections = array();
48
+
49
+     // Connection Projects
50
+
51
+     if ( $terms && ! is_wp_error( $terms ) ) {
52
+          $groups_ = array();
53
+
54
+          foreach ( $terms as $term ) {
55
+               $groups_[] = $term->term_id;
56
+          }
57
+
58
+          if ( count( $groups_ ) > 0 ) {
59
+               $connection_project['post_type'] = 'project';
60
+               $connection_project['title'] = esc_html__( 'Related Projects', 'lsx-projects' );
61
+               //$connection_project['posts'] = get_post_meta( get_the_ID(), 'project_to_project', false );
62
+               $connection_project['posts'] = array();
63
+
64
+               $args = array(
65
+                    'post_type'              => 'project',
66
+                    'post__not_in'           => array( get_the_ID() ),
67
+                    'no_found_rows'          => true,
68
+                    'ignore_sticky_posts'    => 1,
69
+                    'update_post_meta_cache' => false,
70
+                    'tax_query' => array(
71
+                         array(
72
+                              'taxonomy' => 'project-group',
73
+                              'terms'    => $groups_,
74
+                         ),
75
+                    ),
76
+               );
77
+
78
+               $projects_ = new \WP_Query( $args );
79
+
80
+               if ( $projects_->have_posts() ) {
81
+                    while ( $projects_->have_posts() ) {
82
+                         $projects_->the_post();
83
+                         $connection_project['posts'][] = get_the_ID();
84
+                         wp_reset_postdata();
85
+                    }
86
+               }
87
+
88
+               if ( ! empty( $connection_project['posts'] ) ) {
89
+                    $post_ids = join( ',', $connection_project['posts'] );
90
+                    $connection_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]';
91
+                    $connections[] = $connection_project;
92
+               }
93
+          }
94
+     }
95
+
96
+     // Connection Products
97
+
98
+     if ( class_exists( 'WooCommerce' ) ) {
99
+          $connection_product['post_type'] = 'product';
100
+          $connection_product['title'] = esc_html__( 'Related Products', 'lsx-projects' ) . ' <small>' . esc_html__( 'Products used to build this project', 'lsx-projects' ) . '</small>';
101
+          $connection_product['posts'] = get_post_meta( get_the_ID(), 'product_to_project', false );
102
+
103
+          if ( ! empty( $connection_product['posts'] ) ) {
104
+               $connection_product['small_list_html'] = '';
105
+
106
+               $args = array(
107
+                    'post_type'              => 'product',
108
+                    'post__in'               => $connection_product['posts'],
109
+                    'orderby'                => 'post__in',
110
+                    'no_found_rows'          => true,
111
+                    'ignore_sticky_posts'    => 1,
112
+                    'update_post_term_cache' => false,
113
+                    'update_post_meta_cache' => false,
114
+               );
115
+
116
+               $connection_product['posts_obj'] = new \WP_Query( $args );
117
+
118
+               if ( $connection_product['posts_obj']->have_posts() ) {
119
+                    $connection_product['small_list_html'] = array();
120
+
121
+                    while ( $connection_product['posts_obj']->have_posts() ) {
122
+                         $connection_product['posts_obj']->the_post();
123
+                         $connection_product['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
124
+                         wp_reset_postdata();
125
+                    }
126
+
127
+                    $connection_product['posts_obj']->rewind_posts();
128
+                    $connection_product['small_list_html'] = join( ', ', $connection_product['small_list_html'] );
129
+               }
130
+
131
+               $connections[] = $connection_product;
132
+          }
133
+     }
134
+
135
+     // Connection Services
136
+
137
+     $connection_service['post_type'] = 'page';
138
+     // $connection_service['title'] = esc_html__( 'Services', 'lsx-projects' );
139
+     $connection_service['pages'] = get_post_meta( get_the_ID(), 'page_to_project', false );
140
+
141
+     if ( ! empty( $connection_service['pages'] ) ) {
142
+          $post_ids = join( ',', $connection_service['pages'] );
143
+          //$connection_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]';
144
+          $connection_service['small_list_html'] = '';
145
+
146
+          $args = array(
147
+               'post_type'              => 'page',
148
+               'post__in'               => $connection_service['pages'],
149
+               'orderby'                => 'post__in',
150
+               'no_found_rows'          => true,
151
+               'ignore_sticky_posts'    => 1,
152
+               'update_post_term_cache' => false,
153
+               'update_post_meta_cache' => false,
154
+          );
155
+
156
+          $services_ = new \WP_Query( $args );
157
+
158
+          if ( $services_->have_posts() ) {
159
+               $connection_service['small_list_html'] = array();
160
+
161
+               while ( $services_->have_posts() ) {
162
+                    $services_->the_post();
163
+                    $connection_service['small_list_html'][] = '<a href="' . get_permalink() . '">' . the_title( '', '', false ) . '</a>';
164
+                    wp_reset_postdata();
165
+               }
166
+
167
+               $connection_service['small_list_html'] = join( ', ', $connection_service['small_list_html'] );
168
+          }
169
+
170
+          $connections[] = $connection_service;
171
+     }
172
+
173
+     // Connection Testimonials
174
+
175
+     $connection_testimonial['post_type'] = 'testimonial';
176
+     // $connection_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-projects' );
177
+     $connection_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_project', false );
178
+
179
+     if ( ! empty( $connection_testimonial['posts'] ) ) {
180
+          $post_ids = join( ',', $connection_testimonial['posts'] );
181
+          $connection_testimonial['shortcode'] = '[lsx_testimonials columns="1" include="' . $post_ids . '" orderby="date" order="DESC"]';
182
+          $connections[] = $connection_testimonial;
183
+     }
184
+
185
+     // Connection Team
186
+
187
+     $connection_team['post_type'] = 'team';
188
+     // $connection_team['title'] = esc_html__( 'Team', 'lsx-projects' );
189
+     $connection_team['posts'] = get_post_meta( get_the_ID(), 'team_to_project', false );
190
+
191
+     if ( ! empty( $connection_team['posts'] ) ) {
192
+          $post_ids = join( ',', $connection_team['posts'] );
193
+          $connection_team['shortcode'] = '[lsx_team columns="4" include="' . $post_ids . '" show_social="false" show_desc="false" show_link="true"]';
194
+          $connection_team['small_list_html'] = '';
195
+
196
+          $args = array(
197
+               'post_type'              => 'team',
198
+               'post__in'               => $connection_team['posts'],
199
+               'orderby'                => 'post__in',
200
+               'no_found_rows'          => true,
201
+               'ignore_sticky_posts'    => 1,
202
+               'update_post_term_cache' => false,
203
+               'update_post_meta_cache' => false,
204
+          );
205
+
206
+          $team_ = new \WP_Query( $args );
207
+
208
+          if ( $team_->have_posts() ) {
209
+               global $lsx_team;
210
+               $connection_team['small_list_html'] = array();
211
+
212
+               while ( $team_->have_posts() ) {
213
+                    $team_->the_post();
214
+                    $connection_team['small_list_html'][] = '<a href="' . get_permalink() . '">' . $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ) . '</a>';
215
+                    wp_reset_postdata();
216
+               }
217
+
218
+               $connection_team['small_list_html'] = join( ' ', $connection_team['small_list_html'] );
219
+          }
220
+
221
+          $connections[] = $connection_team;
222
+     }
223 223
 ?>
224 224
 
225 225
 <?php lsx_entry_before(); ?>
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 			<?php if ( count( $connections ) > 0 ) : ?>
236 236
 				<?php foreach ( $connections as $i => $connection ) : ?>
237 237
 					<?php
238
-						if ( 'testimonial' === $connection['post_type'] ) {
239
-							echo '<div class="tab-pane-fake">';
240
-							echo do_shortcode( $connection['shortcode'] );
241
-							echo '</div>';
242
-						}
243
-					?>
238
+                              if ( 'testimonial' === $connection['post_type'] ) {
239
+                                   echo '<div class="tab-pane-fake">';
240
+                                   echo do_shortcode( $connection['shortcode'] );
241
+                                   echo '</div>';
242
+                              }
243
+                         ?>
244 244
 				<?php endforeach; ?>
245 245
 			<?php endif; ?>
246 246
 		</div>
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 	<?php if ( count( $connections ) > 0 ) : ?>
292 292
 		<?php foreach ( $connections as $i => $connection ) : ?>
293 293
 			<?php
294
-				// Team is now visible on detail box
295
-				// Services is now visible on detail box
296
-				// Testimonials is now visible below the content
297
-				if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) {
298
-					continue;
299
-				}
300
-			?>
294
+                    // Team is now visible on detail box
295
+                    // Services is now visible on detail box
296
+                    // Testimonials is now visible below the content
297
+                    if ( in_array( $connection['post_type'], array( 'team', 'testimonial', 'service' ) ) ) {
298
+                         continue;
299
+                    }
300
+               ?>
301 301
 			<?php if ( 'page' !== $connection['post_type'] ) { ?>
302 302
 				<div class="lsx-projects-section lsx-full-width">
303 303
 					<div class="row">
@@ -305,34 +305,34 @@  discard block
 block discarded – undo
305 305
 							<h3 class="lsx-title"><?php echo wp_kses_post( $connection['title'] ); ?></h3>
306 306
 
307 307
 							<?php
308
-								if ( 'product' === $connection['post_type'] ) {
309
-									if ( $connection_product['posts_obj']->have_posts() ) {
310
-										// @codingStandardsIgnoreLine
311
-										echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
312
-
313
-										while ( $connection_product['posts_obj']->have_posts() ) {
314
-											$connection_product['posts_obj']->the_post();
315
-
316
-											wc_get_template( 'content-widget-product.php', array(
317
-												'show_rating' => false,
318
-											) );
319
-
320
-											wp_reset_postdata();
321
-										}
322
-
323
-										// @codingStandardsIgnoreLine
324
-										echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
325
-									}
326
-								} else {
327
-									echo do_shortcode( $connection['shortcode'] );
328
-								}
329
-							?>
308
+                                        if ( 'product' === $connection['post_type'] ) {
309
+                                             if ( $connection_product['posts_obj']->have_posts() ) {
310
+                                                  // @codingStandardsIgnoreLine
311
+                                                  echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
312
+
313
+                                                  while ( $connection_product['posts_obj']->have_posts() ) {
314
+                                                       $connection_product['posts_obj']->the_post();
315
+
316
+                                                       wc_get_template( 'content-widget-product.php', array(
317
+                                                            'show_rating' => false,
318
+                                                       ) );
319
+
320
+                                                       wp_reset_postdata();
321
+                                                  }
322
+
323
+                                                  // @codingStandardsIgnoreLine
324
+                                                  echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
325
+                                             }
326
+                                        } else {
327
+                                             echo do_shortcode( $connection['shortcode'] );
328
+                                        }
329
+                                   ?>
330 330
 						</div>
331 331
 					</div>
332 332
 				</div>
333 333
 			<?php
334
-			}
335
-		?>
334
+               }
335
+          ?>
336 336
 		<?php endforeach; ?>
337 337
 	<?php endif; ?>
338 338
 
Please login to merge, or discard this patch.
classes/class-lsx-projects-core.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * Contructor
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) );
32
+		add_action('init', array($this, 'cmb2_post_search_ajax'));
33 33
 		$this->load_vendors();
34 34
 	}
35 35
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	public static function get_instance() {
44 44
 
45 45
 		// If the single instance hasn't been set, set it now.
46
-		if ( null === self::$instance ) {
46
+		if (null === self::$instance) {
47 47
 			self::$instance = new self();
48 48
 		}
49 49
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	private function load_vendors() {
58 58
 		// Configure custom fields.
59
-		if ( ! class_exists( 'CMB2' ) ) {
59
+		if ( ! class_exists('CMB2')) {
60 60
 			require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php';
61 61
 		}
62 62
 	}
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 * @return void
68 68
 	 */
69 69
 	public function get_post_types() {
70
-		$post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) );
71
-		foreach ( $post_types as $index => $post_type ) {
72
-			$is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false );
73
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
74
-				unset( $post_types[ $index ] );
70
+		$post_types = apply_filters('lsx_projects_post_types', isset($this->post_types));
71
+		foreach ($post_types as $index => $post_type) {
72
+			$is_disabled = \cmb2_get_option('lsx_projects_options', $post_type . '_disabled', false);
73
+			if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) {
74
+				unset($post_types[$index]);
75 75
 			}
76 76
 		}
77 77
 		return $post_types;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function cmb2_post_search_ajax() {
86 86
 		require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php';
87
-		if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) {
87
+		if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) {
88 88
 			$this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance();
89 89
 		}
90 90
 	}
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -7,87 +7,87 @@
 block discarded – undo
7 7
  */
8 8
 class LSX_Projects_Core {
9 9
 
10
-	/**
11
-	 * Holds class instance
12
-	 *
13
-	 * @since 1.0.0
14
-	 *
15
-	 * @var      object \lsx_projects\classes\Core()
16
-	 */
17
-	protected static $instance = null;
10
+     /**
11
+      * Holds class instance
12
+      *
13
+      * @since 1.0.0
14
+      *
15
+      * @var      object \lsx_projects\classes\Core()
16
+      */
17
+     protected static $instance = null;
18 18
 
19
-	/**
20
-	 * Holds class instance
21
-	 *
22
-	 * @since 1.0.0
23
-	 *
24
-	 * @var      object \MAG_CMB2_Field_Post_Search_Ajax()
25
-	 */
26
-	public $cmb2_post_search_ajax = false;
19
+     /**
20
+      * Holds class instance
21
+      *
22
+      * @since 1.0.0
23
+      *
24
+      * @var      object \MAG_CMB2_Field_Post_Search_Ajax()
25
+      */
26
+     public $cmb2_post_search_ajax = false;
27 27
 
28
-	/**
29
-	 * Contructor
30
-	 */
31
-	public function __construct() {
32
-		add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) );
33
-		$this->load_vendors();
34
-	}
28
+     /**
29
+      * Contructor
30
+      */
31
+     public function __construct() {
32
+          add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) );
33
+          $this->load_vendors();
34
+     }
35 35
 
36
-	/**
37
-	 * Return an instance of this class.
38
-	 *
39
-	 * @since 1.0.0
40
-	 *
41
-	 * @return    object \lsx_projects\classes\Core()    A single instance of this class.
42
-	 */
43
-	public static function get_instance() {
36
+     /**
37
+      * Return an instance of this class.
38
+      *
39
+      * @since 1.0.0
40
+      *
41
+      * @return    object \lsx_projects\classes\Core()    A single instance of this class.
42
+      */
43
+     public static function get_instance() {
44 44
 
45
-		// If the single instance hasn't been set, set it now.
46
-		if ( null === self::$instance ) {
47
-			self::$instance = new self();
48
-		}
45
+          // If the single instance hasn't been set, set it now.
46
+          if ( null === self::$instance ) {
47
+               self::$instance = new self();
48
+          }
49 49
 
50
-		return self::$instance;
50
+          return self::$instance;
51 51
 
52
-	}
52
+     }
53 53
 
54
-	/**
55
-	 * Loads the plugin functions.
56
-	 */
57
-	private function load_vendors() {
58
-		// Configure custom fields.
59
-		if ( ! class_exists( 'CMB2' ) ) {
60
-			require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php';
61
-		}
62
-	}
54
+     /**
55
+      * Loads the plugin functions.
56
+      */
57
+     private function load_vendors() {
58
+          // Configure custom fields.
59
+          if ( ! class_exists( 'CMB2' ) ) {
60
+               require_once LSX_PROJECTS_PATH . 'vendor/CMB2/init.php';
61
+          }
62
+     }
63 63
 
64
-	/**
65
-	 * Returns the post types currently active
66
-	 *
67
-	 * @return void
68
-	 */
69
-	public function get_post_types() {
70
-		$post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) );
71
-		foreach ( $post_types as $index => $post_type ) {
72
-			$is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false );
73
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
74
-				unset( $post_types[ $index ] );
75
-			}
76
-		}
77
-		return $post_types;
78
-	}
64
+     /**
65
+      * Returns the post types currently active
66
+      *
67
+      * @return void
68
+      */
69
+     public function get_post_types() {
70
+          $post_types = apply_filters( 'lsx_projects_post_types', isset( $this->post_types ) );
71
+          foreach ( $post_types as $index => $post_type ) {
72
+               $is_disabled = \cmb2_get_option( 'lsx_projects_options', $post_type . '_disabled', false );
73
+               if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
74
+                    unset( $post_types[ $index ] );
75
+               }
76
+          }
77
+          return $post_types;
78
+     }
79 79
 
80
-	/**
81
-	 * Includes the Post Search Ajax if it is there.
82
-	 *
83
-	 * @return void
84
-	 */
85
-	public function cmb2_post_search_ajax() {
86
-		require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php';
87
-		if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) {
88
-			$this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance();
89
-		}
90
-	}
80
+     /**
81
+      * Includes the Post Search Ajax if it is there.
82
+      *
83
+      * @return void
84
+      */
85
+     public function cmb2_post_search_ajax() {
86
+          require_once LSX_PROJECTS_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php';
87
+          if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) {
88
+               $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance();
89
+          }
90
+     }
91 91
 }
92 92
 
93 93
 LSX_Projects_Core::get_instance();
Please login to merge, or discard this patch.