Completed
Branch master (4da4d0)
by
unknown
80:57 queued 72:27
created
core/helpers/EEH_Schema.helper.php 2 patches
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -12,296 +12,296 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * generates JSON-based linked data for an event
17
-     *
18
-     * @param EE_Event $event
19
-     * @throws EE_Error
20
-     */
21
-    public static function add_json_linked_data_for_event(EE_Event $event)
22
-    {
23
-        // Check we have a valid datetime for the event
24
-        if (! $event->primary_datetime() instanceof EE_Datetime) {
25
-            return;
26
-        }
27
-
28
-        $template_args = array(
29
-            'event_permalink' => '',
30
-            'event_name' => '',
31
-            'event_description' => '',
32
-            'event_start' => '',
33
-            'event_end' => '',
34
-            'event_attendance_mode' => '',
35
-            'event_status' => '',
36
-            'currency' => '',
37
-            'event_tickets' => array(),
38
-            'venue_name' => '',
39
-            'venue_url' => '',
40
-            'venue_locality' => '',
41
-            'venue_region' => '',
42
-            'venue_address' => '',
43
-            'event_image' => '',
44
-        );
45
-        $template_args['event_permalink'] = $event->get_permalink();
46
-        $template_args['event_name'] = $event->name();
47
-        $template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
48
-        // clone datetime so that date formats don't override those for the original datetime
49
-        $primary_datetime = clone $event->primary_datetime();
50
-        $template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
51
-        $template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
52
-        unset($primary_datetime);
53
-        switch ($event->status()) {
54
-            case EEM_Event::cancelled:
55
-                $event_status = 'EventCancelled';
56
-                break;
57
-            case EEM_Event::postponed:
58
-                $event_status = 'EventPostponed';
59
-                break;
60
-            default:
61
-                $event_status = 'EventScheduled';
62
-        }
63
-        $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
64
-        $template_args['event_status'] = '"https://schema.org/' . $event_status . '"';
65
-        $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
66
-        foreach ($event->tickets() as $original_ticket) {
67
-            // clone tickets so that date formats don't override those for the original ticket
68
-            $ticket= clone $original_ticket;
69
-            $ID = $ticket->ID();
70
-            $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
-            $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
-            $template_args['event_tickets'][ $ID ]['price'] = number_format(
73
-                $ticket->price(),
74
-                EE_Registry::instance()->CFG->currency->dec_plc,
75
-                EE_Registry::instance()->CFG->currency->dec_mrk,
76
-                ''
77
-            );
78
-            switch ($ticket->ticket_status()) {
79
-                case 'TKO':
80
-                    $availability = 'InStock';
81
-                    break;
82
-                case 'TKS':
83
-                    $availability = 'SoldOut';
84
-                    break;
85
-                default:
86
-                    $availability = null;
87
-                    break;
88
-            }
89
-            $template_args['event_tickets'][ $ID ]['availability'] = $availability;
90
-            unset($ticket);
91
-        }
92
-        $VNU_ID = espresso_venue_id();
93
-        if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
94
-            $venue = EEH_Venue_View::get_venue($VNU_ID);
95
-            $template_args['venue_name'] = get_the_title($VNU_ID);
96
-            $template_args['venue_url'] = get_permalink($VNU_ID);
97
-            $template_args['venue_locality'] = $venue->city();
98
-            $template_args['venue_region'] = $venue->state_name();
99
-            $template_args['venue_address'] = $venue->address();
100
-            if ($venue->virtual_url() !== '') {
101
-                $template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode';
102
-            }
103
-            if ($venue->virtual_url() !== '' && $venue->address() !== '') {
104
-                $template_args['event_attendance_mode'] = 'MixedEventAttendanceMode';
105
-            }
106
-        }
107
-        $template_args['event_image'] = $event->feature_image_url();
108
-        $template_args = apply_filters(
109
-            'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
110
-            $template_args,
111
-            $event,
112
-            $VNU_ID
113
-        );
114
-        extract($template_args, EXTR_OVERWRITE);
115
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
116
-    }
117
-
118
-
119
-    /**
120
-     *    location
121
-     *    The location of the event, organization or action.
122
-     *    Should include the Venue name AND schema formatted address info
123
-     *
124
-     * @access public
125
-     * @param string $location
126
-     * @return string
127
-     */
128
-    public static function location($location = null)
129
-    {
130
-        return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
131
-                                      . $location
132
-                                      . '</div>' : '';
133
-    }
134
-
135
-
136
-
137
-    /**
138
-     *    name
139
-     *    The name of the Event or Venue.
140
-     *
141
-     * @access public
142
-     * @param string $name
143
-     * @return string
144
-     */
145
-    public static function name($name = null)
146
-    {
147
-        return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
148
-    }
149
-
150
-
151
-
152
-    /**
153
-     *    streetAddress
154
-     *    The street address. For example, 1600 Amphitheatre Pkwy.
155
-     *
156
-     * @access public
157
-     * @param EEI_Address $obj_with_address
158
-     * @return string
159
-     */
160
-    public static function streetAddress(EEI_Address $obj_with_address = null)
161
-    {
162
-        return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
163
-            ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
164
-    }
165
-
166
-
167
-
168
-    /**
169
-     *    postOfficeBoxNumber
170
-     *    The post office box number for PO box addresses.
171
-     *
172
-     * @access public
173
-     * @param EEI_Address $obj_with_address
174
-     * @return string
175
-     */
176
-    public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
177
-    {
178
-        // regex check for some form of PO Box or P.O. Box, etc, etc, etc
179
-        if (preg_match(
180
-            "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
181
-            $obj_with_address->address2()
182
-        ) ) {
183
-            return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
184
-                ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
185
-        } else {
186
-            return $obj_with_address->address2();
187
-        }
188
-    }
189
-
190
-
191
-
192
-    /**
193
-     *    addressLocality
194
-     *    The locality (city, town, etc). For example, Mountain View.
195
-     *
196
-     * @access public
197
-     * @param EEI_Address $obj_with_address
198
-     * @return string
199
-     */
200
-    public static function addressLocality(EEI_Address $obj_with_address = null)
201
-    {
202
-        return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
203
-            ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
204
-    }
205
-
206
-
207
-
208
-    /**
209
-     *    addressRegion
210
-     *    The region (state, province, etc). For example, CA.
211
-     *
212
-     * @access public
213
-     * @param EEI_Address $obj_with_address
214
-     * @return string
215
-     */
216
-    public static function addressRegion(EEI_Address $obj_with_address = null)
217
-    {
218
-        $state = $obj_with_address->state_name();
219
-        if (! empty($state)) {
220
-            return '<span itemprop="addressRegion">' . $state . '</span>';
221
-        } else {
222
-            return '';
223
-        }
224
-    }
225
-
226
-
227
-
228
-    /**
229
-     *    addressCountry
230
-     *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
231
-     *
232
-     * @access public
233
-     * @param EEI_Address $obj_with_address
234
-     * @return string
235
-     */
236
-    public static function addressCountry(EEI_Address $obj_with_address = null)
237
-    {
238
-        $country = $obj_with_address->country_name();
239
-        if (! empty($country)) {
240
-            return '<span itemprop="addressCountry">' . $country . '</span>';
241
-        } else {
242
-            return '';
243
-        }
244
-    }
245
-
246
-
247
-
248
-    /**
249
-     *    postalCode
250
-     *    The postal code. For example, 94043.
251
-     *
252
-     * @access public
253
-     * @param EEI_Address $obj_with_address
254
-     * @return string
255
-     */
256
-    public static function postalCode(EEI_Address $obj_with_address = null)
257
-    {
258
-        return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
259
-                                                                                      . $obj_with_address->zip()
260
-                                                                                      . '</span>' : '';
261
-    }
262
-
263
-
264
-
265
-    /**
266
-     *    telephone
267
-     *    The telephone number.
268
-     *
269
-     * @access public
270
-     * @param string $phone_nmbr
271
-     * @return string
272
-     */
273
-    public static function telephone($phone_nmbr = null)
274
-    {
275
-        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
276
-            : '';
277
-    }
278
-
279
-
280
-
281
-    /**
282
-     *    URL
283
-     *    URL of the item as a clickable link
284
-     *
285
-     * @access public
286
-     * @param string $url        - the URL that the link will resolve to
287
-     * @param string $text       - the text that will be used for the visible link
288
-     * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
289
-     * @return string (link)
290
-     */
291
-    public static function url($url = null, $text = null, $attributes = array())
292
-    {
293
-        // Check the URL includes a scheme
294
-        $parsed_url = parse_url($url);
295
-        if (empty($parsed_url['scheme'])) {
296
-            $url = 'http://' . ltrim($url, '/');
297
-        }
298
-
299
-        $atts = '';
300
-        foreach ($attributes as $attribute => $value) {
301
-            $atts .= ' ' . $attribute . '="' . $value . '"';
302
-        }
303
-        $text = $text !== null && $text !== '' ? $text : $url;
304
-        return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
305
-            : '';
306
-    }
15
+	/**
16
+	 * generates JSON-based linked data for an event
17
+	 *
18
+	 * @param EE_Event $event
19
+	 * @throws EE_Error
20
+	 */
21
+	public static function add_json_linked_data_for_event(EE_Event $event)
22
+	{
23
+		// Check we have a valid datetime for the event
24
+		if (! $event->primary_datetime() instanceof EE_Datetime) {
25
+			return;
26
+		}
27
+
28
+		$template_args = array(
29
+			'event_permalink' => '',
30
+			'event_name' => '',
31
+			'event_description' => '',
32
+			'event_start' => '',
33
+			'event_end' => '',
34
+			'event_attendance_mode' => '',
35
+			'event_status' => '',
36
+			'currency' => '',
37
+			'event_tickets' => array(),
38
+			'venue_name' => '',
39
+			'venue_url' => '',
40
+			'venue_locality' => '',
41
+			'venue_region' => '',
42
+			'venue_address' => '',
43
+			'event_image' => '',
44
+		);
45
+		$template_args['event_permalink'] = $event->get_permalink();
46
+		$template_args['event_name'] = $event->name();
47
+		$template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
48
+		// clone datetime so that date formats don't override those for the original datetime
49
+		$primary_datetime = clone $event->primary_datetime();
50
+		$template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
51
+		$template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
52
+		unset($primary_datetime);
53
+		switch ($event->status()) {
54
+			case EEM_Event::cancelled:
55
+				$event_status = 'EventCancelled';
56
+				break;
57
+			case EEM_Event::postponed:
58
+				$event_status = 'EventPostponed';
59
+				break;
60
+			default:
61
+				$event_status = 'EventScheduled';
62
+		}
63
+		$template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
64
+		$template_args['event_status'] = '"https://schema.org/' . $event_status . '"';
65
+		$template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
66
+		foreach ($event->tickets() as $original_ticket) {
67
+			// clone tickets so that date formats don't override those for the original ticket
68
+			$ticket= clone $original_ticket;
69
+			$ID = $ticket->ID();
70
+			$template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
+			$template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
+			$template_args['event_tickets'][ $ID ]['price'] = number_format(
73
+				$ticket->price(),
74
+				EE_Registry::instance()->CFG->currency->dec_plc,
75
+				EE_Registry::instance()->CFG->currency->dec_mrk,
76
+				''
77
+			);
78
+			switch ($ticket->ticket_status()) {
79
+				case 'TKO':
80
+					$availability = 'InStock';
81
+					break;
82
+				case 'TKS':
83
+					$availability = 'SoldOut';
84
+					break;
85
+				default:
86
+					$availability = null;
87
+					break;
88
+			}
89
+			$template_args['event_tickets'][ $ID ]['availability'] = $availability;
90
+			unset($ticket);
91
+		}
92
+		$VNU_ID = espresso_venue_id();
93
+		if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
94
+			$venue = EEH_Venue_View::get_venue($VNU_ID);
95
+			$template_args['venue_name'] = get_the_title($VNU_ID);
96
+			$template_args['venue_url'] = get_permalink($VNU_ID);
97
+			$template_args['venue_locality'] = $venue->city();
98
+			$template_args['venue_region'] = $venue->state_name();
99
+			$template_args['venue_address'] = $venue->address();
100
+			if ($venue->virtual_url() !== '') {
101
+				$template_args['event_attendance_mode'] = 'OnlineEventAttendanceMode';
102
+			}
103
+			if ($venue->virtual_url() !== '' && $venue->address() !== '') {
104
+				$template_args['event_attendance_mode'] = 'MixedEventAttendanceMode';
105
+			}
106
+		}
107
+		$template_args['event_image'] = $event->feature_image_url();
108
+		$template_args = apply_filters(
109
+			'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
110
+			$template_args,
111
+			$event,
112
+			$VNU_ID
113
+		);
114
+		extract($template_args, EXTR_OVERWRITE);
115
+		include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
116
+	}
117
+
118
+
119
+	/**
120
+	 *    location
121
+	 *    The location of the event, organization or action.
122
+	 *    Should include the Venue name AND schema formatted address info
123
+	 *
124
+	 * @access public
125
+	 * @param string $location
126
+	 * @return string
127
+	 */
128
+	public static function location($location = null)
129
+	{
130
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
131
+									  . $location
132
+									  . '</div>' : '';
133
+	}
134
+
135
+
136
+
137
+	/**
138
+	 *    name
139
+	 *    The name of the Event or Venue.
140
+	 *
141
+	 * @access public
142
+	 * @param string $name
143
+	 * @return string
144
+	 */
145
+	public static function name($name = null)
146
+	{
147
+		return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
148
+	}
149
+
150
+
151
+
152
+	/**
153
+	 *    streetAddress
154
+	 *    The street address. For example, 1600 Amphitheatre Pkwy.
155
+	 *
156
+	 * @access public
157
+	 * @param EEI_Address $obj_with_address
158
+	 * @return string
159
+	 */
160
+	public static function streetAddress(EEI_Address $obj_with_address = null)
161
+	{
162
+		return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
163
+			? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
164
+	}
165
+
166
+
167
+
168
+	/**
169
+	 *    postOfficeBoxNumber
170
+	 *    The post office box number for PO box addresses.
171
+	 *
172
+	 * @access public
173
+	 * @param EEI_Address $obj_with_address
174
+	 * @return string
175
+	 */
176
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
177
+	{
178
+		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
179
+		if (preg_match(
180
+			"/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
181
+			$obj_with_address->address2()
182
+		) ) {
183
+			return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
184
+				? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
185
+		} else {
186
+			return $obj_with_address->address2();
187
+		}
188
+	}
189
+
190
+
191
+
192
+	/**
193
+	 *    addressLocality
194
+	 *    The locality (city, town, etc). For example, Mountain View.
195
+	 *
196
+	 * @access public
197
+	 * @param EEI_Address $obj_with_address
198
+	 * @return string
199
+	 */
200
+	public static function addressLocality(EEI_Address $obj_with_address = null)
201
+	{
202
+		return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
203
+			? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
204
+	}
205
+
206
+
207
+
208
+	/**
209
+	 *    addressRegion
210
+	 *    The region (state, province, etc). For example, CA.
211
+	 *
212
+	 * @access public
213
+	 * @param EEI_Address $obj_with_address
214
+	 * @return string
215
+	 */
216
+	public static function addressRegion(EEI_Address $obj_with_address = null)
217
+	{
218
+		$state = $obj_with_address->state_name();
219
+		if (! empty($state)) {
220
+			return '<span itemprop="addressRegion">' . $state . '</span>';
221
+		} else {
222
+			return '';
223
+		}
224
+	}
225
+
226
+
227
+
228
+	/**
229
+	 *    addressCountry
230
+	 *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
231
+	 *
232
+	 * @access public
233
+	 * @param EEI_Address $obj_with_address
234
+	 * @return string
235
+	 */
236
+	public static function addressCountry(EEI_Address $obj_with_address = null)
237
+	{
238
+		$country = $obj_with_address->country_name();
239
+		if (! empty($country)) {
240
+			return '<span itemprop="addressCountry">' . $country . '</span>';
241
+		} else {
242
+			return '';
243
+		}
244
+	}
245
+
246
+
247
+
248
+	/**
249
+	 *    postalCode
250
+	 *    The postal code. For example, 94043.
251
+	 *
252
+	 * @access public
253
+	 * @param EEI_Address $obj_with_address
254
+	 * @return string
255
+	 */
256
+	public static function postalCode(EEI_Address $obj_with_address = null)
257
+	{
258
+		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
259
+																					  . $obj_with_address->zip()
260
+																					  . '</span>' : '';
261
+	}
262
+
263
+
264
+
265
+	/**
266
+	 *    telephone
267
+	 *    The telephone number.
268
+	 *
269
+	 * @access public
270
+	 * @param string $phone_nmbr
271
+	 * @return string
272
+	 */
273
+	public static function telephone($phone_nmbr = null)
274
+	{
275
+		return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
276
+			: '';
277
+	}
278
+
279
+
280
+
281
+	/**
282
+	 *    URL
283
+	 *    URL of the item as a clickable link
284
+	 *
285
+	 * @access public
286
+	 * @param string $url        - the URL that the link will resolve to
287
+	 * @param string $text       - the text that will be used for the visible link
288
+	 * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
289
+	 * @return string (link)
290
+	 */
291
+	public static function url($url = null, $text = null, $attributes = array())
292
+	{
293
+		// Check the URL includes a scheme
294
+		$parsed_url = parse_url($url);
295
+		if (empty($parsed_url['scheme'])) {
296
+			$url = 'http://' . ltrim($url, '/');
297
+		}
298
+
299
+		$atts = '';
300
+		foreach ($attributes as $attribute => $value) {
301
+			$atts .= ' ' . $attribute . '="' . $value . '"';
302
+		}
303
+		$text = $text !== null && $text !== '' ? $text : $url;
304
+		return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
305
+			: '';
306
+	}
307 307
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public static function add_json_linked_data_for_event(EE_Event $event)
22 22
     {
23 23
         // Check we have a valid datetime for the event
24
-        if (! $event->primary_datetime() instanceof EE_Datetime) {
24
+        if ( ! $event->primary_datetime() instanceof EE_Datetime) {
25 25
             return;
26 26
         }
27 27
 
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
                 $event_status = 'EventScheduled';
62 62
         }
63 63
         $template_args['event_attendance_mode'] = 'OfflineEventAttendanceMode';
64
-        $template_args['event_status'] = '"https://schema.org/' . $event_status . '"';
64
+        $template_args['event_status'] = '"https://schema.org/'.$event_status.'"';
65 65
         $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
66 66
         foreach ($event->tickets() as $original_ticket) {
67 67
             // clone tickets so that date formats don't override those for the original ticket
68
-            $ticket= clone $original_ticket;
68
+            $ticket = clone $original_ticket;
69 69
             $ID = $ticket->ID();
70
-            $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
-            $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
-            $template_args['event_tickets'][ $ID ]['price'] = number_format(
70
+            $template_args['event_tickets'][$ID]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
71
+            $template_args['event_tickets'][$ID]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
72
+            $template_args['event_tickets'][$ID]['price'] = number_format(
73 73
                 $ticket->price(),
74 74
                 EE_Registry::instance()->CFG->currency->dec_plc,
75 75
                 EE_Registry::instance()->CFG->currency->dec_mrk,
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                     $availability = null;
87 87
                     break;
88 88
             }
89
-            $template_args['event_tickets'][ $ID ]['availability'] = $availability;
89
+            $template_args['event_tickets'][$ID]['availability'] = $availability;
90 90
             unset($ticket);
91 91
         }
92 92
         $VNU_ID = espresso_venue_id();
93
-        if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
93
+        if ( ! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
94 94
             $venue = EEH_Venue_View::get_venue($VNU_ID);
95 95
             $template_args['venue_name'] = get_the_title($VNU_ID);
96 96
             $template_args['venue_url'] = get_permalink($VNU_ID);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $VNU_ID
113 113
         );
114 114
         extract($template_args, EXTR_OVERWRITE);
115
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
115
+        include EE_TEMPLATES.'json_linked_data_for_event.template.php';
116 116
     }
117 117
 
118 118
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function name($name = null)
146 146
     {
147
-        return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
147
+        return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
148 148
     }
149 149
 
150 150
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public static function streetAddress(EEI_Address $obj_with_address = null)
161 161
     {
162 162
         return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
163
-            ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
163
+            ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
164 164
     }
165 165
 
166 166
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
         if (preg_match(
180 180
             "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
181 181
             $obj_with_address->address2()
182
-        ) ) {
182
+        )) {
183 183
             return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
184
-                ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
184
+                ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
185 185
         } else {
186 186
             return $obj_with_address->address2();
187 187
         }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     public static function addressLocality(EEI_Address $obj_with_address = null)
201 201
     {
202 202
         return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
203
-            ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
203
+            ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
204 204
     }
205 205
 
206 206
 
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
     public static function addressRegion(EEI_Address $obj_with_address = null)
217 217
     {
218 218
         $state = $obj_with_address->state_name();
219
-        if (! empty($state)) {
220
-            return '<span itemprop="addressRegion">' . $state . '</span>';
219
+        if ( ! empty($state)) {
220
+            return '<span itemprop="addressRegion">'.$state.'</span>';
221 221
         } else {
222 222
             return '';
223 223
         }
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
     public static function addressCountry(EEI_Address $obj_with_address = null)
237 237
     {
238 238
         $country = $obj_with_address->country_name();
239
-        if (! empty($country)) {
240
-            return '<span itemprop="addressCountry">' . $country . '</span>';
239
+        if ( ! empty($country)) {
240
+            return '<span itemprop="addressCountry">'.$country.'</span>';
241 241
         } else {
242 242
             return '';
243 243
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      */
273 273
     public static function telephone($phone_nmbr = null)
274 274
     {
275
-        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
275
+        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>'
276 276
             : '';
277 277
     }
278 278
 
@@ -293,15 +293,15 @@  discard block
 block discarded – undo
293 293
         // Check the URL includes a scheme
294 294
         $parsed_url = parse_url($url);
295 295
         if (empty($parsed_url['scheme'])) {
296
-            $url = 'http://' . ltrim($url, '/');
296
+            $url = 'http://'.ltrim($url, '/');
297 297
         }
298 298
 
299 299
         $atts = '';
300 300
         foreach ($attributes as $attribute => $value) {
301
-            $atts .= ' ' . $attribute . '="' . $value . '"';
301
+            $atts .= ' '.$attribute.'="'.$value.'"';
302 302
         }
303 303
         $text = $text !== null && $text !== '' ? $text : $url;
304
-        return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
304
+        return $url !== null && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>'
305 305
             : '';
306 306
     }
307 307
 }
Please login to merge, or discard this patch.
core/templates/json_linked_data_for_event.template.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
   "eventStatus": [ <?php echo $event_status; ?> ],
29 29
   "offers": [
30 30
     <?php
31
-    $i = 0;
32
-    foreach ($event_tickets as $ticket) {?>
31
+	$i = 0;
32
+	foreach ($event_tickets as $ticket) {?>
33 33
     {
34 34
       "@type": "Offer",
35 35
       "url": "<?php echo $event_permalink; ?>",
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
       "price": "<?php echo $ticket['price']; ?>",
39 39
       "priceCurrency": "<?php echo $currency; ?>"
40 40
         <?php if (isset($ticket['availability'])) {
41
-            ?>,"availability": "http://schema.org/<?php echo $ticket['availability']; ?>"
41
+			?>,"availability": "http://schema.org/<?php echo $ticket['availability']; ?>"
42 42
         <?php } ?>
43 43
     }<?php
44
-    $i++;
45
-    if ($i < count($event_tickets)) {
46
-        echo ',';
47
-    }
48
-    }
49
-    ?>
44
+	$i++;
45
+	if ($i < count($event_tickets)) {
46
+		echo ',';
47
+	}
48
+	}
49
+	?>
50 50
     ]<?php
51
-    if ($venue_name) {
52
-        ?>,
51
+	if ($venue_name) {
52
+		?>,
53 53
   "location": {
54 54
     "@type": "Place",
55 55
     "name": <?php echo wp_json_encode($venue_name); ?>,
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
     }
63 63
   }
64 64
     <?php
65
-    } ?>
65
+	} ?>
66 66
     <?php
67
-    if ($event_image) {
68
-        ?>,
67
+	if ($event_image) {
68
+		?>,
69 69
   "image": "<?php echo $event_image; ?>"
70 70
     <?php
71
-    } ?>
71
+	} ?>
72 72
     <?php do_action('AHEE__json_linked_data_for_event__template'); ?>
73 73
 }
74 74
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.10.7.rc.002');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.10.7.rc.002');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.