@@ -22,18 +22,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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', |