Issues (1030)

includes/metaboxes/config-activity.php (66 issues)

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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Array double arrow not aligned correctly; expected 7 space(s) between "'id'" and double arrow, but found 1.
Loading history...
40
	'name' => 'Friendly',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'name'" and double arrow, but found 1.
Loading history...
41
	'type' => 'select',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'type'" and double arrow, but found 1.
Loading history...
42
	'multiple' => true,
43
	'options' => array(
0 ignored issues
show
Array double arrow not aligned correctly; expected 2 space(s) between "'options'" and double arrow, but found 1.
Loading history...
44
		'business'		=> esc_html__( 'Business', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 3 space(s) between "'business'" and double arrow, but found 6.
Loading history...
45
		'children'		=> esc_html__( 'Children', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 3 space(s) between "'children'" and double arrow, but found 6.
Loading history...
46
		'disability'	=> esc_html__( 'Disability', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'disability'" and double arrow, but found 4.
Loading history...
47
		'leisure'		=> esc_html__( 'Leisure', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'leisure'" and double arrow, but found 7.
Loading history...
48
		'luxury'		=> esc_html__( 'Luxury', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 5 space(s) between "'luxury'" and double arrow, but found 8.
Loading history...
49
		'pet'			=> esc_html__( 'Pet', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 8 space(s) between "'pet'" and double arrow, but found 11.
Loading history...
50
		'romance'		=> esc_html__( 'Romance', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'romance'" and double arrow, but found 7.
Loading history...
51
		'vegetarian'	=> esc_html__( 'Vegetarian', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'vegetarian'" and double arrow, but found 4.
Loading history...
52
		'weddings'		=> esc_html__( 'Weddings', 'lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 3 space(s) between "'weddings'" and double arrow, but found 6.
Loading history...
53
	),
54
);
55
56
if ( class_exists( 'LSX_TO_Team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Detected high pagination limit, posts_per_page is set to 1000
Loading history...
67
			'orderby'        => 'title',
68
			'order'          => 'ASC',
69
		),
70
	);
71
}
72
73
$metabox['fields'][] = array(
74
	'id' 	=> 'price_title',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 3 space(s) between "'id'" and double arrow, but found 4.
Loading history...
75
	'name' 	=> __( 'Price','lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'name'" and double arrow, but found 2.
Loading history...
76
	'type' 	=> 'title',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'type'" and double arrow, but found 2.
Loading history...
77
);
78
79
$metabox['fields'][] = array(
80
	'id' 	=> 'price',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 3 space(s) between "'id'" and double arrow, but found 4.
Loading history...
81
	'name' 	=> __( 'Price','lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'name'" and double arrow, but found 2.
Loading history...
82
	'type' 	=> 'text',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'type'" and double arrow, but found 2.
Loading history...
83
	'cols'       => 6,
0 ignored issues
show
Array double arrow not aligned correctly; expected 1 space(s) between "'cols'" and double arrow, but found 7.
Loading history...
84
);
85
86
$metabox['fields'][] = array(
87
	'id'		=> 'price_type',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 6 space(s) between "'id'" and double arrow, but found 8.
Loading history...
88
	'name'		=> __( 'Price Type','lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'name'" and double arrow, but found 6.
Loading history...
89
	'type'		=> 'select',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'type'" and double arrow, but found 6.
Loading history...
90
	'cols'       => 6,
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'cols'" and double arrow, but found 7.
Loading history...
91
	'options'	=> array(
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'options'" and double arrow, but found 3.
Loading history...
92
		'none' 			=> 'Select a type',
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 7 space(s) between "'none'" and double arrow, but found 10.
Loading history...
93
		'per_person'	=> __( 'Per Person','lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 1 space(s) between "'per_person'" and double arrow, but found 4.
Loading history...
94
		'per_group'		=> __( 'Per Group','lsx-activities' ),
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
Array double arrow not aligned correctly; expected 2 space(s) between "'per_group'" and double arrow, but found 5.
Loading history...
95
	),
96
);
97
98
if ( class_exists( 'LSX_TO_Maps' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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.

Loading history...
101
102
	if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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