@@ -12,296 +12,296 @@ |
||
| 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'] = $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'] = $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 | } |
@@ -19,32 +19,32 @@ discard block |
||
| 19 | 19 | $has_answers = $question->has_answers(); |
| 20 | 20 | |
| 21 | 21 | if ($QST_system === 'country') { |
| 22 | - echo EEH_HTML::div( |
|
| 23 | - EEH_HTML::h4( |
|
| 24 | - '<span class="dashicons dashicons-info"></span>' . esc_html__('Did you know...', 'event_espresso') |
|
| 25 | - ) . |
|
| 26 | - EEH_HTML::p( |
|
| 27 | - esc_html__( |
|
| 28 | - 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
| 29 | - 'event_espresso' |
|
| 30 | - ) |
|
| 31 | - ), |
|
| 32 | - '', |
|
| 33 | - 'ee-info-box' |
|
| 34 | - ); |
|
| 22 | + echo EEH_HTML::div( |
|
| 23 | + EEH_HTML::h4( |
|
| 24 | + '<span class="dashicons dashicons-info"></span>' . esc_html__('Did you know...', 'event_espresso') |
|
| 25 | + ) . |
|
| 26 | + EEH_HTML::p( |
|
| 27 | + esc_html__( |
|
| 28 | + 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
| 29 | + 'event_espresso' |
|
| 30 | + ) |
|
| 31 | + ), |
|
| 32 | + '', |
|
| 33 | + 'ee-info-box' |
|
| 34 | + ); |
|
| 35 | 35 | } |
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | - do_action('AHEE__questions_main_meta_box__template__inner_admin_page_content', $question); |
|
| 39 | + do_action('AHEE__questions_main_meta_box__template__inner_admin_page_content', $question); |
|
| 40 | 40 | ?> |
| 41 | 41 | |
| 42 | 42 | <div class="padding"> |
| 43 | 43 | <table class="form-table"> |
| 44 | 44 | <tbody> |
| 45 | 45 | <?php |
| 46 | - do_action('AHEE__questions_main_meta_box__template__before_table_form_table', $question); |
|
| 47 | - ?> |
|
| 46 | + do_action('AHEE__questions_main_meta_box__template__before_table_form_table', $question); |
|
| 47 | + ?> |
|
| 48 | 48 | <tr> |
| 49 | 49 | <th> |
| 50 | 50 | <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | </th> |
| 65 | 65 | <td> |
| 66 | 66 | <?php |
| 67 | - $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 68 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 69 | - ?> |
|
| 67 | + $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 68 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 69 | + ?> |
|
| 70 | 70 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id ?>" |
| 71 | 71 | name="QST_admin_label<?php echo $id ?>" |
| 72 | 72 | value="<?php $question->f('QST_admin_label') ?>"<?php echo $disabled_attr ?>/> |
@@ -95,18 +95,18 @@ discard block |
||
| 95 | 95 | </th> |
| 96 | 96 | <td> |
| 97 | 97 | <?php |
| 98 | - $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 99 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 100 | - $admin_only = $question->get('QST_admin_only'); |
|
| 101 | - $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
| 102 | - ?> |
|
| 98 | + $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 99 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 100 | + $admin_only = $question->get('QST_admin_only'); |
|
| 101 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
| 102 | + ?> |
|
| 103 | 103 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" |
| 104 | 104 | name="QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled_attr; |
| 105 | - echo $checked; ?>/> |
|
| 105 | + echo $checked; ?>/> |
|
| 106 | 106 | <br/> |
| 107 | 107 | <p class="description"> |
| 108 | 108 | <?php |
| 109 | - if (! empty($QST_system)) { ?> |
|
| 109 | + if (! empty($QST_system)) { ?> |
|
| 110 | 110 | <span class="description" style="color:#D54E21;"> |
| 111 | 111 | <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso') ?> |
| 112 | 112 | </span> |
@@ -123,39 +123,39 @@ discard block |
||
| 123 | 123 | </th> |
| 124 | 124 | <td> |
| 125 | 125 | <?php |
| 126 | - $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 127 | - if ($disabled) { |
|
| 128 | - $disabled_attr = 'disabled="disabled"'; |
|
| 129 | - $id = '_disabled'; |
|
| 130 | - } else { |
|
| 131 | - $disabled_attr = ''; |
|
| 132 | - $id = ''; |
|
| 133 | - } |
|
| 126 | + $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 127 | + if ($disabled) { |
|
| 128 | + $disabled_attr = 'disabled="disabled"'; |
|
| 129 | + $id = '_disabled'; |
|
| 130 | + } else { |
|
| 131 | + $disabled_attr = ''; |
|
| 132 | + $id = ''; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - // Only display Confirm email for |
|
| 136 | - if (empty($QST_system) |
|
| 137 | - || (! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_email_confirm) |
|
| 138 | - ) { |
|
| 139 | - unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
| 140 | - } |
|
| 135 | + // Only display Confirm email for |
|
| 136 | + if (empty($QST_system) |
|
| 137 | + || (! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_email_confirm) |
|
| 138 | + ) { |
|
| 139 | + unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - echo EEH_Form_Fields::select_input( |
|
| 143 | - 'QST_type' . $id, |
|
| 144 | - $question_types, |
|
| 145 | - $question->type(), |
|
| 146 | - 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 147 | - ); |
|
| 148 | - if ($disabled) { ?> |
|
| 142 | + echo EEH_Form_Fields::select_input( |
|
| 143 | + 'QST_type' . $id, |
|
| 144 | + $question_types, |
|
| 145 | + $question->type(), |
|
| 146 | + 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 147 | + ); |
|
| 148 | + if ($disabled) { ?> |
|
| 149 | 149 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type() ?>"/> |
| 150 | 150 | <?php |
| 151 | - $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
| 152 | - } else { |
|
| 153 | - $explanatory_text = esc_html__( |
|
| 154 | - 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
| 155 | - 'event_espresso' |
|
| 156 | - ); |
|
| 157 | - } |
|
| 158 | - if ($disabled || $has_answers) { ?> |
|
| 151 | + $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
| 152 | + } else { |
|
| 153 | + $explanatory_text = esc_html__( |
|
| 154 | + 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
| 155 | + 'event_espresso' |
|
| 156 | + ); |
|
| 157 | + } |
|
| 158 | + if ($disabled || $has_answers) { ?> |
|
| 159 | 159 | <p><span class="description" style="color:#D54E21;"> |
| 160 | 160 | <?php echo $explanatory_text; ?> |
| 161 | 161 | </span></p> |
@@ -173,25 +173,25 @@ discard block |
||
| 173 | 173 | </th> |
| 174 | 174 | <td> |
| 175 | 175 | <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' |
| 176 | - : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
| 176 | + : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
| 177 | 177 | <p> |
| 178 | 178 | <span class="description"> |
| 179 | 179 | <?php esc_html_e( |
| 180 | - 'Maximum number of characters allowed when answering this question', |
|
| 181 | - 'event_espresso' |
|
| 182 | - ); ?> |
|
| 180 | + 'Maximum number of characters allowed when answering this question', |
|
| 181 | + 'event_espresso' |
|
| 182 | + ); ?> |
|
| 183 | 183 | </span> |
| 184 | 184 | </p> |
| 185 | 185 | <?php if ($QST_system) { ?> |
| 186 | 186 | <p> |
| 187 | 187 | <span class="description" style="color:#D54E21;"> |
| 188 | 188 | <?php printf( |
| 189 | - esc_html__( |
|
| 190 | - 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 191 | - 'event_espresso' |
|
| 192 | - ), |
|
| 193 | - $max_max |
|
| 194 | - ); ?> |
|
| 189 | + esc_html__( |
|
| 190 | + 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 191 | + 'event_espresso' |
|
| 192 | + ), |
|
| 193 | + $max_max |
|
| 194 | + ); ?> |
|
| 195 | 195 | </span> |
| 196 | 196 | </p> |
| 197 | 197 | <?php } ?> |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | </th> |
| 214 | 214 | <th class="option-desc-header"> |
| 215 | 215 | <?php esc_html_e( |
| 216 | - 'Description (optional, only shown on registration form)', |
|
| 217 | - 'event_espresso' |
|
| 218 | - ) ?> |
|
| 216 | + 'Description (optional, only shown on registration form)', |
|
| 217 | + 'event_espresso' |
|
| 218 | + ) ?> |
|
| 219 | 219 | </th> |
| 220 | 220 | <th> |
| 221 | 221 | </th> |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | </tr> |
| 242 | 242 | |
| 243 | 243 | <?php |
| 244 | - $count = 0; |
|
| 245 | - $question_options = $question->options(); |
|
| 246 | - if (! empty($question_options)) { |
|
| 247 | - foreach ($question_options as $option_id => $option) { |
|
| 248 | - $disabled_attr = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 249 | - ?> |
|
| 244 | + $count = 0; |
|
| 245 | + $question_options = $question->options(); |
|
| 246 | + if (! empty($question_options)) { |
|
| 247 | + foreach ($question_options as $option_id => $option) { |
|
| 248 | + $disabled_attr = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 249 | + ?> |
|
| 250 | 250 | <tr class="question-option ee-options-sortable"> |
| 251 | 251 | <td class="option-value-cell"> |
| 252 | 252 | <input type="hidden" class="QSO_order" |
@@ -272,21 +272,21 @@ discard block |
||
| 272 | 272 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
| 273 | 273 | </td> |
| 274 | 274 | <?php |
| 275 | - echo EEH_Form_Fields::hidden_input( |
|
| 276 | - "question_options[{$count}][QST_ID])", |
|
| 277 | - $option->question_ID() |
|
| 278 | - ); |
|
| 279 | - echo EEH_Form_Fields::hidden_input( |
|
| 280 | - "question_options[{$count}][QSO_ID])", |
|
| 281 | - $option->ID() |
|
| 282 | - ); |
|
| 283 | - $count++; |
|
| 284 | - ?> |
|
| 275 | + echo EEH_Form_Fields::hidden_input( |
|
| 276 | + "question_options[{$count}][QST_ID])", |
|
| 277 | + $option->question_ID() |
|
| 278 | + ); |
|
| 279 | + echo EEH_Form_Fields::hidden_input( |
|
| 280 | + "question_options[{$count}][QSO_ID])", |
|
| 281 | + $option->ID() |
|
| 282 | + ); |
|
| 283 | + $count++; |
|
| 284 | + ?> |
|
| 285 | 285 | </tr> |
| 286 | 286 | <?php |
| 287 | - } |
|
| 288 | - } else { |
|
| 289 | - ?> |
|
| 287 | + } |
|
| 288 | + } else { |
|
| 289 | + ?> |
|
| 290 | 290 | <tr class="question-option ee-options-sortable"> |
| 291 | 291 | <td class="option-value-cell"> |
| 292 | 292 | <input type="hidden" class="QSO_order" name="question_options[0][QSO_order]" value="0"/> |
@@ -299,19 +299,19 @@ discard block |
||
| 299 | 299 | </td> |
| 300 | 300 | <td> |
| 301 | 301 | <?php |
| 302 | - echo EEH_Form_Fields::hidden_input("question_options_count", $count); |
|
| 303 | - ?> |
|
| 302 | + echo EEH_Form_Fields::hidden_input("question_options_count", $count); |
|
| 303 | + ?> |
|
| 304 | 304 | </td> |
| 305 | 305 | </tr> |
| 306 | 306 | <?php |
| 307 | - } |
|
| 308 | - ?> |
|
| 307 | + } |
|
| 308 | + ?> |
|
| 309 | 309 | <tr style="display:none"> |
| 310 | 310 | <td colspan="3"> |
| 311 | 311 | <?php echo EEH_Form_Fields::hidden_input( |
| 312 | - "question_options_count", |
|
| 313 | - $count |
|
| 314 | - ); ?></td> |
|
| 312 | + "question_options_count", |
|
| 313 | + $count |
|
| 314 | + ); ?></td> |
|
| 315 | 315 | </tr> |
| 316 | 316 | </tbody> |
| 317 | 317 | </table> |
@@ -322,16 +322,16 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | <p class="description"> |
| 324 | 324 | <?php esc_html_e( |
| 325 | - 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
| 326 | - 'event_espresso' |
|
| 327 | - ) ?> |
|
| 325 | + 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
| 326 | + 'event_espresso' |
|
| 327 | + ) ?> |
|
| 328 | 328 | </p> |
| 329 | 329 | <?php if ($has_answers) : ?> |
| 330 | 330 | <p class="description" style="color:#D54E21;"> |
| 331 | 331 | <?php esc_html_e( |
| 332 | - 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
| 333 | - 'event_espresso' |
|
| 334 | - ); ?> |
|
| 332 | + 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
| 333 | + 'event_espresso' |
|
| 334 | + ); ?> |
|
| 335 | 335 | </p> |
| 336 | 336 | |
| 337 | 337 | <?php endif; ?> |
@@ -345,35 +345,35 @@ discard block |
||
| 345 | 345 | </th> |
| 346 | 346 | <td> |
| 347 | 347 | <?php |
| 348 | - $system_required = array('fname', 'email'); |
|
| 349 | - $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 350 | - $required_on = $question->get('QST_admin_only'); |
|
| 351 | - $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 352 | - $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 353 | - $id = ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 354 | - $requiredOptions = array( |
|
| 355 | - array('text' => esc_html__('Optional', 'event_espresso'), 'id' => 0), |
|
| 356 | - array('text' => esc_html__('Required', 'event_espresso'), 'id' => 1), |
|
| 357 | - ); |
|
| 358 | - echo EEH_Form_Fields::select_input( |
|
| 359 | - 'QST_required' . $id, |
|
| 360 | - $requiredOptions, |
|
| 361 | - $question->required(), |
|
| 362 | - 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 363 | - ); |
|
| 364 | - ?> |
|
| 348 | + $system_required = array('fname', 'email'); |
|
| 349 | + $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 350 | + $required_on = $question->get('QST_admin_only'); |
|
| 351 | + $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 352 | + $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 353 | + $id = ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 354 | + $requiredOptions = array( |
|
| 355 | + array('text' => esc_html__('Optional', 'event_espresso'), 'id' => 0), |
|
| 356 | + array('text' => esc_html__('Required', 'event_espresso'), 'id' => 1), |
|
| 357 | + ); |
|
| 358 | + echo EEH_Form_Fields::select_input( |
|
| 359 | + 'QST_required' . $id, |
|
| 360 | + $requiredOptions, |
|
| 361 | + $question->required(), |
|
| 362 | + 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 363 | + ); |
|
| 364 | + ?> |
|
| 365 | 365 | <p><span id="required_toggled_on" class="description" |
| 366 | 366 | style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
| 367 | 367 | <?php esc_html_e( |
| 368 | - 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 369 | - 'event_espresso' |
|
| 370 | - ) ?> |
|
| 368 | + 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 369 | + 'event_espresso' |
|
| 370 | + ) ?> |
|
| 371 | 371 | </span></p> |
| 372 | 372 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
| 373 | 373 | <?php esc_html_e( |
| 374 | - 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 375 | - 'event_espresso' |
|
| 376 | - ) ?> |
|
| 374 | + 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 375 | + 'event_espresso' |
|
| 376 | + ) ?> |
|
| 377 | 377 | </span></p> |
| 378 | 378 | <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
| 379 | 379 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | <th> |
| 390 | 390 | <label for="QST_required_text"> |
| 391 | 391 | <?php esc_html_e( |
| 392 | - 'Required Text', |
|
| 393 | - 'event_espresso' |
|
| 394 | - ); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
| 392 | + 'Required Text', |
|
| 393 | + 'event_espresso' |
|
| 394 | + ); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
| 395 | 395 | </th> |
| 396 | 396 | <td> |
| 397 | 397 | <input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | </td> |
| 401 | 401 | </tr> |
| 402 | 402 | <?php |
| 403 | - do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 404 | - ?> |
|
| 403 | + do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 404 | + ?> |
|
| 405 | 405 | </tbody> |
| 406 | 406 | </table> |
| 407 | 407 | |
@@ -409,5 +409,5 @@ discard block |
||
| 409 | 409 | </div> |
| 410 | 410 | |
| 411 | 411 | <?php |
| 412 | - do_action('AHEE__questions_main_meta_box__template__after_admin_page_content', $question); |
|
| 412 | + do_action('AHEE__questions_main_meta_box__template__after_admin_page_content', $question); |
|
| 413 | 413 | |
@@ -38,103 +38,103 @@ |
||
| 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.007'); |
|
| 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.007'); |
|
| 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 | } |