1 | <?php |
||
2 | /** |
||
3 | * Tour Operator - Activity Metabox config |
||
4 | * |
||
5 | * @package tour_operator |
||
6 | * @author LightSpeed |
||
7 | * @license GPL-2.0+ |
||
8 | * @link |
||
9 | * @copyright 2017 LightSpeedDevelopment |
||
10 | */ |
||
11 | |||
12 | $metabox = array( |
||
13 | 'title' => esc_html__( 'Tour Operator Plugin', 'lsx-activities' ), |
||
14 | 'pages' => 'activity', |
||
15 | 'fields' => array(), |
||
16 | ); |
||
17 | |||
18 | $metabox['fields'][] = array( |
||
19 | 'id' => 'featured', |
||
20 | 'name' => esc_html__( 'Featured', 'lsx-activities' ), |
||
21 | 'type' => 'checkbox', |
||
22 | ); |
||
23 | |||
24 | $metabox['fields'][] = array( |
||
25 | 'id' => 'disable_single', |
||
26 | 'name' => esc_html__( 'Disable Single', 'to-reviews' ), |
||
27 | 'type' => 'checkbox', |
||
28 | ); |
||
29 | |||
30 | if ( ! class_exists( 'LSX_Banners' ) ) { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
31 | $metabox['fields'][] = array( |
||
32 | 'id' => 'tagline', |
||
33 | 'name' => esc_html__( 'Tagline', 'lsx-activities' ), |
||
34 | 'type' => 'text', |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | $metabox['fields'][] = array( |
||
39 | 'id' => 'friendly', |
||
0 ignored issues
–
show
|
|||
40 | 'name' => 'Friendly', |
||
0 ignored issues
–
show
|
|||
41 | 'type' => 'select', |
||
0 ignored issues
–
show
|
|||
42 | 'multiple' => true, |
||
43 | 'options' => array( |
||
0 ignored issues
–
show
|
|||
44 | 'business' => esc_html__( 'Business', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
45 | 'children' => esc_html__( 'Children', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
46 | 'disability' => esc_html__( 'Disability', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
47 | 'leisure' => esc_html__( 'Leisure', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
48 | 'luxury' => esc_html__( 'Luxury', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
49 | 'pet' => esc_html__( 'Pet', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
50 | 'romance' => esc_html__( 'Romance', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
51 | 'vegetarian' => esc_html__( 'Vegetarian', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
52 | 'weddings' => esc_html__( 'Weddings', 'lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
53 | ), |
||
54 | ); |
||
55 | |||
56 | if ( class_exists( 'LSX_TO_Team' ) ) { |
||
0 ignored issues
–
show
|
|||
57 | $metabox['fields'][] = array( |
||
58 | 'id' => 'team_to_activity', |
||
59 | 'name' => esc_html__( 'Team Member', 'lsx-activities' ), |
||
60 | 'type' => 'post_select', |
||
61 | 'use_ajax' => false, |
||
62 | 'allow_none' => true, |
||
63 | 'query' => array( |
||
64 | 'post_type' => 'team', |
||
65 | 'nopagin' => true, |
||
66 | 'posts_per_page' => 1000, |
||
0 ignored issues
–
show
|
|||
67 | 'orderby' => 'title', |
||
68 | 'order' => 'ASC', |
||
69 | ), |
||
70 | ); |
||
71 | } |
||
72 | |||
73 | $metabox['fields'][] = array( |
||
74 | 'id' => 'price_title', |
||
0 ignored issues
–
show
|
|||
75 | 'name' => __( 'Price','lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
76 | 'type' => 'title', |
||
0 ignored issues
–
show
|
|||
77 | ); |
||
78 | |||
79 | $metabox['fields'][] = array( |
||
80 | 'id' => 'price', |
||
0 ignored issues
–
show
|
|||
81 | 'name' => __( 'Price','lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
82 | 'type' => 'text', |
||
0 ignored issues
–
show
|
|||
83 | 'cols' => 6, |
||
0 ignored issues
–
show
|
|||
84 | ); |
||
85 | |||
86 | $metabox['fields'][] = array( |
||
87 | 'id' => 'price_type', |
||
0 ignored issues
–
show
|
|||
88 | 'name' => __( 'Price Type','lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
89 | 'type' => 'select', |
||
0 ignored issues
–
show
|
|||
90 | 'cols' => 6, |
||
0 ignored issues
–
show
|
|||
91 | 'options' => array( |
||
0 ignored issues
–
show
|
|||
92 | 'none' => 'Select a type', |
||
0 ignored issues
–
show
|
|||
93 | 'per_person' => __( 'Per Person','lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
94 | 'per_group' => __( 'Per Group','lsx-activities' ), |
||
0 ignored issues
–
show
|
|||
95 | ), |
||
96 | ); |
||
97 | |||
98 | if ( class_exists( 'LSX_TO_Maps' ) ) { |
||
0 ignored issues
–
show
|
|||
99 | $tour_operator = tour_operator(); |
||
100 | $api_key = false; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
101 | |||
102 | if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
||
0 ignored issues
–
show
|
|||
103 | $api_key = $tour_operator->options['api']['googlemaps_key']; |
||
104 | } |
||
105 | |||
106 | $metabox['fields'][] = array( |
||
107 | 'id' => 'location_title', |
||
108 | 'name' => esc_html__( 'Location', 'lsx-activities' ), |
||
109 | 'type' => 'title', |
||
110 | ); |
||
111 | |||
112 | $metabox['fields'][] = array( |
||
113 | 'id' => 'location', |
||
114 | 'name' => esc_html__( 'Location', 'lsx-activities' ), |
||
115 | 'type' => 'gmap', |
||
116 | 'google_api_key' => $api_key, |
||
117 | ); |
||
118 | } |
||
119 | |||
120 | $metabox['fields'][] = array( |
||
121 | 'id' => 'gallery_title', |
||
122 | 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
||
123 | 'type' => 'title', |
||
124 | ); |
||
125 | |||
126 | $metabox['fields'][] = array( |
||
127 | 'id' => 'gallery', |
||
128 | 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
||
129 | 'type' => 'image', |
||
130 | 'repeatable' => true, |
||
131 | 'show_size' => false, |
||
132 | ); |
||
133 | |||
134 | if ( class_exists( 'Envira_Gallery' ) ) { |
||
0 ignored issues
–
show
|
|||
135 | $metabox['fields'][] = array( |
||
136 | 'id' => 'envira_title', |
||
137 | 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
||
138 | 'type' => 'title', |
||
139 | ); |
||
140 | |||
141 | $metabox['fields'][] = array( |
||
142 | 'id' => 'envira_gallery', |
||
143 | 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
||
144 | 'type' => 'post_select', |
||
145 | 'use_ajax' => false, |
||
146 | 'allow_none' => true, |
||
147 | 'query' => array( |
||
148 | 'post_type' => 'envira', |
||
149 | 'nopagin' => true, |
||
150 | 'posts_per_page' => '-1', |
||
151 | 'orderby' => 'title', |
||
152 | 'order' => 'ASC', |
||
153 | ), |
||
154 | ); |
||
155 | |||
156 | if ( class_exists( 'Envira_Videos' ) ) { |
||
0 ignored issues
–
show
|
|||
157 | $metabox['fields'][] = array( |
||
158 | 'id' => 'envira_video', |
||
159 | 'name' => esc_html__( 'Envira Video Gallery', 'lsx-activities' ), |
||
160 | 'type' => 'post_select', |
||
161 | 'use_ajax' => false, |
||
162 | 'allow_none' => true, |
||
163 | 'query' => array( |
||
164 | 'post_type' => 'envira', |
||
165 | 'nopagin' => true, |
||
166 | 'posts_per_page' => '-1', |
||
167 | 'orderby' => 'title', |
||
168 | 'order' => 'ASC', |
||
169 | ), |
||
170 | ); |
||
171 | } |
||
172 | } |
||
173 | |||
174 | $post_types = array( |
||
175 | 'post' => esc_html__( 'Posts', 'lsx-activities' ), |
||
176 | 'accommodation' => esc_html__( 'Accommodation', 'lsx-activities' ), |
||
177 | 'destination' => esc_html__( 'Destinations', 'lsx-activities' ), |
||
178 | 'tour' => esc_html__( 'Tours', 'lsx-activities' ), |
||
179 | ); |
||
180 | |||
181 | foreach ( $post_types as $slug => $label ) { |
||
0 ignored issues
–
show
|
|||
182 | $metabox['fields'][] = array( |
||
183 | 'id' => $slug . '_title', |
||
184 | 'name' => $label, |
||
185 | 'type' => 'title', |
||
186 | ); |
||
187 | |||
188 | $metabox['fields'][] = array( |
||
189 | 'id' => $slug . '_to_activity', |
||
190 | 'name' => $label . esc_html__( ' related with this activity', 'lsx-activities' ), |
||
191 | 'type' => 'post_select', |
||
192 | 'use_ajax' => false, |
||
193 | 'repeatable' => true, |
||
194 | 'allow_none' => true, |
||
195 | 'query' => array( |
||
196 | 'post_type' => $slug, |
||
197 | 'nopagin' => true, |
||
198 | 'posts_per_page' => '-1', |
||
199 | 'orderby' => 'title', |
||
200 | 'order' => 'ASC', |
||
201 | ), |
||
202 | ); |
||
203 | } |
||
204 | |||
205 | $metabox['fields'] = apply_filters( 'lsx_to_activity_custom_fields', $metabox['fields'] ); |
||
206 | |||
207 | return $metabox; |
||
208 |