1 | <?php |
||
2 | /** |
||
3 | * Tour Operator - Special 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', 'to-specials' ), |
||
14 | 'pages' => 'special', |
||
15 | 'fields' => array(), |
||
16 | ); |
||
17 | |||
18 | $metabox['fields'][] = array( |
||
19 | 'id' => 'featured', |
||
20 | 'name' => esc_html__( 'Featured', 'to-specials' ), |
||
21 | 'type' => 'checkbox', |
||
22 | ); |
||
23 | |||
24 | $metabox['fields'][] = array( |
||
25 | 'id' => 'disable_single', |
||
26 | 'name' => esc_html__( 'Disable Single', 'to-specials' ), |
||
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', 'to-specials' ), |
||
34 | 'type' => 'text', |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | $metabox['fields'][] = array( |
||
39 | 'id' => 'terms_conditions', |
||
40 | 'name' => esc_html__( 'Terms & Conditions','to-specials' ), |
||
41 | 'type' => 'wysiwyg', |
||
42 | 'options' => array( |
||
43 | 'editor_height' => '100', |
||
44 | ), |
||
45 | ); |
||
46 | |||
47 | if ( class_exists( 'LSX_TO_Team' ) ) { |
||
0 ignored issues
–
show
|
|||
48 | $metabox['fields'][] = array( |
||
49 | 'id' => 'team_to_special', |
||
50 | 'name' => esc_html__( 'Team Member', 'to-specials' ), |
||
51 | 'type' => 'post_select', |
||
52 | 'use_ajax' => false, |
||
53 | 'allow_none' => true, |
||
54 | 'query' => array( |
||
55 | 'post_type' => 'team', |
||
56 | 'nopagin' => true, |
||
57 | 'posts_per_page' => 1000, |
||
0 ignored issues
–
show
|
|||
58 | 'orderby' => 'title', |
||
59 | 'order' => 'ASC', |
||
60 | ), |
||
61 | ); |
||
62 | } |
||
63 | |||
64 | $metabox['fields'][] = array( |
||
65 | 'id' => 'booking_title', |
||
66 | 'name' => esc_html__( 'Booking','to-specials' ), |
||
67 | 'type' => 'title', |
||
68 | ); |
||
69 | |||
70 | $metabox['fields'][] = array( |
||
71 | 'id' => 'price', |
||
72 | 'name' => esc_html__( 'Price','to-specials' ), |
||
73 | 'type' => 'text', |
||
74 | ); |
||
75 | |||
76 | $metabox['fields'][] = array( |
||
77 | 'id' => 'price_type', |
||
0 ignored issues
–
show
|
|||
78 | 'name' => esc_html__( 'Price Type','to-specials' ), |
||
0 ignored issues
–
show
|
|||
79 | 'type' => 'select', |
||
0 ignored issues
–
show
|
|||
80 | 'options' => array( |
||
81 | 'none' => esc_html__( 'Select a type','to-specials' ), |
||
82 | 'per_person' => esc_html__( 'Per Person','to-specials' ), |
||
83 | 'per_person_per_night' => esc_html__( 'Per Person Per Night','to-specials' ), |
||
84 | 'per_person_sharing' => esc_html__( 'Per Person Sharing','to-specials' ), |
||
85 | 'per_person_sharing_per_night' => esc_html__( 'Per Person Sharing Per Night','to-specials' ), |
||
86 | 'total_percentage' => esc_html__( 'Percentage Off Your Price.','to-specials' ), |
||
87 | ), |
||
88 | ); |
||
89 | |||
90 | $metabox['fields'][] = array( |
||
91 | 'id' => 'duration', |
||
92 | 'name' => esc_html__( 'Duration','to-specials' ), |
||
93 | 'type' => 'text', |
||
94 | ); |
||
95 | |||
96 | $metabox['fields'][] = array( |
||
97 | 'id' => 'booking_validity_start', |
||
98 | 'name' => esc_html__( 'Booking Validity (start)','to-specials' ), |
||
99 | 'type' => 'date', |
||
100 | ); |
||
101 | |||
102 | $metabox['fields'][] = array( |
||
103 | 'id' => 'booking_validity_end', |
||
104 | 'name' => esc_html__( 'Booking Validity (end)','to-specials' ), |
||
105 | 'type' => 'date', |
||
106 | ); |
||
107 | |||
108 | $metabox['fields'][] = array( |
||
109 | 'id' => 'expire_post', |
||
110 | 'name' => esc_html__( 'Expire this special automatically', 'to-specials' ), |
||
111 | 'type' => 'checkbox', |
||
112 | ); |
||
113 | |||
114 | $metabox['fields'][] = array( |
||
115 | 'id' => 'travel_dates', |
||
0 ignored issues
–
show
|
|||
116 | 'name' => '', |
||
0 ignored issues
–
show
|
|||
117 | 'single_name' => esc_html__( 'Travel Dates','to-specials' ), |
||
118 | 'type' => 'group', |
||
0 ignored issues
–
show
|
|||
119 | 'repeatable' => true, |
||
120 | 'sortable' => true, |
||
121 | 'fields' => array( |
||
122 | array( |
||
123 | 'id' => 'travel_dates_start', |
||
124 | 'name' => esc_html__( 'Start','to-specials' ), |
||
125 | 'type' => 'date', |
||
126 | ), |
||
127 | array( |
||
128 | 'id' => 'travel_dates_end', |
||
129 | 'name' => esc_html__( 'End','to-specials' ), |
||
130 | 'type' => 'date', |
||
131 | ), |
||
132 | ), |
||
133 | ); |
||
134 | |||
135 | if ( class_exists( 'LSX_TO_Maps' ) ) { |
||
0 ignored issues
–
show
|
|||
136 | $tour_operator = tour_operator(); |
||
137 | $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. ![]() |
|||
138 | |||
139 | if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
||
0 ignored issues
–
show
|
|||
140 | $api_key = $tour_operator->options['api']['googlemaps_key']; |
||
141 | } |
||
142 | |||
143 | $metabox['fields'][] = array( |
||
144 | 'id' => 'location_title', |
||
145 | 'name' => esc_html__( 'Location', 'to-specials' ), |
||
146 | 'type' => 'title', |
||
147 | ); |
||
148 | |||
149 | $metabox['fields'][] = array( |
||
150 | 'id' => 'location', |
||
151 | 'name' => esc_html__( 'Location', 'to-specials' ), |
||
152 | 'type' => 'gmap', |
||
153 | 'google_api_key' => $api_key, |
||
154 | ); |
||
155 | } |
||
156 | |||
157 | $metabox['fields'][] = array( |
||
158 | 'id' => 'gallery_title', |
||
159 | 'name' => esc_html__( 'Gallery', 'to-specials' ), |
||
160 | 'type' => 'title', |
||
161 | ); |
||
162 | |||
163 | $metabox['fields'][] = array( |
||
164 | 'id' => 'gallery', |
||
165 | 'name' => '', |
||
166 | 'type' => 'image', |
||
167 | 'repeatable' => true, |
||
168 | 'show_size' => false, |
||
169 | 'sortable' => true, |
||
170 | 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), |
||
171 | ); |
||
172 | |||
173 | if ( class_exists( 'Envira_Gallery' ) ) { |
||
0 ignored issues
–
show
|
|||
174 | $metabox['fields'][] = array( |
||
175 | 'id' => 'envira_title', |
||
176 | 'name' => esc_html__( 'Envira Gallery', 'to-specials' ), |
||
177 | 'type' => 'title', |
||
178 | ); |
||
179 | |||
180 | $metabox['fields'][] = array( |
||
181 | 'id' => 'envira_gallery', |
||
182 | 'name' => esc_html__( 'Envira Gallery', 'to-specials' ), |
||
183 | 'type' => 'post_select', |
||
184 | 'use_ajax' => false, |
||
185 | 'allow_none' => true, |
||
186 | 'query' => array( |
||
187 | 'post_type' => 'envira', |
||
188 | 'nopagin' => true, |
||
189 | 'posts_per_page' => '-1', |
||
190 | 'orderby' => 'title', |
||
191 | 'order' => 'ASC', |
||
192 | ), |
||
193 | ); |
||
194 | |||
195 | if ( class_exists( 'Envira_Videos' ) ) { |
||
0 ignored issues
–
show
|
|||
196 | $metabox['fields'][] = array( |
||
197 | 'id' => 'envira_video', |
||
198 | 'name' => esc_html__( 'Envira Video Gallery', 'to-specials' ), |
||
199 | 'type' => 'post_select', |
||
200 | 'use_ajax' => false, |
||
201 | 'allow_none' => true, |
||
202 | 'query' => array( |
||
203 | 'post_type' => 'envira', |
||
204 | 'nopagin' => true, |
||
205 | 'posts_per_page' => '-1', |
||
206 | 'orderby' => 'title', |
||
207 | 'order' => 'ASC', |
||
208 | ), |
||
209 | ); |
||
210 | } |
||
211 | } |
||
212 | |||
213 | $post_types = array( |
||
214 | 'post' => esc_html__( 'Posts', 'to-specials' ), |
||
215 | 'accommodation' => esc_html__( 'Accommodation', 'to-specials' ), |
||
216 | 'destination' => esc_html__( 'Destinations', 'to-specials' ), |
||
217 | 'tour' => esc_html__( 'Tours', 'to-specials' ), |
||
218 | ); |
||
219 | |||
220 | foreach ( $post_types as $slug => $label ) { |
||
0 ignored issues
–
show
|
|||
221 | $metabox['fields'][] = array( |
||
222 | 'id' => $slug . '_title', |
||
223 | 'name' => $label, |
||
224 | 'type' => 'title', |
||
225 | ); |
||
226 | |||
227 | $metabox['fields'][] = array( |
||
228 | 'id' => $slug . '_to_special', |
||
229 | 'name' => $label . esc_html__( ' related with this special', 'to-specials' ), |
||
230 | 'type' => 'post_select', |
||
231 | 'use_ajax' => false, |
||
232 | 'repeatable' => true, |
||
233 | 'allow_none' => true, |
||
234 | 'query' => array( |
||
235 | 'post_type' => $slug, |
||
236 | 'nopagin' => true, |
||
237 | 'posts_per_page' => '-1', |
||
238 | 'orderby' => 'title', |
||
239 | 'order' => 'ASC', |
||
240 | ), |
||
241 | ); |
||
242 | } |
||
243 | |||
244 | $metabox['fields'] = apply_filters( 'lsx_to_special_custom_fields', $metabox['fields'] ); |
||
245 | |||
246 | return $metabox; |
||
247 |