@@ -21,139 +21,139 @@ |
||
21 | 21 | class EE_Event_List_Shortcodes extends EE_Shortcodes |
22 | 22 | { |
23 | 23 | |
24 | - public function __construct() |
|
25 | - { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
28 | - |
|
29 | - |
|
30 | - protected function _init_props() |
|
31 | - { |
|
32 | - $this->label = __('Event List Shortcodes', 'event_espresso'); |
|
33 | - $this->description = __('All shortcodes specific to event lists', 'event_espresso'); |
|
34 | - $this->_shortcodes = array( |
|
35 | - '[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'), |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - protected function _parser($shortcode) |
|
41 | - { |
|
42 | - switch ($shortcode) { |
|
43 | - case '[EVENT_LIST]': |
|
44 | - return $this->_get_event_list(); |
|
45 | - break; |
|
46 | - } |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
52 | - * |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - private function _get_event_list() |
|
56 | - { |
|
57 | - $this->_validate_list_requirements(); |
|
58 | - |
|
59 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
60 | - return $this->_get_event_list_for_main(); |
|
61 | - } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
62 | - return $this->_get_event_list_for_registration(); |
|
63 | - } // prevent recursive loop |
|
64 | - else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * This returns the parsed event list for main template |
|
72 | - * |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - private function _get_event_list_for_main() |
|
76 | - { |
|
77 | - |
|
78 | - $valid_shortcodes = array( |
|
79 | - 'event', |
|
80 | - 'attendee_list', |
|
81 | - 'ticket_list', |
|
82 | - 'datetime_list', |
|
83 | - 'venue', |
|
84 | - 'attendee', |
|
85 | - 'recipient_list', |
|
86 | - 'recipient_details', |
|
87 | - 'primary_registration_list', |
|
88 | - 'primary_registration_details', |
|
89 | - 'event_author', |
|
90 | - 'organization', |
|
91 | - ); |
|
92 | - $template = $this->_data['template']; |
|
93 | - $data = $this->_data['data']; |
|
94 | - $events = ''; |
|
95 | - |
|
96 | - // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
97 | - foreach ($data->events as $event) { |
|
98 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
99 | - $template, |
|
100 | - $event['event'], |
|
101 | - $valid_shortcodes, |
|
102 | - $this->_extra_data |
|
103 | - ); |
|
104 | - } |
|
105 | - return $events; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * This returns the parsed event list for an attendee |
|
111 | - * |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - private function _get_event_list_for_registration() |
|
115 | - { |
|
116 | - $valid_shortcodes = array( |
|
117 | - 'event', |
|
118 | - 'ticket_list', |
|
119 | - 'datetime_list', |
|
120 | - 'attendee', |
|
121 | - 'event_author', |
|
122 | - 'recipient_details', |
|
123 | - 'recipient_list', |
|
124 | - 'venue', |
|
125 | - 'organization', |
|
126 | - ); |
|
127 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
128 | - ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
129 | - $registration = $this->_data['data']; |
|
130 | - |
|
131 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
132 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
133 | - |
|
134 | - // here we're setting up the events for the event_list template for THIS registration. |
|
135 | - $evt_result = ''; |
|
136 | - $all_events = $this->_get_events_from_registration($registration); |
|
137 | - |
|
138 | - // we're NOT going to prepare a list of attendees this time around |
|
139 | - $events = ''; |
|
140 | - |
|
141 | - foreach ((array) $all_events as $event) { |
|
142 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
143 | - $template, |
|
144 | - $event, |
|
145 | - $valid_shortcodes, |
|
146 | - $this->_extra_data |
|
147 | - ); |
|
148 | - } |
|
149 | - |
|
150 | - return $events; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - private function _get_events_from_registration(EE_Registration $registration) |
|
155 | - { |
|
156 | - return isset($this->_extra_data['data']->registrations) |
|
157 | - ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array(); |
|
158 | - } |
|
24 | + public function __construct() |
|
25 | + { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | + |
|
29 | + |
|
30 | + protected function _init_props() |
|
31 | + { |
|
32 | + $this->label = __('Event List Shortcodes', 'event_espresso'); |
|
33 | + $this->description = __('All shortcodes specific to event lists', 'event_espresso'); |
|
34 | + $this->_shortcodes = array( |
|
35 | + '[EVENT_LIST]' => __('Will output a list of events', 'event_espresso'), |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + protected function _parser($shortcode) |
|
41 | + { |
|
42 | + switch ($shortcode) { |
|
43 | + case '[EVENT_LIST]': |
|
44 | + return $this->_get_event_list(); |
|
45 | + break; |
|
46 | + } |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
52 | + * |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + private function _get_event_list() |
|
56 | + { |
|
57 | + $this->_validate_list_requirements(); |
|
58 | + |
|
59 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
60 | + return $this->_get_event_list_for_main(); |
|
61 | + } elseif ($this->_data['data'] instanceof EE_Registration) { |
|
62 | + return $this->_get_event_list_for_registration(); |
|
63 | + } // prevent recursive loop |
|
64 | + else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * This returns the parsed event list for main template |
|
72 | + * |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + private function _get_event_list_for_main() |
|
76 | + { |
|
77 | + |
|
78 | + $valid_shortcodes = array( |
|
79 | + 'event', |
|
80 | + 'attendee_list', |
|
81 | + 'ticket_list', |
|
82 | + 'datetime_list', |
|
83 | + 'venue', |
|
84 | + 'attendee', |
|
85 | + 'recipient_list', |
|
86 | + 'recipient_details', |
|
87 | + 'primary_registration_list', |
|
88 | + 'primary_registration_details', |
|
89 | + 'event_author', |
|
90 | + 'organization', |
|
91 | + ); |
|
92 | + $template = $this->_data['template']; |
|
93 | + $data = $this->_data['data']; |
|
94 | + $events = ''; |
|
95 | + |
|
96 | + // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
97 | + foreach ($data->events as $event) { |
|
98 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
99 | + $template, |
|
100 | + $event['event'], |
|
101 | + $valid_shortcodes, |
|
102 | + $this->_extra_data |
|
103 | + ); |
|
104 | + } |
|
105 | + return $events; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * This returns the parsed event list for an attendee |
|
111 | + * |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + private function _get_event_list_for_registration() |
|
115 | + { |
|
116 | + $valid_shortcodes = array( |
|
117 | + 'event', |
|
118 | + 'ticket_list', |
|
119 | + 'datetime_list', |
|
120 | + 'attendee', |
|
121 | + 'event_author', |
|
122 | + 'recipient_details', |
|
123 | + 'recipient_list', |
|
124 | + 'venue', |
|
125 | + 'organization', |
|
126 | + ); |
|
127 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
128 | + ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list']; |
|
129 | + $registration = $this->_data['data']; |
|
130 | + |
|
131 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
132 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
133 | + |
|
134 | + // here we're setting up the events for the event_list template for THIS registration. |
|
135 | + $evt_result = ''; |
|
136 | + $all_events = $this->_get_events_from_registration($registration); |
|
137 | + |
|
138 | + // we're NOT going to prepare a list of attendees this time around |
|
139 | + $events = ''; |
|
140 | + |
|
141 | + foreach ((array) $all_events as $event) { |
|
142 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
143 | + $template, |
|
144 | + $event, |
|
145 | + $valid_shortcodes, |
|
146 | + $this->_extra_data |
|
147 | + ); |
|
148 | + } |
|
149 | + |
|
150 | + return $events; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + private function _get_events_from_registration(EE_Registration $registration) |
|
155 | + { |
|
156 | + return isset($this->_extra_data['data']->registrations) |
|
157 | + ? array($this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']) : array(); |
|
158 | + } |
|
159 | 159 | } |
@@ -19,139 +19,139 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _init_props() |
|
29 | - { |
|
30 | - $this->label = esc_html__('Organization Shortcodes', 'event_espresso'); |
|
31 | - $this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso'); |
|
32 | - $this->_shortcodes = array( |
|
33 | - '[COMPANY]' => esc_html__('Event organization name', 'event_espresso'), |
|
34 | - '[CO_ADD1]' => esc_html__('Address 1 value for the organization', 'event_espresso'), |
|
35 | - '[CO_ADD2]' => esc_html__('Address 2 value for the organization', 'event_espresso'), |
|
36 | - '[CO_CITY]' => esc_html__('City the organization is in', 'event_espresso'), |
|
37 | - '[CO_STATE]' => esc_html__('State the organization is located in', 'event_espresso'), |
|
38 | - '[CO_ZIP]' => esc_html__('The zip code for the organization', 'event_espresso'), |
|
39 | - '[CO_LOGO]' => esc_html__('The logo image for the organization', 'event_espresso'), |
|
40 | - '[CO_EMAIL]' => esc_html__('The primary email address for the organization', 'event_espresso'), |
|
41 | - '[CO_PHONE]' => esc_html__('The phone number for the organization', 'event_espresso'), |
|
42 | - '[CO_LOGO_URL]' => esc_html__( |
|
43 | - 'Just the link to the image used as the logo for the organization', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - '[CO_FACEBOOK_URL]' => esc_html__('Link to organization Facebook page', 'event_espresso'), |
|
47 | - '[CO_TWITTER_URL]' => esc_html__('Link to organization Twitter page', 'event_espresso'), |
|
48 | - '[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'), |
|
49 | - '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
|
50 | - '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
|
51 | - '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
|
52 | - '[CO_TAX_NUMBER_*]' => sprintf( |
|
53 | - esc_html__( |
|
54 | - 'This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', |
|
55 | - 'event_espresso' |
|
56 | - ), |
|
57 | - '<strong>', |
|
58 | - '</strong>' |
|
59 | - ), |
|
60 | - ); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _parser($shortcode) |
|
65 | - { |
|
66 | - |
|
67 | - switch ($shortcode) { |
|
68 | - case '[COMPANY]': |
|
69 | - return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
70 | - break; |
|
71 | - |
|
72 | - case '[CO_ADD1]': |
|
73 | - return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
74 | - break; |
|
75 | - |
|
76 | - case '[CO_ADD2]': |
|
77 | - return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
78 | - break; |
|
79 | - |
|
80 | - case '[CO_CITY]': |
|
81 | - return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
82 | - break; |
|
83 | - |
|
84 | - case '[CO_STATE]': |
|
85 | - $state = EE_Registry::instance()->load_model('State')->get_one_by_ID( |
|
86 | - EE_Registry::instance()->CFG->organization->STA_ID |
|
87 | - ); |
|
88 | - return $state instanceof EE_State ? $state->name() : ''; |
|
89 | - break; |
|
90 | - |
|
91 | - case '[CO_ZIP]': |
|
92 | - return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | - break; |
|
94 | - |
|
95 | - case '[CO_EMAIL]': |
|
96 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | - break; |
|
98 | - |
|
99 | - case '[CO_PHONE]': |
|
100 | - return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | - break; |
|
102 | - |
|
103 | - case '[CO_LOGO]': |
|
104 | - return '<img src="' |
|
105 | - . EE_Registry::instance()->CFG->organization->get_pretty( |
|
106 | - 'logo_url' |
|
107 | - ) . '" id="headerImage" />'; |
|
108 | - break; |
|
109 | - |
|
110 | - case '[CO_LOGO_URL]': |
|
111 | - return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
112 | - break; |
|
113 | - |
|
114 | - case '[CO_FACEBOOK_URL]': |
|
115 | - return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
116 | - break; |
|
117 | - |
|
118 | - case '[CO_TWITTER_URL]': |
|
119 | - return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
120 | - break; |
|
121 | - |
|
122 | - case '[CO_PINTEREST_URL]': |
|
123 | - return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
124 | - break; |
|
125 | - |
|
126 | - case '[CO_LINKEDIN_URL]': |
|
127 | - return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
128 | - break; |
|
129 | - |
|
130 | - case '[CO_GOOGLE_URL]': |
|
131 | - return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
132 | - break; |
|
133 | - |
|
134 | - case '[CO_INSTAGRAM_URL]': |
|
135 | - return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
136 | - break; |
|
137 | - } |
|
138 | - |
|
139 | - // also allow for parameter shortcode |
|
140 | - if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) { |
|
141 | - // first see if there is any company tax number set and bail early if not |
|
142 | - $tax_number = EE_Registry::instance()->CFG->organization->vat; |
|
143 | - if (empty($tax_number)) { |
|
144 | - return ''; |
|
145 | - } |
|
146 | - |
|
147 | - // see if there are any attributes. |
|
148 | - $attrs = $this->_get_shortcode_attrs($shortcode); |
|
149 | - |
|
150 | - // set custom attrs if present (or default) |
|
151 | - $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
152 | - return $prefix . $tax_number; |
|
153 | - } |
|
154 | - |
|
155 | - return ''; |
|
156 | - } |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _init_props() |
|
29 | + { |
|
30 | + $this->label = esc_html__('Organization Shortcodes', 'event_espresso'); |
|
31 | + $this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso'); |
|
32 | + $this->_shortcodes = array( |
|
33 | + '[COMPANY]' => esc_html__('Event organization name', 'event_espresso'), |
|
34 | + '[CO_ADD1]' => esc_html__('Address 1 value for the organization', 'event_espresso'), |
|
35 | + '[CO_ADD2]' => esc_html__('Address 2 value for the organization', 'event_espresso'), |
|
36 | + '[CO_CITY]' => esc_html__('City the organization is in', 'event_espresso'), |
|
37 | + '[CO_STATE]' => esc_html__('State the organization is located in', 'event_espresso'), |
|
38 | + '[CO_ZIP]' => esc_html__('The zip code for the organization', 'event_espresso'), |
|
39 | + '[CO_LOGO]' => esc_html__('The logo image for the organization', 'event_espresso'), |
|
40 | + '[CO_EMAIL]' => esc_html__('The primary email address for the organization', 'event_espresso'), |
|
41 | + '[CO_PHONE]' => esc_html__('The phone number for the organization', 'event_espresso'), |
|
42 | + '[CO_LOGO_URL]' => esc_html__( |
|
43 | + 'Just the link to the image used as the logo for the organization', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + '[CO_FACEBOOK_URL]' => esc_html__('Link to organization Facebook page', 'event_espresso'), |
|
47 | + '[CO_TWITTER_URL]' => esc_html__('Link to organization Twitter page', 'event_espresso'), |
|
48 | + '[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'), |
|
49 | + '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
|
50 | + '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
|
51 | + '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
|
52 | + '[CO_TAX_NUMBER_*]' => sprintf( |
|
53 | + esc_html__( |
|
54 | + 'This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', |
|
55 | + 'event_espresso' |
|
56 | + ), |
|
57 | + '<strong>', |
|
58 | + '</strong>' |
|
59 | + ), |
|
60 | + ); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _parser($shortcode) |
|
65 | + { |
|
66 | + |
|
67 | + switch ($shortcode) { |
|
68 | + case '[COMPANY]': |
|
69 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
70 | + break; |
|
71 | + |
|
72 | + case '[CO_ADD1]': |
|
73 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
74 | + break; |
|
75 | + |
|
76 | + case '[CO_ADD2]': |
|
77 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
78 | + break; |
|
79 | + |
|
80 | + case '[CO_CITY]': |
|
81 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
82 | + break; |
|
83 | + |
|
84 | + case '[CO_STATE]': |
|
85 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID( |
|
86 | + EE_Registry::instance()->CFG->organization->STA_ID |
|
87 | + ); |
|
88 | + return $state instanceof EE_State ? $state->name() : ''; |
|
89 | + break; |
|
90 | + |
|
91 | + case '[CO_ZIP]': |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | + break; |
|
94 | + |
|
95 | + case '[CO_EMAIL]': |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | + break; |
|
98 | + |
|
99 | + case '[CO_PHONE]': |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | + break; |
|
102 | + |
|
103 | + case '[CO_LOGO]': |
|
104 | + return '<img src="' |
|
105 | + . EE_Registry::instance()->CFG->organization->get_pretty( |
|
106 | + 'logo_url' |
|
107 | + ) . '" id="headerImage" />'; |
|
108 | + break; |
|
109 | + |
|
110 | + case '[CO_LOGO_URL]': |
|
111 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
112 | + break; |
|
113 | + |
|
114 | + case '[CO_FACEBOOK_URL]': |
|
115 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
116 | + break; |
|
117 | + |
|
118 | + case '[CO_TWITTER_URL]': |
|
119 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
120 | + break; |
|
121 | + |
|
122 | + case '[CO_PINTEREST_URL]': |
|
123 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
124 | + break; |
|
125 | + |
|
126 | + case '[CO_LINKEDIN_URL]': |
|
127 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
128 | + break; |
|
129 | + |
|
130 | + case '[CO_GOOGLE_URL]': |
|
131 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
132 | + break; |
|
133 | + |
|
134 | + case '[CO_INSTAGRAM_URL]': |
|
135 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
136 | + break; |
|
137 | + } |
|
138 | + |
|
139 | + // also allow for parameter shortcode |
|
140 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) { |
|
141 | + // first see if there is any company tax number set and bail early if not |
|
142 | + $tax_number = EE_Registry::instance()->CFG->organization->vat; |
|
143 | + if (empty($tax_number)) { |
|
144 | + return ''; |
|
145 | + } |
|
146 | + |
|
147 | + // see if there are any attributes. |
|
148 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
149 | + |
|
150 | + // set custom attrs if present (or default) |
|
151 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
152 | + return $prefix . $tax_number; |
|
153 | + } |
|
154 | + |
|
155 | + return ''; |
|
156 | + } |
|
157 | 157 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.061'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.061'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |