Completed
Branch master (4a9548)
by
unknown
61:50 queued 53:14
created
venues/templates/venue_virtual_location_metabox_content.template.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
                         <?php esc_html_e('URL of Event:', 'event_espresso'); ?>
8 8
                     </label>
9 9
                     <?php //phpcs:disable Generic.Files.LineLength.TooLong
10
-                    // no new lines within <textarea> here because they'll output whitespace ?>
10
+					// no new lines within <textarea> here because they'll output whitespace ?>
11 11
                     <textarea id="url-event" cols="30" rows="4" tabindex="112" name="vnu_virtual_url"><?php $_venue->f('VNU_virtual_url'); ?></textarea>
12 12
                     <?php //phpcs:enable ?>
13 13
                 </p>
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.5.rc.005');
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.5.rc.005');
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.
core/helpers/EEH_Schema.helper.php 1 patch
Indentation   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -12,288 +12,288 @@
 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_status' => '',
35
-            'currency' => '',
36
-            'event_tickets' => array(),
37
-            'venue_name' => '',
38
-            'venue_url' => '',
39
-            'venue_locality' => '',
40
-            'venue_region' => '',
41
-            'venue_address' => '',
42
-            'event_image' => '',
43
-        );
44
-        $template_args['event_permalink'] = $event->get_permalink();
45
-        $template_args['event_name'] = $event->name();
46
-        $template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
47
-        // clone datetime so that date formats don't override those for the original datetime
48
-        $primary_datetime = clone $event->primary_datetime();
49
-        $template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
50
-        $template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
51
-        unset($primary_datetime);
52
-        switch ($event->status()) {
53
-            case EEM_Event::cancelled:
54
-                $event_status = 'EventCancelled';
55
-                break;
56
-            case EEM_Event::postponed:
57
-                $event_status = 'EventPostponed';
58
-                break;
59
-            default:
60
-                $event_status = 'EventScheduled';
61
-        }
62
-        $template_args['event_status'] = $event_status;
63
-        $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
64
-        foreach ($event->tickets() as $original_ticket) {
65
-            // clone tickets so that date formats don't override those for the original ticket
66
-            $ticket= clone $original_ticket;
67
-            $ID = $ticket->ID();
68
-            $template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
69
-            $template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
70
-            $template_args['event_tickets'][ $ID ]['price'] = number_format(
71
-                $ticket->price(),
72
-                EE_Registry::instance()->CFG->currency->dec_plc,
73
-                EE_Registry::instance()->CFG->currency->dec_mrk,
74
-                ''
75
-            );
76
-            switch ($ticket->ticket_status()) {
77
-                case 'TKO':
78
-                    $availability = 'InStock';
79
-                    break;
80
-                case 'TKS':
81
-                    $availability = 'SoldOut';
82
-                    break;
83
-                default:
84
-                    $availability = null;
85
-                    break;
86
-            }
87
-            $template_args['event_tickets'][ $ID ]['availability'] = $availability;
88
-            unset($ticket);
89
-        }
90
-        $VNU_ID = espresso_venue_id();
91
-        if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
92
-            $venue = EEH_Venue_View::get_venue($VNU_ID);
93
-            $template_args['venue_name'] = get_the_title($VNU_ID);
94
-            $template_args['venue_url'] = get_permalink($VNU_ID);
95
-            $template_args['venue_locality'] = $venue->city();
96
-            $template_args['venue_region'] = $venue->state_name();
97
-            $template_args['venue_address'] = $venue->address();
98
-        }
99
-        $template_args['event_image'] = $event->feature_image_url();
100
-        $template_args = apply_filters(
101
-            'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
102
-            $template_args,
103
-            $event,
104
-            $VNU_ID
105
-        );
106
-        extract($template_args, EXTR_OVERWRITE);
107
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
108
-    }
109
-
110
-
111
-    /**
112
-     *    location
113
-     *    The location of the event, organization or action.
114
-     *    Should include the Venue name AND schema formatted address info
115
-     *
116
-     * @access public
117
-     * @param string $location
118
-     * @return string
119
-     */
120
-    public static function location($location = null)
121
-    {
122
-        return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
123
-                                      . $location
124
-                                      . '</div>' : '';
125
-    }
126
-
127
-
128
-
129
-    /**
130
-     *    name
131
-     *    The name of the Event or Venue.
132
-     *
133
-     * @access public
134
-     * @param string $name
135
-     * @return string
136
-     */
137
-    public static function name($name = null)
138
-    {
139
-        return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
140
-    }
141
-
142
-
143
-
144
-    /**
145
-     *    streetAddress
146
-     *    The street address. For example, 1600 Amphitheatre Pkwy.
147
-     *
148
-     * @access public
149
-     * @param EEI_Address $obj_with_address
150
-     * @return string
151
-     */
152
-    public static function streetAddress(EEI_Address $obj_with_address = null)
153
-    {
154
-        return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
155
-            ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
156
-    }
157
-
158
-
159
-
160
-    /**
161
-     *    postOfficeBoxNumber
162
-     *    The post office box number for PO box addresses.
163
-     *
164
-     * @access public
165
-     * @param EEI_Address $obj_with_address
166
-     * @return string
167
-     */
168
-    public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
169
-    {
170
-        // regex check for some form of PO Box or P.O. Box, etc, etc, etc
171
-        if (preg_match(
172
-            "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
173
-            $obj_with_address->address2()
174
-        ) ) {
175
-            return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
176
-                ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
177
-        } else {
178
-            return $obj_with_address->address2();
179
-        }
180
-    }
181
-
182
-
183
-
184
-    /**
185
-     *    addressLocality
186
-     *    The locality (city, town, etc). For example, Mountain View.
187
-     *
188
-     * @access public
189
-     * @param EEI_Address $obj_with_address
190
-     * @return string
191
-     */
192
-    public static function addressLocality(EEI_Address $obj_with_address = null)
193
-    {
194
-        return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
195
-            ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     *    addressRegion
202
-     *    The region (state, province, etc). For example, CA.
203
-     *
204
-     * @access public
205
-     * @param EEI_Address $obj_with_address
206
-     * @return string
207
-     */
208
-    public static function addressRegion(EEI_Address $obj_with_address = null)
209
-    {
210
-        $state = $obj_with_address->state_name();
211
-        if (! empty($state)) {
212
-            return '<span itemprop="addressRegion">' . $state . '</span>';
213
-        } else {
214
-            return '';
215
-        }
216
-    }
217
-
218
-
219
-
220
-    /**
221
-     *    addressCountry
222
-     *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
223
-     *
224
-     * @access public
225
-     * @param EEI_Address $obj_with_address
226
-     * @return string
227
-     */
228
-    public static function addressCountry(EEI_Address $obj_with_address = null)
229
-    {
230
-        $country = $obj_with_address->country_name();
231
-        if (! empty($country)) {
232
-            return '<span itemprop="addressCountry">' . $country . '</span>';
233
-        } else {
234
-            return '';
235
-        }
236
-    }
237
-
238
-
239
-
240
-    /**
241
-     *    postalCode
242
-     *    The postal code. For example, 94043.
243
-     *
244
-     * @access public
245
-     * @param EEI_Address $obj_with_address
246
-     * @return string
247
-     */
248
-    public static function postalCode(EEI_Address $obj_with_address = null)
249
-    {
250
-        return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
251
-                                                                                      . $obj_with_address->zip()
252
-                                                                                      . '</span>' : '';
253
-    }
254
-
255
-
256
-
257
-    /**
258
-     *    telephone
259
-     *    The telephone number.
260
-     *
261
-     * @access public
262
-     * @param string $phone_nmbr
263
-     * @return string
264
-     */
265
-    public static function telephone($phone_nmbr = null)
266
-    {
267
-        return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
268
-            : '';
269
-    }
270
-
271
-
272
-
273
-    /**
274
-     *    URL
275
-     *    URL of the item as a clickable link
276
-     *
277
-     * @access public
278
-     * @param string $url        - the URL that the link will resolve to
279
-     * @param string $text       - the text that will be used for the visible link
280
-     * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
281
-     * @return string (link)
282
-     */
283
-    public static function url($url = null, $text = null, $attributes = array())
284
-    {
285
-        // Check the URL includes a scheme
286
-        $parsed_url = parse_url($url);
287
-        if (empty($parsed_url['scheme'])) {
288
-            $url = 'http://' . ltrim($url, '/');
289
-        }
290
-
291
-        $atts = '';
292
-        foreach ($attributes as $attribute => $value) {
293
-            $atts .= ' ' . $attribute . '="' . $value . '"';
294
-        }
295
-        $text = $text !== null && $text !== '' ? $text : $url;
296
-        return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
297
-            : '';
298
-    }
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_status' => '',
35
+			'currency' => '',
36
+			'event_tickets' => array(),
37
+			'venue_name' => '',
38
+			'venue_url' => '',
39
+			'venue_locality' => '',
40
+			'venue_region' => '',
41
+			'venue_address' => '',
42
+			'event_image' => '',
43
+		);
44
+		$template_args['event_permalink'] = $event->get_permalink();
45
+		$template_args['event_name'] = $event->name();
46
+		$template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
47
+		// clone datetime so that date formats don't override those for the original datetime
48
+		$primary_datetime = clone $event->primary_datetime();
49
+		$template_args['event_start'] = $primary_datetime->start_date(DateTime::ATOM);
50
+		$template_args['event_end'] = $primary_datetime->end_date(DateTime::ATOM);
51
+		unset($primary_datetime);
52
+		switch ($event->status()) {
53
+			case EEM_Event::cancelled:
54
+				$event_status = 'EventCancelled';
55
+				break;
56
+			case EEM_Event::postponed:
57
+				$event_status = 'EventPostponed';
58
+				break;
59
+			default:
60
+				$event_status = 'EventScheduled';
61
+		}
62
+		$template_args['event_status'] = $event_status;
63
+		$template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
64
+		foreach ($event->tickets() as $original_ticket) {
65
+			// clone tickets so that date formats don't override those for the original ticket
66
+			$ticket= clone $original_ticket;
67
+			$ID = $ticket->ID();
68
+			$template_args['event_tickets'][ $ID ]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
69
+			$template_args['event_tickets'][ $ID ]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
70
+			$template_args['event_tickets'][ $ID ]['price'] = number_format(
71
+				$ticket->price(),
72
+				EE_Registry::instance()->CFG->currency->dec_plc,
73
+				EE_Registry::instance()->CFG->currency->dec_mrk,
74
+				''
75
+			);
76
+			switch ($ticket->ticket_status()) {
77
+				case 'TKO':
78
+					$availability = 'InStock';
79
+					break;
80
+				case 'TKS':
81
+					$availability = 'SoldOut';
82
+					break;
83
+				default:
84
+					$availability = null;
85
+					break;
86
+			}
87
+			$template_args['event_tickets'][ $ID ]['availability'] = $availability;
88
+			unset($ticket);
89
+		}
90
+		$VNU_ID = espresso_venue_id();
91
+		if (! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
92
+			$venue = EEH_Venue_View::get_venue($VNU_ID);
93
+			$template_args['venue_name'] = get_the_title($VNU_ID);
94
+			$template_args['venue_url'] = get_permalink($VNU_ID);
95
+			$template_args['venue_locality'] = $venue->city();
96
+			$template_args['venue_region'] = $venue->state_name();
97
+			$template_args['venue_address'] = $venue->address();
98
+		}
99
+		$template_args['event_image'] = $event->feature_image_url();
100
+		$template_args = apply_filters(
101
+			'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
102
+			$template_args,
103
+			$event,
104
+			$VNU_ID
105
+		);
106
+		extract($template_args, EXTR_OVERWRITE);
107
+		include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
108
+	}
109
+
110
+
111
+	/**
112
+	 *    location
113
+	 *    The location of the event, organization or action.
114
+	 *    Should include the Venue name AND schema formatted address info
115
+	 *
116
+	 * @access public
117
+	 * @param string $location
118
+	 * @return string
119
+	 */
120
+	public static function location($location = null)
121
+	{
122
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
123
+									  . $location
124
+									  . '</div>' : '';
125
+	}
126
+
127
+
128
+
129
+	/**
130
+	 *    name
131
+	 *    The name of the Event or Venue.
132
+	 *
133
+	 * @access public
134
+	 * @param string $name
135
+	 * @return string
136
+	 */
137
+	public static function name($name = null)
138
+	{
139
+		return ! empty($name) ? '<span itemprop="name">' . $name . '</span>' : '';
140
+	}
141
+
142
+
143
+
144
+	/**
145
+	 *    streetAddress
146
+	 *    The street address. For example, 1600 Amphitheatre Pkwy.
147
+	 *
148
+	 * @access public
149
+	 * @param EEI_Address $obj_with_address
150
+	 * @return string
151
+	 */
152
+	public static function streetAddress(EEI_Address $obj_with_address = null)
153
+	{
154
+		return $obj_with_address->address() !== null && $obj_with_address->address() !== ''
155
+			? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
156
+	}
157
+
158
+
159
+
160
+	/**
161
+	 *    postOfficeBoxNumber
162
+	 *    The post office box number for PO box addresses.
163
+	 *
164
+	 * @access public
165
+	 * @param EEI_Address $obj_with_address
166
+	 * @return string
167
+	 */
168
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = null)
169
+	{
170
+		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
171
+		if (preg_match(
172
+			"/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i",
173
+			$obj_with_address->address2()
174
+		) ) {
175
+			return $obj_with_address->address2() !== null && $obj_with_address->address2() !== ''
176
+				? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
177
+		} else {
178
+			return $obj_with_address->address2();
179
+		}
180
+	}
181
+
182
+
183
+
184
+	/**
185
+	 *    addressLocality
186
+	 *    The locality (city, town, etc). For example, Mountain View.
187
+	 *
188
+	 * @access public
189
+	 * @param EEI_Address $obj_with_address
190
+	 * @return string
191
+	 */
192
+	public static function addressLocality(EEI_Address $obj_with_address = null)
193
+	{
194
+		return $obj_with_address->city() !== null && $obj_with_address->city() !== ''
195
+			? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 *    addressRegion
202
+	 *    The region (state, province, etc). For example, CA.
203
+	 *
204
+	 * @access public
205
+	 * @param EEI_Address $obj_with_address
206
+	 * @return string
207
+	 */
208
+	public static function addressRegion(EEI_Address $obj_with_address = null)
209
+	{
210
+		$state = $obj_with_address->state_name();
211
+		if (! empty($state)) {
212
+			return '<span itemprop="addressRegion">' . $state . '</span>';
213
+		} else {
214
+			return '';
215
+		}
216
+	}
217
+
218
+
219
+
220
+	/**
221
+	 *    addressCountry
222
+	 *    The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
223
+	 *
224
+	 * @access public
225
+	 * @param EEI_Address $obj_with_address
226
+	 * @return string
227
+	 */
228
+	public static function addressCountry(EEI_Address $obj_with_address = null)
229
+	{
230
+		$country = $obj_with_address->country_name();
231
+		if (! empty($country)) {
232
+			return '<span itemprop="addressCountry">' . $country . '</span>';
233
+		} else {
234
+			return '';
235
+		}
236
+	}
237
+
238
+
239
+
240
+	/**
241
+	 *    postalCode
242
+	 *    The postal code. For example, 94043.
243
+	 *
244
+	 * @access public
245
+	 * @param EEI_Address $obj_with_address
246
+	 * @return string
247
+	 */
248
+	public static function postalCode(EEI_Address $obj_with_address = null)
249
+	{
250
+		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
251
+																					  . $obj_with_address->zip()
252
+																					  . '</span>' : '';
253
+	}
254
+
255
+
256
+
257
+	/**
258
+	 *    telephone
259
+	 *    The telephone number.
260
+	 *
261
+	 * @access public
262
+	 * @param string $phone_nmbr
263
+	 * @return string
264
+	 */
265
+	public static function telephone($phone_nmbr = null)
266
+	{
267
+		return $phone_nmbr !== null && $phone_nmbr !== '' ? '<span itemprop="telephone">' . $phone_nmbr . '</span>'
268
+			: '';
269
+	}
270
+
271
+
272
+
273
+	/**
274
+	 *    URL
275
+	 *    URL of the item as a clickable link
276
+	 *
277
+	 * @access public
278
+	 * @param string $url        - the URL that the link will resolve to
279
+	 * @param string $text       - the text that will be used for the visible link
280
+	 * @param array  $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
281
+	 * @return string (link)
282
+	 */
283
+	public static function url($url = null, $text = null, $attributes = array())
284
+	{
285
+		// Check the URL includes a scheme
286
+		$parsed_url = parse_url($url);
287
+		if (empty($parsed_url['scheme'])) {
288
+			$url = 'http://' . ltrim($url, '/');
289
+		}
290
+
291
+		$atts = '';
292
+		foreach ($attributes as $attribute => $value) {
293
+			$atts .= ' ' . $attribute . '="' . $value . '"';
294
+		}
295
+		$text = $text !== null && $text !== '' ? $text : $url;
296
+		return $url !== null && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>'
297
+			: '';
298
+	}
299 299
 }
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
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
   "eventStatus": "https://schema.org/<?php echo $event_status; ?>",
27 27
   "offers": [
28 28
     <?php
29
-    $i = 0;
30
-    foreach ($event_tickets as $ticket) {?>
29
+	$i = 0;
30
+	foreach ($event_tickets as $ticket) {?>
31 31
     {
32 32
       "@type": "Offer",
33 33
       "url": "<?php echo $event_permalink; ?>",
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
       "price": "<?php echo $ticket['price']; ?>",
37 37
       "priceCurrency": "<?php echo $currency; ?>"
38 38
         <?php if (isset($ticket['availability'])) {
39
-            ?>,"availability": "http://schema.org/<?php echo $ticket['availability']; ?>"
39
+			?>,"availability": "http://schema.org/<?php echo $ticket['availability']; ?>"
40 40
         <?php } ?>
41 41
     }<?php
42
-    $i++;
43
-    if ($i < count($event_tickets)) {
44
-        echo ',';
45
-    }
46
-    }
47
-    ?>
42
+	$i++;
43
+	if ($i < count($event_tickets)) {
44
+		echo ',';
45
+	}
46
+	}
47
+	?>
48 48
     ]<?php
49
-    if ($venue_name) {
50
-        ?>,
49
+	if ($venue_name) {
50
+		?>,
51 51
   "location": {
52 52
     "@type": "Place",
53 53
     "name": <?php echo wp_json_encode($venue_name); ?>,
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
     }
61 61
   }
62 62
     <?php
63
-    } ?>
63
+	} ?>
64 64
     <?php
65
-    if ($event_image) {
66
-        ?>,
65
+	if ($event_image) {
66
+		?>,
67 67
   "image": "<?php echo $event_image; ?>"
68 68
     <?php
69
-    } ?>
69
+	} ?>
70 70
     <?php do_action('AHEE__json_linked_data_for_event__template'); ?>
71 71
 }
72 72
 
Please login to merge, or discard this patch.