@@ -21,110 +21,110 @@ |
||
| 21 | 21 | class EventMutation |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Maps the GraphQL input to a format that the model functions can use |
|
| 26 | - * |
|
| 27 | - * @param array $input Data coming from the GraphQL mutation query input |
|
| 28 | - * @return array |
|
| 29 | - * @throws Exception |
|
| 30 | - */ |
|
| 31 | - public static function prepareFields(array $input): array |
|
| 32 | - { |
|
| 33 | - $args = []; |
|
| 34 | - |
|
| 35 | - if (array_key_exists('allowDonations', $input)) { |
|
| 36 | - $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - if (array_key_exists('allowOverflow', $input)) { |
|
| 40 | - $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - if (array_key_exists('altRegPage', $input)) { |
|
| 44 | - $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - if (! empty($input['defaultRegStatus'])) { |
|
| 48 | - $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - if (! empty($input['description'])) { |
|
| 52 | - $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db'); |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - if (array_key_exists('displayDescription', $input)) { |
|
| 56 | - $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - if (array_key_exists('displayTicketSelector', $input)) { |
|
| 60 | - $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - if (! empty($input['maxRegistrations'])) { |
|
| 64 | - $args['EVT_additional_limit'] = absint($input['maxRegistrations']); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if (array_key_exists('memberOnly', $input)) { |
|
| 68 | - $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - if (! empty($input['name'])) { |
|
| 72 | - $args['EVT_name'] = sanitize_text_field($input['name']); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - if (array_key_exists('order', $input)) { |
|
| 76 | - $args['EVT_order'] = absint($input['order']); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - if (array_key_exists('phoneNumber', $input)) { |
|
| 80 | - $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if (array_key_exists('shortDescription', $input)) { |
|
| 84 | - $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db'); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - if (array_key_exists('timezoneString', $input)) { |
|
| 88 | - $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - if (! empty($input['visibleOn'])) { |
|
| 92 | - $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - if (! empty($input['manager'])) { |
|
| 96 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['manager'])); |
|
| 97 | - $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - if (array_key_exists('venue', $input)) { |
|
| 101 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['venue'])); |
|
| 102 | - $args['venue'] = ! empty($parts['id']) ? $parts['id'] : 0; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - return apply_filters( |
|
| 106 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
| 107 | - $args, |
|
| 108 | - $input |
|
| 109 | - ); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Sets the venue for the event. |
|
| 115 | - * |
|
| 116 | - * @param EE_Event $entity The event instance. |
|
| 117 | - * @param int $venue The venue ID |
|
| 118 | - * @throws EE_Error |
|
| 119 | - * @throws InvalidDataTypeException |
|
| 120 | - * @throws InvalidInterfaceException |
|
| 121 | - * @throws InvalidArgumentException |
|
| 122 | - * @throws ReflectionException |
|
| 123 | - */ |
|
| 124 | - public static function setEventVenue(EE_Event $entity, int $venue) |
|
| 125 | - { |
|
| 126 | - if ($venue) { |
|
| 127 | - $entity->add_venue($venue); |
|
| 128 | - } |
|
| 129 | - } |
|
| 24 | + /** |
|
| 25 | + * Maps the GraphQL input to a format that the model functions can use |
|
| 26 | + * |
|
| 27 | + * @param array $input Data coming from the GraphQL mutation query input |
|
| 28 | + * @return array |
|
| 29 | + * @throws Exception |
|
| 30 | + */ |
|
| 31 | + public static function prepareFields(array $input): array |
|
| 32 | + { |
|
| 33 | + $args = []; |
|
| 34 | + |
|
| 35 | + if (array_key_exists('allowDonations', $input)) { |
|
| 36 | + $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + if (array_key_exists('allowOverflow', $input)) { |
|
| 40 | + $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + if (array_key_exists('altRegPage', $input)) { |
|
| 44 | + $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + if (! empty($input['defaultRegStatus'])) { |
|
| 48 | + $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + if (! empty($input['description'])) { |
|
| 52 | + $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db'); |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + if (array_key_exists('displayDescription', $input)) { |
|
| 56 | + $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + if (array_key_exists('displayTicketSelector', $input)) { |
|
| 60 | + $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + if (! empty($input['maxRegistrations'])) { |
|
| 64 | + $args['EVT_additional_limit'] = absint($input['maxRegistrations']); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if (array_key_exists('memberOnly', $input)) { |
|
| 68 | + $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + if (! empty($input['name'])) { |
|
| 72 | + $args['EVT_name'] = sanitize_text_field($input['name']); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + if (array_key_exists('order', $input)) { |
|
| 76 | + $args['EVT_order'] = absint($input['order']); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + if (array_key_exists('phoneNumber', $input)) { |
|
| 80 | + $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + if (array_key_exists('shortDescription', $input)) { |
|
| 84 | + $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db'); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + if (array_key_exists('timezoneString', $input)) { |
|
| 88 | + $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + if (! empty($input['visibleOn'])) { |
|
| 92 | + $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + if (! empty($input['manager'])) { |
|
| 96 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['manager'])); |
|
| 97 | + $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + if (array_key_exists('venue', $input)) { |
|
| 101 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['venue'])); |
|
| 102 | + $args['venue'] = ! empty($parts['id']) ? $parts['id'] : 0; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + return apply_filters( |
|
| 106 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args', |
|
| 107 | + $args, |
|
| 108 | + $input |
|
| 109 | + ); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Sets the venue for the event. |
|
| 115 | + * |
|
| 116 | + * @param EE_Event $entity The event instance. |
|
| 117 | + * @param int $venue The venue ID |
|
| 118 | + * @throws EE_Error |
|
| 119 | + * @throws InvalidDataTypeException |
|
| 120 | + * @throws InvalidInterfaceException |
|
| 121 | + * @throws InvalidArgumentException |
|
| 122 | + * @throws ReflectionException |
|
| 123 | + */ |
|
| 124 | + public static function setEventVenue(EE_Event $entity, int $venue) |
|
| 125 | + { |
|
| 126 | + if ($venue) { |
|
| 127 | + $entity->add_venue($venue); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | 130 | } |
@@ -27,246 +27,246 @@ |
||
| 27 | 27 | class Venue extends TypeBase |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Venue constructor. |
|
| 32 | - * |
|
| 33 | - * @param EEM_Venue $venue_model |
|
| 34 | - */ |
|
| 35 | - public function __construct(EEM_Venue $venue_model) |
|
| 36 | - { |
|
| 37 | - $this->setName($this->namespace . 'Venue'); |
|
| 38 | - $this->setIsCustomPostType(true); |
|
| 39 | - parent::__construct($venue_model); |
|
| 40 | - } |
|
| 30 | + /** |
|
| 31 | + * Venue constructor. |
|
| 32 | + * |
|
| 33 | + * @param EEM_Venue $venue_model |
|
| 34 | + */ |
|
| 35 | + public function __construct(EEM_Venue $venue_model) |
|
| 36 | + { |
|
| 37 | + $this->setName($this->namespace . 'Venue'); |
|
| 38 | + $this->setIsCustomPostType(true); |
|
| 39 | + parent::__construct($venue_model); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @return GraphQLFieldInterface[] |
|
| 45 | - */ |
|
| 46 | - public function getFields(): array |
|
| 47 | - { |
|
| 48 | - $fields = [ |
|
| 49 | - new GraphQLOutputField( |
|
| 50 | - 'dbId', |
|
| 51 | - ['non_null' => 'Int'], |
|
| 52 | - 'ID', |
|
| 53 | - esc_html__('The venue ID.', 'event_espresso') |
|
| 54 | - ), |
|
| 55 | - new GraphQLOutputField( |
|
| 56 | - 'cacheId', |
|
| 57 | - ['non_null' => 'String'], |
|
| 58 | - null, |
|
| 59 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 60 | - ), |
|
| 61 | - new GraphQLField( |
|
| 62 | - 'name', |
|
| 63 | - 'String', |
|
| 64 | - 'name', |
|
| 65 | - esc_html__('Venue Name', 'event_espresso') |
|
| 66 | - ), |
|
| 67 | - new GraphQLField( |
|
| 68 | - 'description', |
|
| 69 | - 'String', |
|
| 70 | - 'description', |
|
| 71 | - esc_html__('Venue Description', 'event_espresso') |
|
| 72 | - ), |
|
| 73 | - new GraphQLField( |
|
| 74 | - 'shortDescription', |
|
| 75 | - 'String', |
|
| 76 | - 'excerpt', |
|
| 77 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
| 78 | - ), |
|
| 79 | - new GraphQLField( |
|
| 80 | - 'identifier', |
|
| 81 | - 'String', |
|
| 82 | - 'identifier', |
|
| 83 | - esc_html__('Venue Identifier', 'event_espresso') |
|
| 84 | - ), |
|
| 85 | - new GraphQLField( |
|
| 86 | - 'created', |
|
| 87 | - 'String', |
|
| 88 | - 'created', |
|
| 89 | - esc_html__('Date Venue Created', 'event_espresso') |
|
| 90 | - ), |
|
| 91 | - new GraphQLField( |
|
| 92 | - 'order', |
|
| 93 | - 'Int', |
|
| 94 | - 'order', |
|
| 95 | - esc_html__('Venue order', 'event_espresso') |
|
| 96 | - ), |
|
| 97 | - new GraphQLOutputField( |
|
| 98 | - 'wpUser', |
|
| 99 | - 'User', |
|
| 100 | - null, |
|
| 101 | - esc_html__('Venue Creator', 'event_espresso') |
|
| 102 | - ), |
|
| 103 | - new GraphQLInputField( |
|
| 104 | - 'wpUser', |
|
| 105 | - 'Int', |
|
| 106 | - null, |
|
| 107 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
| 108 | - ), |
|
| 109 | - new GraphQLField( |
|
| 110 | - 'address', |
|
| 111 | - 'String', |
|
| 112 | - 'address', |
|
| 113 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
| 114 | - ), |
|
| 115 | - new GraphQLField( |
|
| 116 | - 'address2', |
|
| 117 | - 'String', |
|
| 118 | - 'address2', |
|
| 119 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
| 120 | - ), |
|
| 121 | - new GraphQLField( |
|
| 122 | - 'city', |
|
| 123 | - 'String', |
|
| 124 | - 'city', |
|
| 125 | - esc_html__('Venue City', 'event_espresso') |
|
| 126 | - ), |
|
| 127 | - new GraphQLOutputField( |
|
| 128 | - 'state', |
|
| 129 | - $this->namespace . 'State', |
|
| 130 | - null, |
|
| 131 | - esc_html__('Venue state', 'event_espresso') |
|
| 132 | - ), |
|
| 133 | - new GraphQLOutputField( |
|
| 134 | - 'stateName', |
|
| 135 | - 'String', |
|
| 136 | - 'state_name', |
|
| 137 | - esc_html__('Venue state name', 'event_espresso') |
|
| 138 | - ), |
|
| 139 | - new GraphQLOutputField( |
|
| 140 | - 'stateAbbrev', |
|
| 141 | - 'String', |
|
| 142 | - 'state_abbrev', |
|
| 143 | - esc_html__('Venue state abbreviation', 'event_espresso') |
|
| 144 | - ), |
|
| 145 | - new GraphQLInputField( |
|
| 146 | - 'state', |
|
| 147 | - 'Int', |
|
| 148 | - null, |
|
| 149 | - esc_html__('State ID', 'event_espresso') |
|
| 150 | - ), |
|
| 151 | - new GraphQLOutputField( |
|
| 152 | - 'country', |
|
| 153 | - $this->namespace . 'Country', |
|
| 154 | - null, |
|
| 155 | - esc_html__('Venue country', 'event_espresso') |
|
| 156 | - ), |
|
| 157 | - new GraphQLOutputField( |
|
| 158 | - 'countryName', |
|
| 159 | - 'String', |
|
| 160 | - 'country_name', |
|
| 161 | - esc_html__('Venue country name', 'event_espresso') |
|
| 162 | - ), |
|
| 163 | - new GraphQLOutputField( |
|
| 164 | - 'countryISO', |
|
| 165 | - 'String', |
|
| 166 | - 'country_ID', |
|
| 167 | - esc_html__('Venue Country ISO Code', 'event_espresso') |
|
| 168 | - ), |
|
| 169 | - new GraphQLInputField( |
|
| 170 | - 'country', |
|
| 171 | - 'String', |
|
| 172 | - null, |
|
| 173 | - esc_html__('Country ISO Code', 'event_espresso') |
|
| 174 | - ), |
|
| 175 | - new GraphQLField( |
|
| 176 | - 'zip', |
|
| 177 | - 'String', |
|
| 178 | - 'zip', |
|
| 179 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 180 | - ), |
|
| 181 | - new GraphQLField( |
|
| 182 | - 'capacity', |
|
| 183 | - 'Int', |
|
| 184 | - 'capacity', |
|
| 185 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
| 186 | - [$this, 'parseInfiniteValue'] |
|
| 187 | - ), |
|
| 188 | - new GraphQLField( |
|
| 189 | - 'phone', |
|
| 190 | - 'String', |
|
| 191 | - 'phone', |
|
| 192 | - esc_html__('Venue Phone', 'event_espresso') |
|
| 193 | - ), |
|
| 194 | - new GraphQLField( |
|
| 195 | - 'virtualPhone', |
|
| 196 | - 'String', |
|
| 197 | - 'virtual_phone', |
|
| 198 | - esc_html__('Call in Number', 'event_espresso') |
|
| 199 | - ), |
|
| 200 | - new GraphQLField( |
|
| 201 | - 'url', |
|
| 202 | - 'String', |
|
| 203 | - 'venue_url', |
|
| 204 | - esc_html__('Venue Website', 'event_espresso') |
|
| 205 | - ), |
|
| 206 | - new GraphQLField( |
|
| 207 | - 'virtualUrl', |
|
| 208 | - 'String', |
|
| 209 | - 'virtual_url', |
|
| 210 | - esc_html__('Virtual URL', 'event_espresso') |
|
| 211 | - ), |
|
| 212 | - new GraphQLField( |
|
| 213 | - 'googleMapLink', |
|
| 214 | - 'String', |
|
| 215 | - 'google_map_link', |
|
| 216 | - esc_html__('Google Map Link', 'event_espresso') |
|
| 217 | - ), |
|
| 218 | - new GraphQLField( |
|
| 219 | - 'enableForGmap', |
|
| 220 | - 'String', |
|
| 221 | - 'enable_for_gmap', |
|
| 222 | - esc_html__('Show Google Map?', 'event_espresso') |
|
| 223 | - ), |
|
| 224 | - new GraphQLOutputField( |
|
| 225 | - 'thumbnail', |
|
| 226 | - 'String', |
|
| 227 | - 'thumbnail', |
|
| 228 | - esc_html__('Venue Thumbnail', 'event_espresso'), |
|
| 229 | - null, |
|
| 230 | - [$this, 'getThumbnail'] |
|
| 231 | - ), |
|
| 232 | - ]; |
|
| 43 | + /** |
|
| 44 | + * @return GraphQLFieldInterface[] |
|
| 45 | + */ |
|
| 46 | + public function getFields(): array |
|
| 47 | + { |
|
| 48 | + $fields = [ |
|
| 49 | + new GraphQLOutputField( |
|
| 50 | + 'dbId', |
|
| 51 | + ['non_null' => 'Int'], |
|
| 52 | + 'ID', |
|
| 53 | + esc_html__('The venue ID.', 'event_espresso') |
|
| 54 | + ), |
|
| 55 | + new GraphQLOutputField( |
|
| 56 | + 'cacheId', |
|
| 57 | + ['non_null' => 'String'], |
|
| 58 | + null, |
|
| 59 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 60 | + ), |
|
| 61 | + new GraphQLField( |
|
| 62 | + 'name', |
|
| 63 | + 'String', |
|
| 64 | + 'name', |
|
| 65 | + esc_html__('Venue Name', 'event_espresso') |
|
| 66 | + ), |
|
| 67 | + new GraphQLField( |
|
| 68 | + 'description', |
|
| 69 | + 'String', |
|
| 70 | + 'description', |
|
| 71 | + esc_html__('Venue Description', 'event_espresso') |
|
| 72 | + ), |
|
| 73 | + new GraphQLField( |
|
| 74 | + 'shortDescription', |
|
| 75 | + 'String', |
|
| 76 | + 'excerpt', |
|
| 77 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
| 78 | + ), |
|
| 79 | + new GraphQLField( |
|
| 80 | + 'identifier', |
|
| 81 | + 'String', |
|
| 82 | + 'identifier', |
|
| 83 | + esc_html__('Venue Identifier', 'event_espresso') |
|
| 84 | + ), |
|
| 85 | + new GraphQLField( |
|
| 86 | + 'created', |
|
| 87 | + 'String', |
|
| 88 | + 'created', |
|
| 89 | + esc_html__('Date Venue Created', 'event_espresso') |
|
| 90 | + ), |
|
| 91 | + new GraphQLField( |
|
| 92 | + 'order', |
|
| 93 | + 'Int', |
|
| 94 | + 'order', |
|
| 95 | + esc_html__('Venue order', 'event_espresso') |
|
| 96 | + ), |
|
| 97 | + new GraphQLOutputField( |
|
| 98 | + 'wpUser', |
|
| 99 | + 'User', |
|
| 100 | + null, |
|
| 101 | + esc_html__('Venue Creator', 'event_espresso') |
|
| 102 | + ), |
|
| 103 | + new GraphQLInputField( |
|
| 104 | + 'wpUser', |
|
| 105 | + 'Int', |
|
| 106 | + null, |
|
| 107 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
| 108 | + ), |
|
| 109 | + new GraphQLField( |
|
| 110 | + 'address', |
|
| 111 | + 'String', |
|
| 112 | + 'address', |
|
| 113 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
| 114 | + ), |
|
| 115 | + new GraphQLField( |
|
| 116 | + 'address2', |
|
| 117 | + 'String', |
|
| 118 | + 'address2', |
|
| 119 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
| 120 | + ), |
|
| 121 | + new GraphQLField( |
|
| 122 | + 'city', |
|
| 123 | + 'String', |
|
| 124 | + 'city', |
|
| 125 | + esc_html__('Venue City', 'event_espresso') |
|
| 126 | + ), |
|
| 127 | + new GraphQLOutputField( |
|
| 128 | + 'state', |
|
| 129 | + $this->namespace . 'State', |
|
| 130 | + null, |
|
| 131 | + esc_html__('Venue state', 'event_espresso') |
|
| 132 | + ), |
|
| 133 | + new GraphQLOutputField( |
|
| 134 | + 'stateName', |
|
| 135 | + 'String', |
|
| 136 | + 'state_name', |
|
| 137 | + esc_html__('Venue state name', 'event_espresso') |
|
| 138 | + ), |
|
| 139 | + new GraphQLOutputField( |
|
| 140 | + 'stateAbbrev', |
|
| 141 | + 'String', |
|
| 142 | + 'state_abbrev', |
|
| 143 | + esc_html__('Venue state abbreviation', 'event_espresso') |
|
| 144 | + ), |
|
| 145 | + new GraphQLInputField( |
|
| 146 | + 'state', |
|
| 147 | + 'Int', |
|
| 148 | + null, |
|
| 149 | + esc_html__('State ID', 'event_espresso') |
|
| 150 | + ), |
|
| 151 | + new GraphQLOutputField( |
|
| 152 | + 'country', |
|
| 153 | + $this->namespace . 'Country', |
|
| 154 | + null, |
|
| 155 | + esc_html__('Venue country', 'event_espresso') |
|
| 156 | + ), |
|
| 157 | + new GraphQLOutputField( |
|
| 158 | + 'countryName', |
|
| 159 | + 'String', |
|
| 160 | + 'country_name', |
|
| 161 | + esc_html__('Venue country name', 'event_espresso') |
|
| 162 | + ), |
|
| 163 | + new GraphQLOutputField( |
|
| 164 | + 'countryISO', |
|
| 165 | + 'String', |
|
| 166 | + 'country_ID', |
|
| 167 | + esc_html__('Venue Country ISO Code', 'event_espresso') |
|
| 168 | + ), |
|
| 169 | + new GraphQLInputField( |
|
| 170 | + 'country', |
|
| 171 | + 'String', |
|
| 172 | + null, |
|
| 173 | + esc_html__('Country ISO Code', 'event_espresso') |
|
| 174 | + ), |
|
| 175 | + new GraphQLField( |
|
| 176 | + 'zip', |
|
| 177 | + 'String', |
|
| 178 | + 'zip', |
|
| 179 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
| 180 | + ), |
|
| 181 | + new GraphQLField( |
|
| 182 | + 'capacity', |
|
| 183 | + 'Int', |
|
| 184 | + 'capacity', |
|
| 185 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
| 186 | + [$this, 'parseInfiniteValue'] |
|
| 187 | + ), |
|
| 188 | + new GraphQLField( |
|
| 189 | + 'phone', |
|
| 190 | + 'String', |
|
| 191 | + 'phone', |
|
| 192 | + esc_html__('Venue Phone', 'event_espresso') |
|
| 193 | + ), |
|
| 194 | + new GraphQLField( |
|
| 195 | + 'virtualPhone', |
|
| 196 | + 'String', |
|
| 197 | + 'virtual_phone', |
|
| 198 | + esc_html__('Call in Number', 'event_espresso') |
|
| 199 | + ), |
|
| 200 | + new GraphQLField( |
|
| 201 | + 'url', |
|
| 202 | + 'String', |
|
| 203 | + 'venue_url', |
|
| 204 | + esc_html__('Venue Website', 'event_espresso') |
|
| 205 | + ), |
|
| 206 | + new GraphQLField( |
|
| 207 | + 'virtualUrl', |
|
| 208 | + 'String', |
|
| 209 | + 'virtual_url', |
|
| 210 | + esc_html__('Virtual URL', 'event_espresso') |
|
| 211 | + ), |
|
| 212 | + new GraphQLField( |
|
| 213 | + 'googleMapLink', |
|
| 214 | + 'String', |
|
| 215 | + 'google_map_link', |
|
| 216 | + esc_html__('Google Map Link', 'event_espresso') |
|
| 217 | + ), |
|
| 218 | + new GraphQLField( |
|
| 219 | + 'enableForGmap', |
|
| 220 | + 'String', |
|
| 221 | + 'enable_for_gmap', |
|
| 222 | + esc_html__('Show Google Map?', 'event_espresso') |
|
| 223 | + ), |
|
| 224 | + new GraphQLOutputField( |
|
| 225 | + 'thumbnail', |
|
| 226 | + 'String', |
|
| 227 | + 'thumbnail', |
|
| 228 | + esc_html__('Venue Thumbnail', 'event_espresso'), |
|
| 229 | + null, |
|
| 230 | + [$this, 'getThumbnail'] |
|
| 231 | + ), |
|
| 232 | + ]; |
|
| 233 | 233 | |
| 234 | - return apply_filters( |
|
| 235 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
| 236 | - $fields, |
|
| 237 | - $this->name, |
|
| 238 | - $this->model |
|
| 239 | - ); |
|
| 240 | - } |
|
| 234 | + return apply_filters( |
|
| 235 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
| 236 | + $fields, |
|
| 237 | + $this->name, |
|
| 238 | + $this->model |
|
| 239 | + ); |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Extends the existing WP GraphQL mutations. |
|
| 245 | - * |
|
| 246 | - * @return void |
|
| 247 | - */ |
|
| 248 | - public function extendMutations() |
|
| 249 | - { |
|
| 250 | - add_action( |
|
| 251 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 252 | - VenueUpdate::mutateFields($this->model, $this), |
|
| 253 | - 10, |
|
| 254 | - 6 |
|
| 255 | - ); |
|
| 256 | - } |
|
| 243 | + /** |
|
| 244 | + * Extends the existing WP GraphQL mutations. |
|
| 245 | + * |
|
| 246 | + * @return void |
|
| 247 | + */ |
|
| 248 | + public function extendMutations() |
|
| 249 | + { |
|
| 250 | + add_action( |
|
| 251 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 252 | + VenueUpdate::mutateFields($this->model, $this), |
|
| 253 | + 10, |
|
| 254 | + 6 |
|
| 255 | + ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * @param EE_Venue $venue |
|
| 261 | - * @param array $args |
|
| 262 | - * @param AppContext $context |
|
| 263 | - * @param ResolveInfo $info |
|
| 264 | - * @return string |
|
| 265 | - * @throws EE_Error |
|
| 266 | - * @throws ReflectionException |
|
| 267 | - */ |
|
| 268 | - public function getThumbnail(EE_Venue $venue, array $args, AppContext $context, ResolveInfo $info): string |
|
| 269 | - { |
|
| 270 | - return wp_get_attachment_url(get_post_thumbnail_id($venue->ID())); |
|
| 271 | - } |
|
| 259 | + /** |
|
| 260 | + * @param EE_Venue $venue |
|
| 261 | + * @param array $args |
|
| 262 | + * @param AppContext $context |
|
| 263 | + * @param ResolveInfo $info |
|
| 264 | + * @return string |
|
| 265 | + * @throws EE_Error |
|
| 266 | + * @throws ReflectionException |
|
| 267 | + */ |
|
| 268 | + public function getThumbnail(EE_Venue $venue, array $args, AppContext $context, ResolveInfo $info): string |
|
| 269 | + { |
|
| 270 | + return wp_get_attachment_url(get_post_thumbnail_id($venue->ID())); |
|
| 271 | + } |
|
| 272 | 272 | } |
@@ -25,227 +25,227 @@ |
||
| 25 | 25 | class Event extends TypeBase |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Event constructor. |
|
| 30 | - * |
|
| 31 | - * @param EEM_Event $event_model |
|
| 32 | - */ |
|
| 33 | - public function __construct(EEM_Event $event_model) |
|
| 34 | - { |
|
| 35 | - $this->setName($this->namespace . 'Event'); |
|
| 36 | - $this->setIsCustomPostType(true); |
|
| 37 | - parent::__construct($event_model); |
|
| 38 | - } |
|
| 28 | + /** |
|
| 29 | + * Event constructor. |
|
| 30 | + * |
|
| 31 | + * @param EEM_Event $event_model |
|
| 32 | + */ |
|
| 33 | + public function __construct(EEM_Event $event_model) |
|
| 34 | + { |
|
| 35 | + $this->setName($this->namespace . 'Event'); |
|
| 36 | + $this->setIsCustomPostType(true); |
|
| 37 | + parent::__construct($event_model); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @return GraphQLFieldInterface[] |
|
| 43 | - */ |
|
| 44 | - public function getFields(): array |
|
| 45 | - { |
|
| 46 | - $fields = [ |
|
| 47 | - new GraphQLField( |
|
| 48 | - 'allowDonations', |
|
| 49 | - 'Boolean', |
|
| 50 | - 'donations', |
|
| 51 | - esc_html__('Accept Donations?', 'event_espresso') |
|
| 52 | - ), |
|
| 53 | - new GraphQLField( |
|
| 54 | - 'allowOverflow', |
|
| 55 | - 'Boolean', |
|
| 56 | - 'allow_overflow', |
|
| 57 | - esc_html__('Enable Wait List for Event', 'event_espresso') |
|
| 58 | - ), |
|
| 59 | - new GraphQLField( |
|
| 60 | - 'altRegPage', |
|
| 61 | - 'String', |
|
| 62 | - 'external_url', |
|
| 63 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 64 | - ), |
|
| 65 | - new GraphQLOutputField( |
|
| 66 | - 'cacheId', |
|
| 67 | - ['non_null' => 'String'], |
|
| 68 | - null, |
|
| 69 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 70 | - ), |
|
| 71 | - new GraphQLField( |
|
| 72 | - 'created', |
|
| 73 | - 'String', |
|
| 74 | - 'created', |
|
| 75 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 76 | - ), |
|
| 77 | - new GraphQLOutputField( |
|
| 78 | - 'dbId', |
|
| 79 | - ['non_null' => 'Int'], |
|
| 80 | - 'ID', |
|
| 81 | - esc_html__('The event ID.', 'event_espresso') |
|
| 82 | - ), |
|
| 83 | - new GraphQLField( |
|
| 84 | - 'defaultRegStatus', |
|
| 85 | - $this->namespace . 'RegistrationStatusEnum', |
|
| 86 | - 'default_registration_status', |
|
| 87 | - esc_html__('Default Event Registration Status', 'event_espresso') |
|
| 88 | - ), |
|
| 89 | - new GraphQLField( |
|
| 90 | - 'description', |
|
| 91 | - 'String', |
|
| 92 | - 'description', |
|
| 93 | - esc_html__('Event Description', 'event_espresso') |
|
| 94 | - ), |
|
| 95 | - new GraphQLField( |
|
| 96 | - 'displayDescription', |
|
| 97 | - 'Boolean', |
|
| 98 | - 'display_description', |
|
| 99 | - esc_html__('Display Description Flag', 'event_espresso') |
|
| 100 | - ), |
|
| 101 | - new GraphQLField( |
|
| 102 | - 'displayTicketSelector', |
|
| 103 | - 'Boolean', |
|
| 104 | - 'display_ticket_selector', |
|
| 105 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 106 | - ), |
|
| 107 | - new GraphQLOutputField( |
|
| 108 | - 'isActive', |
|
| 109 | - 'Boolean', |
|
| 110 | - 'is_active', |
|
| 111 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 112 | - ), |
|
| 113 | - new GraphQLOutputField( |
|
| 114 | - 'isCancelled', |
|
| 115 | - 'Boolean', |
|
| 116 | - 'is_cancelled', |
|
| 117 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 118 | - ), |
|
| 119 | - new GraphQLOutputField( |
|
| 120 | - 'isExpired', |
|
| 121 | - 'Boolean', |
|
| 122 | - 'is_expired', |
|
| 123 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 124 | - ), |
|
| 125 | - new GraphQLOutputField( |
|
| 126 | - 'isInactive', |
|
| 127 | - 'Boolean', |
|
| 128 | - 'is_inactive', |
|
| 129 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 130 | - ), |
|
| 131 | - new GraphQLOutputField( |
|
| 132 | - 'isPostponed', |
|
| 133 | - 'Boolean', |
|
| 134 | - 'is_postponed', |
|
| 135 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 136 | - ), |
|
| 137 | - new GraphQLOutputField( |
|
| 138 | - 'isSoldOut', |
|
| 139 | - 'Boolean', |
|
| 140 | - 'is_sold_out', |
|
| 141 | - esc_html__( |
|
| 142 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 143 | - 'event_espresso' |
|
| 144 | - ) |
|
| 145 | - ), |
|
| 146 | - new GraphQLOutputField( |
|
| 147 | - 'isUpcoming', |
|
| 148 | - 'Boolean', |
|
| 149 | - 'is_upcoming', |
|
| 150 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 151 | - ), |
|
| 152 | - new GraphQLInputField( |
|
| 153 | - 'manager', |
|
| 154 | - 'String', |
|
| 155 | - null, |
|
| 156 | - esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
| 157 | - ), |
|
| 158 | - new GraphQLOutputField( |
|
| 159 | - 'manager', |
|
| 160 | - 'User', |
|
| 161 | - null, |
|
| 162 | - esc_html__('Event Manager', 'event_espresso') |
|
| 163 | - ), |
|
| 164 | - new GraphQLField( |
|
| 165 | - 'maxRegistrations', |
|
| 166 | - 'Int', |
|
| 167 | - 'additional_limit', |
|
| 168 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 169 | - ), |
|
| 170 | - new GraphQLField( |
|
| 171 | - 'memberOnly', |
|
| 172 | - 'Boolean', |
|
| 173 | - 'member_only', |
|
| 174 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 175 | - ), |
|
| 176 | - new GraphQLField( |
|
| 177 | - 'name', |
|
| 178 | - 'String', |
|
| 179 | - 'name', |
|
| 180 | - esc_html__('Event Name', 'event_espresso') |
|
| 181 | - ), |
|
| 182 | - new GraphQLField( |
|
| 183 | - 'order', |
|
| 184 | - 'Int', |
|
| 185 | - 'order', |
|
| 186 | - esc_html__('Event Menu Order', 'event_espresso') |
|
| 187 | - ), |
|
| 188 | - new GraphQLField( |
|
| 189 | - 'phoneNumber', |
|
| 190 | - 'String', |
|
| 191 | - 'phone', |
|
| 192 | - esc_html__('Event Phone Number', 'event_espresso') |
|
| 193 | - ), |
|
| 194 | - new GraphQLField( |
|
| 195 | - 'shortDescription', |
|
| 196 | - 'String', |
|
| 197 | - 'short_description', |
|
| 198 | - esc_html__('Event Short Description', 'event_espresso') |
|
| 199 | - ), |
|
| 200 | - new GraphQLField( |
|
| 201 | - 'timezoneString', |
|
| 202 | - 'String', |
|
| 203 | - 'timezone_string', |
|
| 204 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 205 | - ), |
|
| 206 | - new GraphQLField( |
|
| 207 | - 'visibleOn', |
|
| 208 | - 'String', |
|
| 209 | - 'visible_on', |
|
| 210 | - esc_html__('Event Visible Date', 'event_espresso') |
|
| 211 | - ), |
|
| 212 | - new GraphQLField( |
|
| 213 | - 'venue', |
|
| 214 | - 'String', |
|
| 215 | - null, |
|
| 216 | - esc_html__('Event venue ID', 'event_espresso'), |
|
| 217 | - null, |
|
| 218 | - function (EE_Event $source) { |
|
| 219 | - $venue_ID = $source->venue_ID(); |
|
| 220 | - return $venue_ID |
|
| 221 | - // Since venue is a CPT, $type will be 'post' |
|
| 222 | - ? Relay::toGlobalId('post', $venue_ID) |
|
| 223 | - : null; |
|
| 224 | - } |
|
| 225 | - ), |
|
| 226 | - ]; |
|
| 41 | + /** |
|
| 42 | + * @return GraphQLFieldInterface[] |
|
| 43 | + */ |
|
| 44 | + public function getFields(): array |
|
| 45 | + { |
|
| 46 | + $fields = [ |
|
| 47 | + new GraphQLField( |
|
| 48 | + 'allowDonations', |
|
| 49 | + 'Boolean', |
|
| 50 | + 'donations', |
|
| 51 | + esc_html__('Accept Donations?', 'event_espresso') |
|
| 52 | + ), |
|
| 53 | + new GraphQLField( |
|
| 54 | + 'allowOverflow', |
|
| 55 | + 'Boolean', |
|
| 56 | + 'allow_overflow', |
|
| 57 | + esc_html__('Enable Wait List for Event', 'event_espresso') |
|
| 58 | + ), |
|
| 59 | + new GraphQLField( |
|
| 60 | + 'altRegPage', |
|
| 61 | + 'String', |
|
| 62 | + 'external_url', |
|
| 63 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
| 64 | + ), |
|
| 65 | + new GraphQLOutputField( |
|
| 66 | + 'cacheId', |
|
| 67 | + ['non_null' => 'String'], |
|
| 68 | + null, |
|
| 69 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
| 70 | + ), |
|
| 71 | + new GraphQLField( |
|
| 72 | + 'created', |
|
| 73 | + 'String', |
|
| 74 | + 'created', |
|
| 75 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
| 76 | + ), |
|
| 77 | + new GraphQLOutputField( |
|
| 78 | + 'dbId', |
|
| 79 | + ['non_null' => 'Int'], |
|
| 80 | + 'ID', |
|
| 81 | + esc_html__('The event ID.', 'event_espresso') |
|
| 82 | + ), |
|
| 83 | + new GraphQLField( |
|
| 84 | + 'defaultRegStatus', |
|
| 85 | + $this->namespace . 'RegistrationStatusEnum', |
|
| 86 | + 'default_registration_status', |
|
| 87 | + esc_html__('Default Event Registration Status', 'event_espresso') |
|
| 88 | + ), |
|
| 89 | + new GraphQLField( |
|
| 90 | + 'description', |
|
| 91 | + 'String', |
|
| 92 | + 'description', |
|
| 93 | + esc_html__('Event Description', 'event_espresso') |
|
| 94 | + ), |
|
| 95 | + new GraphQLField( |
|
| 96 | + 'displayDescription', |
|
| 97 | + 'Boolean', |
|
| 98 | + 'display_description', |
|
| 99 | + esc_html__('Display Description Flag', 'event_espresso') |
|
| 100 | + ), |
|
| 101 | + new GraphQLField( |
|
| 102 | + 'displayTicketSelector', |
|
| 103 | + 'Boolean', |
|
| 104 | + 'display_ticket_selector', |
|
| 105 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
| 106 | + ), |
|
| 107 | + new GraphQLOutputField( |
|
| 108 | + 'isActive', |
|
| 109 | + 'Boolean', |
|
| 110 | + 'is_active', |
|
| 111 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
| 112 | + ), |
|
| 113 | + new GraphQLOutputField( |
|
| 114 | + 'isCancelled', |
|
| 115 | + 'Boolean', |
|
| 116 | + 'is_cancelled', |
|
| 117 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
| 118 | + ), |
|
| 119 | + new GraphQLOutputField( |
|
| 120 | + 'isExpired', |
|
| 121 | + 'Boolean', |
|
| 122 | + 'is_expired', |
|
| 123 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
| 124 | + ), |
|
| 125 | + new GraphQLOutputField( |
|
| 126 | + 'isInactive', |
|
| 127 | + 'Boolean', |
|
| 128 | + 'is_inactive', |
|
| 129 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
| 130 | + ), |
|
| 131 | + new GraphQLOutputField( |
|
| 132 | + 'isPostponed', |
|
| 133 | + 'Boolean', |
|
| 134 | + 'is_postponed', |
|
| 135 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
| 136 | + ), |
|
| 137 | + new GraphQLOutputField( |
|
| 138 | + 'isSoldOut', |
|
| 139 | + 'Boolean', |
|
| 140 | + 'is_sold_out', |
|
| 141 | + esc_html__( |
|
| 142 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 143 | + 'event_espresso' |
|
| 144 | + ) |
|
| 145 | + ), |
|
| 146 | + new GraphQLOutputField( |
|
| 147 | + 'isUpcoming', |
|
| 148 | + 'Boolean', |
|
| 149 | + 'is_upcoming', |
|
| 150 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
| 151 | + ), |
|
| 152 | + new GraphQLInputField( |
|
| 153 | + 'manager', |
|
| 154 | + 'String', |
|
| 155 | + null, |
|
| 156 | + esc_html__('Globally unique event ID for the event manager', 'event_espresso') |
|
| 157 | + ), |
|
| 158 | + new GraphQLOutputField( |
|
| 159 | + 'manager', |
|
| 160 | + 'User', |
|
| 161 | + null, |
|
| 162 | + esc_html__('Event Manager', 'event_espresso') |
|
| 163 | + ), |
|
| 164 | + new GraphQLField( |
|
| 165 | + 'maxRegistrations', |
|
| 166 | + 'Int', |
|
| 167 | + 'additional_limit', |
|
| 168 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
| 169 | + ), |
|
| 170 | + new GraphQLField( |
|
| 171 | + 'memberOnly', |
|
| 172 | + 'Boolean', |
|
| 173 | + 'member_only', |
|
| 174 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
| 175 | + ), |
|
| 176 | + new GraphQLField( |
|
| 177 | + 'name', |
|
| 178 | + 'String', |
|
| 179 | + 'name', |
|
| 180 | + esc_html__('Event Name', 'event_espresso') |
|
| 181 | + ), |
|
| 182 | + new GraphQLField( |
|
| 183 | + 'order', |
|
| 184 | + 'Int', |
|
| 185 | + 'order', |
|
| 186 | + esc_html__('Event Menu Order', 'event_espresso') |
|
| 187 | + ), |
|
| 188 | + new GraphQLField( |
|
| 189 | + 'phoneNumber', |
|
| 190 | + 'String', |
|
| 191 | + 'phone', |
|
| 192 | + esc_html__('Event Phone Number', 'event_espresso') |
|
| 193 | + ), |
|
| 194 | + new GraphQLField( |
|
| 195 | + 'shortDescription', |
|
| 196 | + 'String', |
|
| 197 | + 'short_description', |
|
| 198 | + esc_html__('Event Short Description', 'event_espresso') |
|
| 199 | + ), |
|
| 200 | + new GraphQLField( |
|
| 201 | + 'timezoneString', |
|
| 202 | + 'String', |
|
| 203 | + 'timezone_string', |
|
| 204 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
| 205 | + ), |
|
| 206 | + new GraphQLField( |
|
| 207 | + 'visibleOn', |
|
| 208 | + 'String', |
|
| 209 | + 'visible_on', |
|
| 210 | + esc_html__('Event Visible Date', 'event_espresso') |
|
| 211 | + ), |
|
| 212 | + new GraphQLField( |
|
| 213 | + 'venue', |
|
| 214 | + 'String', |
|
| 215 | + null, |
|
| 216 | + esc_html__('Event venue ID', 'event_espresso'), |
|
| 217 | + null, |
|
| 218 | + function (EE_Event $source) { |
|
| 219 | + $venue_ID = $source->venue_ID(); |
|
| 220 | + return $venue_ID |
|
| 221 | + // Since venue is a CPT, $type will be 'post' |
|
| 222 | + ? Relay::toGlobalId('post', $venue_ID) |
|
| 223 | + : null; |
|
| 224 | + } |
|
| 225 | + ), |
|
| 226 | + ]; |
|
| 227 | 227 | |
| 228 | - return apply_filters( |
|
| 229 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 230 | - $fields, |
|
| 231 | - $this->name, |
|
| 232 | - $this->model |
|
| 233 | - ); |
|
| 234 | - } |
|
| 228 | + return apply_filters( |
|
| 229 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields', |
|
| 230 | + $fields, |
|
| 231 | + $this->name, |
|
| 232 | + $this->model |
|
| 233 | + ); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | |
| 237 | - /** |
|
| 238 | - * Extends the existing WP GraphQL mutations. |
|
| 239 | - * |
|
| 240 | - * @since $VID:$ |
|
| 241 | - */ |
|
| 242 | - public function extendMutations() |
|
| 243 | - { |
|
| 244 | - add_action( |
|
| 245 | - 'graphql_post_object_mutation_update_additional_data', |
|
| 246 | - EventUpdate::mutateFields($this->model, $this), |
|
| 247 | - 10, |
|
| 248 | - 6 |
|
| 249 | - ); |
|
| 250 | - } |
|
| 237 | + /** |
|
| 238 | + * Extends the existing WP GraphQL mutations. |
|
| 239 | + * |
|
| 240 | + * @since $VID:$ |
|
| 241 | + */ |
|
| 242 | + public function extendMutations() |
|
| 243 | + { |
|
| 244 | + add_action( |
|
| 245 | + 'graphql_post_object_mutation_update_additional_data', |
|
| 246 | + EventUpdate::mutateFields($this->model, $this), |
|
| 247 | + 10, |
|
| 248 | + 6 |
|
| 249 | + ); |
|
| 250 | + } |
|
| 251 | 251 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function __construct(EEM_Event $event_model) |
| 34 | 34 | { |
| 35 | - $this->setName($this->namespace . 'Event'); |
|
| 35 | + $this->setName($this->namespace.'Event'); |
|
| 36 | 36 | $this->setIsCustomPostType(true); |
| 37 | 37 | parent::__construct($event_model); |
| 38 | 38 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ), |
| 83 | 83 | new GraphQLField( |
| 84 | 84 | 'defaultRegStatus', |
| 85 | - $this->namespace . 'RegistrationStatusEnum', |
|
| 85 | + $this->namespace.'RegistrationStatusEnum', |
|
| 86 | 86 | 'default_registration_status', |
| 87 | 87 | esc_html__('Default Event Registration Status', 'event_espresso') |
| 88 | 88 | ), |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | null, |
| 216 | 216 | esc_html__('Event venue ID', 'event_espresso'), |
| 217 | 217 | null, |
| 218 | - function (EE_Event $source) { |
|
| 218 | + function(EE_Event $source) { |
|
| 219 | 219 | $venue_ID = $source->venue_ID(); |
| 220 | 220 | return $venue_ID |
| 221 | 221 | // Since venue is a CPT, $type will be 'post' |
@@ -13,1024 +13,1024 @@ |
||
| 13 | 13 | { |
| 14 | 14 | |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @return EED_Events_Archive_Filters |
|
| 18 | - */ |
|
| 19 | - public static function instance() |
|
| 20 | - { |
|
| 21 | - return parent::get_instance(__CLASS__); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Start Date |
|
| 27 | - * |
|
| 28 | - * @var $_elf_month |
|
| 29 | - * @access protected |
|
| 30 | - */ |
|
| 31 | - protected $_elf_month = null; |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Category |
|
| 36 | - * |
|
| 37 | - * @var $_elf_category |
|
| 38 | - * @access protected |
|
| 39 | - */ |
|
| 40 | - protected $_elf_category = null; |
|
| 41 | - |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * whether to display expired events in the event list |
|
| 45 | - * |
|
| 46 | - * @var $_show_expired |
|
| 47 | - * @access protected |
|
| 48 | - */ |
|
| 49 | - protected $_show_expired = null; |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * whether to display the event list as a grid or list |
|
| 54 | - * |
|
| 55 | - * @var $_type |
|
| 56 | - * @access protected |
|
| 57 | - */ |
|
| 58 | - protected static $_type = null; |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * array of existing event list views |
|
| 63 | - * |
|
| 64 | - * @var $_types |
|
| 65 | - * @access protected |
|
| 66 | - */ |
|
| 67 | - protected static $_types = array('grid', 'text', 'dates'); |
|
| 68 | - |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
| 73 | - * |
|
| 74 | - * @access public |
|
| 75 | - * @return void |
|
| 76 | - */ |
|
| 77 | - public static function set_hooks() |
|
| 78 | - { |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 83 | - * |
|
| 84 | - * @access public |
|
| 85 | - * @return void |
|
| 86 | - */ |
|
| 87 | - public static function set_hooks_admin() |
|
| 88 | - { |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * set_definitions |
|
| 94 | - * |
|
| 95 | - * @access public |
|
| 96 | - * @return void |
|
| 97 | - */ |
|
| 98 | - public static function set_definitions() |
|
| 99 | - { |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * run - initial module setup |
|
| 105 | - * |
|
| 106 | - * @access public |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function run($WP) |
|
| 110 | - { |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * event_list |
|
| 116 | - * |
|
| 117 | - * @access public |
|
| 118 | - * @return void |
|
| 119 | - */ |
|
| 120 | - public function event_list() |
|
| 121 | - { |
|
| 122 | - // load other required components |
|
| 123 | - $this->_load_assests(); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * _filter_query_parts |
|
| 129 | - * |
|
| 130 | - * @access public |
|
| 131 | - * @return void |
|
| 132 | - */ |
|
| 133 | - private function _filter_query_parts() |
|
| 134 | - { |
|
| 135 | - // build event list query |
|
| 136 | - add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
| 137 | - add_filter('posts_where', array($this, 'posts_where'), 1, 2); |
|
| 138 | - add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * _type - the type of event list : grid, text, dates |
|
| 143 | - * |
|
| 144 | - * @access public |
|
| 145 | - * @return string |
|
| 146 | - */ |
|
| 147 | - public static function set_type() |
|
| 148 | - { |
|
| 149 | - do_action('AHEE__EED_Events_Archive_Filters__before_set_type'); |
|
| 150 | - EED_Events_Archive_Filters::$_types = apply_filters( |
|
| 151 | - 'EED_Events_Archive_Filters__set_type__types', |
|
| 152 | - EED_Events_Archive_Filters::$_types |
|
| 153 | - ); |
|
| 154 | - $view = isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type']) ? EE_Registry::instance( |
|
| 155 | - )->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
| 156 | - $elf_type = EE_Registry::instance()->REQ->is_set('elf_type') ? sanitize_text_field( |
|
| 157 | - EE_Registry::instance()->REQ->get('elf_type') |
|
| 158 | - ) : ''; |
|
| 159 | - $view = ! empty($elf_type) ? $elf_type : $view; |
|
| 160 | - $view = apply_filters('EED_Events_Archive_Filters__set_type__type', $view); |
|
| 161 | - if (! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
| 162 | - self::$_type = $view; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * _show_expired |
|
| 168 | - * |
|
| 169 | - * @access private |
|
| 170 | - * @param boolean $req_only if TRUE, then ignore defaults and only return $_POST value |
|
| 171 | - * @return boolean |
|
| 172 | - */ |
|
| 173 | - private static function _show_expired($req_only = false) |
|
| 174 | - { |
|
| 175 | - // get default value for "display_expired_events" as set in the EE General Settings > Templates > Event Listings |
|
| 176 | - $show_expired = ! $req_only && isset( |
|
| 177 | - EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] |
|
| 178 | - ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : false; |
|
| 179 | - // override default expired option if set via filter |
|
| 180 | - $show_expired = EE_Registry::instance()->REQ->is_set('elf_expired_chk') ? absint( |
|
| 181 | - EE_Registry::instance()->REQ->get('elf_expired_chk') |
|
| 182 | - ) : $show_expired; |
|
| 183 | - return $show_expired ? true : false; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * _event_category_slug |
|
| 188 | - * |
|
| 189 | - * @access private |
|
| 190 | - * @return string |
|
| 191 | - */ |
|
| 192 | - private static function _event_category_slug() |
|
| 193 | - { |
|
| 194 | - return EE_Registry::instance()->REQ->is_set('elf_category_dd') ? sanitize_text_field( |
|
| 195 | - EE_Registry::instance()->REQ->get('elf_category_dd') |
|
| 196 | - ) : ''; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * _display_month - what month should the event list display events for? |
|
| 201 | - * |
|
| 202 | - * @access private |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 205 | - private static function _display_month() |
|
| 206 | - { |
|
| 207 | - return EE_Registry::instance()->REQ->is_set('elf_month_dd') ? sanitize_text_field( |
|
| 208 | - EE_Registry::instance()->REQ->get('elf_month_dd') |
|
| 209 | - ) : ''; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * get_post_data |
|
| 215 | - * |
|
| 216 | - * @access public |
|
| 217 | - * @return void |
|
| 218 | - */ |
|
| 219 | - public function get_post_data() |
|
| 220 | - { |
|
| 221 | - $this->_elf_month = EED_Events_Archive_Filters::_display_month(); |
|
| 222 | - $this->_elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
|
| 223 | - $this->_show_expired = EED_Events_Archive_Filters::_show_expired(true); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * posts_join |
|
| 229 | - * |
|
| 230 | - * @access public |
|
| 231 | - * @return void |
|
| 232 | - */ |
|
| 233 | - public function posts_join($SQL, WP_Query $wp_query) |
|
| 234 | - { |
|
| 235 | - if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
| 236 | - // Category |
|
| 237 | - $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms( |
|
| 238 | - EED_Events_Archive_Filters::_event_category_slug() |
|
| 239 | - ); |
|
| 240 | - } |
|
| 241 | - return $SQL; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * posts_join_sql_for_terms |
|
| 247 | - * |
|
| 248 | - * @access public |
|
| 249 | - * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value |
|
| 250 | - * doesn't really get used for anything yet |
|
| 251 | - * @return string |
|
| 252 | - */ |
|
| 253 | - public static function posts_join_sql_for_terms($join_terms = null) |
|
| 254 | - { |
|
| 255 | - $SQL = ''; |
|
| 256 | - if (! empty($join_terms)) { |
|
| 257 | - global $wpdb; |
|
| 258 | - $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
|
| 259 | - $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
|
| 260 | - $SQL .= " LEFT JOIN $wpdb->terms ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) "; |
|
| 261 | - } |
|
| 262 | - return $SQL; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * usage: $SQL .= EED_Events_Archive_Filters::posts_join_for_orderby( $orderby_params ); |
|
| 268 | - * |
|
| 269 | - * @param array $orderby_params |
|
| 270 | - * @return string |
|
| 271 | - * @throws EE_Error |
|
| 272 | - * @throws ReflectionException |
|
| 273 | - */ |
|
| 274 | - public static function posts_join_for_orderby(array $orderby_params = array()): string |
|
| 275 | - { |
|
| 276 | - global $wpdb; |
|
| 277 | - $SQL = ''; |
|
| 278 | - $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
| 279 | - foreach ($orderby_params as $orderby) { |
|
| 280 | - switch ($orderby) { |
|
| 281 | - case 'ticket_start': |
|
| 282 | - case 'ticket_end': |
|
| 283 | - $SQL .= ' LEFT JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' ON (' |
|
| 284 | - . EEM_Datetime::instance()->table() . '.DTT_ID = ' |
|
| 285 | - . EEM_Datetime_Ticket::instance()->table() . '.DTT_ID )'; |
|
| 286 | - $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' |
|
| 287 | - . EEM_Datetime_Ticket::instance()->table() . '.TKT_ID = ' |
|
| 288 | - . EEM_Ticket::instance()->table() . '.TKT_ID )'; |
|
| 289 | - break; |
|
| 290 | - |
|
| 291 | - case 'city': |
|
| 292 | - case 'state': |
|
| 293 | - case 'venue_title': |
|
| 294 | - // grab wp_posts (event), venue, and event_meta table names |
|
| 295 | - $wp_posts = $wpdb->posts; |
|
| 296 | - $venue = EEM_Venue::instance()->table(); |
|
| 297 | - $event_meta = EEM_Event::instance()->second_table(); |
|
| 298 | - $SQL .= " LEFT JOIN $event_meta ON ( $wp_posts.ID = $event_meta.EVT_ID )"; |
|
| 299 | - $SQL .= " LEFT JOIN $venue ON ( $event_meta.VNU_ID = $venue.VNU_ID )"; |
|
| 300 | - break; |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - return $SQL; |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * posts_where |
|
| 309 | - * |
|
| 310 | - * @access public |
|
| 311 | - * @return void |
|
| 312 | - */ |
|
| 313 | - public function posts_where($SQL, WP_Query $wp_query) |
|
| 314 | - { |
|
| 315 | - if (isset($wp_query->query_vars) && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
| 316 | - // Show Expired ? |
|
| 317 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired( |
|
| 318 | - EED_Events_Archive_Filters::_show_expired() |
|
| 319 | - ); |
|
| 320 | - // Category |
|
| 321 | - // $elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
|
| 322 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug( |
|
| 323 | - EED_Events_Archive_Filters::_event_category_slug() |
|
| 324 | - ); |
|
| 325 | - // Start Date |
|
| 326 | - // $elf_month = EED_Events_Archive_Filters::_display_month(); |
|
| 327 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month( |
|
| 328 | - EED_Events_Archive_Filters::_display_month() |
|
| 329 | - ); |
|
| 330 | - } |
|
| 331 | - return $SQL; |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * posts_where_sql_for_show_expired |
|
| 337 | - * |
|
| 338 | - * @access public |
|
| 339 | - * @param boolean $show_expired if TRUE, then displayed past events |
|
| 340 | - * @return string |
|
| 341 | - */ |
|
| 342 | - public static function posts_where_sql_for_show_expired($show_expired = false) |
|
| 343 | - { |
|
| 344 | - return ! $show_expired |
|
| 345 | - ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . date('Y-m-d H:s:i') . '" ' |
|
| 346 | - : ''; |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * posts_where_sql_for_event_category_slug |
|
| 352 | - * |
|
| 353 | - * @access public |
|
| 354 | - * @param boolean $event_category_slug |
|
| 355 | - * @return string |
|
| 356 | - */ |
|
| 357 | - public static function posts_where_sql_for_event_category_slug($event_category_slug = null) |
|
| 358 | - { |
|
| 359 | - global $wpdb; |
|
| 360 | - return ! empty($event_category_slug) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * posts_where_sql_for_event_list_month |
|
| 365 | - * |
|
| 366 | - * @access public |
|
| 367 | - * @param boolean $month |
|
| 368 | - * @return string |
|
| 369 | - */ |
|
| 370 | - public static function posts_where_sql_for_event_list_month($month = null) |
|
| 371 | - { |
|
| 372 | - $SQL = ''; |
|
| 373 | - if (! empty($month)) { |
|
| 374 | - // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
|
| 375 | - $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start'; |
|
| 376 | - $SQL .= ' <= "' . date('Y-m-t 23:59:59', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '"'; |
|
| 377 | - // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
|
| 378 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end'; |
|
| 379 | - $SQL .= ' >= "' . date('Y-m-d 0:0:00', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '" '; |
|
| 380 | - } |
|
| 381 | - return $SQL; |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - |
|
| 385 | - /** |
|
| 386 | - * posts_orderby |
|
| 387 | - * |
|
| 388 | - * @access public |
|
| 389 | - * @return void |
|
| 390 | - */ |
|
| 391 | - public function posts_orderby($SQL, WP_Query $wp_query) |
|
| 392 | - { |
|
| 393 | - if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
| 394 | - $SQL = EED_Events_Archive_Filters::posts_orderby_sql(array('start_date')); |
|
| 395 | - } |
|
| 396 | - return $SQL; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - |
|
| 400 | - /** |
|
| 401 | - * posts_orderby_sql |
|
| 402 | - * |
|
| 403 | - * possible parameters: |
|
| 404 | - * ID |
|
| 405 | - * start_date |
|
| 406 | - * end_date |
|
| 407 | - * event_name |
|
| 408 | - * category_slug |
|
| 409 | - * ticket_start |
|
| 410 | - * ticket_end |
|
| 411 | - * venue_title |
|
| 412 | - * city |
|
| 413 | - * state |
|
| 414 | - * |
|
| 415 | - * **IMPORTANT** |
|
| 416 | - * make sure to also send the $orderby_params array to the posts_join_for_orderby() method |
|
| 417 | - * or else some of the table references below will result in MySQL errors |
|
| 418 | - * |
|
| 419 | - * @access public |
|
| 420 | - * @param boolean $orderby_params |
|
| 421 | - * @return string |
|
| 422 | - */ |
|
| 423 | - public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') |
|
| 424 | - { |
|
| 425 | - global $wpdb; |
|
| 426 | - $SQL = ''; |
|
| 427 | - $cntr = 1; |
|
| 428 | - $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
| 429 | - foreach ($orderby_params as $orderby) { |
|
| 430 | - $glue = $cntr == 1 || $cntr == count($orderby_params) ? ' ' : ', '; |
|
| 431 | - switch ($orderby) { |
|
| 432 | - case 'id': |
|
| 433 | - case 'ID': |
|
| 434 | - $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
| 435 | - break; |
|
| 436 | - |
|
| 437 | - case 'start_date': |
|
| 438 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort; |
|
| 439 | - break; |
|
| 440 | - |
|
| 441 | - case 'end_date': |
|
| 442 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
| 443 | - break; |
|
| 444 | - |
|
| 445 | - case 'event_name': |
|
| 446 | - $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
| 447 | - break; |
|
| 448 | - |
|
| 449 | - case 'category_slug': |
|
| 450 | - $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
| 451 | - break; |
|
| 452 | - |
|
| 453 | - case 'ticket_start': |
|
| 454 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
| 455 | - break; |
|
| 456 | - |
|
| 457 | - case 'ticket_end': |
|
| 458 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
| 459 | - break; |
|
| 460 | - |
|
| 461 | - case 'venue_title': |
|
| 462 | - $SQL .= $glue . 'venue_title ' . $sort; |
|
| 463 | - break; |
|
| 464 | - |
|
| 465 | - case 'city': |
|
| 466 | - $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
| 467 | - break; |
|
| 468 | - |
|
| 469 | - case 'state': |
|
| 470 | - $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
| 471 | - break; |
|
| 472 | - } |
|
| 473 | - $cntr++; |
|
| 474 | - } |
|
| 475 | - // echo '<h4>$SQL : ' . $SQL . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
|
| 476 | - return $SQL; |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * template_redirect |
|
| 482 | - * |
|
| 483 | - * @access public |
|
| 484 | - * @return void |
|
| 485 | - */ |
|
| 486 | - public function template_redirect() |
|
| 487 | - { |
|
| 488 | - // add event list filters |
|
| 489 | - add_action('loop_start', array($this, 'event_list_template_filters')); |
|
| 490 | - // and pagination |
|
| 491 | - add_action('loop_start', array($this, 'event_list_pagination')); |
|
| 492 | - add_action('loop_end', array($this, 'event_list_pagination')); |
|
| 493 | - // if NOT a custom template |
|
| 494 | - if ( |
|
| 495 | - EE_Registry::instance() |
|
| 496 | - ->load_core('Front_Controller', array(), false, true) |
|
| 497 | - ->get_selected_template() != 'archive-espresso_events.php' |
|
| 498 | - ) { |
|
| 499 | - // don't know if theme uses the_excerpt |
|
| 500 | - add_filter('the_excerpt', array($this, 'event_details'), 100); |
|
| 501 | - add_filter('the_excerpt', array($this, 'event_tickets'), 110); |
|
| 502 | - add_filter('the_excerpt', array($this, 'event_datetimes'), 120); |
|
| 503 | - add_filter('the_excerpt', array($this, 'event_venues'), 130); |
|
| 504 | - // or the_content |
|
| 505 | - add_filter('the_content', array($this, 'event_details'), 100); |
|
| 506 | - add_filter('the_content', array($this, 'event_tickets'), 110); |
|
| 507 | - add_filter('the_content', array($this, 'event_datetimes'), 120); |
|
| 508 | - add_filter('the_content', array($this, 'event_venues'), 130); |
|
| 509 | - } else { |
|
| 510 | - remove_all_filters('excerpt_length'); |
|
| 511 | - add_filter('excerpt_length', array($this, 'excerpt_length'), 10); |
|
| 512 | - add_filter('excerpt_more', array($this, 'excerpt_more'), 10); |
|
| 513 | - } |
|
| 514 | - } |
|
| 515 | - |
|
| 516 | - |
|
| 517 | - /** |
|
| 518 | - * event_list_pagination |
|
| 519 | - * |
|
| 520 | - * @access public |
|
| 521 | - * @return void |
|
| 522 | - */ |
|
| 523 | - public function event_list_pagination() |
|
| 524 | - { |
|
| 525 | - echo '<div class="ee-pagination-dv ee-clear-float">' . espresso_event_list_pagination() . '</div>'; |
|
| 526 | - } |
|
| 527 | - |
|
| 528 | - |
|
| 529 | - /** |
|
| 530 | - * event_details |
|
| 531 | - * |
|
| 532 | - * @access public |
|
| 533 | - * @param string $content |
|
| 534 | - * @return void |
|
| 535 | - */ |
|
| 536 | - public function event_details($content) |
|
| 537 | - { |
|
| 538 | - return EEH_Template::display_template( |
|
| 539 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-details.php', |
|
| 540 | - array('the_content' => $content), |
|
| 541 | - true |
|
| 542 | - ); |
|
| 543 | - } |
|
| 544 | - |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * event_tickets |
|
| 548 | - * |
|
| 549 | - * @access public |
|
| 550 | - * @param string $content |
|
| 551 | - * @return void |
|
| 552 | - */ |
|
| 553 | - public function event_tickets($content) |
|
| 554 | - { |
|
| 555 | - return $content |
|
| 556 | - . EEH_Template::display_template( |
|
| 557 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-tickets.php', |
|
| 558 | - array(), |
|
| 559 | - true |
|
| 560 | - ); |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - /** |
|
| 564 | - * event_datetimes |
|
| 565 | - * |
|
| 566 | - * @access public |
|
| 567 | - * @param string $content |
|
| 568 | - * @return void |
|
| 569 | - */ |
|
| 570 | - public function event_datetimes($content) |
|
| 571 | - { |
|
| 572 | - return $content |
|
| 573 | - . EEH_Template::display_template( |
|
| 574 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-datetimes.php', |
|
| 575 | - array(), |
|
| 576 | - true |
|
| 577 | - ); |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - /** |
|
| 581 | - * event_venues |
|
| 582 | - * |
|
| 583 | - * @access public |
|
| 584 | - * @param string $content |
|
| 585 | - * @return void |
|
| 586 | - */ |
|
| 587 | - public function event_venues($content) |
|
| 588 | - { |
|
| 589 | - return $content |
|
| 590 | - . EEH_Template::display_template( |
|
| 591 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-venues.php', |
|
| 592 | - array(), |
|
| 593 | - true |
|
| 594 | - ); |
|
| 595 | - } |
|
| 596 | - |
|
| 597 | - |
|
| 598 | - /** |
|
| 599 | - * _initial_setup |
|
| 600 | - * |
|
| 601 | - * @access public |
|
| 602 | - * @return void |
|
| 603 | - */ |
|
| 604 | - private function _load_assests() |
|
| 605 | - { |
|
| 606 | - do_action('AHEE__EED_Events_Archive_Filters__before_load_assests'); |
|
| 607 | - wp_enqueue_style('espresso_default'); |
|
| 608 | - wp_enqueue_style('espresso_custom_css'); |
|
| 609 | - add_filter('FHEE_load_EE_Session', '__return_true'); |
|
| 610 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 611 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
| 612 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
| 613 | - } |
|
| 614 | - // add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), 999 ); |
|
| 615 | - } |
|
| 616 | - |
|
| 617 | - |
|
| 618 | - /** |
|
| 619 | - * _get_template |
|
| 620 | - * |
|
| 621 | - * @access private |
|
| 622 | - * @return string |
|
| 623 | - */ |
|
| 624 | - private function _get_template($which = 'part') |
|
| 625 | - { |
|
| 626 | - return EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - |
|
| 630 | - /** |
|
| 631 | - * excerpt_length |
|
| 632 | - * |
|
| 633 | - * @access public |
|
| 634 | - * @return void |
|
| 635 | - */ |
|
| 636 | - public function excerpt_length($length) |
|
| 637 | - { |
|
| 638 | - |
|
| 639 | - if (self::$_type == 'grid') { |
|
| 640 | - return 36; |
|
| 641 | - } |
|
| 642 | - |
|
| 643 | - switch (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) { |
|
| 644 | - case 'tiny': |
|
| 645 | - return 12; |
|
| 646 | - break; |
|
| 647 | - case 'small': |
|
| 648 | - return 24; |
|
| 649 | - break; |
|
| 650 | - case 'large': |
|
| 651 | - return 48; |
|
| 652 | - break; |
|
| 653 | - case 'medium': |
|
| 654 | - default: |
|
| 655 | - return 36; |
|
| 656 | - } |
|
| 657 | - } |
|
| 658 | - |
|
| 659 | - |
|
| 660 | - /** |
|
| 661 | - * excerpt_more |
|
| 662 | - * |
|
| 663 | - * @access public |
|
| 664 | - * @return void |
|
| 665 | - */ |
|
| 666 | - public function excerpt_more($more) |
|
| 667 | - { |
|
| 668 | - return '…'; |
|
| 669 | - } |
|
| 670 | - |
|
| 671 | - |
|
| 672 | - |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * wp_enqueue_scripts |
|
| 676 | - * |
|
| 677 | - * @access public |
|
| 678 | - * @return void |
|
| 679 | - */ |
|
| 680 | - public function wp_enqueue_scripts() |
|
| 681 | - { |
|
| 682 | - // get some style |
|
| 683 | - if (apply_filters('FHEE_enable_default_espresso_css', false)) { |
|
| 684 | - // first check uploads folder |
|
| 685 | - if ( |
|
| 686 | - is_readable( |
|
| 687 | - get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.css' |
|
| 688 | - ) |
|
| 689 | - ) { |
|
| 690 | - wp_register_style( |
|
| 691 | - 'archive-espresso_events', |
|
| 692 | - get_stylesheet_directory_uri() . EE_Config::get_current_theme( |
|
| 693 | - ) . '/archive-espresso_events.css', |
|
| 694 | - array('dashicons', 'espresso_default') |
|
| 695 | - ); |
|
| 696 | - } else { |
|
| 697 | - wp_register_style( |
|
| 698 | - 'archive-espresso_events', |
|
| 699 | - EE_TEMPLATES_URL . EE_Config::get_current_theme() . '/archive-espresso_events.css', |
|
| 700 | - array('dashicons', 'espresso_default') |
|
| 701 | - ); |
|
| 702 | - } |
|
| 703 | - if ( |
|
| 704 | - is_readable( |
|
| 705 | - get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.js' |
|
| 706 | - ) |
|
| 707 | - ) { |
|
| 708 | - wp_register_script( |
|
| 709 | - 'archive-espresso_events', |
|
| 710 | - get_stylesheet_directory_uri() . EE_Config::get_current_theme() . '/archive-espresso_events.js', |
|
| 711 | - array('jquery-masonry'), |
|
| 712 | - '1.0', |
|
| 713 | - true |
|
| 714 | - ); |
|
| 715 | - } else { |
|
| 716 | - wp_register_script( |
|
| 717 | - 'archive-espresso_events', |
|
| 718 | - EVENTS_ARCHIVE_ASSETS_URL . 'archive-espresso_events.js', |
|
| 719 | - array('jquery-masonry'), |
|
| 720 | - '1.0', |
|
| 721 | - true |
|
| 722 | - ); |
|
| 723 | - } |
|
| 724 | - wp_enqueue_style('archive-espresso_events'); |
|
| 725 | - wp_enqueue_script('jquery-masonry'); |
|
| 726 | - wp_enqueue_script('archive-espresso_events'); |
|
| 727 | - add_action('wp_footer', array('EED_Events_Archive_Filters', 'localize_grid_event_lists'), 1); |
|
| 728 | - } |
|
| 729 | - } |
|
| 730 | - |
|
| 731 | - |
|
| 732 | - /** |
|
| 733 | - * template_settings_form |
|
| 734 | - * |
|
| 735 | - * @access public |
|
| 736 | - * @static |
|
| 737 | - * @return void |
|
| 738 | - */ |
|
| 739 | - public static function localize_grid_event_lists() |
|
| 740 | - { |
|
| 741 | - wp_localize_script( |
|
| 742 | - 'archive-espresso_events', |
|
| 743 | - 'espresso_grid_event_lists', |
|
| 744 | - EED_Events_Archive_Filters::$espresso_grid_event_lists |
|
| 745 | - ); |
|
| 746 | - } |
|
| 747 | - |
|
| 748 | - |
|
| 749 | - /** |
|
| 750 | - * template_settings_form |
|
| 751 | - * |
|
| 752 | - * @access public |
|
| 753 | - * @static |
|
| 754 | - * @return void |
|
| 755 | - */ |
|
| 756 | - public static function template_settings_form() |
|
| 757 | - { |
|
| 758 | - $EE = EE_Registry::instance(); |
|
| 759 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = isset($EE->CFG->template_settings->EED_Events_Archive_Filters) |
|
| 760 | - ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
| 761 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters( |
|
| 762 | - 'FHEE__Event_List__template_settings_form__event_list_config', |
|
| 763 | - $EE->CFG->template_settings->EED_Events_Archive_Filters |
|
| 764 | - ); |
|
| 765 | - EEH_Template::display_template( |
|
| 766 | - EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
| 767 | - $EE->CFG->template_settings->EED_Events_Archive_Filters |
|
| 768 | - ); |
|
| 769 | - } |
|
| 770 | - |
|
| 771 | - |
|
| 772 | - /** |
|
| 773 | - * set_default_settings |
|
| 774 | - * |
|
| 775 | - * @access public |
|
| 776 | - * @static |
|
| 777 | - * @return void |
|
| 778 | - */ |
|
| 779 | - public static function set_default_settings($CFG) |
|
| 780 | - { |
|
| 781 | - // EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
| 782 | - $CFG->display_description = isset($CFG->display_description) && ! empty($CFG->display_description) |
|
| 783 | - ? $CFG->display_description : 1; |
|
| 784 | - $CFG->display_address = isset($CFG->display_address) && ! empty($CFG->display_address) ? $CFG->display_address |
|
| 785 | - : true; |
|
| 786 | - $CFG->display_venue_details = isset($CFG->display_venue_details) && ! empty($CFG->display_venue_details) |
|
| 787 | - ? $CFG->display_venue_details : true; |
|
| 788 | - $CFG->display_expired_events = isset($CFG->display_expired_events) && ! empty($CFG->display_expired_events) |
|
| 789 | - ? $CFG->display_expired_events : false; |
|
| 790 | - $CFG->default_type = isset($CFG->default_type) && ! empty($CFG->default_type) ? $CFG->default_type : 'grid'; |
|
| 791 | - $CFG->event_list_grid_size = isset($CFG->event_list_grid_size) && ! empty($CFG->event_list_grid_size) |
|
| 792 | - ? $CFG->event_list_grid_size : 'medium'; |
|
| 793 | - $CFG->templates['full'] = isset($CFG->templates['full']) && ! empty($CFG->templates['full']) |
|
| 794 | - ? $CFG->templates['full'] |
|
| 795 | - : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 796 | - $CFG->templates['part'] = isset($CFG->templates['part']) && ! empty($CFG->templates['part']) |
|
| 797 | - ? $CFG->templates['part'] |
|
| 798 | - : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-grid-view.php'; |
|
| 799 | - return $CFG; |
|
| 800 | - } |
|
| 801 | - |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * filter_config |
|
| 805 | - * |
|
| 806 | - * @access public |
|
| 807 | - * @return void |
|
| 808 | - */ |
|
| 809 | - public function filter_config($CFG) |
|
| 810 | - { |
|
| 811 | - return $CFG; |
|
| 812 | - } |
|
| 813 | - |
|
| 814 | - |
|
| 815 | - /** |
|
| 816 | - * filter_config |
|
| 817 | - * |
|
| 818 | - * @access public |
|
| 819 | - * @return void |
|
| 820 | - */ |
|
| 821 | - public static function update_template_settings($CFG, $REQ) |
|
| 822 | - { |
|
| 823 | - // $CFG->template_settings->EED_Events_Archive_Filters = new stdClass(); |
|
| 824 | - $CFG->EED_Events_Archive_Filters->display_description = isset($REQ['display_description_in_event_list']) |
|
| 825 | - ? absint($REQ['display_description_in_event_list']) : 1; |
|
| 826 | - $CFG->EED_Events_Archive_Filters->display_address = isset($REQ['display_address_in_event_list']) ? absint( |
|
| 827 | - $REQ['display_address_in_event_list'] |
|
| 828 | - ) : true; |
|
| 829 | - $CFG->EED_Events_Archive_Filters->display_venue_details = isset($REQ['display_venue_details_in_event_list']) |
|
| 830 | - ? absint($REQ['display_venue_details_in_event_list']) : true; |
|
| 831 | - $CFG->EED_Events_Archive_Filters->display_expired_events = isset($REQ['display_expired_events']) ? absint( |
|
| 832 | - $REQ['display_expired_events'] |
|
| 833 | - ) : false; |
|
| 834 | - $CFG->EED_Events_Archive_Filters->default_type = isset($REQ['default_type']) ? sanitize_text_field( |
|
| 835 | - $REQ['default_type'] |
|
| 836 | - ) : 'grid'; |
|
| 837 | - $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset($REQ['event_list_grid_size']) |
|
| 838 | - ? sanitize_text_field($REQ['event_list_grid_size']) : 'medium'; |
|
| 839 | - $CFG->EED_Events_Archive_Filters->templates = array( |
|
| 840 | - 'full' => EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php', |
|
| 841 | - ); |
|
| 842 | - |
|
| 843 | - switch ($CFG->EED_Events_Archive_Filters->default_type) { |
|
| 844 | - case 'dates': |
|
| 845 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 846 | - . '/archive-espresso_events-dates-view.php'; |
|
| 847 | - break; |
|
| 848 | - case 'text': |
|
| 849 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 850 | - . '/archive-espresso_events-text-view.php'; |
|
| 851 | - break; |
|
| 852 | - default: |
|
| 853 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 854 | - . '/archive-espresso_events-grid-view.php'; |
|
| 855 | - } |
|
| 856 | - |
|
| 857 | - $CFG->EED_Events_Archive_Filters = isset($REQ['reset_event_list_settings']) |
|
| 858 | - && absint($REQ['reset_event_list_settings']) == 1 |
|
| 859 | - ? new EE_Events_Archive_Config() |
|
| 860 | - : $CFG->EED_Events_Archive_Filters; |
|
| 861 | - return $CFG; |
|
| 862 | - } |
|
| 863 | - |
|
| 864 | - |
|
| 865 | - /** |
|
| 866 | - * get_template_part |
|
| 867 | - * |
|
| 868 | - * @access public |
|
| 869 | - * @return void |
|
| 870 | - */ |
|
| 871 | - public static function get_template_part() |
|
| 872 | - { |
|
| 873 | - switch (self::$_type) { |
|
| 874 | - case 'dates': |
|
| 875 | - return 'archive-espresso_events-dates-view.php'; |
|
| 876 | - break; |
|
| 877 | - case 'text': |
|
| 878 | - return 'archive-espresso_events-text-view.php'; |
|
| 879 | - break; |
|
| 880 | - default: |
|
| 881 | - return 'archive-espresso_events-grid-view.php'; |
|
| 882 | - } |
|
| 883 | - } |
|
| 884 | - |
|
| 885 | - |
|
| 886 | - /** |
|
| 887 | - * event_list_template_filters |
|
| 888 | - * |
|
| 889 | - * @access public |
|
| 890 | - * @return void |
|
| 891 | - */ |
|
| 892 | - public function event_list_template_filters() |
|
| 893 | - { |
|
| 894 | - $args = array( |
|
| 895 | - 'form_url' => get_post_type_archive_link('espresso_events'), |
|
| 896 | - // add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
| 897 | - 'elf_month' => EED_Events_Archive_Filters::_display_month(), |
|
| 898 | - 'elf_category' => EED_Events_Archive_Filters::_event_category_slug(), |
|
| 899 | - 'elf_show_expired' => EED_Events_Archive_Filters::_show_expired(), |
|
| 900 | - 'elf_type' => self::$_type, |
|
| 901 | - ); |
|
| 902 | - EEH_Template::display_template( |
|
| 903 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-filters.php', |
|
| 904 | - $args |
|
| 905 | - ); |
|
| 906 | - } |
|
| 907 | - |
|
| 908 | - |
|
| 909 | - /** |
|
| 910 | - * event_list_css |
|
| 911 | - * |
|
| 912 | - * @access public |
|
| 913 | - * @return void |
|
| 914 | - */ |
|
| 915 | - public static function event_list_css($extra_class = '') |
|
| 916 | - { |
|
| 917 | - $EE = EE_Registry::instance(); |
|
| 918 | - $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
| 919 | - $event_list_css[] = 'espresso-event-list-event'; |
|
| 920 | - if (self::$_type == 'grid') { |
|
| 921 | - $event_list_grid_size = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) |
|
| 922 | - ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
| 923 | - $event_list_css[] = $event_list_grid_size . '-event-list-grid'; |
|
| 924 | - } |
|
| 925 | - $event_list_css = apply_filters( |
|
| 926 | - 'EED_Events_Archive_Filters__event_list_css__event_list_css_array', |
|
| 927 | - $event_list_css |
|
| 928 | - ); |
|
| 929 | - return implode(' ', $event_list_css); |
|
| 930 | - } |
|
| 931 | - |
|
| 932 | - |
|
| 933 | - /** |
|
| 934 | - * event_categories |
|
| 935 | - * |
|
| 936 | - * @access public |
|
| 937 | - * @return void |
|
| 938 | - */ |
|
| 939 | - public static function event_categories() |
|
| 940 | - { |
|
| 941 | - return EE_Registry::instance()->load_model('Term')->get_all_ee_categories(); |
|
| 942 | - } |
|
| 943 | - |
|
| 944 | - |
|
| 945 | - /** |
|
| 946 | - * display_description |
|
| 947 | - * |
|
| 948 | - * @access public |
|
| 949 | - * @return void |
|
| 950 | - */ |
|
| 951 | - public static function display_description($value) |
|
| 952 | - { |
|
| 953 | - $EE = EE_Registry::instance(); |
|
| 954 | - $display_description = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_description) |
|
| 955 | - ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
| 956 | - return $display_description === $value ? true : false; |
|
| 957 | - } |
|
| 958 | - |
|
| 959 | - |
|
| 960 | - /** |
|
| 961 | - * display_venue_details |
|
| 962 | - * |
|
| 963 | - * @access public |
|
| 964 | - * @return void |
|
| 965 | - */ |
|
| 966 | - public static function display_venue_details() |
|
| 967 | - { |
|
| 968 | - $EE = EE_Registry::instance(); |
|
| 969 | - $display_venue_details = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details) |
|
| 970 | - ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : true; |
|
| 971 | - $venue_name = EEH_Venue_View::venue_name(); |
|
| 972 | - return $display_venue_details && ! empty($venue_name) ? true : false; |
|
| 973 | - } |
|
| 974 | - |
|
| 975 | - |
|
| 976 | - /** |
|
| 977 | - * display_address |
|
| 978 | - * |
|
| 979 | - * @access public |
|
| 980 | - * @return void |
|
| 981 | - */ |
|
| 982 | - public static function display_address() |
|
| 983 | - { |
|
| 984 | - $EE = EE_Registry::instance(); |
|
| 985 | - $display_address = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_address) |
|
| 986 | - ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : false; |
|
| 987 | - $venue_name = EEH_Venue_View::venue_name(); |
|
| 988 | - return $display_address && ! empty($venue_name) ? true : false; |
|
| 989 | - } |
|
| 990 | - |
|
| 991 | - |
|
| 992 | - /** |
|
| 993 | - * pagination |
|
| 994 | - * |
|
| 995 | - * @access public |
|
| 996 | - * @return void |
|
| 997 | - */ |
|
| 998 | - public static function pagination() |
|
| 999 | - { |
|
| 1000 | - global $wp_query; |
|
| 1001 | - $big = 999999999; // need an unlikely integer |
|
| 1002 | - $pagination = paginate_links( |
|
| 1003 | - array( |
|
| 1004 | - 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
| 1005 | - 'format' => '?paged=%#%', |
|
| 1006 | - 'current' => max(1, get_query_var('paged')), |
|
| 1007 | - 'total' => $wp_query->max_num_pages, |
|
| 1008 | - 'show_all' => true, |
|
| 1009 | - 'end_size' => 10, |
|
| 1010 | - 'mid_size' => 6, |
|
| 1011 | - 'prev_next' => true, |
|
| 1012 | - 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
| 1013 | - 'next_text' => __('NEXT ›', 'event_espresso'), |
|
| 1014 | - 'type' => 'plain', |
|
| 1015 | - 'add_args' => false, |
|
| 1016 | - 'add_fragment' => '', |
|
| 1017 | - ) |
|
| 1018 | - ); |
|
| 1019 | - return ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 1020 | - } |
|
| 1021 | - |
|
| 1022 | - |
|
| 1023 | - /** |
|
| 1024 | - * event_list_title |
|
| 1025 | - * |
|
| 1026 | - * @access public |
|
| 1027 | - * @return void |
|
| 1028 | - */ |
|
| 1029 | - public static function event_list_title() |
|
| 1030 | - { |
|
| 1031 | - return apply_filters( |
|
| 1032 | - 'EED_Events_Archive_Filters__event_list_title__event_list_title', |
|
| 1033 | - __('Upcoming Events', 'event_espresso') |
|
| 1034 | - ); |
|
| 1035 | - } |
|
| 16 | + /** |
|
| 17 | + * @return EED_Events_Archive_Filters |
|
| 18 | + */ |
|
| 19 | + public static function instance() |
|
| 20 | + { |
|
| 21 | + return parent::get_instance(__CLASS__); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Start Date |
|
| 27 | + * |
|
| 28 | + * @var $_elf_month |
|
| 29 | + * @access protected |
|
| 30 | + */ |
|
| 31 | + protected $_elf_month = null; |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Category |
|
| 36 | + * |
|
| 37 | + * @var $_elf_category |
|
| 38 | + * @access protected |
|
| 39 | + */ |
|
| 40 | + protected $_elf_category = null; |
|
| 41 | + |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * whether to display expired events in the event list |
|
| 45 | + * |
|
| 46 | + * @var $_show_expired |
|
| 47 | + * @access protected |
|
| 48 | + */ |
|
| 49 | + protected $_show_expired = null; |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * whether to display the event list as a grid or list |
|
| 54 | + * |
|
| 55 | + * @var $_type |
|
| 56 | + * @access protected |
|
| 57 | + */ |
|
| 58 | + protected static $_type = null; |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * array of existing event list views |
|
| 63 | + * |
|
| 64 | + * @var $_types |
|
| 65 | + * @access protected |
|
| 66 | + */ |
|
| 67 | + protected static $_types = array('grid', 'text', 'dates'); |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
| 73 | + * |
|
| 74 | + * @access public |
|
| 75 | + * @return void |
|
| 76 | + */ |
|
| 77 | + public static function set_hooks() |
|
| 78 | + { |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
| 83 | + * |
|
| 84 | + * @access public |
|
| 85 | + * @return void |
|
| 86 | + */ |
|
| 87 | + public static function set_hooks_admin() |
|
| 88 | + { |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * set_definitions |
|
| 94 | + * |
|
| 95 | + * @access public |
|
| 96 | + * @return void |
|
| 97 | + */ |
|
| 98 | + public static function set_definitions() |
|
| 99 | + { |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * run - initial module setup |
|
| 105 | + * |
|
| 106 | + * @access public |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function run($WP) |
|
| 110 | + { |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * event_list |
|
| 116 | + * |
|
| 117 | + * @access public |
|
| 118 | + * @return void |
|
| 119 | + */ |
|
| 120 | + public function event_list() |
|
| 121 | + { |
|
| 122 | + // load other required components |
|
| 123 | + $this->_load_assests(); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * _filter_query_parts |
|
| 129 | + * |
|
| 130 | + * @access public |
|
| 131 | + * @return void |
|
| 132 | + */ |
|
| 133 | + private function _filter_query_parts() |
|
| 134 | + { |
|
| 135 | + // build event list query |
|
| 136 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
| 137 | + add_filter('posts_where', array($this, 'posts_where'), 1, 2); |
|
| 138 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * _type - the type of event list : grid, text, dates |
|
| 143 | + * |
|
| 144 | + * @access public |
|
| 145 | + * @return string |
|
| 146 | + */ |
|
| 147 | + public static function set_type() |
|
| 148 | + { |
|
| 149 | + do_action('AHEE__EED_Events_Archive_Filters__before_set_type'); |
|
| 150 | + EED_Events_Archive_Filters::$_types = apply_filters( |
|
| 151 | + 'EED_Events_Archive_Filters__set_type__types', |
|
| 152 | + EED_Events_Archive_Filters::$_types |
|
| 153 | + ); |
|
| 154 | + $view = isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type']) ? EE_Registry::instance( |
|
| 155 | + )->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
| 156 | + $elf_type = EE_Registry::instance()->REQ->is_set('elf_type') ? sanitize_text_field( |
|
| 157 | + EE_Registry::instance()->REQ->get('elf_type') |
|
| 158 | + ) : ''; |
|
| 159 | + $view = ! empty($elf_type) ? $elf_type : $view; |
|
| 160 | + $view = apply_filters('EED_Events_Archive_Filters__set_type__type', $view); |
|
| 161 | + if (! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
| 162 | + self::$_type = $view; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * _show_expired |
|
| 168 | + * |
|
| 169 | + * @access private |
|
| 170 | + * @param boolean $req_only if TRUE, then ignore defaults and only return $_POST value |
|
| 171 | + * @return boolean |
|
| 172 | + */ |
|
| 173 | + private static function _show_expired($req_only = false) |
|
| 174 | + { |
|
| 175 | + // get default value for "display_expired_events" as set in the EE General Settings > Templates > Event Listings |
|
| 176 | + $show_expired = ! $req_only && isset( |
|
| 177 | + EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] |
|
| 178 | + ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : false; |
|
| 179 | + // override default expired option if set via filter |
|
| 180 | + $show_expired = EE_Registry::instance()->REQ->is_set('elf_expired_chk') ? absint( |
|
| 181 | + EE_Registry::instance()->REQ->get('elf_expired_chk') |
|
| 182 | + ) : $show_expired; |
|
| 183 | + return $show_expired ? true : false; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * _event_category_slug |
|
| 188 | + * |
|
| 189 | + * @access private |
|
| 190 | + * @return string |
|
| 191 | + */ |
|
| 192 | + private static function _event_category_slug() |
|
| 193 | + { |
|
| 194 | + return EE_Registry::instance()->REQ->is_set('elf_category_dd') ? sanitize_text_field( |
|
| 195 | + EE_Registry::instance()->REQ->get('elf_category_dd') |
|
| 196 | + ) : ''; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * _display_month - what month should the event list display events for? |
|
| 201 | + * |
|
| 202 | + * @access private |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | + private static function _display_month() |
|
| 206 | + { |
|
| 207 | + return EE_Registry::instance()->REQ->is_set('elf_month_dd') ? sanitize_text_field( |
|
| 208 | + EE_Registry::instance()->REQ->get('elf_month_dd') |
|
| 209 | + ) : ''; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * get_post_data |
|
| 215 | + * |
|
| 216 | + * @access public |
|
| 217 | + * @return void |
|
| 218 | + */ |
|
| 219 | + public function get_post_data() |
|
| 220 | + { |
|
| 221 | + $this->_elf_month = EED_Events_Archive_Filters::_display_month(); |
|
| 222 | + $this->_elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
|
| 223 | + $this->_show_expired = EED_Events_Archive_Filters::_show_expired(true); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * posts_join |
|
| 229 | + * |
|
| 230 | + * @access public |
|
| 231 | + * @return void |
|
| 232 | + */ |
|
| 233 | + public function posts_join($SQL, WP_Query $wp_query) |
|
| 234 | + { |
|
| 235 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
| 236 | + // Category |
|
| 237 | + $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms( |
|
| 238 | + EED_Events_Archive_Filters::_event_category_slug() |
|
| 239 | + ); |
|
| 240 | + } |
|
| 241 | + return $SQL; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * posts_join_sql_for_terms |
|
| 247 | + * |
|
| 248 | + * @access public |
|
| 249 | + * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value |
|
| 250 | + * doesn't really get used for anything yet |
|
| 251 | + * @return string |
|
| 252 | + */ |
|
| 253 | + public static function posts_join_sql_for_terms($join_terms = null) |
|
| 254 | + { |
|
| 255 | + $SQL = ''; |
|
| 256 | + if (! empty($join_terms)) { |
|
| 257 | + global $wpdb; |
|
| 258 | + $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
|
| 259 | + $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
|
| 260 | + $SQL .= " LEFT JOIN $wpdb->terms ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) "; |
|
| 261 | + } |
|
| 262 | + return $SQL; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * usage: $SQL .= EED_Events_Archive_Filters::posts_join_for_orderby( $orderby_params ); |
|
| 268 | + * |
|
| 269 | + * @param array $orderby_params |
|
| 270 | + * @return string |
|
| 271 | + * @throws EE_Error |
|
| 272 | + * @throws ReflectionException |
|
| 273 | + */ |
|
| 274 | + public static function posts_join_for_orderby(array $orderby_params = array()): string |
|
| 275 | + { |
|
| 276 | + global $wpdb; |
|
| 277 | + $SQL = ''; |
|
| 278 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
| 279 | + foreach ($orderby_params as $orderby) { |
|
| 280 | + switch ($orderby) { |
|
| 281 | + case 'ticket_start': |
|
| 282 | + case 'ticket_end': |
|
| 283 | + $SQL .= ' LEFT JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' ON (' |
|
| 284 | + . EEM_Datetime::instance()->table() . '.DTT_ID = ' |
|
| 285 | + . EEM_Datetime_Ticket::instance()->table() . '.DTT_ID )'; |
|
| 286 | + $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' |
|
| 287 | + . EEM_Datetime_Ticket::instance()->table() . '.TKT_ID = ' |
|
| 288 | + . EEM_Ticket::instance()->table() . '.TKT_ID )'; |
|
| 289 | + break; |
|
| 290 | + |
|
| 291 | + case 'city': |
|
| 292 | + case 'state': |
|
| 293 | + case 'venue_title': |
|
| 294 | + // grab wp_posts (event), venue, and event_meta table names |
|
| 295 | + $wp_posts = $wpdb->posts; |
|
| 296 | + $venue = EEM_Venue::instance()->table(); |
|
| 297 | + $event_meta = EEM_Event::instance()->second_table(); |
|
| 298 | + $SQL .= " LEFT JOIN $event_meta ON ( $wp_posts.ID = $event_meta.EVT_ID )"; |
|
| 299 | + $SQL .= " LEFT JOIN $venue ON ( $event_meta.VNU_ID = $venue.VNU_ID )"; |
|
| 300 | + break; |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + return $SQL; |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * posts_where |
|
| 309 | + * |
|
| 310 | + * @access public |
|
| 311 | + * @return void |
|
| 312 | + */ |
|
| 313 | + public function posts_where($SQL, WP_Query $wp_query) |
|
| 314 | + { |
|
| 315 | + if (isset($wp_query->query_vars) && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
| 316 | + // Show Expired ? |
|
| 317 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired( |
|
| 318 | + EED_Events_Archive_Filters::_show_expired() |
|
| 319 | + ); |
|
| 320 | + // Category |
|
| 321 | + // $elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
|
| 322 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug( |
|
| 323 | + EED_Events_Archive_Filters::_event_category_slug() |
|
| 324 | + ); |
|
| 325 | + // Start Date |
|
| 326 | + // $elf_month = EED_Events_Archive_Filters::_display_month(); |
|
| 327 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month( |
|
| 328 | + EED_Events_Archive_Filters::_display_month() |
|
| 329 | + ); |
|
| 330 | + } |
|
| 331 | + return $SQL; |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * posts_where_sql_for_show_expired |
|
| 337 | + * |
|
| 338 | + * @access public |
|
| 339 | + * @param boolean $show_expired if TRUE, then displayed past events |
|
| 340 | + * @return string |
|
| 341 | + */ |
|
| 342 | + public static function posts_where_sql_for_show_expired($show_expired = false) |
|
| 343 | + { |
|
| 344 | + return ! $show_expired |
|
| 345 | + ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . date('Y-m-d H:s:i') . '" ' |
|
| 346 | + : ''; |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * posts_where_sql_for_event_category_slug |
|
| 352 | + * |
|
| 353 | + * @access public |
|
| 354 | + * @param boolean $event_category_slug |
|
| 355 | + * @return string |
|
| 356 | + */ |
|
| 357 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = null) |
|
| 358 | + { |
|
| 359 | + global $wpdb; |
|
| 360 | + return ! empty($event_category_slug) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * posts_where_sql_for_event_list_month |
|
| 365 | + * |
|
| 366 | + * @access public |
|
| 367 | + * @param boolean $month |
|
| 368 | + * @return string |
|
| 369 | + */ |
|
| 370 | + public static function posts_where_sql_for_event_list_month($month = null) |
|
| 371 | + { |
|
| 372 | + $SQL = ''; |
|
| 373 | + if (! empty($month)) { |
|
| 374 | + // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
|
| 375 | + $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start'; |
|
| 376 | + $SQL .= ' <= "' . date('Y-m-t 23:59:59', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '"'; |
|
| 377 | + // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
|
| 378 | + $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end'; |
|
| 379 | + $SQL .= ' >= "' . date('Y-m-d 0:0:00', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '" '; |
|
| 380 | + } |
|
| 381 | + return $SQL; |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + |
|
| 385 | + /** |
|
| 386 | + * posts_orderby |
|
| 387 | + * |
|
| 388 | + * @access public |
|
| 389 | + * @return void |
|
| 390 | + */ |
|
| 391 | + public function posts_orderby($SQL, WP_Query $wp_query) |
|
| 392 | + { |
|
| 393 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
| 394 | + $SQL = EED_Events_Archive_Filters::posts_orderby_sql(array('start_date')); |
|
| 395 | + } |
|
| 396 | + return $SQL; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + |
|
| 400 | + /** |
|
| 401 | + * posts_orderby_sql |
|
| 402 | + * |
|
| 403 | + * possible parameters: |
|
| 404 | + * ID |
|
| 405 | + * start_date |
|
| 406 | + * end_date |
|
| 407 | + * event_name |
|
| 408 | + * category_slug |
|
| 409 | + * ticket_start |
|
| 410 | + * ticket_end |
|
| 411 | + * venue_title |
|
| 412 | + * city |
|
| 413 | + * state |
|
| 414 | + * |
|
| 415 | + * **IMPORTANT** |
|
| 416 | + * make sure to also send the $orderby_params array to the posts_join_for_orderby() method |
|
| 417 | + * or else some of the table references below will result in MySQL errors |
|
| 418 | + * |
|
| 419 | + * @access public |
|
| 420 | + * @param boolean $orderby_params |
|
| 421 | + * @return string |
|
| 422 | + */ |
|
| 423 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') |
|
| 424 | + { |
|
| 425 | + global $wpdb; |
|
| 426 | + $SQL = ''; |
|
| 427 | + $cntr = 1; |
|
| 428 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
| 429 | + foreach ($orderby_params as $orderby) { |
|
| 430 | + $glue = $cntr == 1 || $cntr == count($orderby_params) ? ' ' : ', '; |
|
| 431 | + switch ($orderby) { |
|
| 432 | + case 'id': |
|
| 433 | + case 'ID': |
|
| 434 | + $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
| 435 | + break; |
|
| 436 | + |
|
| 437 | + case 'start_date': |
|
| 438 | + $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort; |
|
| 439 | + break; |
|
| 440 | + |
|
| 441 | + case 'end_date': |
|
| 442 | + $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
| 443 | + break; |
|
| 444 | + |
|
| 445 | + case 'event_name': |
|
| 446 | + $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
| 447 | + break; |
|
| 448 | + |
|
| 449 | + case 'category_slug': |
|
| 450 | + $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
| 451 | + break; |
|
| 452 | + |
|
| 453 | + case 'ticket_start': |
|
| 454 | + $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
| 455 | + break; |
|
| 456 | + |
|
| 457 | + case 'ticket_end': |
|
| 458 | + $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
| 459 | + break; |
|
| 460 | + |
|
| 461 | + case 'venue_title': |
|
| 462 | + $SQL .= $glue . 'venue_title ' . $sort; |
|
| 463 | + break; |
|
| 464 | + |
|
| 465 | + case 'city': |
|
| 466 | + $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
| 467 | + break; |
|
| 468 | + |
|
| 469 | + case 'state': |
|
| 470 | + $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
| 471 | + break; |
|
| 472 | + } |
|
| 473 | + $cntr++; |
|
| 474 | + } |
|
| 475 | + // echo '<h4>$SQL : ' . $SQL . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
|
| 476 | + return $SQL; |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * template_redirect |
|
| 482 | + * |
|
| 483 | + * @access public |
|
| 484 | + * @return void |
|
| 485 | + */ |
|
| 486 | + public function template_redirect() |
|
| 487 | + { |
|
| 488 | + // add event list filters |
|
| 489 | + add_action('loop_start', array($this, 'event_list_template_filters')); |
|
| 490 | + // and pagination |
|
| 491 | + add_action('loop_start', array($this, 'event_list_pagination')); |
|
| 492 | + add_action('loop_end', array($this, 'event_list_pagination')); |
|
| 493 | + // if NOT a custom template |
|
| 494 | + if ( |
|
| 495 | + EE_Registry::instance() |
|
| 496 | + ->load_core('Front_Controller', array(), false, true) |
|
| 497 | + ->get_selected_template() != 'archive-espresso_events.php' |
|
| 498 | + ) { |
|
| 499 | + // don't know if theme uses the_excerpt |
|
| 500 | + add_filter('the_excerpt', array($this, 'event_details'), 100); |
|
| 501 | + add_filter('the_excerpt', array($this, 'event_tickets'), 110); |
|
| 502 | + add_filter('the_excerpt', array($this, 'event_datetimes'), 120); |
|
| 503 | + add_filter('the_excerpt', array($this, 'event_venues'), 130); |
|
| 504 | + // or the_content |
|
| 505 | + add_filter('the_content', array($this, 'event_details'), 100); |
|
| 506 | + add_filter('the_content', array($this, 'event_tickets'), 110); |
|
| 507 | + add_filter('the_content', array($this, 'event_datetimes'), 120); |
|
| 508 | + add_filter('the_content', array($this, 'event_venues'), 130); |
|
| 509 | + } else { |
|
| 510 | + remove_all_filters('excerpt_length'); |
|
| 511 | + add_filter('excerpt_length', array($this, 'excerpt_length'), 10); |
|
| 512 | + add_filter('excerpt_more', array($this, 'excerpt_more'), 10); |
|
| 513 | + } |
|
| 514 | + } |
|
| 515 | + |
|
| 516 | + |
|
| 517 | + /** |
|
| 518 | + * event_list_pagination |
|
| 519 | + * |
|
| 520 | + * @access public |
|
| 521 | + * @return void |
|
| 522 | + */ |
|
| 523 | + public function event_list_pagination() |
|
| 524 | + { |
|
| 525 | + echo '<div class="ee-pagination-dv ee-clear-float">' . espresso_event_list_pagination() . '</div>'; |
|
| 526 | + } |
|
| 527 | + |
|
| 528 | + |
|
| 529 | + /** |
|
| 530 | + * event_details |
|
| 531 | + * |
|
| 532 | + * @access public |
|
| 533 | + * @param string $content |
|
| 534 | + * @return void |
|
| 535 | + */ |
|
| 536 | + public function event_details($content) |
|
| 537 | + { |
|
| 538 | + return EEH_Template::display_template( |
|
| 539 | + EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-details.php', |
|
| 540 | + array('the_content' => $content), |
|
| 541 | + true |
|
| 542 | + ); |
|
| 543 | + } |
|
| 544 | + |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * event_tickets |
|
| 548 | + * |
|
| 549 | + * @access public |
|
| 550 | + * @param string $content |
|
| 551 | + * @return void |
|
| 552 | + */ |
|
| 553 | + public function event_tickets($content) |
|
| 554 | + { |
|
| 555 | + return $content |
|
| 556 | + . EEH_Template::display_template( |
|
| 557 | + EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-tickets.php', |
|
| 558 | + array(), |
|
| 559 | + true |
|
| 560 | + ); |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + /** |
|
| 564 | + * event_datetimes |
|
| 565 | + * |
|
| 566 | + * @access public |
|
| 567 | + * @param string $content |
|
| 568 | + * @return void |
|
| 569 | + */ |
|
| 570 | + public function event_datetimes($content) |
|
| 571 | + { |
|
| 572 | + return $content |
|
| 573 | + . EEH_Template::display_template( |
|
| 574 | + EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-datetimes.php', |
|
| 575 | + array(), |
|
| 576 | + true |
|
| 577 | + ); |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + /** |
|
| 581 | + * event_venues |
|
| 582 | + * |
|
| 583 | + * @access public |
|
| 584 | + * @param string $content |
|
| 585 | + * @return void |
|
| 586 | + */ |
|
| 587 | + public function event_venues($content) |
|
| 588 | + { |
|
| 589 | + return $content |
|
| 590 | + . EEH_Template::display_template( |
|
| 591 | + EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-venues.php', |
|
| 592 | + array(), |
|
| 593 | + true |
|
| 594 | + ); |
|
| 595 | + } |
|
| 596 | + |
|
| 597 | + |
|
| 598 | + /** |
|
| 599 | + * _initial_setup |
|
| 600 | + * |
|
| 601 | + * @access public |
|
| 602 | + * @return void |
|
| 603 | + */ |
|
| 604 | + private function _load_assests() |
|
| 605 | + { |
|
| 606 | + do_action('AHEE__EED_Events_Archive_Filters__before_load_assests'); |
|
| 607 | + wp_enqueue_style('espresso_default'); |
|
| 608 | + wp_enqueue_style('espresso_custom_css'); |
|
| 609 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
| 610 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
| 611 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
| 612 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
| 613 | + } |
|
| 614 | + // add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), 999 ); |
|
| 615 | + } |
|
| 616 | + |
|
| 617 | + |
|
| 618 | + /** |
|
| 619 | + * _get_template |
|
| 620 | + * |
|
| 621 | + * @access private |
|
| 622 | + * @return string |
|
| 623 | + */ |
|
| 624 | + private function _get_template($which = 'part') |
|
| 625 | + { |
|
| 626 | + return EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + |
|
| 630 | + /** |
|
| 631 | + * excerpt_length |
|
| 632 | + * |
|
| 633 | + * @access public |
|
| 634 | + * @return void |
|
| 635 | + */ |
|
| 636 | + public function excerpt_length($length) |
|
| 637 | + { |
|
| 638 | + |
|
| 639 | + if (self::$_type == 'grid') { |
|
| 640 | + return 36; |
|
| 641 | + } |
|
| 642 | + |
|
| 643 | + switch (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) { |
|
| 644 | + case 'tiny': |
|
| 645 | + return 12; |
|
| 646 | + break; |
|
| 647 | + case 'small': |
|
| 648 | + return 24; |
|
| 649 | + break; |
|
| 650 | + case 'large': |
|
| 651 | + return 48; |
|
| 652 | + break; |
|
| 653 | + case 'medium': |
|
| 654 | + default: |
|
| 655 | + return 36; |
|
| 656 | + } |
|
| 657 | + } |
|
| 658 | + |
|
| 659 | + |
|
| 660 | + /** |
|
| 661 | + * excerpt_more |
|
| 662 | + * |
|
| 663 | + * @access public |
|
| 664 | + * @return void |
|
| 665 | + */ |
|
| 666 | + public function excerpt_more($more) |
|
| 667 | + { |
|
| 668 | + return '…'; |
|
| 669 | + } |
|
| 670 | + |
|
| 671 | + |
|
| 672 | + |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * wp_enqueue_scripts |
|
| 676 | + * |
|
| 677 | + * @access public |
|
| 678 | + * @return void |
|
| 679 | + */ |
|
| 680 | + public function wp_enqueue_scripts() |
|
| 681 | + { |
|
| 682 | + // get some style |
|
| 683 | + if (apply_filters('FHEE_enable_default_espresso_css', false)) { |
|
| 684 | + // first check uploads folder |
|
| 685 | + if ( |
|
| 686 | + is_readable( |
|
| 687 | + get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.css' |
|
| 688 | + ) |
|
| 689 | + ) { |
|
| 690 | + wp_register_style( |
|
| 691 | + 'archive-espresso_events', |
|
| 692 | + get_stylesheet_directory_uri() . EE_Config::get_current_theme( |
|
| 693 | + ) . '/archive-espresso_events.css', |
|
| 694 | + array('dashicons', 'espresso_default') |
|
| 695 | + ); |
|
| 696 | + } else { |
|
| 697 | + wp_register_style( |
|
| 698 | + 'archive-espresso_events', |
|
| 699 | + EE_TEMPLATES_URL . EE_Config::get_current_theme() . '/archive-espresso_events.css', |
|
| 700 | + array('dashicons', 'espresso_default') |
|
| 701 | + ); |
|
| 702 | + } |
|
| 703 | + if ( |
|
| 704 | + is_readable( |
|
| 705 | + get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.js' |
|
| 706 | + ) |
|
| 707 | + ) { |
|
| 708 | + wp_register_script( |
|
| 709 | + 'archive-espresso_events', |
|
| 710 | + get_stylesheet_directory_uri() . EE_Config::get_current_theme() . '/archive-espresso_events.js', |
|
| 711 | + array('jquery-masonry'), |
|
| 712 | + '1.0', |
|
| 713 | + true |
|
| 714 | + ); |
|
| 715 | + } else { |
|
| 716 | + wp_register_script( |
|
| 717 | + 'archive-espresso_events', |
|
| 718 | + EVENTS_ARCHIVE_ASSETS_URL . 'archive-espresso_events.js', |
|
| 719 | + array('jquery-masonry'), |
|
| 720 | + '1.0', |
|
| 721 | + true |
|
| 722 | + ); |
|
| 723 | + } |
|
| 724 | + wp_enqueue_style('archive-espresso_events'); |
|
| 725 | + wp_enqueue_script('jquery-masonry'); |
|
| 726 | + wp_enqueue_script('archive-espresso_events'); |
|
| 727 | + add_action('wp_footer', array('EED_Events_Archive_Filters', 'localize_grid_event_lists'), 1); |
|
| 728 | + } |
|
| 729 | + } |
|
| 730 | + |
|
| 731 | + |
|
| 732 | + /** |
|
| 733 | + * template_settings_form |
|
| 734 | + * |
|
| 735 | + * @access public |
|
| 736 | + * @static |
|
| 737 | + * @return void |
|
| 738 | + */ |
|
| 739 | + public static function localize_grid_event_lists() |
|
| 740 | + { |
|
| 741 | + wp_localize_script( |
|
| 742 | + 'archive-espresso_events', |
|
| 743 | + 'espresso_grid_event_lists', |
|
| 744 | + EED_Events_Archive_Filters::$espresso_grid_event_lists |
|
| 745 | + ); |
|
| 746 | + } |
|
| 747 | + |
|
| 748 | + |
|
| 749 | + /** |
|
| 750 | + * template_settings_form |
|
| 751 | + * |
|
| 752 | + * @access public |
|
| 753 | + * @static |
|
| 754 | + * @return void |
|
| 755 | + */ |
|
| 756 | + public static function template_settings_form() |
|
| 757 | + { |
|
| 758 | + $EE = EE_Registry::instance(); |
|
| 759 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = isset($EE->CFG->template_settings->EED_Events_Archive_Filters) |
|
| 760 | + ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
| 761 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters( |
|
| 762 | + 'FHEE__Event_List__template_settings_form__event_list_config', |
|
| 763 | + $EE->CFG->template_settings->EED_Events_Archive_Filters |
|
| 764 | + ); |
|
| 765 | + EEH_Template::display_template( |
|
| 766 | + EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
| 767 | + $EE->CFG->template_settings->EED_Events_Archive_Filters |
|
| 768 | + ); |
|
| 769 | + } |
|
| 770 | + |
|
| 771 | + |
|
| 772 | + /** |
|
| 773 | + * set_default_settings |
|
| 774 | + * |
|
| 775 | + * @access public |
|
| 776 | + * @static |
|
| 777 | + * @return void |
|
| 778 | + */ |
|
| 779 | + public static function set_default_settings($CFG) |
|
| 780 | + { |
|
| 781 | + // EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
| 782 | + $CFG->display_description = isset($CFG->display_description) && ! empty($CFG->display_description) |
|
| 783 | + ? $CFG->display_description : 1; |
|
| 784 | + $CFG->display_address = isset($CFG->display_address) && ! empty($CFG->display_address) ? $CFG->display_address |
|
| 785 | + : true; |
|
| 786 | + $CFG->display_venue_details = isset($CFG->display_venue_details) && ! empty($CFG->display_venue_details) |
|
| 787 | + ? $CFG->display_venue_details : true; |
|
| 788 | + $CFG->display_expired_events = isset($CFG->display_expired_events) && ! empty($CFG->display_expired_events) |
|
| 789 | + ? $CFG->display_expired_events : false; |
|
| 790 | + $CFG->default_type = isset($CFG->default_type) && ! empty($CFG->default_type) ? $CFG->default_type : 'grid'; |
|
| 791 | + $CFG->event_list_grid_size = isset($CFG->event_list_grid_size) && ! empty($CFG->event_list_grid_size) |
|
| 792 | + ? $CFG->event_list_grid_size : 'medium'; |
|
| 793 | + $CFG->templates['full'] = isset($CFG->templates['full']) && ! empty($CFG->templates['full']) |
|
| 794 | + ? $CFG->templates['full'] |
|
| 795 | + : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 796 | + $CFG->templates['part'] = isset($CFG->templates['part']) && ! empty($CFG->templates['part']) |
|
| 797 | + ? $CFG->templates['part'] |
|
| 798 | + : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-grid-view.php'; |
|
| 799 | + return $CFG; |
|
| 800 | + } |
|
| 801 | + |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * filter_config |
|
| 805 | + * |
|
| 806 | + * @access public |
|
| 807 | + * @return void |
|
| 808 | + */ |
|
| 809 | + public function filter_config($CFG) |
|
| 810 | + { |
|
| 811 | + return $CFG; |
|
| 812 | + } |
|
| 813 | + |
|
| 814 | + |
|
| 815 | + /** |
|
| 816 | + * filter_config |
|
| 817 | + * |
|
| 818 | + * @access public |
|
| 819 | + * @return void |
|
| 820 | + */ |
|
| 821 | + public static function update_template_settings($CFG, $REQ) |
|
| 822 | + { |
|
| 823 | + // $CFG->template_settings->EED_Events_Archive_Filters = new stdClass(); |
|
| 824 | + $CFG->EED_Events_Archive_Filters->display_description = isset($REQ['display_description_in_event_list']) |
|
| 825 | + ? absint($REQ['display_description_in_event_list']) : 1; |
|
| 826 | + $CFG->EED_Events_Archive_Filters->display_address = isset($REQ['display_address_in_event_list']) ? absint( |
|
| 827 | + $REQ['display_address_in_event_list'] |
|
| 828 | + ) : true; |
|
| 829 | + $CFG->EED_Events_Archive_Filters->display_venue_details = isset($REQ['display_venue_details_in_event_list']) |
|
| 830 | + ? absint($REQ['display_venue_details_in_event_list']) : true; |
|
| 831 | + $CFG->EED_Events_Archive_Filters->display_expired_events = isset($REQ['display_expired_events']) ? absint( |
|
| 832 | + $REQ['display_expired_events'] |
|
| 833 | + ) : false; |
|
| 834 | + $CFG->EED_Events_Archive_Filters->default_type = isset($REQ['default_type']) ? sanitize_text_field( |
|
| 835 | + $REQ['default_type'] |
|
| 836 | + ) : 'grid'; |
|
| 837 | + $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset($REQ['event_list_grid_size']) |
|
| 838 | + ? sanitize_text_field($REQ['event_list_grid_size']) : 'medium'; |
|
| 839 | + $CFG->EED_Events_Archive_Filters->templates = array( |
|
| 840 | + 'full' => EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php', |
|
| 841 | + ); |
|
| 842 | + |
|
| 843 | + switch ($CFG->EED_Events_Archive_Filters->default_type) { |
|
| 844 | + case 'dates': |
|
| 845 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 846 | + . '/archive-espresso_events-dates-view.php'; |
|
| 847 | + break; |
|
| 848 | + case 'text': |
|
| 849 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 850 | + . '/archive-espresso_events-text-view.php'; |
|
| 851 | + break; |
|
| 852 | + default: |
|
| 853 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 854 | + . '/archive-espresso_events-grid-view.php'; |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + $CFG->EED_Events_Archive_Filters = isset($REQ['reset_event_list_settings']) |
|
| 858 | + && absint($REQ['reset_event_list_settings']) == 1 |
|
| 859 | + ? new EE_Events_Archive_Config() |
|
| 860 | + : $CFG->EED_Events_Archive_Filters; |
|
| 861 | + return $CFG; |
|
| 862 | + } |
|
| 863 | + |
|
| 864 | + |
|
| 865 | + /** |
|
| 866 | + * get_template_part |
|
| 867 | + * |
|
| 868 | + * @access public |
|
| 869 | + * @return void |
|
| 870 | + */ |
|
| 871 | + public static function get_template_part() |
|
| 872 | + { |
|
| 873 | + switch (self::$_type) { |
|
| 874 | + case 'dates': |
|
| 875 | + return 'archive-espresso_events-dates-view.php'; |
|
| 876 | + break; |
|
| 877 | + case 'text': |
|
| 878 | + return 'archive-espresso_events-text-view.php'; |
|
| 879 | + break; |
|
| 880 | + default: |
|
| 881 | + return 'archive-espresso_events-grid-view.php'; |
|
| 882 | + } |
|
| 883 | + } |
|
| 884 | + |
|
| 885 | + |
|
| 886 | + /** |
|
| 887 | + * event_list_template_filters |
|
| 888 | + * |
|
| 889 | + * @access public |
|
| 890 | + * @return void |
|
| 891 | + */ |
|
| 892 | + public function event_list_template_filters() |
|
| 893 | + { |
|
| 894 | + $args = array( |
|
| 895 | + 'form_url' => get_post_type_archive_link('espresso_events'), |
|
| 896 | + // add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
| 897 | + 'elf_month' => EED_Events_Archive_Filters::_display_month(), |
|
| 898 | + 'elf_category' => EED_Events_Archive_Filters::_event_category_slug(), |
|
| 899 | + 'elf_show_expired' => EED_Events_Archive_Filters::_show_expired(), |
|
| 900 | + 'elf_type' => self::$_type, |
|
| 901 | + ); |
|
| 902 | + EEH_Template::display_template( |
|
| 903 | + EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-filters.php', |
|
| 904 | + $args |
|
| 905 | + ); |
|
| 906 | + } |
|
| 907 | + |
|
| 908 | + |
|
| 909 | + /** |
|
| 910 | + * event_list_css |
|
| 911 | + * |
|
| 912 | + * @access public |
|
| 913 | + * @return void |
|
| 914 | + */ |
|
| 915 | + public static function event_list_css($extra_class = '') |
|
| 916 | + { |
|
| 917 | + $EE = EE_Registry::instance(); |
|
| 918 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
| 919 | + $event_list_css[] = 'espresso-event-list-event'; |
|
| 920 | + if (self::$_type == 'grid') { |
|
| 921 | + $event_list_grid_size = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) |
|
| 922 | + ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
| 923 | + $event_list_css[] = $event_list_grid_size . '-event-list-grid'; |
|
| 924 | + } |
|
| 925 | + $event_list_css = apply_filters( |
|
| 926 | + 'EED_Events_Archive_Filters__event_list_css__event_list_css_array', |
|
| 927 | + $event_list_css |
|
| 928 | + ); |
|
| 929 | + return implode(' ', $event_list_css); |
|
| 930 | + } |
|
| 931 | + |
|
| 932 | + |
|
| 933 | + /** |
|
| 934 | + * event_categories |
|
| 935 | + * |
|
| 936 | + * @access public |
|
| 937 | + * @return void |
|
| 938 | + */ |
|
| 939 | + public static function event_categories() |
|
| 940 | + { |
|
| 941 | + return EE_Registry::instance()->load_model('Term')->get_all_ee_categories(); |
|
| 942 | + } |
|
| 943 | + |
|
| 944 | + |
|
| 945 | + /** |
|
| 946 | + * display_description |
|
| 947 | + * |
|
| 948 | + * @access public |
|
| 949 | + * @return void |
|
| 950 | + */ |
|
| 951 | + public static function display_description($value) |
|
| 952 | + { |
|
| 953 | + $EE = EE_Registry::instance(); |
|
| 954 | + $display_description = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_description) |
|
| 955 | + ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
| 956 | + return $display_description === $value ? true : false; |
|
| 957 | + } |
|
| 958 | + |
|
| 959 | + |
|
| 960 | + /** |
|
| 961 | + * display_venue_details |
|
| 962 | + * |
|
| 963 | + * @access public |
|
| 964 | + * @return void |
|
| 965 | + */ |
|
| 966 | + public static function display_venue_details() |
|
| 967 | + { |
|
| 968 | + $EE = EE_Registry::instance(); |
|
| 969 | + $display_venue_details = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details) |
|
| 970 | + ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : true; |
|
| 971 | + $venue_name = EEH_Venue_View::venue_name(); |
|
| 972 | + return $display_venue_details && ! empty($venue_name) ? true : false; |
|
| 973 | + } |
|
| 974 | + |
|
| 975 | + |
|
| 976 | + /** |
|
| 977 | + * display_address |
|
| 978 | + * |
|
| 979 | + * @access public |
|
| 980 | + * @return void |
|
| 981 | + */ |
|
| 982 | + public static function display_address() |
|
| 983 | + { |
|
| 984 | + $EE = EE_Registry::instance(); |
|
| 985 | + $display_address = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_address) |
|
| 986 | + ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : false; |
|
| 987 | + $venue_name = EEH_Venue_View::venue_name(); |
|
| 988 | + return $display_address && ! empty($venue_name) ? true : false; |
|
| 989 | + } |
|
| 990 | + |
|
| 991 | + |
|
| 992 | + /** |
|
| 993 | + * pagination |
|
| 994 | + * |
|
| 995 | + * @access public |
|
| 996 | + * @return void |
|
| 997 | + */ |
|
| 998 | + public static function pagination() |
|
| 999 | + { |
|
| 1000 | + global $wp_query; |
|
| 1001 | + $big = 999999999; // need an unlikely integer |
|
| 1002 | + $pagination = paginate_links( |
|
| 1003 | + array( |
|
| 1004 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
| 1005 | + 'format' => '?paged=%#%', |
|
| 1006 | + 'current' => max(1, get_query_var('paged')), |
|
| 1007 | + 'total' => $wp_query->max_num_pages, |
|
| 1008 | + 'show_all' => true, |
|
| 1009 | + 'end_size' => 10, |
|
| 1010 | + 'mid_size' => 6, |
|
| 1011 | + 'prev_next' => true, |
|
| 1012 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
| 1013 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
| 1014 | + 'type' => 'plain', |
|
| 1015 | + 'add_args' => false, |
|
| 1016 | + 'add_fragment' => '', |
|
| 1017 | + ) |
|
| 1018 | + ); |
|
| 1019 | + return ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 1020 | + } |
|
| 1021 | + |
|
| 1022 | + |
|
| 1023 | + /** |
|
| 1024 | + * event_list_title |
|
| 1025 | + * |
|
| 1026 | + * @access public |
|
| 1027 | + * @return void |
|
| 1028 | + */ |
|
| 1029 | + public static function event_list_title() |
|
| 1030 | + { |
|
| 1031 | + return apply_filters( |
|
| 1032 | + 'EED_Events_Archive_Filters__event_list_title__event_list_title', |
|
| 1033 | + __('Upcoming Events', 'event_espresso') |
|
| 1034 | + ); |
|
| 1035 | + } |
|
| 1036 | 1036 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ) : ''; |
| 159 | 159 | $view = ! empty($elf_type) ? $elf_type : $view; |
| 160 | 160 | $view = apply_filters('EED_Events_Archive_Filters__set_type__type', $view); |
| 161 | - if (! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
| 161 | + if ( ! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
| 162 | 162 | self::$_type = $view; |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public static function posts_join_sql_for_terms($join_terms = null) |
| 254 | 254 | { |
| 255 | 255 | $SQL = ''; |
| 256 | - if (! empty($join_terms)) { |
|
| 256 | + if ( ! empty($join_terms)) { |
|
| 257 | 257 | global $wpdb; |
| 258 | 258 | $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
| 259 | 259 | $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | switch ($orderby) { |
| 281 | 281 | case 'ticket_start': |
| 282 | 282 | case 'ticket_end': |
| 283 | - $SQL .= ' LEFT JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' ON (' |
|
| 284 | - . EEM_Datetime::instance()->table() . '.DTT_ID = ' |
|
| 285 | - . EEM_Datetime_Ticket::instance()->table() . '.DTT_ID )'; |
|
| 286 | - $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' |
|
| 287 | - . EEM_Datetime_Ticket::instance()->table() . '.TKT_ID = ' |
|
| 288 | - . EEM_Ticket::instance()->table() . '.TKT_ID )'; |
|
| 283 | + $SQL .= ' LEFT JOIN '.EEM_Datetime_Ticket::instance()->table().' ON (' |
|
| 284 | + . EEM_Datetime::instance()->table().'.DTT_ID = ' |
|
| 285 | + . EEM_Datetime_Ticket::instance()->table().'.DTT_ID )'; |
|
| 286 | + $SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON (' |
|
| 287 | + . EEM_Datetime_Ticket::instance()->table().'.TKT_ID = ' |
|
| 288 | + . EEM_Ticket::instance()->table().'.TKT_ID )'; |
|
| 289 | 289 | break; |
| 290 | 290 | |
| 291 | 291 | case 'city': |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | public static function posts_where_sql_for_show_expired($show_expired = false) |
| 343 | 343 | { |
| 344 | 344 | return ! $show_expired |
| 345 | - ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . date('Y-m-d H:s:i') . '" ' |
|
| 345 | + ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.date('Y-m-d H:s:i').'" ' |
|
| 346 | 346 | : ''; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | public static function posts_where_sql_for_event_category_slug($event_category_slug = null) |
| 358 | 358 | { |
| 359 | 359 | global $wpdb; |
| 360 | - return ! empty($event_category_slug) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
| 360 | + return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : ''; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -370,13 +370,13 @@ discard block |
||
| 370 | 370 | public static function posts_where_sql_for_event_list_month($month = null) |
| 371 | 371 | { |
| 372 | 372 | $SQL = ''; |
| 373 | - if (! empty($month)) { |
|
| 373 | + if ( ! empty($month)) { |
|
| 374 | 374 | // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
| 375 | - $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start'; |
|
| 376 | - $SQL .= ' <= "' . date('Y-m-t 23:59:59', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '"'; |
|
| 375 | + $SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start'; |
|
| 376 | + $SQL .= ' <= "'.date('Y-m-t 23:59:59', \EEH_DTT_Helper::first_of_month_timestamp($month)).'"'; |
|
| 377 | 377 | // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
| 378 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end'; |
|
| 379 | - $SQL .= ' >= "' . date('Y-m-d 0:0:00', \EEH_DTT_Helper::first_of_month_timestamp($month)) . '" '; |
|
| 378 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end'; |
|
| 379 | + $SQL .= ' >= "'.date('Y-m-d 0:0:00', \EEH_DTT_Helper::first_of_month_timestamp($month)).'" '; |
|
| 380 | 380 | } |
| 381 | 381 | return $SQL; |
| 382 | 382 | } |
@@ -431,43 +431,43 @@ discard block |
||
| 431 | 431 | switch ($orderby) { |
| 432 | 432 | case 'id': |
| 433 | 433 | case 'ID': |
| 434 | - $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
| 434 | + $SQL .= $glue.$wpdb->posts.'.ID '.$sort; |
|
| 435 | 435 | break; |
| 436 | 436 | |
| 437 | 437 | case 'start_date': |
| 438 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort; |
|
| 438 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort; |
|
| 439 | 439 | break; |
| 440 | 440 | |
| 441 | 441 | case 'end_date': |
| 442 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
| 442 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort; |
|
| 443 | 443 | break; |
| 444 | 444 | |
| 445 | 445 | case 'event_name': |
| 446 | - $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
| 446 | + $SQL .= $glue.$wpdb->posts.'.post_title '.$sort; |
|
| 447 | 447 | break; |
| 448 | 448 | |
| 449 | 449 | case 'category_slug': |
| 450 | - $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
| 450 | + $SQL .= $glue.$wpdb->terms.'.slug '.$sort; |
|
| 451 | 451 | break; |
| 452 | 452 | |
| 453 | 453 | case 'ticket_start': |
| 454 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
| 454 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort; |
|
| 455 | 455 | break; |
| 456 | 456 | |
| 457 | 457 | case 'ticket_end': |
| 458 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
| 458 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort; |
|
| 459 | 459 | break; |
| 460 | 460 | |
| 461 | 461 | case 'venue_title': |
| 462 | - $SQL .= $glue . 'venue_title ' . $sort; |
|
| 462 | + $SQL .= $glue.'venue_title '.$sort; |
|
| 463 | 463 | break; |
| 464 | 464 | |
| 465 | 465 | case 'city': |
| 466 | - $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
| 466 | + $SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort; |
|
| 467 | 467 | break; |
| 468 | 468 | |
| 469 | 469 | case 'state': |
| 470 | - $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
| 470 | + $SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort; |
|
| 471 | 471 | break; |
| 472 | 472 | } |
| 473 | 473 | $cntr++; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function event_list_pagination() |
| 524 | 524 | { |
| 525 | - echo '<div class="ee-pagination-dv ee-clear-float">' . espresso_event_list_pagination() . '</div>'; |
|
| 525 | + echo '<div class="ee-pagination-dv ee-clear-float">'.espresso_event_list_pagination().'</div>'; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | public function event_details($content) |
| 537 | 537 | { |
| 538 | 538 | return EEH_Template::display_template( |
| 539 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-details.php', |
|
| 539 | + EE_TEMPLATES.EE_Config::get_current_theme().'/content-espresso_events-details.php', |
|
| 540 | 540 | array('the_content' => $content), |
| 541 | 541 | true |
| 542 | 542 | ); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | { |
| 555 | 555 | return $content |
| 556 | 556 | . EEH_Template::display_template( |
| 557 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-tickets.php', |
|
| 557 | + EE_TEMPLATES.EE_Config::get_current_theme().'/content-espresso_events-tickets.php', |
|
| 558 | 558 | array(), |
| 559 | 559 | true |
| 560 | 560 | ); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | { |
| 572 | 572 | return $content |
| 573 | 573 | . EEH_Template::display_template( |
| 574 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-datetimes.php', |
|
| 574 | + EE_TEMPLATES.EE_Config::get_current_theme().'/content-espresso_events-datetimes.php', |
|
| 575 | 575 | array(), |
| 576 | 576 | true |
| 577 | 577 | ); |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | { |
| 589 | 589 | return $content |
| 590 | 590 | . EEH_Template::display_template( |
| 591 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/content-espresso_events-venues.php', |
|
| 591 | + EE_TEMPLATES.EE_Config::get_current_theme().'/content-espresso_events-venues.php', |
|
| 592 | 592 | array(), |
| 593 | 593 | true |
| 594 | 594 | ); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | */ |
| 624 | 624 | private function _get_template($which = 'part') |
| 625 | 625 | { |
| 626 | - return EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 626 | + return EE_TEMPLATES.EE_Config::get_current_theme().'/archive-espresso_events.php'; |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
@@ -684,30 +684,30 @@ discard block |
||
| 684 | 684 | // first check uploads folder |
| 685 | 685 | if ( |
| 686 | 686 | is_readable( |
| 687 | - get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.css' |
|
| 687 | + get_stylesheet_directory().EE_Config::get_current_theme().'/archive-espresso_events.css' |
|
| 688 | 688 | ) |
| 689 | 689 | ) { |
| 690 | 690 | wp_register_style( |
| 691 | 691 | 'archive-espresso_events', |
| 692 | - get_stylesheet_directory_uri() . EE_Config::get_current_theme( |
|
| 693 | - ) . '/archive-espresso_events.css', |
|
| 692 | + get_stylesheet_directory_uri().EE_Config::get_current_theme( |
|
| 693 | + ).'/archive-espresso_events.css', |
|
| 694 | 694 | array('dashicons', 'espresso_default') |
| 695 | 695 | ); |
| 696 | 696 | } else { |
| 697 | 697 | wp_register_style( |
| 698 | 698 | 'archive-espresso_events', |
| 699 | - EE_TEMPLATES_URL . EE_Config::get_current_theme() . '/archive-espresso_events.css', |
|
| 699 | + EE_TEMPLATES_URL.EE_Config::get_current_theme().'/archive-espresso_events.css', |
|
| 700 | 700 | array('dashicons', 'espresso_default') |
| 701 | 701 | ); |
| 702 | 702 | } |
| 703 | 703 | if ( |
| 704 | 704 | is_readable( |
| 705 | - get_stylesheet_directory() . EE_Config::get_current_theme() . '/archive-espresso_events.js' |
|
| 705 | + get_stylesheet_directory().EE_Config::get_current_theme().'/archive-espresso_events.js' |
|
| 706 | 706 | ) |
| 707 | 707 | ) { |
| 708 | 708 | wp_register_script( |
| 709 | 709 | 'archive-espresso_events', |
| 710 | - get_stylesheet_directory_uri() . EE_Config::get_current_theme() . '/archive-espresso_events.js', |
|
| 710 | + get_stylesheet_directory_uri().EE_Config::get_current_theme().'/archive-espresso_events.js', |
|
| 711 | 711 | array('jquery-masonry'), |
| 712 | 712 | '1.0', |
| 713 | 713 | true |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | } else { |
| 716 | 716 | wp_register_script( |
| 717 | 717 | 'archive-espresso_events', |
| 718 | - EVENTS_ARCHIVE_ASSETS_URL . 'archive-espresso_events.js', |
|
| 718 | + EVENTS_ARCHIVE_ASSETS_URL.'archive-espresso_events.js', |
|
| 719 | 719 | array('jquery-masonry'), |
| 720 | 720 | '1.0', |
| 721 | 721 | true |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | $EE->CFG->template_settings->EED_Events_Archive_Filters |
| 764 | 764 | ); |
| 765 | 765 | EEH_Template::display_template( |
| 766 | - EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
| 766 | + EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', |
|
| 767 | 767 | $EE->CFG->template_settings->EED_Events_Archive_Filters |
| 768 | 768 | ); |
| 769 | 769 | } |
@@ -792,10 +792,10 @@ discard block |
||
| 792 | 792 | ? $CFG->event_list_grid_size : 'medium'; |
| 793 | 793 | $CFG->templates['full'] = isset($CFG->templates['full']) && ! empty($CFG->templates['full']) |
| 794 | 794 | ? $CFG->templates['full'] |
| 795 | - : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php'; |
|
| 795 | + : EE_TEMPLATES.EE_Config::get_current_theme().'/archive-espresso_events.php'; |
|
| 796 | 796 | $CFG->templates['part'] = isset($CFG->templates['part']) && ! empty($CFG->templates['part']) |
| 797 | 797 | ? $CFG->templates['part'] |
| 798 | - : EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-grid-view.php'; |
|
| 798 | + : EE_TEMPLATES.EE_Config::get_current_theme().'/archive-espresso_events-grid-view.php'; |
|
| 799 | 799 | return $CFG; |
| 800 | 800 | } |
| 801 | 801 | |
@@ -837,20 +837,20 @@ discard block |
||
| 837 | 837 | $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset($REQ['event_list_grid_size']) |
| 838 | 838 | ? sanitize_text_field($REQ['event_list_grid_size']) : 'medium'; |
| 839 | 839 | $CFG->EED_Events_Archive_Filters->templates = array( |
| 840 | - 'full' => EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events.php', |
|
| 840 | + 'full' => EE_TEMPLATES.EE_Config::get_current_theme().'/archive-espresso_events.php', |
|
| 841 | 841 | ); |
| 842 | 842 | |
| 843 | 843 | switch ($CFG->EED_Events_Archive_Filters->default_type) { |
| 844 | 844 | case 'dates': |
| 845 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 845 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme() |
|
| 846 | 846 | . '/archive-espresso_events-dates-view.php'; |
| 847 | 847 | break; |
| 848 | 848 | case 'text': |
| 849 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 849 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme() |
|
| 850 | 850 | . '/archive-espresso_events-text-view.php'; |
| 851 | 851 | break; |
| 852 | 852 | default: |
| 853 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() |
|
| 853 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme() |
|
| 854 | 854 | . '/archive-espresso_events-grid-view.php'; |
| 855 | 855 | } |
| 856 | 856 | |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | 'elf_type' => self::$_type, |
| 901 | 901 | ); |
| 902 | 902 | EEH_Template::display_template( |
| 903 | - EE_TEMPLATES . EE_Config::get_current_theme() . '/archive-espresso_events-filters.php', |
|
| 903 | + EE_TEMPLATES.EE_Config::get_current_theme().'/archive-espresso_events-filters.php', |
|
| 904 | 904 | $args |
| 905 | 905 | ); |
| 906 | 906 | } |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | if (self::$_type == 'grid') { |
| 921 | 921 | $event_list_grid_size = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) |
| 922 | 922 | ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
| 923 | - $event_list_css[] = $event_list_grid_size . '-event-list-grid'; |
|
| 923 | + $event_list_css[] = $event_list_grid_size.'-event-list-grid'; |
|
| 924 | 924 | } |
| 925 | 925 | $event_list_css = apply_filters( |
| 926 | 926 | 'EED_Events_Archive_Filters__event_list_css__event_list_css_array', |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | 'add_fragment' => '', |
| 1017 | 1017 | ) |
| 1018 | 1018 | ); |
| 1019 | - return ! empty($pagination) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 1019 | + return ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | |