@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | '[VENUE_FORMATTED_ADDRESS]' => __('This just outputs the venue address in a semantic address format.', 'event_espresso'), |
58 | 58 | '[VENUE_ZIP]' => __('The zip code for the venue address', 'event_espresso'), |
59 | 59 | '[GOOGLE_MAP_LINK]' => __('Link to a google map for the venue', 'event_espresso'), |
60 | - '[GOOGLE_MAP_LINK_*]' => __('Link to a google map for the venue with custom height and width', 'event_espresso') . |
|
61 | - '<p><ul>' . |
|
62 | - '<li><strong>h</strong>:' . __('Height of the Image in px.', 'event_espresso') . '</li>' . |
|
63 | - '<li><strong>w</strong>:' . __('Width of the Image in px.', 'event_espresso' ) . '</li>' . |
|
60 | + '[GOOGLE_MAP_LINK_*]' => __('Link to a google map for the venue with custom height and width', 'event_espresso'). |
|
61 | + '<p><ul>'. |
|
62 | + '<li><strong>h</strong>:'.__('Height of the Image in px.', 'event_espresso').'</li>'. |
|
63 | + '<li><strong>w</strong>:'.__('Width of the Image in px.', 'event_espresso').'</li>'. |
|
64 | 64 | '</ul></p>', |
65 | 65 | '[GOOGLE_MAP_IMAGE]' => __('Google map for venue wrapped in image tags', 'event_espresso'), |
66 | - '[GOOGLE_MAP_IMAGE_*]' => __('Google map for venue wrapped in image tags with custom height and width', 'event_espresso') . |
|
67 | - '<p><ul>' . |
|
68 | - '<li><strong>h</strong>:' . __('Height of the Image in px.', 'event_espresso') . '</li>' . |
|
69 | - '<li><strong>w</strong>:' . __('Width of the Image in px.', 'event_espresso' ) . '</li>' . |
|
66 | + '[GOOGLE_MAP_IMAGE_*]' => __('Google map for venue wrapped in image tags with custom height and width', 'event_espresso'). |
|
67 | + '<p><ul>'. |
|
68 | + '<li><strong>h</strong>:'.__('Height of the Image in px.', 'event_espresso').'</li>'. |
|
69 | + '<li><strong>w</strong>:'.__('Width of the Image in px.', 'event_espresso').'</li>'. |
|
70 | 70 | '</ul></p>', |
71 | 71 | ); |
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | - protected function _parser( $shortcode ) { |
|
75 | + protected function _parser($shortcode) { |
|
76 | 76 | |
77 | - switch ( $shortcode ) { |
|
77 | + switch ($shortcode) { |
|
78 | 78 | |
79 | 79 | case '[VENUE_TITLE]' : |
80 | 80 | return $this->_venue('title'); |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | - if ( preg_match('/^\[GOOGLE_MAP_(LINK|IMAGE)(_)?/', $shortcode, $matches) ) { |
|
130 | - return $this->_venue('gmap_link'.($matches[1] == 'IMAGE' ? '_img' :''), $this->_get_shortcode_attrs( $shortcode )); |
|
129 | + if (preg_match('/^\[GOOGLE_MAP_(LINK|IMAGE)(_)?/', $shortcode, $matches)) { |
|
130 | + return $this->_venue('gmap_link'.($matches[1] == 'IMAGE' ? '_img' : ''), $this->_get_shortcode_attrs($shortcode)); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -138,38 +138,38 @@ discard block |
||
138 | 138 | * @param string $what What to retrieve from database |
139 | 139 | * @return string What was retrieved! |
140 | 140 | */ |
141 | - private function _venue( $db_ref, $args = NULL) { |
|
141 | + private function _venue($db_ref, $args = NULL) { |
|
142 | 142 | |
143 | 143 | //we need the EE_Event object to get the venue. |
144 | 144 | |
145 | 145 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
146 | 146 | |
147 | 147 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
148 | - if ( empty( $this->_event ) ) { |
|
148 | + if (empty($this->_event)) { |
|
149 | 149 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
150 | 150 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
151 | 151 | |
152 | 152 | $this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->event() : NULL; |
153 | 153 | |
154 | 154 | //if still empty do we have a ticket data item? |
155 | - $this->_event = empty( $this->_event ) && $this->_data instanceof EE_Ticket && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event'] : $this->_event; |
|
155 | + $this->_event = empty($this->_event) && $this->_data instanceof EE_Ticket && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event'] : $this->_event; |
|
156 | 156 | |
157 | 157 | //if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee and use that. |
158 | - $event = $aee instanceof EE_Messages_Addressee ? reset( $aee->events ) : array(); |
|
159 | - $this->_event = empty( $this->_event ) && !empty( $events ) ? $event : $this->_event; |
|
158 | + $event = $aee instanceof EE_Messages_Addressee ? reset($aee->events) : array(); |
|
159 | + $this->_event = empty($this->_event) && ! empty($events) ? $event : $this->_event; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | //If there is no event objecdt by now then get out. |
164 | - if ( ! $this->_event instanceof EE_Event ) |
|
164 | + if ( ! $this->_event instanceof EE_Event) |
|
165 | 165 | return ''; |
166 | 166 | |
167 | 167 | $venue = $this->_event->get_first_related('Venue'); |
168 | 168 | |
169 | - if ( empty( $venue ) ) |
|
169 | + if (empty($venue)) |
|
170 | 170 | return ''; //no venue so get out. |
171 | 171 | |
172 | - switch ( $db_ref ) { |
|
172 | + switch ($db_ref) { |
|
173 | 173 | case 'title': |
174 | 174 | return $venue->get('VNU_name'); |
175 | 175 | break; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | case 'url': |
182 | 182 | $url = $venue->get('VNU_url'); |
183 | - return empty( $url ) ? $venue->get_permalink() : $url; |
|
183 | + return empty($url) ? $venue->get_permalink() : $url; |
|
184 | 184 | break; |
185 | 185 | |
186 | 186 | case 'image': |
187 | - return '<img src="' . $venue->feature_image_url(array(200,200) ) . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $venue->get('VNU_name') ) . '" />'; |
|
187 | + return '<img src="'.$venue->feature_image_url(array(200, 200)).'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $venue->get('VNU_name')).'" />'; |
|
188 | 188 | break; |
189 | 189 | |
190 | 190 | case 'phone': |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | break; |
219 | 219 | |
220 | 220 | case 'formatted_address' : |
221 | - return EEH_Address::format( $venue ); |
|
221 | + return EEH_Address::format($venue); |
|
222 | 222 | break; |
223 | 223 | |
224 | 224 | case 'gmap_link': |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | 'id' => $venue->ID(), |
230 | 230 | 'address' => $venue->get('VNU_address'), |
231 | 231 | 'city' => $venue->get('VNU_city'), |
232 | - 'state' => is_object( $state ) ? $state->get('STA_name') : '', |
|
232 | + 'state' => is_object($state) ? $state->get('STA_name') : '', |
|
233 | 233 | 'zip' => $venue->get('VNU_zip'), |
234 | - 'country' => is_object( $country ) ? $country->get('CNT_name'): '', |
|
234 | + 'country' => is_object($country) ? $country->get('CNT_name') : '', |
|
235 | 235 | 'type' => $db_ref == 'gmap_link' ? 'url' : 'map', |
236 | - 'map_w' => !empty($args['w']) ? abs((int) $args['w']) : 200, |
|
237 | - 'map_h' => !empty($args['h']) ? abs((int) $args['h']) : 200 |
|
236 | + 'map_w' => ! empty($args['w']) ? abs((int) $args['w']) : 200, |
|
237 | + 'map_h' => ! empty($args['h']) ? abs((int) $args['h']) : 200 |
|
238 | 238 | ); |
239 | 239 | |
240 | 240 | return EEH_Maps::google_map_link($atts); |