@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -101,8 +102,9 @@ discard block |
||
101 | 102 | private function _get_event_admin_emails( $fancy_headers = TRUE ) { |
102 | 103 | |
103 | 104 | if ( !empty( $this->_data->admin_email ) ) { |
104 | - if ( ! $fancy_headers ) |
|
105 | - return $this->_data->admin_email; |
|
105 | + if ( ! $fancy_headers ) { |
|
106 | + return $this->_data->admin_email; |
|
107 | + } |
|
106 | 108 | return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>'; |
107 | 109 | } |
108 | 110 | |
@@ -142,7 +144,9 @@ discard block |
||
142 | 144 | |
143 | 145 | foreach ( $admin_details as $admin ) { |
144 | 146 | //only add an admin email if it is present. |
145 | - if ( empty( $admin->email ) || $admin->email == '' ) continue; |
|
147 | + if ( empty( $admin->email ) || $admin->email == '' ) { |
|
148 | + continue; |
|
149 | + } |
|
146 | 150 | |
147 | 151 | if ( ! $fancy_headers ) { |
148 | 152 | $admin_email[] = $admin->email; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $this->description = esc_html__('All shortcodes related to emails', 'event_espresso'); |
44 | 44 | $this->_shortcodes = array( |
45 | 45 | '[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'), |
46 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ), |
|
47 | - '[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ), |
|
48 | - '[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), |
|
46 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'), |
|
47 | + '[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'), |
|
48 | + '[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), |
|
49 | 49 | '[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'), |
50 | - '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso' ), |
|
50 | + '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', 'event_espresso'), |
|
51 | 51 | '[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso') |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - protected function _parser( $shortcode ) { |
|
56 | + protected function _parser($shortcode) { |
|
57 | 57 | |
58 | - switch ( $shortcode ) { |
|
58 | + switch ($shortcode) { |
|
59 | 59 | |
60 | 60 | case '[SITE_ADMIN_EMAIL]' : |
61 | 61 | return $this->_get_site_admin_email(); |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | break; |
67 | 67 | |
68 | 68 | case '[EVENT_AUTHOR_EMAIL]' : |
69 | - return $this->_get_event_admin_emails( FALSE ); |
|
69 | + return $this->_get_event_admin_emails(FALSE); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case '[CO_FORMATTED_EMAIL]' : |
73 | 73 | case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' : |
74 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>'; |
|
74 | + return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>'; |
|
75 | 75 | break; |
76 | 76 | |
77 | 77 | case '[CO_EMAIL]' : |
78 | 78 | case '[ESPRESSO_ADMIN_EMAIL]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | default : |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | - private function _get_event_admin_emails( $fancy_headers = TRUE ) { |
|
101 | + private function _get_event_admin_emails($fancy_headers = TRUE) { |
|
102 | 102 | |
103 | - if ( !empty( $this->_data->admin_email ) ) { |
|
104 | - if ( ! $fancy_headers ) |
|
103 | + if ( ! empty($this->_data->admin_email)) { |
|
104 | + if ( ! $fancy_headers) |
|
105 | 105 | return $this->_data->admin_email; |
106 | - return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>'; |
|
106 | + return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | //k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!. |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | $admin_email = array(); |
112 | 112 | |
113 | 113 | //loop through events and set the list of event_ids to retrieve so we can do ONE query. |
114 | - foreach ( $this->_data->events as $event ) { |
|
114 | + foreach ($this->_data->events as $event) { |
|
115 | 115 | $ids[] = $event['ID']; |
116 | 116 | } |
117 | 117 | |
118 | 118 | //get all the events |
119 | - $events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) ); |
|
119 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids)))); |
|
120 | 120 | |
121 | 121 | //now loop through each event and setup the details |
122 | 122 | $admin_details = array(); |
123 | 123 | $cnt = 0; |
124 | - foreach ( $events as $event ) { |
|
125 | - $user = get_userdata($event->get('EVT_wp_user') ); |
|
124 | + foreach ($events as $event) { |
|
125 | + $user = get_userdata($event->get('EVT_wp_user')); |
|
126 | 126 | $admin_details[$cnt] = new stdClass(); |
127 | 127 | $admin_details[$cnt]->email = $user->user_email; |
128 | 128 | $admin_details[$cnt]->first_name = $user->user_firstname; |
@@ -131,28 +131,28 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | //results? |
134 | - if ( empty($admin_details) || !is_array($admin_details) ) { |
|
134 | + if (empty($admin_details) || ! is_array($admin_details)) { |
|
135 | 135 | $msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso'); |
136 | - $msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql ); |
|
137 | - $msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) ); |
|
138 | - $msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) ); |
|
139 | - $msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) ); |
|
140 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' ); |
|
136 | + $msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql); |
|
137 | + $msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE)); |
|
138 | + $msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE)); |
|
139 | + $msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details)); |
|
140 | + do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser'); |
|
141 | 141 | } |
142 | 142 | |
143 | - foreach ( $admin_details as $admin ) { |
|
143 | + foreach ($admin_details as $admin) { |
|
144 | 144 | //only add an admin email if it is present. |
145 | - if ( empty( $admin->email ) || $admin->email == '' ) continue; |
|
145 | + if (empty($admin->email) || $admin->email == '') continue; |
|
146 | 146 | |
147 | - if ( ! $fancy_headers ) { |
|
147 | + if ( ! $fancy_headers) { |
|
148 | 148 | $admin_email[] = $admin->email; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | |
152 | - $admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>'; |
|
152 | + $admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>'; |
|
153 | 153 | } |
154 | 154 | |
155 | - $admin_email = implode( ',', $admin_email ); |
|
155 | + $admin_email = implode(',', $admin_email); |
|
156 | 156 | return $admin_email; |
157 | 157 | } |
158 | 158 |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -58,8 +59,9 @@ discard block |
||
58 | 59 | //now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
59 | 60 | $event = $this->_data instanceof EE_Event ? $this->_data : NULL; |
60 | 61 | |
61 | - if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) |
|
62 | - return ''; |
|
62 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) { |
|
63 | + return ''; |
|
64 | + } |
|
63 | 65 | |
64 | 66 | switch ( $shortcode ) { |
65 | 67 | case '[EVENT_AUTHOR_FNAME]' : |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,54 +49,54 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - protected function _parser( $shortcode ) { |
|
52 | + protected function _parser($shortcode) { |
|
53 | 53 | //make sure we end up with a copy of the EE_Messages_Addressee object |
54 | 54 | $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
55 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
55 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
56 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
57 | 57 | |
58 | 58 | //now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
59 | 59 | $event = $this->_data instanceof EE_Event ? $this->_data : NULL; |
60 | 60 | |
61 | - if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) |
|
61 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) |
|
62 | 62 | return ''; |
63 | 63 | |
64 | - switch ( $shortcode ) { |
|
64 | + switch ($shortcode) { |
|
65 | 65 | case '[EVENT_AUTHOR_FNAME]' : |
66 | - $fname = !empty( $recipient ) ? $recipient->fname : NULL; |
|
67 | - if ( empty( $fname ) && !empty( $event ) ) { |
|
68 | - $user = $this->_get_author_for_event( $event ); |
|
66 | + $fname = ! empty($recipient) ? $recipient->fname : NULL; |
|
67 | + if (empty($fname) && ! empty($event)) { |
|
68 | + $user = $this->_get_author_for_event($event); |
|
69 | 69 | $fname = $user->first_name; |
70 | 70 | } |
71 | 71 | return $fname; |
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[EVENT_AUTHOR_LNAME]' : |
75 | - $lname = !empty( $recipient ) ? $recipient->lname : NULL; |
|
76 | - if ( empty( $lname ) && !empty( $event ) ) { |
|
77 | - $user = $this->_get_author_for_event( $event ); |
|
75 | + $lname = ! empty($recipient) ? $recipient->lname : NULL; |
|
76 | + if (empty($lname) && ! empty($event)) { |
|
77 | + $user = $this->_get_author_for_event($event); |
|
78 | 78 | $lname = $user->last_name; |
79 | 79 | } |
80 | 80 | return $lname; |
81 | 81 | break; |
82 | 82 | |
83 | 83 | case '[EVENT_AUTHOR_FORMATTED_EMAIL]' : |
84 | - if ( !empty( $recipient ) ) { |
|
85 | - $email = !empty( $recipient->fname ) ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $recipient->admin_email . '>'; |
|
84 | + if ( ! empty($recipient)) { |
|
85 | + $email = ! empty($recipient->fname) ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$recipient->admin_email.'>'; |
|
86 | 86 | } else { |
87 | 87 | $email = NULL; |
88 | 88 | } |
89 | - if ( empty( $email ) && ! empty( $event ) ) { |
|
90 | - $user = $this->_get_author_for_event( $event ); |
|
91 | - $email = ! empty( $user->first_name ) ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $user->user_email . '>'; |
|
89 | + if (empty($email) && ! empty($event)) { |
|
90 | + $user = $this->_get_author_for_event($event); |
|
91 | + $email = ! empty($user->first_name) ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$user->user_email.'>'; |
|
92 | 92 | } |
93 | 93 | return $email; |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case '[EVENT_AUTHOR_EMAIL]' : |
97 | - $email = ! empty( $recipient ) ? $recipient->admin_email : NULL; |
|
98 | - if ( empty( $email ) && !empty( $event ) ) { |
|
99 | - $user = $this->_get_author_for_event( $event ); |
|
97 | + $email = ! empty($recipient) ? $recipient->admin_email : NULL; |
|
98 | + if (empty($email) && ! empty($event)) { |
|
99 | + $user = $this->_get_author_for_event($event); |
|
100 | 100 | $email = $user->user_email; |
101 | 101 | } |
102 | 102 | return $email; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return WP_User |
119 | 119 | */ |
120 | - private function _get_author_for_event( EE_Event $event ) { |
|
120 | + private function _get_author_for_event(EE_Event $event) { |
|
121 | 121 | $author_id = $event->wp_user(); |
122 | - $user_data = get_userdata( (int) $author_id ); |
|
122 | + $user_data = get_userdata((int) $author_id); |
|
123 | 123 | return $user_data; |
124 | 124 | } |
125 | 125 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | * @param mixed (array|object) $data incoming data object/array |
52 | 52 | * @return string parsed code. |
53 | 53 | */ |
54 | - public function parser( $shortcode, $data, $extra_data = array() ) { |
|
54 | + public function parser($shortcode, $data, $extra_data = array()) { |
|
55 | 55 | |
56 | 56 | //all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key); |
57 | - if ( empty( $this->_data['ID'] ) ) |
|
57 | + if (empty($this->_data['ID'])) |
|
58 | 58 | return ''; //need the event id to do anything! |
59 | 59 | |
60 | 60 | $meta = get_post_meta($this->_data['ID'], $shortcode, true); |
61 | 61 | |
62 | - return !empty( $meta ) ? $meta : ''; |
|
62 | + return ! empty($meta) ? $meta : ''; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _parser( $shortcode ) {} |
|
66 | + protected function _parser($shortcode) {} |
|
67 | 67 | |
68 | 68 | |
69 | 69 | } //end EE_Event_Meta_Shortcodes class |
70 | 70 | \ No newline at end of file |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -54,8 +55,10 @@ discard block |
||
54 | 55 | public function parser( $shortcode, $data, $extra_data = array() ) { |
55 | 56 | |
56 | 57 | //all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key); |
57 | - if ( empty( $this->_data['ID'] ) ) |
|
58 | - return ''; //need the event id to do anything! |
|
58 | + if ( empty( $this->_data['ID'] ) ) { |
|
59 | + return ''; |
|
60 | + } |
|
61 | + //need the event id to do anything! |
|
59 | 62 | |
60 | 63 | $meta = get_post_meta($this->_data['ID'], $shortcode, true); |
61 | 64 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | '[LINE_ITEM_NAME]' => __('Outputs the line item name.', 'event_espresso'), |
35 | 35 | '[LINE_ITEM_DESCRIPTION]' => __('Outputs a the description for the line item.', 'event_espresso'), |
36 | 36 | '[LINE_ITEM_QUANTITY]' => __('Outputs the quantity for this line item.', 'event_espresso'), |
37 | - '[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso' ), |
|
37 | + '[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso'), |
|
38 | 38 | '[LINE_ITEM_TOTAL]' => __('This outputs the line item total.', 'event_espresso'), |
39 | - '[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not. One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item. So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned. The default symbol if no attribute is included is the "*" symbol.', 'event_espresso' ) |
|
39 | + '[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not. One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item. So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned. The default symbol if no attribute is included is the "*" symbol.', 'event_espresso') |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - protected function _parser( $shortcode ) { |
|
45 | + protected function _parser($shortcode) { |
|
46 | 46 | //ensure that the incoming object IS a line item. If it isn't then bail early. |
47 | - if ( ! $this->_data instanceof EE_Line_Item ) { |
|
47 | + if ( ! $this->_data instanceof EE_Line_Item) { |
|
48 | 48 | return ''; |
49 | 49 | } |
50 | 50 | |
51 | 51 | $line_item = $this->_data; |
52 | 52 | |
53 | - switch ( $shortcode ) { |
|
53 | + switch ($shortcode) { |
|
54 | 54 | case '[LINE_ITEM_NAME]' : |
55 | 55 | return $line_item->name(); |
56 | 56 | break; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | break; |
65 | 65 | |
66 | 66 | case '[LINE_ITEM_AMOUNT]' : |
67 | - return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code(); |
|
67 | + return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code(); |
|
68 | 68 | break; |
69 | 69 | |
70 | 70 | case '[LINE_ITEM_TOTAL]' : |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | break; |
73 | 73 | } |
74 | 74 | |
75 | - if ( strpos( $shortcode, '[LINE_ITEM_TAXABLE_*' ) !== FALSE ) { |
|
76 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
77 | - if ( $line_item->is_taxable() ) { |
|
78 | - return !empty( $attrs['symbol'] ) ? $attrs['symbol'] : '*'; |
|
75 | + if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== FALSE) { |
|
76 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
77 | + if ($line_item->is_taxable()) { |
|
78 | + return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*'; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage shortcodes library |
8 | 8 | */ |
9 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | +} |
|
10 | 12 | /** |
11 | 13 | * EE_Messenger_Shortcodes |
12 | 14 | * |
@@ -69,8 +71,9 @@ discard block |
||
69 | 71 | $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
70 | 72 | $recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
71 | 73 | |
72 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
73 | - return ''; |
|
74 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
75 | + return ''; |
|
76 | + } |
|
74 | 77 | |
75 | 78 | switch ( $shortcode ) { |
76 | 79 | case '[DISPLAY_HTML_URL]' : |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | $this->label = __('Messenger Shortcodes', 'event_espresso'); |
42 | 42 | $this->description = __('All shortcodes that are messenger specific.', 'event_espresso'); |
43 | 43 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
44 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
44 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
45 | 45 | //add messages about what happens when the messenger is active. |
46 | 46 | $this->_active_messengers = $message_resource_manager->active_messengers(); |
47 | 47 | |
48 | - $this->_shortcodes['[DISPLAY_HTML_URL]'] =__('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso'); |
|
49 | - $this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso' ); |
|
48 | + $this->_shortcodes['[DISPLAY_HTML_URL]'] = __('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso'); |
|
49 | + $this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso'); |
|
50 | 50 | $this->_shortcodes['[DISPLAY_PDF_BUTTON]'] = __('This will return html for a download pdf button trigger if the pdf messenger is active.', 'event_espresso'); |
51 | 51 | |
52 | 52 | //show error message about buttons/urls not working as expected if messenger deactivated. |
53 | - if ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'update_message_template' ) { |
|
54 | - if ( ! isset( $this->_active_messengers['pdf'] ) ) { |
|
55 | - EE_Error::add_attention( __('Be aware that the pdf messenger is inactive. This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso' ) ); |
|
53 | + if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update_message_template') { |
|
54 | + if ( ! isset($this->_active_messengers['pdf'])) { |
|
55 | + EE_Error::add_attention(__('Be aware that the pdf messenger is inactive. This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso')); |
|
56 | 56 | } |
57 | 57 | |
58 | - if ( !isset( $this->_active_messengers['html'] ) ) { |
|
59 | - EE_Error::add_attention( __('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso' ) ); |
|
58 | + if ( ! isset($this->_active_messengers['html'])) { |
|
59 | + EE_Error::add_attention(__('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso')); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -64,24 +64,24 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | - protected function _parser( $shortcode ) { |
|
67 | + protected function _parser($shortcode) { |
|
68 | 68 | //make sure we end up with a copy of the EE_Messages_Addressee object |
69 | 69 | $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
70 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
71 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
70 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient; |
|
71 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient; |
|
72 | 72 | |
73 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
73 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
74 | 74 | return ''; |
75 | 75 | |
76 | - switch ( $shortcode ) { |
|
76 | + switch ($shortcode) { |
|
77 | 77 | case '[DISPLAY_HTML_URL]' : |
78 | - return isset( $this->_active_messengers['html'] ) ? $this->_get_url( $recipient, 'html' ) : ''; |
|
78 | + return isset($this->_active_messengers['html']) ? $this->_get_url($recipient, 'html') : ''; |
|
79 | 79 | break; |
80 | 80 | case '[DISPLAY_PDF_URL]' : |
81 | - return isset( $this->_active_messengers['pdf'] ) ? $this->_get_url( $recipient, 'pdf' ) : ''; |
|
81 | + return isset($this->_active_messengers['pdf']) ? $this->_get_url($recipient, 'pdf') : ''; |
|
82 | 82 | break; |
83 | 83 | case '[DISPLAY_PDF_BUTTON]' : |
84 | - return isset( $this->_active_messengers['pdf'] ) ? $this->_get_button( $recipient, 'pdf' ) : ''; |
|
84 | + return isset($this->_active_messengers['pdf']) ? $this->_get_button($recipient, 'pdf') : ''; |
|
85 | 85 | break; |
86 | 86 | } |
87 | 87 | return ''; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return string Generated html |
101 | 101 | */ |
102 | - private function _get_button( EE_Messages_Addressee $recipient, $sending_messenger ) { |
|
103 | - $download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso' ); |
|
102 | + private function _get_button(EE_Messages_Addressee $recipient, $sending_messenger) { |
|
103 | + $download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso'); |
|
104 | 104 | $content = ' |
105 | -<form method="post" action="' . $this->_get_url( $recipient, $sending_messenger ) . '" > |
|
106 | - <input class="print_button" type="submit" value="' . $download_text . '" /> |
|
105 | +<form method="post" action="' . $this->_get_url($recipient, $sending_messenger).'" > |
|
106 | + <input class="print_button" type="submit" value="' . $download_text.'" /> |
|
107 | 107 | </form> |
108 | 108 | '; |
109 | 109 | return $content; |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | * @return string The generated url for displaying the link. |
123 | 123 | * @throws EE_Error |
124 | 124 | */ |
125 | - private function _get_url( EE_Messages_Addressee $recipient, $sending_messenger ) { |
|
125 | + private function _get_url(EE_Messages_Addressee $recipient, $sending_messenger) { |
|
126 | 126 | |
127 | 127 | $reg = $recipient->reg_obj; |
128 | 128 | $reg = ! $reg instanceof EE_Registration ? $recipient->primary_reg_obj : $reg; |
129 | 129 | |
130 | 130 | |
131 | - if ( $this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message ) { |
|
132 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
131 | + if ($this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message) { |
|
132 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
133 | 133 | try { |
134 | - return EEH_MSG_Template::get_url_trigger( $this->_message_type, $this->_message, $reg, $sending_messenger ); |
|
135 | - } catch( EE_Error $e ) { |
|
136 | - if ( WP_DEBUG ) { |
|
134 | + return EEH_MSG_Template::get_url_trigger($this->_message_type, $this->_message, $reg, $sending_messenger); |
|
135 | + } catch (EE_Error $e) { |
|
136 | + if (WP_DEBUG) { |
|
137 | 137 | $e->get_error(); |
138 | 138 | } |
139 | 139 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | '[PAYMENT_TIMESTAMP]' => __('Outputs the date of the payment (using the default date format).', 'event_espresso'), |
35 | 35 | '[PAYMENT_METHOD]' => __('Outputs a the payment method.', 'event_espresso'), |
36 | 36 | '[PAYMENT_AMOUNT]' => __('Outputs the payment amount (with currency symbol).', 'event_espresso'), |
37 | - '[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso' ), |
|
37 | + '[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso'), |
|
38 | 38 | '[PAYMENT_GATEWAY_RESPONSE]' => __('Outputs the payment gateway response.', 'event_espresso'), |
39 | 39 | '[PAYMENT_GATEWAY_TXN_ID]' => __('This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.', 'event_espresso'), |
40 | 40 | '[PAYMENT_PO_NUMBER]' => __('Purchase Order number (if present)', 'event_espresso'), |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - protected function _parser( $shortcode ) { |
|
49 | + protected function _parser($shortcode) { |
|
50 | 50 | //ensure that the incoming object is an EE_Payment object. If it isn't then bail early. |
51 | - if ( ! $this->_data instanceof EE_Payment ) { |
|
51 | + if ( ! $this->_data instanceof EE_Payment) { |
|
52 | 52 | return ''; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $payment = $this->_data; |
56 | 56 | |
57 | - switch ( $shortcode ) { |
|
57 | + switch ($shortcode) { |
|
58 | 58 | case '[PAYMENT_TIMESTAMP]' : |
59 | 59 | return $payment->timestamp(); |
60 | 60 | break; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | |
71 | 71 | case '[PAYMENT_GATEWAY]' : |
72 | 72 | //previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
73 | - if( $payment->payment_method() instanceof EE_Payment_Method ){ |
|
73 | + if ($payment->payment_method() instanceof EE_Payment_Method) { |
|
74 | 74 | return $payment->payment_method()->name(); |
75 | - }else{ |
|
76 | - return __( 'Unknown', 'event_espresso' ); |
|
75 | + } else { |
|
76 | + return __('Unknown', 'event_espresso'); |
|
77 | 77 | } |
78 | 78 | break; |
79 | 79 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | break; |
99 | 99 | |
100 | 100 | case '[PAYMENT_STATUS_WITH_ICONS]' : |
101 | - return $payment->pretty_status( TRUE ); |
|
101 | + return $payment->pretty_status(TRUE); |
|
102 | 102 | break; |
103 | 103 | |
104 | 104 | default : |
@@ -6,8 +6,9 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -72,7 +73,7 @@ discard block |
||
72 | 73 | //previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
73 | 74 | if( $payment->payment_method() instanceof EE_Payment_Method ){ |
74 | 75 | return $payment->payment_method()->name(); |
75 | - }else{ |
|
76 | + } else{ |
|
76 | 77 | return __( 'Unknown', 'event_espresso' ); |
77 | 78 | } |
78 | 79 | break; |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -61,14 +62,16 @@ discard block |
||
61 | 62 | $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
62 | 63 | $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
63 | 64 | |
64 | - if ( ! $primary_registration instanceof EE_Messages_Addressee ) |
|
65 | - return ''; |
|
65 | + if ( ! $primary_registration instanceof EE_Messages_Addressee ) { |
|
66 | + return ''; |
|
67 | + } |
|
66 | 68 | |
67 | 69 | $attendee = $primary_registration->primary_att_obj; |
68 | 70 | $primary_reg = $primary_registration->primary_reg_obj; |
69 | 71 | |
70 | - if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) |
|
71 | - return ''; |
|
72 | + if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) { |
|
73 | + return ''; |
|
74 | + } |
|
72 | 75 | |
73 | 76 | switch ( $shortcode ) { |
74 | 77 | case '[PRIMARY_REGISTRANT_FNAME]' : |
@@ -118,8 +121,9 @@ discard block |
||
118 | 121 | break; |
119 | 122 | |
120 | 123 | case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' : |
121 | - if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) |
|
122 | - return ''; |
|
124 | + if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) { |
|
125 | + return ''; |
|
126 | + } |
|
123 | 127 | return $primary_registration->primary_reg_obj->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ); |
124 | 128 | break; |
125 | 129 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | '[PRIMARY_REGISTRANT_ADDRESS2]' => __('Whatever was in the address 2 field for the primary registrant for the transaction.', 'event_espresso'), |
46 | 46 | '[PRIMARY_REGISTRANT_CITY]' => __('The city for the primary registrant for the transaction.', 'event_espresso'), |
47 | 47 | '[PRIMARY_REGISTRANT_ZIP_PC]' => __('The ZIP (or Postal) Code for the primary registrant for the transaction.', 'event_espresso'), |
48 | - '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso' ), |
|
48 | + '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso'), |
|
49 | 49 | '[PRIMARY_REGISTRANT_COUNTRY]' => __('The country for the primary registrant for the transaction.', 'event_espresso'), |
50 | 50 | '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' => __('The date the registration occured for the primary registration.', 'event_espresso'), |
51 | 51 | '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => __('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
52 | - '[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso' ) |
|
52 | + '[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso') |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | - protected function _parser( $shortcode ) { |
|
58 | + protected function _parser($shortcode) { |
|
59 | 59 | //make sure we end up with a copy of the EE_Messages_Addressee object |
60 | 60 | $primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
61 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
|
62 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
|
61 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
|
62 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
|
63 | 63 | |
64 | - if ( ! $primary_registration instanceof EE_Messages_Addressee ) |
|
64 | + if ( ! $primary_registration instanceof EE_Messages_Addressee) |
|
65 | 65 | return ''; |
66 | 66 | |
67 | 67 | $attendee = $primary_registration->primary_att_obj; |
68 | 68 | $primary_reg = $primary_registration->primary_reg_obj; |
69 | 69 | |
70 | - if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) |
|
70 | + if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) |
|
71 | 71 | return ''; |
72 | 72 | |
73 | - switch ( $shortcode ) { |
|
73 | + switch ($shortcode) { |
|
74 | 74 | case '[PRIMARY_REGISTRANT_FNAME]' : |
75 | 75 | return $attendee->fname(); |
76 | 76 | break; |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | break; |
119 | 119 | |
120 | 120 | case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' : |
121 | - if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) |
|
121 | + if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration) |
|
122 | 122 | return ''; |
123 | - return $primary_registration->primary_reg_obj->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ); |
|
123 | + return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format')); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' : |
@@ -128,22 +128,22 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | |
131 | - if ( strpos( $shortcode, '[PRIMARY_REGISTRANT_ANSWER_*' ) !== false ) { |
|
132 | - $shortcode = str_replace( '[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode ); |
|
133 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
131 | + if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) { |
|
132 | + $shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode); |
|
133 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | //now let's figure out what question has this text |
137 | - if ( empty( $primary_registration->questions ) ) { |
|
137 | + if (empty($primary_registration->questions)) { |
|
138 | 138 | return ''; |
139 | 139 | } |
140 | 140 | |
141 | - foreach ( $primary_registration->questions as $ansid => $question ) { |
|
141 | + foreach ($primary_registration->questions as $ansid => $question) { |
|
142 | 142 | if ( |
143 | - trim( $question->get( 'QST_display_text' ) ) == trim( $shortcode ) |
|
144 | - && isset( $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ] ) |
|
143 | + trim($question->get('QST_display_text')) == trim($shortcode) |
|
144 | + && isset($primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]) |
|
145 | 145 | ) { |
146 | - return $primary_registration->registrations[ $primary_reg->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
146 | + return $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -80,8 +81,9 @@ discard block |
||
80 | 81 | |
81 | 82 | |
82 | 83 | //If there is no event object by now then get out. |
83 | - if ( ! $this->_ticket instanceof EE_Ticket ) |
|
84 | - return ''; |
|
84 | + if ( ! $this->_ticket instanceof EE_Ticket ) { |
|
85 | + return ''; |
|
86 | + } |
|
85 | 87 | |
86 | 88 | switch ( $shortcode ) { |
87 | 89 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -50,38 +50,38 @@ discard block |
||
50 | 50 | '[TICKET_PRICE]' => __('The price of the ticket', 'event_espresso'), |
51 | 51 | '[TICKET_PRICE_WITH_TAXES]' => __('The price of the ticket including any taxes that might be on the ticket', 'event_espresso'), |
52 | 52 | '[TKT_QTY_PURCHASED]' => __('The total quantity of the current ticket in the list that has been purchased in this transaction', 'event_espresso'), |
53 | - '[TKT_USES_*]' => __( 'This attribute based shortcode parses to show the number of uses the ticket has. The optional "schema" attribute can be used to indicate what schema is used when the uses is infinite. Options are:', 'event_espresso' ) . |
|
54 | - '<p><ul>' . |
|
55 | - '<li><strong>symbol</strong>:' . __('This returns the ∞ symbol.', 'event_espresso') . '</li>' . |
|
56 | - '<li><strong>text</strong>:' . __('This returns the word, "Unlimited". This is also the default if the "schema" attribute is not used.', 'event_espresso' ) . '</li>' . |
|
57 | - '<li><strong>{custom}</strong>:' . __('You can put anything you want as a string instead and that will be used. So you could have the world "any" and whenever uses for a ticket is infinity, this shortcode will parse to "any".', 'event_espresso' ) . '</li>' . |
|
53 | + '[TKT_USES_*]' => __('This attribute based shortcode parses to show the number of uses the ticket has. The optional "schema" attribute can be used to indicate what schema is used when the uses is infinite. Options are:', 'event_espresso'). |
|
54 | + '<p><ul>'. |
|
55 | + '<li><strong>symbol</strong>:'.__('This returns the ∞ symbol.', 'event_espresso').'</li>'. |
|
56 | + '<li><strong>text</strong>:'.__('This returns the word, "Unlimited". This is also the default if the "schema" attribute is not used.', 'event_espresso').'</li>'. |
|
57 | + '<li><strong>{custom}</strong>:'.__('You can put anything you want as a string instead and that will be used. So you could have the world "any" and whenever uses for a ticket is infinity, this shortcode will parse to "any".', 'event_espresso').'</li>'. |
|
58 | 58 | '</ul></p>' |
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | - protected function _parser( $shortcode ) { |
|
63 | + protected function _parser($shortcode) { |
|
64 | 64 | |
65 | 65 | $this->_ticket = $this->_data instanceof EE_Ticket ? $this->_data : null; |
66 | 66 | |
67 | 67 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
68 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee; |
|
68 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee; |
|
69 | 69 | |
70 | 70 | |
71 | 71 | //possible EE_Line_Item may be incoming data |
72 | - $this->_ticket = empty( $this->_ticket ) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && ! empty( $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] ) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket; |
|
72 | + $this->_ticket = empty($this->_ticket) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && ! empty($aee->line_items_with_children[$this->_data->ID()]['EE_Ticket']) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket; |
|
73 | 73 | |
74 | 74 | //if still no ticket, then let's see if there is a reg_obj. If there IS, then we'll try and grab the ticket from the reg_obj instead. |
75 | - if ( empty( $this->_ticket ) ) { |
|
75 | + if (empty($this->_ticket)) { |
|
76 | 76 | $this->_ticket = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->ticket() : NULL; |
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | //If there is no event object by now then get out. |
81 | - if ( ! $this->_ticket instanceof EE_Ticket ) |
|
81 | + if ( ! $this->_ticket instanceof EE_Ticket) |
|
82 | 82 | return ''; |
83 | 83 | |
84 | - switch ( $shortcode ) { |
|
84 | + switch ($shortcode) { |
|
85 | 85 | |
86 | 86 | case '[TICKET_ID]' : |
87 | 87 | return $this->_ticket->ID(); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | break; |
97 | 97 | |
98 | 98 | case '[TICKET_PRICE]' : |
99 | - return EEH_Template::format_currency( $this->_ticket->get('TKT_price') ); |
|
99 | + return EEH_Template::format_currency($this->_ticket->get('TKT_price')); |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | case '[TICKET_PRICE_WITH_TAXES]' : |
103 | - return EEH_Template::format_currency( $this->_ticket->get_ticket_total_with_taxes() ); |
|
103 | + return EEH_Template::format_currency($this->_ticket->get_ticket_total_with_taxes()); |
|
104 | 104 | break; |
105 | 105 | |
106 | 106 | case '[TKT_QTY_PURCHASED]' : |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | break; |
109 | 109 | } |
110 | 110 | |
111 | - if ( strpos( $shortcode, '[TKT_USES_*') !== FALSE ) { |
|
112 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
113 | - $schema = empty( $attrs['schema'] ) ? null : $attrs['schema']; |
|
114 | - return $this->_ticket->get_pretty( 'TKT_uses', $schema ); |
|
111 | + if (strpos($shortcode, '[TKT_USES_*') !== FALSE) { |
|
112 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
113 | + $schema = empty($attrs['schema']) ? null : $attrs['schema']; |
|
114 | + return $this->_ticket->get_pretty('TKT_uses', $schema); |
|
115 | 115 | } |
116 | 116 | return ''; |
117 | 117 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Csv |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @access public |
61 | 61 | * @return void |
62 | 62 | */ |
63 | - public function run( $WP ) { |
|
63 | + public function run($WP) { |
|
64 | 64 | // add_filter( 'FHEE_load_ee_config', '__return_true' ); |
65 | 65 | // add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
66 | 66 | // add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public function export() { |
82 | - $Export = EE_Registry::instance()->load_class( 'Export' ); |
|
82 | + $Export = EE_Registry::instance()->load_class('Export'); |
|
83 | 83 | $Export->export(); |
84 | 84 | } |
85 | 85 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function import() { |
96 | - $Import = EE_Registry::instance()->load_class( 'Import' ); |
|
96 | + $Import = EE_Registry::instance()->load_class('Import'); |
|
97 | 97 | $Import->import(); |
98 | 98 | } |
99 | 99 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |