Passed
Push — master ( 15012d...972fe5 )
by Warwick
03:37
created
classes/class-lsx-to-vehicles-admin.php 2 patches
Indentation   +421 added lines, -421 removed lines patch added patch discarded remove patch
@@ -18,447 +18,447 @@
 block discarded – undo
18 18
 
19 19
 class LSX_TO_Vehicles_Admin extends LSX_TO_Vehicles {
20 20
 
21
-	/**
22
-	 * Constructor
23
-	 */
24
-	public function __construct() {
25
-		add_action( 'init', array( $this, 'register_post_types' ) );
26
-		add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) );
21
+     /**
22
+      * Constructor
23
+      */
24
+     public function __construct() {
25
+          add_action( 'init', array( $this, 'register_post_types' ) );
26
+          add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) );
27 27
 
28
-		//add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29
-		//add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
28
+          //add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29
+          //add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
30 30
 
31
-		add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) );
32
-		add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) );
33
-		add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) );
34
-		add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) );
35
-		add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
36
-		add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
37
-	}
31
+          add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) );
32
+          add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) );
33
+          add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) );
34
+          add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) );
35
+          add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
36
+          add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
37
+     }
38 38
 
39
-	/**
40
-	 * Register the activity post type config
41
-	 *
42
-	 * @param  $objects
43
-	 * @return   array
44
-	 */
45
-	public function post_type_config( $objects ) {
39
+     /**
40
+      * Register the activity post type config
41
+      *
42
+      * @param  $objects
43
+      * @return   array
44
+      */
45
+     public function post_type_config( $objects ) {
46 46
 
47
-		foreach ( $this->post_types as $key => $label ) {
48
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
49
-				$objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
50
-			}
51
-		}
47
+          foreach ( $this->post_types as $key => $label ) {
48
+               if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
49
+                    $objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
50
+               }
51
+          }
52 52
 
53
-		return 	$objects;
54
-	}
53
+          return 	$objects;
54
+     }
55 55
 
56
-	/**
57
-	 * Register the activity metabox config
58
-	 *
59
-	 * @param  $meta_boxes
60
-	 * @return   array
61
-	 */
62
-	public function meta_box_config( $meta_boxes ) {
63
-		foreach ( $this->post_types as $key => $label ) {
64
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
65
-				$meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
66
-			}
67
-		}
68
-		return 	$meta_boxes;
69
-	}
56
+     /**
57
+      * Register the activity metabox config
58
+      *
59
+      * @param  $meta_boxes
60
+      * @return   array
61
+      */
62
+     public function meta_box_config( $meta_boxes ) {
63
+          foreach ( $this->post_types as $key => $label ) {
64
+               if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
65
+                    $meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
66
+               }
67
+          }
68
+          return 	$meta_boxes;
69
+     }
70 70
 
71
-	/**
72
-	 * Register the landing pages post type.
73
-	 */
74
-	public function register_post_types() {
71
+     /**
72
+      * Register the landing pages post type.
73
+      */
74
+     public function register_post_types() {
75 75
 
76
-		$labels = array(
77
-			'name'               => _x( 'Vehicles', 'to-vehicles' ),
78
-			'singular_name'      => _x( 'Vehicle', 'to-vehicles' ),
79
-			'add_new'            => _x( 'Add New', 'to-vehicles' ),
80
-			'add_new_item'       => _x( 'Add New Vehicle', 'to-vehicles' ),
81
-			'edit_item'          => _x( 'Edit Vehicle', 'to-vehicles' ),
82
-			'new_item'           => _x( 'New Vehicle', 'to-vehicles' ),
83
-			'all_items'          => _x( 'Vehicles', 'to-vehicles' ),
84
-			'view_item'          => _x( 'View Vehicle', 'to-vehicles' ),
85
-			'search_items'       => _x( 'Search Vehicles', 'to-vehicles' ),
86
-			'not_found'          => _x( 'No vehicles found', 'to-vehicles' ),
87
-			'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ),
88
-			'parent_item_colon'  => '',
89
-			'menu_name'          => _x( 'Vehicles', 'to-vehicles' ),
90
-		);
76
+          $labels = array(
77
+               'name'               => _x( 'Vehicles', 'to-vehicles' ),
78
+               'singular_name'      => _x( 'Vehicle', 'to-vehicles' ),
79
+               'add_new'            => _x( 'Add New', 'to-vehicles' ),
80
+               'add_new_item'       => _x( 'Add New Vehicle', 'to-vehicles' ),
81
+               'edit_item'          => _x( 'Edit Vehicle', 'to-vehicles' ),
82
+               'new_item'           => _x( 'New Vehicle', 'to-vehicles' ),
83
+               'all_items'          => _x( 'Vehicles', 'to-vehicles' ),
84
+               'view_item'          => _x( 'View Vehicle', 'to-vehicles' ),
85
+               'search_items'       => _x( 'Search Vehicles', 'to-vehicles' ),
86
+               'not_found'          => _x( 'No vehicles found', 'to-vehicles' ),
87
+               'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ),
88
+               'parent_item_colon'  => '',
89
+               'menu_name'          => _x( 'Vehicles', 'to-vehicles' ),
90
+          );
91 91
 
92
-		$args = array(
93
-			'menu_icon'          => 'dashicons-performance',
94
-			'labels'             => $labels,
95
-			'public'             => true,
96
-			'publicly_queryable' => true,
97
-			'show_ui'            => true,
98
-			'show_in_menu'       => 'tour-operator',
99
-			'menu_position'      => 80,
100
-			'query_var'          => true,
101
-			'rewrite'            => array(
102
-				'slug' => 'vehicle',
103
-			),
104
-			'capability_type'    => 'post',
105
-			'has_archive'        => 'vehicles',
106
-			'hierarchical'       => true,
107
-			'show_in_rest'       => true,
108
-			'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
109
-		);
92
+          $args = array(
93
+               'menu_icon'          => 'dashicons-performance',
94
+               'labels'             => $labels,
95
+               'public'             => true,
96
+               'publicly_queryable' => true,
97
+               'show_ui'            => true,
98
+               'show_in_menu'       => 'tour-operator',
99
+               'menu_position'      => 80,
100
+               'query_var'          => true,
101
+               'rewrite'            => array(
102
+                    'slug' => 'vehicle',
103
+               ),
104
+               'capability_type'    => 'post',
105
+               'has_archive'        => 'vehicles',
106
+               'hierarchical'       => true,
107
+               'show_in_rest'       => true,
108
+               'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
109
+          );
110 110
 
111
-		register_post_type( 'vehicle', $args );
111
+          register_post_type( 'vehicle', $args );
112 112
 
113
-	}
113
+     }
114 114
 
115
-	function register_metaboxes( array $meta_boxes ) {
115
+     function register_metaboxes( array $meta_boxes ) {
116 116
 
117
-		$fields[] = array(
118
-			'id'   => 'title',
119
-			'name' => 'General',
120
-			'type' => 'title',
121
-		);
122
-		$fields[] = array(
123
-			'id'   => 'featured',
124
-			'name' => 'Featured',
125
-			'type' => 'checkbox',
126
-		);
127
-		if ( ! class_exists( 'LSX_Banners' ) ) {
128
-			$fields[] = array(
129
-				'id'   => 'tagline',
130
-				'name' => 'Tagline',
131
-				'type' => 'text',
132
-			);
133
-		}
134
-		$fields[] = array(
135
-			'id'   => 'code',
136
-			'name' => 'Code',
137
-			'type' => 'text',
138
-		);
139
-		$fields[] = array(
140
-			'id'      => 'gearbox',
141
-			'name'    => 'Gearbox Type',
142
-			'type'    => 'radio',
143
-			'options' => array(
144
-				'Automatic' => 'Automatic',
145
-				'Manual'    => 'Manual',
146
-			),
147
-		);
148
-		$fields[] = array(
149
-			'id'      => 'gears',
150
-			'name'    => 'Gears',
151
-			'type'    => 'radio',
152
-			'options' => array(
153
-				'4',
154
-				'5',
155
-				'6',
156
-				'7',
157
-			),
158
-		);
159
-		$fields[] = array(
160
-			'id'   => 'vehicle_type',
161
-			'name' => 'Vehicle Type',
162
-			'type' => 'text',
163
-		);
164
-		$fields[] = array(
165
-			'id'   => 'price',
166
-			'name' => 'Price Guide',
167
-			'type' => 'text',
168
-		);
169
-		$fields[] = array(
170
-			'id'      => 'engine_type',
171
-			'name'    => 'Engine Type',
172
-			'type'    => 'radio',
173
-			'options' => array(
174
-				'Diesel' => 'Diesel',
175
-				'Petrol' => 'Petrol',
176
-			),
177
-		);
178
-		$fields[] = array(
179
-			'id'   => 'engine_size',
180
-			'name' => 'Engine Size',
181
-			'type' => 'text',
182
-		);
183
-		$fields[] = array(
184
-			'id'   => 'seating',
185
-			'name' => 'Seats',
186
-			'type' => 'text',
187
-		);
188
-		$fields[] = array(
189
-			'id'      => 'features',
190
-			'name'    => 'Features',
191
-			'type'    => 'wysiwyg',
192
-			'options' => array(
193
-				'editor_height' => '100',
194
-			),
195
-		);
196
-		$fields[] = array(
197
-			'id'   => 'gallery_title',
198
-			'name' => 'Gallery',
199
-			'type' => 'title',
200
-		);
117
+          $fields[] = array(
118
+               'id'   => 'title',
119
+               'name' => 'General',
120
+               'type' => 'title',
121
+          );
122
+          $fields[] = array(
123
+               'id'   => 'featured',
124
+               'name' => 'Featured',
125
+               'type' => 'checkbox',
126
+          );
127
+          if ( ! class_exists( 'LSX_Banners' ) ) {
128
+               $fields[] = array(
129
+                    'id'   => 'tagline',
130
+                    'name' => 'Tagline',
131
+                    'type' => 'text',
132
+               );
133
+          }
134
+          $fields[] = array(
135
+               'id'   => 'code',
136
+               'name' => 'Code',
137
+               'type' => 'text',
138
+          );
139
+          $fields[] = array(
140
+               'id'      => 'gearbox',
141
+               'name'    => 'Gearbox Type',
142
+               'type'    => 'radio',
143
+               'options' => array(
144
+                    'Automatic' => 'Automatic',
145
+                    'Manual'    => 'Manual',
146
+               ),
147
+          );
148
+          $fields[] = array(
149
+               'id'      => 'gears',
150
+               'name'    => 'Gears',
151
+               'type'    => 'radio',
152
+               'options' => array(
153
+                    '4',
154
+                    '5',
155
+                    '6',
156
+                    '7',
157
+               ),
158
+          );
159
+          $fields[] = array(
160
+               'id'   => 'vehicle_type',
161
+               'name' => 'Vehicle Type',
162
+               'type' => 'text',
163
+          );
164
+          $fields[] = array(
165
+               'id'   => 'price',
166
+               'name' => 'Price Guide',
167
+               'type' => 'text',
168
+          );
169
+          $fields[] = array(
170
+               'id'      => 'engine_type',
171
+               'name'    => 'Engine Type',
172
+               'type'    => 'radio',
173
+               'options' => array(
174
+                    'Diesel' => 'Diesel',
175
+                    'Petrol' => 'Petrol',
176
+               ),
177
+          );
178
+          $fields[] = array(
179
+               'id'   => 'engine_size',
180
+               'name' => 'Engine Size',
181
+               'type' => 'text',
182
+          );
183
+          $fields[] = array(
184
+               'id'   => 'seating',
185
+               'name' => 'Seats',
186
+               'type' => 'text',
187
+          );
188
+          $fields[] = array(
189
+               'id'      => 'features',
190
+               'name'    => 'Features',
191
+               'type'    => 'wysiwyg',
192
+               'options' => array(
193
+                    'editor_height' => '100',
194
+               ),
195
+          );
196
+          $fields[] = array(
197
+               'id'   => 'gallery_title',
198
+               'name' => 'Gallery',
199
+               'type' => 'title',
200
+          );
201 201
 
202
-		//Galleries Block
203
-		$fields[] = array(
204
-			'id'   => 'gallery_title',
205
-			'name' => esc_html__( 'Gallery', 'tour-operator' ),
206
-			'type' => 'title',
207
-		);
208
-		$fields[] = array(
209
-			'id'                  => 'gallery',
210
-			'name'                => '',
211
-			'type'                => 'image',
212
-			'repeatable'          => true,
213
-			'show_size'           => false,
214
-			'sortable'            => true,
215
-			'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ),
216
-		);
217
-		if ( class_exists( 'Envira_Gallery' ) ) {
218
-			$fields[] = array(
219
-				'id'   => 'envira_title',
220
-				'name' => esc_html__( 'Envira Gallery', 'tour-operator' ),
221
-				'type' => 'title',
222
-			);
223
-			$fields[] = array(
224
-				'id'         => 'envira_gallery',
225
-				'name'       => esc_html__( 'Envira Gallery', 'to-galleries' ),
226
-				'type'       => 'post_select',
227
-				'use_ajax'   => false,
228
-				'query'      => array(
229
-					'post_type'      => 'envira',
230
-					'nopagin'        => true,
231
-					'posts_per_page' => '-1',
232
-					'orderby'        => 'title',
233
-					'order'          => 'ASC',
234
-				),
235
-				'allow_none' => true,
236
-			);
237
-			if ( class_exists( 'Envira_Videos' ) ) {
238
-				$fields[] = array(
239
-					'id'         => 'envira_video',
240
-					'name'       => esc_html__( 'Envira Video Gallery', 'to-galleries' ),
241
-					'type'       => 'post_select',
242
-					'use_ajax'   => false,
243
-					'query'      => array(
244
-						'post_type'      => 'envira',
245
-						'nopagin'        => true,
246
-						'posts_per_page' => '-1',
247
-						'orderby'        => 'title',
248
-						'order'          => 'ASC',
249
-					),
250
-					'allow_none' => true,
251
-				);
252
-			}
253
-		}
202
+          //Galleries Block
203
+          $fields[] = array(
204
+               'id'   => 'gallery_title',
205
+               'name' => esc_html__( 'Gallery', 'tour-operator' ),
206
+               'type' => 'title',
207
+          );
208
+          $fields[] = array(
209
+               'id'                  => 'gallery',
210
+               'name'                => '',
211
+               'type'                => 'image',
212
+               'repeatable'          => true,
213
+               'show_size'           => false,
214
+               'sortable'            => true,
215
+               'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ),
216
+          );
217
+          if ( class_exists( 'Envira_Gallery' ) ) {
218
+               $fields[] = array(
219
+                    'id'   => 'envira_title',
220
+                    'name' => esc_html__( 'Envira Gallery', 'tour-operator' ),
221
+                    'type' => 'title',
222
+               );
223
+               $fields[] = array(
224
+                    'id'         => 'envira_gallery',
225
+                    'name'       => esc_html__( 'Envira Gallery', 'to-galleries' ),
226
+                    'type'       => 'post_select',
227
+                    'use_ajax'   => false,
228
+                    'query'      => array(
229
+                         'post_type'      => 'envira',
230
+                         'nopagin'        => true,
231
+                         'posts_per_page' => '-1',
232
+                         'orderby'        => 'title',
233
+                         'order'          => 'ASC',
234
+                    ),
235
+                    'allow_none' => true,
236
+               );
237
+               if ( class_exists( 'Envira_Videos' ) ) {
238
+                    $fields[] = array(
239
+                         'id'         => 'envira_video',
240
+                         'name'       => esc_html__( 'Envira Video Gallery', 'to-galleries' ),
241
+                         'type'       => 'post_select',
242
+                         'use_ajax'   => false,
243
+                         'query'      => array(
244
+                              'post_type'      => 'envira',
245
+                              'nopagin'        => true,
246
+                              'posts_per_page' => '-1',
247
+                              'orderby'        => 'title',
248
+                              'order'          => 'ASC',
249
+                         ),
250
+                         'allow_none' => true,
251
+                    );
252
+               }
253
+          }
254 254
 
255
-		if ( class_exists( 'LSX_Field_Pattern' ) ) {
256
-			$fields = array_merge( $fields, LSX_Field_Pattern::videos() );
257
-		}
255
+          if ( class_exists( 'LSX_Field_Pattern' ) ) {
256
+               $fields = array_merge( $fields, LSX_Field_Pattern::videos() );
257
+          }
258 258
 
259
-		$fields[] = array(
260
-			'id'   => 'accommodation_title',
261
-			'name' => 'Accommodation',
262
-			'type' => 'title',
263
-		);
264
-		$fields[] = array(
265
-			'id'         => 'accommodation_to_vehicle',
266
-			'name'       => 'Accommodations related with this vehicle',
267
-			'type'       => 'post_select',
268
-			'use_ajax'   => false,
269
-			'query'      => array(
270
-				'post_type'      => 'accommodation',
271
-				'nopagin'        => true,
272
-				'posts_per_page' => 1000,
273
-				'orderby'        => 'title',
274
-				'order'          => 'ASC',
275
-			),
276
-			'repeatable' => true,
277
-			'sortable'   => true,
278
-			'allow_none' => true,
279
-		);
280
-		$fields[] = array(
281
-			'id'   => 'activity_title',
282
-			'name' => 'Activities',
283
-			'type' => 'title',
284
-		);
285
-		$fields[] = array(
286
-			'id'         => 'activity_to_vehicle',
287
-			'name'       => 'Activities related with this vehicle',
288
-			'type'       => 'post_select',
289
-			'use_ajax'   => false,
290
-			'query'      => array(
291
-				'post_type'      => 'activity',
292
-				'nopagin'        => true,
293
-				'posts_per_page' => 1000,
294
-				'orderby'        => 'title',
295
-				'order'          => 'ASC',
296
-			),
297
-			'repeatable' => true,
298
-			'sortable'   => true,
299
-			'allow_none' => true,
300
-		);
301
-		$fields[] = array(
302
-			'id'   => 'destinations_title',
303
-			'name' => 'Destinations',
304
-			'type' => 'title',
305
-		);
306
-		$fields[] = array(
307
-			'id'         => 'destination_to_vehicle',
308
-			'name'       => 'Destinations related with this vehicle',
309
-			'type'       => 'post_select',
310
-			'use_ajax'   => false,
311
-			'query'      => array(
312
-				'post_type'      => 'destination',
313
-				'nopagin'        => true,
314
-				'posts_per_page' => 1000,
315
-				'orderby'        => 'title',
316
-				'order'          => 'ASC',
317
-			),
318
-			'repeatable' => true,
319
-			'sortable'   => true,
320
-			'allow_none' => true,
321
-		);
322
-		$fields[] = array(
323
-			'id'   => 'review_title',
324
-			'name' => 'Reviews',
325
-			'type' => 'title',
326
-		);
327
-		$fields[] = array(
328
-			'id'         => 'review_to_vehicle',
329
-			'name'       => 'Reviews related with this vehicle',
330
-			'type'       => 'post_select',
331
-			'use_ajax'   => false,
332
-			'query'      => array(
333
-				'post_type'      => 'reviews',
334
-				'nopagin'        => true,
335
-				'posts_per_page' => 1000,
336
-				'orderby'        => 'title',
337
-				'order'          => 'ASC',
338
-			),
339
-			'repeatable' => true,
340
-			'sortable'   => true,
341
-			'allow_none' => true,
342
-		);
343
-		$fields[] = array(
344
-			'id'   => 'specials_title',
345
-			'name' => 'Specials',
346
-			'type' => 'title',
347
-		);
348
-		$fields[] = array(
349
-			'id'         => 'special_to_vehicle',
350
-			'name'       => 'Specials related with this vehicle',
351
-			'type'       => 'post_select',
352
-			'use_ajax'   => false,
353
-			'query'      => array(
354
-				'post_type'      => 'special',
355
-				'nopagin'        => true,
356
-				'posts_per_page' => 1000,
357
-				'orderby'        => 'title',
358
-				'order'          => 'ASC',
359
-			),
360
-			'repeatable' => true,
361
-			'sortable'   => true,
362
-			'allow_none' => true,
363
-		);
364
-		$fields[] = array(
365
-			'id'   => 'team_title',
366
-			'name' => 'Team Members',
367
-			'type' => 'title',
368
-		);
369
-		$fields[] = array(
370
-			'id'         => 'team_to_vehicle',
371
-			'name'       => 'Team members related with this vehicle',
372
-			'type'       => 'post_select',
373
-			'use_ajax'   => false,
374
-			'query'      => array(
375
-				'post_type'      => 'team',
376
-				'nopagin'        => true,
377
-				'posts_per_page' => 1000,
378
-				'orderby'        => 'title',
379
-				'order'          => 'ASC',
380
-			),
381
-			'repeatable' => true,
382
-			'sortable'   => true,
383
-			'allow_none' => true,
384
-		);
385
-		$fields[] = array(
386
-			'id'   => 'tours_title',
387
-			'name' => 'Tours',
388
-			'type' => 'title',
389
-		);
390
-		$fields[] = array(
391
-			'id'         => 'tour_to_vehicle',
392
-			'name'       => 'Tours related with this vehicle',
393
-			'type'       => 'post_select',
394
-			'use_ajax'   => false,
395
-			'query'      => array(
396
-				'post_type'      => 'tour',
397
-				'nopagin'        => true,
398
-				'posts_per_page' => 1000,
399
-				'orderby'        => 'title',
400
-				'order'          => 'ASC',
401
-			),
402
-			'repeatable' => true,
403
-			'sortable'   => true,
404
-			'allow_none' => true,
405
-		);
259
+          $fields[] = array(
260
+               'id'   => 'accommodation_title',
261
+               'name' => 'Accommodation',
262
+               'type' => 'title',
263
+          );
264
+          $fields[] = array(
265
+               'id'         => 'accommodation_to_vehicle',
266
+               'name'       => 'Accommodations related with this vehicle',
267
+               'type'       => 'post_select',
268
+               'use_ajax'   => false,
269
+               'query'      => array(
270
+                    'post_type'      => 'accommodation',
271
+                    'nopagin'        => true,
272
+                    'posts_per_page' => 1000,
273
+                    'orderby'        => 'title',
274
+                    'order'          => 'ASC',
275
+               ),
276
+               'repeatable' => true,
277
+               'sortable'   => true,
278
+               'allow_none' => true,
279
+          );
280
+          $fields[] = array(
281
+               'id'   => 'activity_title',
282
+               'name' => 'Activities',
283
+               'type' => 'title',
284
+          );
285
+          $fields[] = array(
286
+               'id'         => 'activity_to_vehicle',
287
+               'name'       => 'Activities related with this vehicle',
288
+               'type'       => 'post_select',
289
+               'use_ajax'   => false,
290
+               'query'      => array(
291
+                    'post_type'      => 'activity',
292
+                    'nopagin'        => true,
293
+                    'posts_per_page' => 1000,
294
+                    'orderby'        => 'title',
295
+                    'order'          => 'ASC',
296
+               ),
297
+               'repeatable' => true,
298
+               'sortable'   => true,
299
+               'allow_none' => true,
300
+          );
301
+          $fields[] = array(
302
+               'id'   => 'destinations_title',
303
+               'name' => 'Destinations',
304
+               'type' => 'title',
305
+          );
306
+          $fields[] = array(
307
+               'id'         => 'destination_to_vehicle',
308
+               'name'       => 'Destinations related with this vehicle',
309
+               'type'       => 'post_select',
310
+               'use_ajax'   => false,
311
+               'query'      => array(
312
+                    'post_type'      => 'destination',
313
+                    'nopagin'        => true,
314
+                    'posts_per_page' => 1000,
315
+                    'orderby'        => 'title',
316
+                    'order'          => 'ASC',
317
+               ),
318
+               'repeatable' => true,
319
+               'sortable'   => true,
320
+               'allow_none' => true,
321
+          );
322
+          $fields[] = array(
323
+               'id'   => 'review_title',
324
+               'name' => 'Reviews',
325
+               'type' => 'title',
326
+          );
327
+          $fields[] = array(
328
+               'id'         => 'review_to_vehicle',
329
+               'name'       => 'Reviews related with this vehicle',
330
+               'type'       => 'post_select',
331
+               'use_ajax'   => false,
332
+               'query'      => array(
333
+                    'post_type'      => 'reviews',
334
+                    'nopagin'        => true,
335
+                    'posts_per_page' => 1000,
336
+                    'orderby'        => 'title',
337
+                    'order'          => 'ASC',
338
+               ),
339
+               'repeatable' => true,
340
+               'sortable'   => true,
341
+               'allow_none' => true,
342
+          );
343
+          $fields[] = array(
344
+               'id'   => 'specials_title',
345
+               'name' => 'Specials',
346
+               'type' => 'title',
347
+          );
348
+          $fields[] = array(
349
+               'id'         => 'special_to_vehicle',
350
+               'name'       => 'Specials related with this vehicle',
351
+               'type'       => 'post_select',
352
+               'use_ajax'   => false,
353
+               'query'      => array(
354
+                    'post_type'      => 'special',
355
+                    'nopagin'        => true,
356
+                    'posts_per_page' => 1000,
357
+                    'orderby'        => 'title',
358
+                    'order'          => 'ASC',
359
+               ),
360
+               'repeatable' => true,
361
+               'sortable'   => true,
362
+               'allow_none' => true,
363
+          );
364
+          $fields[] = array(
365
+               'id'   => 'team_title',
366
+               'name' => 'Team Members',
367
+               'type' => 'title',
368
+          );
369
+          $fields[] = array(
370
+               'id'         => 'team_to_vehicle',
371
+               'name'       => 'Team members related with this vehicle',
372
+               'type'       => 'post_select',
373
+               'use_ajax'   => false,
374
+               'query'      => array(
375
+                    'post_type'      => 'team',
376
+                    'nopagin'        => true,
377
+                    'posts_per_page' => 1000,
378
+                    'orderby'        => 'title',
379
+                    'order'          => 'ASC',
380
+               ),
381
+               'repeatable' => true,
382
+               'sortable'   => true,
383
+               'allow_none' => true,
384
+          );
385
+          $fields[] = array(
386
+               'id'   => 'tours_title',
387
+               'name' => 'Tours',
388
+               'type' => 'title',
389
+          );
390
+          $fields[] = array(
391
+               'id'         => 'tour_to_vehicle',
392
+               'name'       => 'Tours related with this vehicle',
393
+               'type'       => 'post_select',
394
+               'use_ajax'   => false,
395
+               'query'      => array(
396
+                    'post_type'      => 'tour',
397
+                    'nopagin'        => true,
398
+                    'posts_per_page' => 1000,
399
+                    'orderby'        => 'title',
400
+                    'order'          => 'ASC',
401
+               ),
402
+               'repeatable' => true,
403
+               'sortable'   => true,
404
+               'allow_none' => true,
405
+          );
406 406
 
407
-		$fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields );
407
+          $fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields );
408 408
 
409
-		$meta_boxes[] = array(
410
-			'title'  => 'Tour Operator Plugin',
411
-			'pages'  => 'vehicle',
412
-			'fields' => $fields,
413
-		);
414
-		return $meta_boxes;
409
+          $meta_boxes[] = array(
410
+               'title'  => 'Tour Operator Plugin',
411
+               'pages'  => 'vehicle',
412
+               'fields' => $fields,
413
+          );
414
+          return $meta_boxes;
415 415
 
416
-	}
416
+     }
417 417
 
418
-	/**
419
-	 * Adds in the gallery fields to the Tour Operators Post Types.
420
-	 */
421
-	public function custom_fields( $fields ) {
422
-		global $post, $typenow, $current_screen;
418
+     /**
419
+      * Adds in the gallery fields to the Tour Operators Post Types.
420
+      */
421
+     public function custom_fields( $fields ) {
422
+          global $post, $typenow, $current_screen;
423 423
 
424
-		$post_type = false;
425
-		if ( $post && $post->post_type ) {
426
-			$post_type = $post->post_type;
427
-		} elseif ( $typenow ) {
428
-			$post_type = $typenow;
429
-		} elseif ( $current_screen && $current_screen->post_type ) {
430
-			$post_type = $current_screen->post_type;
431
-		} elseif ( isset( $_REQUEST['post_type'] ) ) {
432
-			$post_type = sanitize_key( $_REQUEST['post_type'] );
433
-		} elseif ( isset( $_REQUEST['post'] ) ) {
434
-			$post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) );
435
-		}
436
-		//$post_type = get_post_type();
437
-		if ( false !== $post_type ) {
438
-			$fields[]  = array(
439
-				'id'   => 'vehicle_title',
440
-				'name' => 'Vehicles',
441
-				'type' => 'title',
442
-				'cols' => 12,
443
-			);
444
-			$fields[]  = array(
445
-				'id'         => 'vehicle_to_' . $post_type,
446
-				'name'       => 'Vehicles related with this ' . $post_type,
447
-				'type'       => 'post_select',
448
-				'use_ajax'   => false,
449
-				'query'      => array(
450
-					'post_type'      => 'vehicle',
451
-					'nopagin'        => true,
452
-					'posts_per_page' => '-1',
453
-					'orderby'        => 'title',
454
-					'order'          => 'ASC',
455
-				),
456
-				'repeatable' => true,
457
-				'allow_none' => true,
458
-				'cols'       => 12,
459
-			);
460
-		}
461
-		return $fields;
462
-	}
424
+          $post_type = false;
425
+          if ( $post && $post->post_type ) {
426
+               $post_type = $post->post_type;
427
+          } elseif ( $typenow ) {
428
+               $post_type = $typenow;
429
+          } elseif ( $current_screen && $current_screen->post_type ) {
430
+               $post_type = $current_screen->post_type;
431
+          } elseif ( isset( $_REQUEST['post_type'] ) ) {
432
+               $post_type = sanitize_key( $_REQUEST['post_type'] );
433
+          } elseif ( isset( $_REQUEST['post'] ) ) {
434
+               $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) );
435
+          }
436
+          //$post_type = get_post_type();
437
+          if ( false !== $post_type ) {
438
+               $fields[]  = array(
439
+                    'id'   => 'vehicle_title',
440
+                    'name' => 'Vehicles',
441
+                    'type' => 'title',
442
+                    'cols' => 12,
443
+               );
444
+               $fields[]  = array(
445
+                    'id'         => 'vehicle_to_' . $post_type,
446
+                    'name'       => 'Vehicles related with this ' . $post_type,
447
+                    'type'       => 'post_select',
448
+                    'use_ajax'   => false,
449
+                    'query'      => array(
450
+                         'post_type'      => 'vehicle',
451
+                         'nopagin'        => true,
452
+                         'posts_per_page' => '-1',
453
+                         'orderby'        => 'title',
454
+                         'order'          => 'ASC',
455
+                    ),
456
+                    'repeatable' => true,
457
+                    'allow_none' => true,
458
+                    'cols'       => 12,
459
+               );
460
+          }
461
+          return $fields;
462
+     }
463 463
 }
464 464
 new LSX_TO_Vehicles_Admin();
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@  discard block
 block discarded – undo
22 22
 	 * Constructor
23 23
 	 */
24 24
 	public function __construct() {
25
-		add_action( 'init', array( $this, 'register_post_types' ) );
26
-		add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) );
25
+		add_action('init', array($this, 'register_post_types'));
26
+		add_filter('cmb_meta_boxes', array($this, 'register_metaboxes'));
27 27
 
28 28
 		//add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29 29
 		//add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
30 30
 
31
-		add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) );
32
-		add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) );
33
-		add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) );
34
-		add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) );
35
-		add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
36
-		add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
31
+		add_filter('lsx_to_destination_custom_fields', array($this, 'custom_fields'));
32
+		add_filter('lsx_to_tour_custom_fields', array($this, 'custom_fields'));
33
+		add_filter('lsx_to_accommodation_custom_fields', array($this, 'custom_fields'));
34
+		add_filter('lsx_to_team_custom_fields', array($this, 'custom_fields'));
35
+		add_filter('lsx_to_special_custom_fields', array($this, 'custom_fields'));
36
+		add_filter('lsx_to_activity_custom_fields', array($this, 'custom_fields'));
37 37
 	}
38 38
 
39 39
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param  $objects
43 43
 	 * @return   array
44 44
 	 */
45
-	public function post_type_config( $objects ) {
45
+	public function post_type_config($objects) {
46 46
 
47
-		foreach ( $this->post_types as $key => $label ) {
48
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
49
-				$objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
47
+		foreach ($this->post_types as $key => $label) {
48
+			if (file_exists(LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php')) {
49
+				$objects[$key] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
50 50
 			}
51 51
 		}
52 52
 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * @param  $meta_boxes
60 60
 	 * @return   array
61 61
 	 */
62
-	public function meta_box_config( $meta_boxes ) {
63
-		foreach ( $this->post_types as $key => $label ) {
64
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
65
-				$meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
62
+	public function meta_box_config($meta_boxes) {
63
+		foreach ($this->post_types as $key => $label) {
64
+			if (file_exists(LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php')) {
65
+				$meta_boxes[$key] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
66 66
 			}
67 67
 		}
68 68
 		return 	$meta_boxes;
@@ -74,19 +74,19 @@  discard block
 block discarded – undo
74 74
 	public function register_post_types() {
75 75
 
76 76
 		$labels = array(
77
-			'name'               => _x( 'Vehicles', 'to-vehicles' ),
78
-			'singular_name'      => _x( 'Vehicle', 'to-vehicles' ),
79
-			'add_new'            => _x( 'Add New', 'to-vehicles' ),
80
-			'add_new_item'       => _x( 'Add New Vehicle', 'to-vehicles' ),
81
-			'edit_item'          => _x( 'Edit Vehicle', 'to-vehicles' ),
82
-			'new_item'           => _x( 'New Vehicle', 'to-vehicles' ),
83
-			'all_items'          => _x( 'Vehicles', 'to-vehicles' ),
84
-			'view_item'          => _x( 'View Vehicle', 'to-vehicles' ),
85
-			'search_items'       => _x( 'Search Vehicles', 'to-vehicles' ),
86
-			'not_found'          => _x( 'No vehicles found', 'to-vehicles' ),
87
-			'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ),
77
+			'name'               => _x('Vehicles', 'to-vehicles'),
78
+			'singular_name'      => _x('Vehicle', 'to-vehicles'),
79
+			'add_new'            => _x('Add New', 'to-vehicles'),
80
+			'add_new_item'       => _x('Add New Vehicle', 'to-vehicles'),
81
+			'edit_item'          => _x('Edit Vehicle', 'to-vehicles'),
82
+			'new_item'           => _x('New Vehicle', 'to-vehicles'),
83
+			'all_items'          => _x('Vehicles', 'to-vehicles'),
84
+			'view_item'          => _x('View Vehicle', 'to-vehicles'),
85
+			'search_items'       => _x('Search Vehicles', 'to-vehicles'),
86
+			'not_found'          => _x('No vehicles found', 'to-vehicles'),
87
+			'not_found_in_trash' => _x('No vehicles found in Trash', 'to-vehicles'),
88 88
 			'parent_item_colon'  => '',
89
-			'menu_name'          => _x( 'Vehicles', 'to-vehicles' ),
89
+			'menu_name'          => _x('Vehicles', 'to-vehicles'),
90 90
 		);
91 91
 
92 92
 		$args = array(
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 			'has_archive'        => 'vehicles',
106 106
 			'hierarchical'       => true,
107 107
 			'show_in_rest'       => true,
108
-			'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
108
+			'supports'           => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'),
109 109
 		);
110 110
 
111
-		register_post_type( 'vehicle', $args );
111
+		register_post_type('vehicle', $args);
112 112
 
113 113
 	}
114 114
 
115
-	function register_metaboxes( array $meta_boxes ) {
115
+	function register_metaboxes(array $meta_boxes) {
116 116
 
117 117
 		$fields[] = array(
118 118
 			'id'   => 'title',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			'name' => 'Featured',
125 125
 			'type' => 'checkbox',
126 126
 		);
127
-		if ( ! class_exists( 'LSX_Banners' ) ) {
127
+		if ( ! class_exists('LSX_Banners')) {
128 128
 			$fields[] = array(
129 129
 				'id'   => 'tagline',
130 130
 				'name' => 'Tagline',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		//Galleries Block
203 203
 		$fields[] = array(
204 204
 			'id'   => 'gallery_title',
205
-			'name' => esc_html__( 'Gallery', 'tour-operator' ),
205
+			'name' => esc_html__('Gallery', 'tour-operator'),
206 206
 			'type' => 'title',
207 207
 		);
208 208
 		$fields[] = array(
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 			'repeatable'          => true,
213 213
 			'show_size'           => false,
214 214
 			'sortable'            => true,
215
-			'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ),
215
+			'string-repeat-field' => esc_html__('Add new image', 'tour-operator'),
216 216
 		);
217
-		if ( class_exists( 'Envira_Gallery' ) ) {
217
+		if (class_exists('Envira_Gallery')) {
218 218
 			$fields[] = array(
219 219
 				'id'   => 'envira_title',
220
-				'name' => esc_html__( 'Envira Gallery', 'tour-operator' ),
220
+				'name' => esc_html__('Envira Gallery', 'tour-operator'),
221 221
 				'type' => 'title',
222 222
 			);
223 223
 			$fields[] = array(
224 224
 				'id'         => 'envira_gallery',
225
-				'name'       => esc_html__( 'Envira Gallery', 'to-galleries' ),
225
+				'name'       => esc_html__('Envira Gallery', 'to-galleries'),
226 226
 				'type'       => 'post_select',
227 227
 				'use_ajax'   => false,
228 228
 				'query'      => array(
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 				),
235 235
 				'allow_none' => true,
236 236
 			);
237
-			if ( class_exists( 'Envira_Videos' ) ) {
237
+			if (class_exists('Envira_Videos')) {
238 238
 				$fields[] = array(
239 239
 					'id'         => 'envira_video',
240
-					'name'       => esc_html__( 'Envira Video Gallery', 'to-galleries' ),
240
+					'name'       => esc_html__('Envira Video Gallery', 'to-galleries'),
241 241
 					'type'       => 'post_select',
242 242
 					'use_ajax'   => false,
243 243
 					'query'      => array(
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 			}
253 253
 		}
254 254
 
255
-		if ( class_exists( 'LSX_Field_Pattern' ) ) {
256
-			$fields = array_merge( $fields, LSX_Field_Pattern::videos() );
255
+		if (class_exists('LSX_Field_Pattern')) {
256
+			$fields = array_merge($fields, LSX_Field_Pattern::videos());
257 257
 		}
258 258
 
259 259
 		$fields[] = array(
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			'allow_none' => true,
405 405
 		);
406 406
 
407
-		$fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields );
407
+		$fields = apply_filters('lsx_to_vehicle_custom_fields', $fields);
408 408
 
409 409
 		$meta_boxes[] = array(
410 410
 			'title'  => 'Tour Operator Plugin',
@@ -418,30 +418,30 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * Adds in the gallery fields to the Tour Operators Post Types.
420 420
 	 */
421
-	public function custom_fields( $fields ) {
421
+	public function custom_fields($fields) {
422 422
 		global $post, $typenow, $current_screen;
423 423
 
424 424
 		$post_type = false;
425
-		if ( $post && $post->post_type ) {
425
+		if ($post && $post->post_type) {
426 426
 			$post_type = $post->post_type;
427
-		} elseif ( $typenow ) {
427
+		} elseif ($typenow) {
428 428
 			$post_type = $typenow;
429
-		} elseif ( $current_screen && $current_screen->post_type ) {
429
+		} elseif ($current_screen && $current_screen->post_type) {
430 430
 			$post_type = $current_screen->post_type;
431
-		} elseif ( isset( $_REQUEST['post_type'] ) ) {
432
-			$post_type = sanitize_key( $_REQUEST['post_type'] );
433
-		} elseif ( isset( $_REQUEST['post'] ) ) {
434
-			$post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) );
431
+		} elseif (isset($_REQUEST['post_type'])) {
432
+			$post_type = sanitize_key($_REQUEST['post_type']);
433
+		} elseif (isset($_REQUEST['post'])) {
434
+			$post_type = get_post_type(sanitize_key($_REQUEST['post']));
435 435
 		}
436 436
 		//$post_type = get_post_type();
437
-		if ( false !== $post_type ) {
438
-			$fields[]  = array(
437
+		if (false !== $post_type) {
438
+			$fields[] = array(
439 439
 				'id'   => 'vehicle_title',
440 440
 				'name' => 'Vehicles',
441 441
 				'type' => 'title',
442 442
 				'cols' => 12,
443 443
 			);
444
-			$fields[]  = array(
444
+			$fields[] = array(
445 445
 				'id'         => 'vehicle_to_' . $post_type,
446 446
 				'name'       => 'Vehicles related with this ' . $post_type,
447 447
 				'type'       => 'post_select',
Please login to merge, or discard this patch.