@@ -15,27 +15,27 @@ |
||
15 | 15 | * @type bool $show_gravatar whether to show gravatar or not. |
16 | 16 | */ |
17 | 17 | |
18 | -$no_attendees_message = apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso' ) ); |
|
18 | +$no_attendees_message = apply_filters('FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso')); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div class="event-attendees"> |
24 | - <?php do_action( 'AHEE__loop-espresso_event_attendees__before', $contacts, $event, $datetime, $ticket, $show_gravatar ); ?> |
|
25 | - <?php if ( $contacts ) : ?> |
|
24 | + <?php do_action('AHEE__loop-espresso_event_attendees__before', $contacts, $event, $datetime, $ticket, $show_gravatar); ?> |
|
25 | + <?php if ($contacts) : ?> |
|
26 | 26 | <ul class="event-attendees-list"> |
27 | - <?php foreach( $contacts as $contact ) : |
|
28 | - EEH_Template::get_template_part( 'content', 'espresso_event_attendees', array( |
|
27 | + <?php foreach ($contacts as $contact) : |
|
28 | + EEH_Template::get_template_part('content', 'espresso_event_attendees', array( |
|
29 | 29 | 'contact' => $contact, |
30 | 30 | 'event' => $event, |
31 | 31 | 'datetime' => $datetime, |
32 | 32 | 'ticket' => $ticket, |
33 | 33 | 'show_gravatar' => $show_gravatar |
34 | - ) ); |
|
34 | + )); |
|
35 | 35 | endforeach; ?> |
36 | 36 | </ul> |
37 | 37 | <?php else : ?> |
38 | 38 | <p><?php echo $no_attendees_message; ?></p> |
39 | 39 | <?php endif; ?> |
40 | - <?php do_action( 'AHEE__loop-espresso_event_attendees__after', $contacts, $event, $datetime, $ticket, $show_gravatar ); ?> |
|
40 | + <?php do_action('AHEE__loop-espresso_event_attendees__after', $contacts, $event, $datetime, $ticket, $show_gravatar); ?> |
|
41 | 41 | </div> |
42 | 42 | \ No newline at end of file |
@@ -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 | /** |
@@ -58,96 +58,96 @@ discard block |
||
58 | 58 | '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
59 | 59 | '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
60 | 60 | '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
61 | - '[CO_TAX_NUMBER_*]' => sprintf( esc_html__('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.', 'event_espresso' ),'<strong>','</strong>') |
|
61 | + '[CO_TAX_NUMBER_*]' => sprintf(esc_html__('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.', 'event_espresso'), '<strong>', '</strong>') |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _parser( $shortcode ) { |
|
66 | + protected function _parser($shortcode) { |
|
67 | 67 | |
68 | - switch ( $shortcode ) { |
|
68 | + switch ($shortcode) { |
|
69 | 69 | |
70 | 70 | case '[COMPANY]' : |
71 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
71 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[CO_ADD1]' : |
75 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ); |
|
75 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case '[CO_ADD2]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | case '[CO_CITY]' : |
83 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'city' ); |
|
83 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
84 | 84 | break; |
85 | 85 | |
86 | 86 | case '[CO_STATE]' : |
87 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID ); |
|
87 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID); |
|
88 | 88 | return $state->name(); |
89 | 89 | break; |
90 | 90 | |
91 | 91 | case '[CO_ZIP]' : |
92 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ); |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | 93 | break; |
94 | 94 | |
95 | 95 | case '[CO_EMAIL]' : |
96 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | 97 | break; |
98 | 98 | |
99 | 99 | case '[CO_PHONE]' : |
100 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ); |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | 101 | break; |
102 | 102 | |
103 | 103 | case '[CO_LOGO]' : |
104 | - return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />'; |
|
104 | + return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />'; |
|
105 | 105 | break; |
106 | 106 | |
107 | 107 | case '[CO_LOGO_URL]' : |
108 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
108 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[CO_FACEBOOK_URL]' : |
112 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
112 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
113 | 113 | break; |
114 | 114 | |
115 | 115 | case '[CO_TWITTER_URL]' : |
116 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
116 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
117 | 117 | break; |
118 | 118 | |
119 | 119 | case '[CO_PINTEREST_URL]' : |
120 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
120 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
121 | 121 | break; |
122 | 122 | |
123 | 123 | case '[CO_LINKEDIN_URL]' : |
124 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
124 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | case '[CO_GOOGLE_URL]' : |
128 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
128 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case '[CO_INSTAGRAM_URL]' : |
132 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
132 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | 137 | //also allow for parameter shortcode |
138 | - if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) { |
|
138 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) { |
|
139 | 139 | //first see if there is any company tax number set and bail early if not |
140 | 140 | $tax_number = EE_Registry::instance()->CFG->organization->vat; |
141 | - if ( empty( $tax_number ) ) { |
|
141 | + if (empty($tax_number)) { |
|
142 | 142 | return ''; |
143 | 143 | } |
144 | 144 | |
145 | 145 | //see if there are any attributes. |
146 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
146 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
147 | 147 | |
148 | 148 | //set custom attrs if present (or default) |
149 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | - return $prefix . $tax_number; |
|
149 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
150 | + return $prefix.$tax_number; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return ''; |
@@ -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,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 | /** |
@@ -42,25 +42,25 @@ discard block |
||
42 | 42 | $this->_shortcodes = array( |
43 | 43 | '[TXN_ID]' => esc_html__('The transaction id for the purchase.', 'event_espresso'), |
44 | 44 | '[PAYMENT_URL]' => esc_html__('This is a link to make a payment for the event', 'event_espresso'), |
45 | - '[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>' |
|
46 | - . '<li>' . sprintf( esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
47 | - . '<li>' . sprintf( esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
48 | - . '<li>' . sprintf( esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
45 | + '[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>' |
|
46 | + . '<li>'.sprintf(esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
47 | + . '<li>'.sprintf(esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
48 | + . '<li>'.sprintf(esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
49 | 49 | . '</ul>', |
50 | - '[PAYMENT_DUE_DATE_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso' ) |
|
50 | + '[PAYMENT_DUE_DATE_*]' => esc_html__('This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso') |
|
51 | 51 | . '<ul>' |
52 | - . '<li>' . sprintf( esc_html__( '%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
53 | - . '<li>' . sprintf( esc_html__( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
54 | - . '<li>' . sprintf( esc_html__( '%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>', |
|
52 | + . '<li>'.sprintf(esc_html__('%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
53 | + . '<li>'.sprintf(esc_html__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
54 | + . '<li>'.sprintf(esc_html__('%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>', |
|
55 | 55 | '[INVOICE_LINK]' => esc_html__('This is a full html link to the invoice', 'event_espresso'), |
56 | 56 | '[INVOICE_URL]' => esc_html__('This is just the url for the invoice', 'event_espresso'), |
57 | 57 | '[INVOICE_LOGO_URL]' => esc_html__('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'), |
58 | 58 | '[INVOICE_LOGO]' => esc_html__('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'), |
59 | 59 | '[INVOICE_PAYEE_NAME]' => esc_html__('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
60 | - '[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
61 | - '[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ), |
|
62 | - '[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
63 | - '[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf( esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), '<code>', '</code>' ), |
|
60 | + '[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
61 | + '[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'), |
|
62 | + '[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
63 | + '[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf(esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), '<code>', '</code>'), |
|
64 | 64 | '[TOTAL_COST]' => esc_html__('The total cost for the transaction', 'event_espresso'), |
65 | 65 | '[TXN_STATUS]' => esc_html__('The transaction status for the transaction.', 'event_espresso'), |
66 | 66 | '[TXN_STATUS_ID]' => esc_html__('The ID representing the transaction status as saved in the db. This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'), |
@@ -71,52 +71,52 @@ discard block |
||
71 | 71 | '[TOTAL_OWING]' => esc_html__('The total owing on a transaction with no attributes.', 'event_espresso'), |
72 | 72 | '[TXN_SUBTOTAL]' => esc_html__('The subtotal for all txn line items.', 'event_espresso'), |
73 | 73 | '[TXN_TAX_SUBTOTAL]' => esc_html__('The subtotal for all tax line items.', 'event_espresso'), |
74 | - '[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' . |
|
75 | - '<li><strong>still_owing</strong>:' . esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' . |
|
76 | - '<li><strong>none_owing</strong>:' . esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>', |
|
74 | + '[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'. |
|
75 | + '<li><strong>still_owing</strong>:'.esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'. |
|
76 | + '<li><strong>none_owing</strong>:'.esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>', |
|
77 | 77 | '[TXN_TOTAL_TICKETS]' => esc_html__('The total number of all tickets purchased in a transaction', 'event_espresso'), |
78 | - '[TKT_QTY_PURCHASED]' => sprintf( esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>' ), |
|
78 | + '[TKT_QTY_PURCHASED]' => sprintf(esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>'), |
|
79 | 79 | '[TRANSACTION_ADMIN_URL]' => esc_html__('The url to the admin page for this transaction', 'event_espresso'), |
80 | 80 | '[RECEIPT_URL]' => esc_html__('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'), |
81 | - '[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | - '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( esc_html__( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' ) |
|
81 | + '[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | + '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(esc_html__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>') |
|
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - protected function _parser( $shortcode ) { |
|
87 | + protected function _parser($shortcode) { |
|
88 | 88 | |
89 | 89 | //attempt to get the transaction. Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction. |
90 | 90 | $transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null; |
91 | - $transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction; |
|
91 | + $transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction; |
|
92 | 92 | |
93 | 93 | //payment |
94 | 94 | $payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null; |
95 | - $payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment; |
|
95 | + $payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment; |
|
96 | 96 | |
97 | 97 | |
98 | - if ( ! $transaction instanceof EE_Transaction ) |
|
98 | + if ( ! $transaction instanceof EE_Transaction) |
|
99 | 99 | return ''; |
100 | 100 | |
101 | - switch ( $shortcode ) { |
|
101 | + switch ($shortcode) { |
|
102 | 102 | case '[TXN_ID]' : |
103 | 103 | return $transaction->ID(); |
104 | 104 | break; |
105 | 105 | |
106 | 106 | case '[PAYMENT_URL]' : |
107 | 107 | $payment_url = $transaction->payment_overview_url(); |
108 | - return empty( $payment_url ) ? esc_html__( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
108 | + return empty($payment_url) ? esc_html__('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[INVOICE_LINK]' : |
112 | 112 | $invoice_url = $transaction->invoice_url(); |
113 | - $invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
114 | - return sprintf( esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' ); |
|
113 | + $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
114 | + return sprintf(esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>'); |
|
115 | 115 | break; /**/ |
116 | 116 | |
117 | 117 | case '[INVOICE_URL]' : |
118 | 118 | $invoice_url = $transaction->invoice_url(); |
119 | - return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
119 | + return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case '[INVOICE_LOGO_URL]' : |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | break; |
125 | 125 | |
126 | 126 | case '[INVOICE_LOGO]' : |
127 | - return $this->_get_invoice_logo( TRUE ); |
|
127 | + return $this->_get_invoice_logo(TRUE); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | case '[INVOICE_PAYEE_NAME]' : |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | |
147 | 147 | case "[TOTAL_COST]" : |
148 | 148 | $total = $transaction->total(); |
149 | - return ! empty($total) ? EEH_Template::format_currency( $total ) : ''; |
|
149 | + return ! empty($total) ? EEH_Template::format_currency($total) : ''; |
|
150 | 150 | break; |
151 | 151 | |
152 | 152 | case "[PAYMENT_STATUS]" : |
153 | 153 | $status = $transaction->pretty_status(); |
154 | - return !empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
154 | + return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
155 | 155 | break; /**/ |
156 | 156 | |
157 | 157 | // note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity. |
158 | 158 | case "[TXN_STATUS]" : |
159 | 159 | $status = $transaction->pretty_status(); |
160 | - return !empty( $status ) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
160 | + return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso'); |
|
161 | 161 | break; |
162 | 162 | |
163 | 163 | case "[TXN_STATUS_ID]" : |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | break; |
166 | 166 | |
167 | 167 | case "[PAYMENT_GATEWAY]" : |
168 | - return $this->_get_payment_gateway( $transaction ); |
|
168 | + return $this->_get_payment_gateway($transaction); |
|
169 | 169 | break; |
170 | 170 | |
171 | 171 | case "[AMOUNT_PAID]" : |
172 | 172 | $amount = $payment instanceof EE_Payment ? $payment->amount() : 0; |
173 | - return EEH_Template::format_currency( $amount ); |
|
173 | + return EEH_Template::format_currency($amount); |
|
174 | 174 | break; |
175 | 175 | |
176 | 176 | case "[TOTAL_AMOUNT_PAID]" : |
177 | - return EEH_Template::format_currency( $transaction->paid() ); |
|
177 | + return EEH_Template::format_currency($transaction->paid()); |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case "[TOTAL_OWING]" : |
181 | 181 | $total_owing = $transaction->remaining(); |
182 | - return EEH_Template::format_currency( $total_owing ); |
|
182 | + return EEH_Template::format_currency($total_owing); |
|
183 | 183 | break; |
184 | 184 | |
185 | 185 | case "[TXN_SUBTOTAL]" : |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | case "[TXN_TAX_SUBTOTAL]" : |
190 | - return EEH_Template::format_currency($this->_get_subtotal( TRUE )); |
|
190 | + return EEH_Template::format_currency($this->_get_subtotal(TRUE)); |
|
191 | 191 | break; |
192 | 192 | |
193 | 193 | case "[TKT_QTY_PURCHASED]" : |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | break; |
197 | 197 | |
198 | 198 | case "[TRANSACTION_ADMIN_URL]" : |
199 | - require_once EE_CORE . 'admin/EE_Admin_Page.core.php'; |
|
200 | - $query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ); |
|
201 | - $url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') ); |
|
199 | + require_once EE_CORE.'admin/EE_Admin_Page.core.php'; |
|
200 | + $query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID()); |
|
201 | + $url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')); |
|
202 | 202 | return $url; |
203 | 203 | break; |
204 | 204 | |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | //get primary_registration |
207 | 207 | $reg = $this->_data->primary_reg_obj; |
208 | 208 | |
209 | - if ( ! $reg instanceof EE_Registration ) { |
|
209 | + if ( ! $reg instanceof EE_Registration) { |
|
210 | 210 | return ''; |
211 | 211 | } |
212 | 212 | return $reg->receipt_url(); |
213 | 213 | break; |
214 | 214 | |
215 | 215 | case "[INVOICE_RECEIPT_SWITCHER_URL]" : |
216 | - return $this->_get_invoice_receipt_switcher( FALSE ); |
|
216 | + return $this->_get_invoice_receipt_switcher(FALSE); |
|
217 | 217 | break; |
218 | 218 | |
219 | 219 | case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" : |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | |
224 | 224 | } |
225 | 225 | |
226 | - if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) { |
|
227 | - return $this->_get_custom_total_oweing( $shortcode ); |
|
226 | + if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) { |
|
227 | + return $this->_get_custom_total_oweing($shortcode); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) { |
|
231 | - return $this->_get_invoice_payee_tax_number( $shortcode ); |
|
230 | + if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) { |
|
231 | + return $this->_get_invoice_payee_tax_number($shortcode); |
|
232 | 232 | } |
233 | 233 | |
234 | - if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) { |
|
235 | - return $this->_get_payment_link_if_needed( $shortcode ); |
|
234 | + if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) { |
|
235 | + return $this->_get_payment_link_if_needed($shortcode); |
|
236 | 236 | } |
237 | 237 | |
238 | - if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) { |
|
239 | - return $this->_get_payment_due_date( $shortcode, $transaction ); |
|
238 | + if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) { |
|
239 | + return $this->_get_payment_due_date($shortcode, $transaction); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return ''; |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return string parsed. |
255 | 255 | */ |
256 | - private function _get_custom_total_oweing( $shortcode ) { |
|
257 | - $valid_shortcodes = array( 'transaction' ); |
|
258 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
256 | + private function _get_custom_total_oweing($shortcode) { |
|
257 | + $valid_shortcodes = array('transaction'); |
|
258 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
259 | 259 | |
260 | 260 | //ensure default is set. |
261 | 261 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
262 | 262 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
263 | 263 | |
264 | - if ( $total_owing > 0 ) { |
|
265 | - $owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ); |
|
266 | - $owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
264 | + if ($total_owing > 0) { |
|
265 | + $owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>'); |
|
266 | + $owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
267 | 267 | } else { |
268 | - $owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
268 | + $owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $owing_content; |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | |
274 | 274 | |
275 | 275 | |
276 | - private function _get_payment_gateway( $transaction ) { |
|
277 | - $pm = $this->_get_payment_method( $transaction ); |
|
276 | + private function _get_payment_gateway($transaction) { |
|
277 | + $pm = $this->_get_payment_method($transaction); |
|
278 | 278 | return $pm instanceof EE_Payment_Method ? $pm->name() : ''; |
279 | 279 | } |
280 | 280 | |
@@ -289,37 +289,37 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string url or html |
291 | 291 | */ |
292 | - private function _get_invoice_logo( $img_tags = FALSE ) { |
|
292 | + private function _get_invoice_logo($img_tags = FALSE) { |
|
293 | 293 | //try to get the invoice payment method's logo for this transaction image first |
294 | 294 | $pm = $this->_get_payment_method(); |
295 | - if ( $pm instanceof EE_Payment_Method ){ |
|
296 | - $invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE ); |
|
297 | - }else{ |
|
295 | + if ($pm instanceof EE_Payment_Method) { |
|
296 | + $invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE); |
|
297 | + } else { |
|
298 | 298 | $invoice_logo_url = NULL; |
299 | 299 | } |
300 | - if( empty( $invoice_logo_url ) ){ |
|
300 | + if (empty($invoice_logo_url)) { |
|
301 | 301 | $invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url; |
302 | 302 | } |
303 | 303 | |
304 | - if ( empty( $invoice_logo_url ) ) { |
|
304 | + if (empty($invoice_logo_url)) { |
|
305 | 305 | return ''; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! $img_tags ) { |
|
308 | + if ( ! $img_tags) { |
|
309 | 309 | return $invoice_logo_url; |
310 | 310 | } |
311 | 311 | |
312 | 312 | //image tags have been requested. |
313 | - $image_size = getimagesize( $invoice_logo_url ); |
|
313 | + $image_size = getimagesize($invoice_logo_url); |
|
314 | 314 | |
315 | 315 | //if image is wider than 200px, set the wideth to 200 |
316 | - if ( $image_size[0] > 300 ) { |
|
316 | + if ($image_size[0] > 300) { |
|
317 | 317 | $image_width = 300; |
318 | - }else{ |
|
318 | + } else { |
|
319 | 319 | $image_width = $image_size[0]; |
320 | 320 | } |
321 | 321 | |
322 | - return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />'; |
|
322 | + return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />'; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -336,26 +336,26 @@ discard block |
||
336 | 336 | private function _get_invoice_payee_name() { |
337 | 337 | $payee_name = NULL; |
338 | 338 | $pm = $this->_get_payment_method(); |
339 | - if( $pm instanceof EE_Payment_Method ){ |
|
340 | - $payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE ); |
|
339 | + if ($pm instanceof EE_Payment_Method) { |
|
340 | + $payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE); |
|
341 | 341 | } |
342 | - $payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name; |
|
342 | + $payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name; |
|
343 | 343 | return $payee_name; |
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | 347 | * gets the payment method for this transaction. Otherwise gets a default one. |
348 | 348 | */ |
349 | - private function _get_payment_method( $transaction = null ){ |
|
350 | - if( $transaction instanceof EE_Transaction ) { |
|
349 | + private function _get_payment_method($transaction = null) { |
|
350 | + if ($transaction instanceof EE_Transaction) { |
|
351 | 351 | $payment_method = $transaction->payment_method(); |
352 | - if ( empty( $payment_method ) ) { |
|
353 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
352 | + if (empty($payment_method)) { |
|
353 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
354 | 354 | } |
355 | 355 | return $payment_method; |
356 | - }else{ |
|
356 | + } else { |
|
357 | 357 | //get the first payment method we can find |
358 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
358 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | private function _get_invoice_payee_email() { |
373 | 373 | $payee_email = NULL; |
374 | 374 | $pm = $this->_get_payment_method(); |
375 | - if( $pm instanceof EE_Payment_Method ){ |
|
376 | - $payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE ); |
|
375 | + if ($pm instanceof EE_Payment_Method) { |
|
376 | + $payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE); |
|
377 | 377 | } |
378 | - $payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email; |
|
378 | + $payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email; |
|
379 | 379 | return $payee_email; |
380 | 380 | } |
381 | 381 | |
@@ -391,24 +391,24 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - private function _get_invoice_payee_tax_number( $shortcode ) { |
|
394 | + private function _get_invoice_payee_tax_number($shortcode) { |
|
395 | 395 | $payee_tax_number = NULL; |
396 | 396 | $pm = $this->_get_payment_method(); |
397 | - if( $pm instanceof EE_Payment_Method ){ |
|
398 | - $payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE ); |
|
397 | + if ($pm instanceof EE_Payment_Method) { |
|
398 | + $payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE); |
|
399 | 399 | } |
400 | - $payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
400 | + $payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
401 | 401 | |
402 | - if ( empty( $payee_tax_number ) ) { |
|
402 | + if (empty($payee_tax_number)) { |
|
403 | 403 | return ''; |
404 | 404 | } |
405 | 405 | |
406 | 406 | //any attributes? |
407 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
407 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
408 | 408 | |
409 | 409 | //prefix? |
410 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__( 'VAT/Tax Number: ', 'event_espresso' ); |
|
411 | - return $prefix . $payee_tax_number; |
|
410 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
411 | + return $prefix.$payee_tax_number; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -425,22 +425,22 @@ discard block |
||
425 | 425 | private function _get_invoice_payee_address() { |
426 | 426 | $payee_address = NULL; |
427 | 427 | $pm = $this->_get_payment_method(); |
428 | - if( $pm instanceof EE_Payment_Method ){ |
|
429 | - $payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE ); |
|
428 | + if ($pm instanceof EE_Payment_Method) { |
|
429 | + $payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE); |
|
430 | 430 | } |
431 | - if ( empty( $payee_address ) ) { |
|
431 | + if (empty($payee_address)) { |
|
432 | 432 | $organization = EE_Registry::instance()->CFG->organization; |
433 | - $payee_address = $organization->get_pretty( 'address_1' ) . '<br>'; |
|
434 | - $payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : ''; |
|
435 | - $payee_address .= $organization->get_pretty( 'city' ) . '<br>'; |
|
433 | + $payee_address = $organization->get_pretty('address_1').'<br>'; |
|
434 | + $payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : ''; |
|
435 | + $payee_address .= $organization->get_pretty('city').'<br>'; |
|
436 | 436 | |
437 | 437 | //state |
438 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID ); |
|
439 | - $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
438 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
439 | + $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
440 | 440 | |
441 | 441 | //Country |
442 | - $payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : ''; |
|
443 | - $payee_address .= ! empty( $organization->zip ) ? $organization->zip : ''; |
|
442 | + $payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : ''; |
|
443 | + $payee_address .= ! empty($organization->zip) ? $organization->zip : ''; |
|
444 | 444 | } |
445 | 445 | return $payee_address; |
446 | 446 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | private function _get_invoice_payment_instructions() { |
459 | 459 | $instructions = NULL; |
460 | 460 | $pm = $this->_get_payment_method(); |
461 | - return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : ''; |
|
461 | + return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : ''; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -472,27 +472,27 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return string |
474 | 474 | */ |
475 | - protected function _get_invoice_receipt_switcher( $button = TRUE ) { |
|
475 | + protected function _get_invoice_receipt_switcher($button = TRUE) { |
|
476 | 476 | $reg = $this->_data->primary_reg_obj; |
477 | - $message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : ''; |
|
478 | - if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) { |
|
477 | + $message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : ''; |
|
478 | + if ( ! $reg instanceof EE_Registration || empty($message_type)) { |
|
479 | 479 | return ''; |
480 | 480 | } |
481 | 481 | |
482 | - $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
483 | - $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso' ) : esc_html__( 'Switch to Invoice', 'event_espresso' ); |
|
484 | - $switch_to_label = ! $switch_to_invoice ? esc_html__( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label; |
|
482 | + $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
483 | + $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso') : esc_html__('Switch to Invoice', 'event_espresso'); |
|
484 | + $switch_to_label = ! $switch_to_invoice ? esc_html__('Switch to Receipt', 'event_espresso') : $switch_to_label; |
|
485 | 485 | $switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url(); |
486 | 486 | |
487 | - if ( ! $button ) { |
|
487 | + if ( ! $button) { |
|
488 | 488 | return $switch_to_url; |
489 | 489 | } |
490 | 490 | |
491 | - if ( ! empty( $switch_to_url ) ) { |
|
491 | + if ( ! empty($switch_to_url)) { |
|
492 | 492 | |
493 | 493 | return ' |
494 | - <form method="post" action="' . $switch_to_url . '" > |
|
495 | - <input class="print_button" type="submit" value="' . $switch_to_label . '" /> |
|
494 | + <form method="post" action="' . $switch_to_url.'" > |
|
495 | + <input class="print_button" type="submit" value="' . $switch_to_label.'" /> |
|
496 | 496 | </form> |
497 | 497 | '; |
498 | 498 | } |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return string |
514 | 514 | */ |
515 | - private function _get_receipt_url( EE_Transaction $transaction ) { |
|
515 | + private function _get_receipt_url(EE_Transaction $transaction) { |
|
516 | 516 | //get primary_registration |
517 | 517 | $reg = $this->_data->primary_reg_obj; |
518 | 518 | |
519 | - if ( ! $reg instanceof EE_Registration ) { |
|
519 | + if ( ! $reg instanceof EE_Registration) { |
|
520 | 520 | return ''; |
521 | 521 | } |
522 | 522 | |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @return int |
534 | 534 | */ |
535 | - private function _get_subtotal( $tax = FALSE ) { |
|
536 | - $grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL; |
|
535 | + private function _get_subtotal($tax = FALSE) { |
|
536 | + $grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL; |
|
537 | 537 | |
538 | - if ( ! $grand_total instanceof EE_Line_Item ) { |
|
538 | + if ( ! $grand_total instanceof EE_Line_Item) { |
|
539 | 539 | return 0; |
540 | 540 | } |
541 | 541 | |
@@ -554,26 +554,26 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return string parsed. |
556 | 556 | */ |
557 | - private function _get_payment_link_if_needed( $shortcode ) { |
|
558 | - $valid_shortcodes = array( 'transaction' ); |
|
559 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
557 | + private function _get_payment_link_if_needed($shortcode) { |
|
558 | + $valid_shortcodes = array('transaction'); |
|
559 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
560 | 560 | |
561 | 561 | //ensure default is set. |
562 | 562 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
563 | 563 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
564 | 564 | |
565 | - if ( $total_owing > 0 ) { |
|
566 | - $class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout'; |
|
567 | - $custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
568 | - $container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p'; |
|
569 | - $opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : ''; |
|
570 | - $opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag; |
|
571 | - $opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag; |
|
572 | - $closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : ''; |
|
573 | - $content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag; |
|
565 | + if ($total_owing > 0) { |
|
566 | + $class = isset($attrs['class']) ? $attrs['class'] : 'callout'; |
|
567 | + $custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
568 | + $container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p'; |
|
569 | + $opening_tag = ! empty($container_tag) ? '<'.$container_tag : ''; |
|
570 | + $opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag; |
|
571 | + $opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag; |
|
572 | + $closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : ''; |
|
573 | + $content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag; |
|
574 | 574 | |
575 | 575 | //we need to re run this string through the parser to catch any shortcodes that are in it. |
576 | - $owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
576 | + $owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
577 | 577 | } else { |
578 | 578 | return ''; |
579 | 579 | } |
@@ -593,31 +593,31 @@ discard block |
||
593 | 593 | * @param EE_Transaction $transaction |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) { |
|
596 | + protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) { |
|
597 | 597 | //if transaction is paid in full then we can just return an empty string |
598 | - if ( $transaction->remaining() === 0 ) { |
|
598 | + if ($transaction->remaining() === 0) { |
|
599 | 599 | return ''; |
600 | 600 | } |
601 | 601 | |
602 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
603 | - $format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' ); |
|
604 | - $days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30; |
|
605 | - $prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : esc_html__( 'Payment in full due by: ', 'event_espresso' ); |
|
606 | - $transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' ); |
|
602 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
603 | + $format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format'); |
|
604 | + $days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30; |
|
605 | + $prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : esc_html__('Payment in full due by: ', 'event_espresso'); |
|
606 | + $transaction_created = $transaction->get_DateTime_object('TXN_timestamp'); |
|
607 | 607 | |
608 | 608 | //setup date due: |
609 | 609 | try { |
610 | - if ( $transaction_created instanceof DateTime ) { |
|
611 | - $date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format ); |
|
610 | + if ($transaction_created instanceof DateTime) { |
|
611 | + $date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format); |
|
612 | 612 | } else { |
613 | 613 | throw new Exception(); |
614 | 614 | } |
615 | - } catch( Exception $e ) { |
|
615 | + } catch (Exception $e) { |
|
616 | 616 | //format was likely invalid. |
617 | 617 | $date_due = 'Unable to calculate date due, likely the format string is invalid.'; |
618 | 618 | } |
619 | 619 | |
620 | - return $prefix_text . $date_due; |
|
620 | + return $prefix_text.$date_due; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | } //end EE_Transaction Shortcodes library |
@@ -959,12 +959,12 @@ |
||
959 | 959 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
960 | 960 | 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
961 | 961 | 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable', |
962 | - 'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event |
|
963 | - ? '' |
|
964 | - : EE_Admin_Page::add_query_args_and_nonce( |
|
965 | - array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ), |
|
966 | - REG_ADMIN_URL |
|
967 | - ) |
|
962 | + 'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event |
|
963 | + ? '' |
|
964 | + : EE_Admin_Page::add_query_args_and_nonce( |
|
965 | + array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ), |
|
966 | + REG_ADMIN_URL |
|
967 | + ) |
|
968 | 968 | ); |
969 | 969 | |
970 | 970 | $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->_name = 'pricing'; |
55 | 55 | |
56 | 56 | //capability check |
57 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) { |
|
57 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | //if we were going to add our own metaboxes we'd use the below. |
63 | 63 | $this->_metaboxes = array( |
64 | 64 | 0 => array( |
65 | - 'page_route' => array('edit','create_new'), |
|
65 | + 'page_route' => array('edit', 'create_new'), |
|
66 | 66 | 'func' => 'pricing_metabox', |
67 | 67 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
68 | 68 | 'priority' => 'high', |
69 | 69 | 'context' => 'normal' |
70 | 70 | ), |
71 | 71 | |
72 | - );/**/ |
|
72 | + ); /**/ |
|
73 | 73 | |
74 | 74 | $this->_remove_metaboxes = array( |
75 | 75 | 0 => array( |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @var array Expected an array returned with 'date' and 'time' keys. |
90 | 90 | */ |
91 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
91 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | 92 | 'date' => 'Y-m-d', |
93 | 93 | 'time' => 'h:i a' |
94 | 94 | )); |
95 | 95 | |
96 | 96 | //validate |
97 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
98 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
97 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
98 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
99 | 99 | |
100 | 100 | //validate format strings |
101 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
102 | - if ( is_array( $format_validation ) ) { |
|
103 | - $msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>'; |
|
104 | - foreach ( $format_validation as $error ) { |
|
105 | - $msg .= '<li>' . $error . '</li>'; |
|
101 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
102 | + if (is_array($format_validation)) { |
|
103 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
104 | + foreach ($format_validation as $error) { |
|
105 | + $msg .= '<li>'.$error.'</li>'; |
|
106 | 106 | } |
107 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
108 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
107 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
108 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
109 | 109 | $this->_date_format_strings = array( |
110 | 110 | 'date' => 'Y-m-d', |
111 | 111 | 'time' => 'h:i a' |
@@ -116,60 +116,60 @@ discard block |
||
116 | 116 | $this->_scripts_styles = array( |
117 | 117 | 'registers' => array( |
118 | 118 | 'ee-tickets-datetimes-css' => array( |
119 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
119 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
120 | 120 | 'type' => 'css' |
121 | 121 | ), |
122 | 122 | 'ee-dtt-ticket-metabox' => array( |
123 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
123 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
124 | 124 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
125 | 125 | ) |
126 | 126 | ), |
127 | 127 | 'deregisters' => array( |
128 | - 'event-editor-css' => array('type' => 'css' ), |
|
128 | + 'event-editor-css' => array('type' => 'css'), |
|
129 | 129 | 'event-datetime-metabox' => array('type' => 'js') |
130 | 130 | ), |
131 | 131 | 'enqueues' => array( |
132 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
133 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
132 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
133 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
134 | 134 | ), |
135 | 135 | 'localize' => array( |
136 | 136 | 'ee-dtt-ticket-metabox' => array( |
137 | 137 | 'DTT_TRASH_BLOCK' => array( |
138 | 138 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
139 | 139 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
140 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
140 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
141 | 141 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
142 | 142 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
143 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
143 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
144 | 144 | ), |
145 | 145 | 'DTT_ERROR_MSG' => array( |
146 | 146 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
147 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
147 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
148 | 148 | ), |
149 | 149 | 'DTT_OVERSELL_WARNING' => array( |
150 | 150 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), |
151 | 151 | 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso') |
152 | 152 | ), |
153 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
154 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
153 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
154 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
155 | 155 | ) |
156 | 156 | ) |
157 | 157 | ); |
158 | 158 | |
159 | 159 | |
160 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
161 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
160 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
161 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | |
166 | - public function caf_updates( $update_callbacks ) { |
|
167 | - foreach ( $update_callbacks as $key => $callback ) { |
|
168 | - if ( $callback[1] == '_default_tickets_update' ) |
|
169 | - unset( $update_callbacks[$key] ); |
|
166 | + public function caf_updates($update_callbacks) { |
|
167 | + foreach ($update_callbacks as $key => $callback) { |
|
168 | + if ($callback[1] == '_default_tickets_update') |
|
169 | + unset($update_callbacks[$key]); |
|
170 | 170 | } |
171 | 171 | |
172 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
172 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
173 | 173 | return $update_callbacks; |
174 | 174 | } |
175 | 175 | |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * @param array $data The request data from the form |
183 | 183 | * @return bool success or fail |
184 | 184 | */ |
185 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
185 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
186 | 186 | //first we need to start with datetimes cause they are the "root" items attached to events. |
187 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
187 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
188 | 188 | //next tackle the tickets (and prices?) |
189 | - $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
189 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -197,41 +197,41 @@ discard block |
||
197 | 197 | * @param array $data the request data from the form |
198 | 198 | * @return EE_Datetime[] |
199 | 199 | */ |
200 | - protected function _update_dtts( $evt_obj, $data ) { |
|
201 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
200 | + protected function _update_dtts($evt_obj, $data) { |
|
201 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
202 | 202 | $saved_dtt_ids = array(); |
203 | 203 | $saved_dtt_objs = array(); |
204 | 204 | |
205 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
205 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
206 | 206 | //trim all values to ensure any excess whitespace is removed. |
207 | 207 | $dtt = array_map( |
208 | - function( $datetime_data ) { |
|
209 | - return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data ); |
|
208 | + function($datetime_data) { |
|
209 | + return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
210 | 210 | }, |
211 | 211 | $dtt |
212 | 212 | ); |
213 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
213 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
214 | 214 | $datetime_values = array( |
215 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
216 | - 'DTT_name' => ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
217 | - 'DTT_description' => ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
215 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
216 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
217 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
218 | 218 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
219 | 219 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
220 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ], |
|
221 | - 'DTT_order' => ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
220 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
221 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
222 | 222 | ); |
223 | 223 | |
224 | 224 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
225 | 225 | |
226 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
227 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
226 | + if ( ! empty($dtt['DTT_ID'])) { |
|
227 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
228 | 228 | |
229 | 229 | //set date and time format according to what is set in this class. |
230 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
231 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
230 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
231 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
232 | 232 | |
233 | - foreach ( $datetime_values as $field => $value ) { |
|
234 | - $DTM->set( $field, $value ); |
|
233 | + foreach ($datetime_values as $field => $value) { |
|
234 | + $DTM->set($field, $value); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
240 | 240 | |
241 | 241 | } else { |
242 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
242 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
243 | 243 | |
244 | 244 | //reset date and times to match the format |
245 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
246 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
247 | - foreach( $datetime_values as $field => $value ) { |
|
248 | - $DTM->set( $field, $value ); |
|
245 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
246 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
247 | + foreach ($datetime_values as $field => $value) { |
|
248 | + $DTM->set($field, $value); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | 252 | |
253 | 253 | $DTM->save(); |
254 | - $DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
254 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
255 | 255 | $evt_obj->save(); |
256 | 256 | |
257 | 257 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
258 | - if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) { |
|
259 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') ); |
|
258 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
259 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
260 | 260 | $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
261 | 261 | $DTM->save(); |
262 | 262 | } |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
274 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
274 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
275 | 275 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
276 | 276 | |
277 | - if ( is_array( $old_datetimes ) ) { |
|
278 | - $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
|
279 | - foreach ( $dtts_to_delete as $id ) { |
|
280 | - $id = absint( $id ); |
|
281 | - if ( empty( $id ) ) |
|
277 | + if (is_array($old_datetimes)) { |
|
278 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
279 | + foreach ($dtts_to_delete as $id) { |
|
280 | + $id = absint($id); |
|
281 | + if (empty($id)) |
|
282 | 282 | continue; |
283 | 283 | |
284 | 284 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
285 | 285 | |
286 | 286 | //remove tkt relationships. |
287 | 287 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
288 | - foreach ( $related_tickets as $tkt ) { |
|
288 | + foreach ($related_tickets as $tkt) { |
|
289 | 289 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
290 | 290 | } |
291 | 291 | |
292 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
292 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
293 | 293 | $dtt_to_remove->refresh_cache_of_related_objects(); |
294 | 294 | |
295 | 295 | } |
@@ -310,85 +310,85 @@ discard block |
||
310 | 310 | * @param array $data incoming request data |
311 | 311 | * @return EE_Ticket[] |
312 | 312 | */ |
313 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
313 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
314 | 314 | |
315 | 315 | $new_tkt = null; |
316 | 316 | $new_default = null; |
317 | 317 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
318 | 318 | $data = stripslashes_deep($data); |
319 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
319 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
320 | 320 | $saved_tickets = $dtts_on_existing = array(); |
321 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
321 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
322 | 322 | |
323 | 323 | //load money helper |
324 | 324 | |
325 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
325 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
326 | 326 | |
327 | 327 | $update_prices = $create_new_TKT = FALSE; |
328 | 328 | |
329 | 329 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
330 | 330 | |
331 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
332 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
331 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
332 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
333 | 333 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
334 | 334 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
335 | 335 | |
336 | 336 | // trim inputs to ensure any excess whitespace is removed. |
337 | 337 | $tkt = array_map( |
338 | - function( $ticket_data ) { |
|
339 | - return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data ); |
|
338 | + function($ticket_data) { |
|
339 | + return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
340 | 340 | }, |
341 | 341 | $tkt |
342 | 342 | ); |
343 | 343 | |
344 | 344 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
345 | 345 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
346 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
346 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
347 | 347 | |
348 | 348 | //note incoming base price needs converted from localized value. |
349 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
349 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
350 | 350 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
351 | 351 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
352 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
352 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
353 | 353 | |
354 | 354 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
355 | 355 | |
356 | 356 | $now = null; |
357 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
357 | + if (empty($tkt['TKT_start_date'])) { |
|
358 | 358 | //lets' use now in the set timezone. |
359 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
360 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
359 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
360 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
361 | 361 | } |
362 | 362 | |
363 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
363 | + if (empty($tkt['TKT_end_date'])) { |
|
364 | 364 | /** |
365 | 365 | * set the TKT_end_date to the first datetime attached to the ticket. |
366 | 366 | */ |
367 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
368 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
367 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
368 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $TKT_values = array( |
372 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
373 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
374 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
375 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
372 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
373 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
374 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
375 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
376 | 376 | 'TKT_start_date' => $tkt['TKT_start_date'], |
377 | 377 | 'TKT_end_date' => $tkt['TKT_end_date'], |
378 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ], |
|
379 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'], |
|
380 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
381 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
378 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
379 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
380 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
381 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
382 | 382 | 'TKT_row' => $row, |
383 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
384 | - 'TKT_taxable' => ! empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
385 | - 'TKT_required' => ! empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
383 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
384 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
385 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
386 | 386 | 'TKT_price' => $ticket_price |
387 | 387 | ); |
388 | 388 | |
389 | 389 | |
390 | 390 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
391 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
391 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
392 | 392 | $TKT_values['TKT_ID'] = 0; |
393 | 393 | $TKT_values['TKT_is_default'] = 0; |
394 | 394 | $update_prices = TRUE; |
@@ -400,21 +400,21 @@ discard block |
||
400 | 400 | // but DID have it's items modified. |
401 | 401 | // keep in mind that if the TKT has been sold (and we have changed pricing information), |
402 | 402 | // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
403 | - if ( absint( $TKT_values['TKT_ID'] ) ) { |
|
404 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
405 | - if ( $TKT instanceof EE_Ticket ) { |
|
403 | + if (absint($TKT_values['TKT_ID'])) { |
|
404 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
405 | + if ($TKT instanceof EE_Ticket) { |
|
406 | 406 | |
407 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
407 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
408 | 408 | // are there any registrations using this ticket ? |
409 | 409 | $tickets_sold = $TKT->count_related( |
410 | 410 | 'Registration', |
411 | - array( array( |
|
412 | - 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) |
|
413 | - ) ) |
|
411 | + array(array( |
|
412 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
413 | + )) |
|
414 | 414 | ); |
415 | 415 | //set ticket formats |
416 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
417 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
416 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
417 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
418 | 418 | |
419 | 419 | // let's just check the total price for the existing ticket |
420 | 420 | // and determine if it matches the new total price. |
@@ -424,17 +424,17 @@ discard block |
||
424 | 424 | ? TRUE : FALSE; |
425 | 425 | |
426 | 426 | //set new values |
427 | - foreach ( $TKT_values as $field => $value ) { |
|
428 | - if ( $field === 'TKT_qty' ) { |
|
429 | - $TKT->set_qty( $value ); |
|
427 | + foreach ($TKT_values as $field => $value) { |
|
428 | + if ($field === 'TKT_qty') { |
|
429 | + $TKT->set_qty($value); |
|
430 | 430 | } else { |
431 | - $TKT->set( $field, $value ); |
|
431 | + $TKT->set($field, $value); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | 435 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
436 | - if ( $create_new_TKT ) { |
|
437 | - $new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id ); |
|
436 | + if ($create_new_TKT) { |
|
437 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | $TKT = EE_Ticket::new_instance( |
444 | 444 | $TKT_values, |
445 | 445 | $timezone, |
446 | - array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ] ) |
|
446 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
447 | 447 | ); |
448 | - if ( $TKT instanceof EE_Ticket ) { |
|
448 | + if ($TKT instanceof EE_Ticket) { |
|
449 | 449 | // make sure ticket has an ID of setting relations won't work |
450 | 450 | $TKT->save(); |
451 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
451 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
452 | 452 | $update_prices = TRUE; |
453 | 453 | } |
454 | 454 | } |
@@ -456,37 +456,37 @@ discard block |
||
456 | 456 | //$TKT->save(); |
457 | 457 | |
458 | 458 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
459 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
460 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
459 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
460 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
461 | 461 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
462 | 462 | } |
463 | 463 | |
464 | 464 | //let's make sure the base price is handled |
465 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
465 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
466 | 466 | |
467 | 467 | //add/update price_modifiers |
468 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
468 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
469 | 469 | |
470 | 470 | //need to make sue that the TKT_price is accurate after saving the prices. |
471 | 471 | $TKT->ensure_TKT_Price_correct(); |
472 | 472 | |
473 | 473 | //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
474 | - if ( ! defined('DOING_AUTOSAVE' ) ) { |
|
475 | - if ( !empty($tkt['TKT_is_default_selector'] ) ) { |
|
474 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
475 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
476 | 476 | $update_prices = TRUE; |
477 | 477 | $new_default = clone $TKT; |
478 | - $new_default->set( 'TKT_ID', 0 ); |
|
479 | - $new_default->set( 'TKT_is_default', 1 ); |
|
480 | - $new_default->set( 'TKT_row', 1 ); |
|
481 | - $new_default->set( 'TKT_price', $ticket_price ); |
|
478 | + $new_default->set('TKT_ID', 0); |
|
479 | + $new_default->set('TKT_is_default', 1); |
|
480 | + $new_default->set('TKT_row', 1); |
|
481 | + $new_default->set('TKT_price', $ticket_price); |
|
482 | 482 | //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
483 | 483 | $new_default->_remove_relations('Datetime'); |
484 | 484 | //todo we need to add the current attached prices as new prices to the new default ticket. |
485 | - $new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices ); |
|
485 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
486 | 486 | //don't forget the base price! |
487 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
487 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
488 | 488 | $new_default->save(); |
489 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data ); |
|
489 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -497,19 +497,19 @@ discard block |
||
497 | 497 | //let's assign any tickets that have been setup to the saved_tickets tracker |
498 | 498 | //save existing TKT |
499 | 499 | $TKT->save(); |
500 | - if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) { |
|
500 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
501 | 501 | //save new TKT |
502 | 502 | $new_tkt->save(); |
503 | 503 | //add new ticket to array |
504 | - $saved_tickets[ $new_tkt->ID() ] = $new_tkt; |
|
504 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
505 | 505 | |
506 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
506 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
507 | 507 | |
508 | 508 | } else { |
509 | 509 | //add tkt to saved tkts |
510 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
510 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
511 | 511 | |
512 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
512 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | } |
@@ -519,22 +519,22 @@ discard block |
||
519 | 519 | // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
520 | 520 | // Or a draft event was saved and in the process of editing a ticket is trashed. |
521 | 521 | // No sense in keeping all the related data in the db! |
522 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
523 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
522 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
523 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
524 | 524 | |
525 | - foreach ( $tickets_removed as $id ) { |
|
526 | - $id = absint( $id ); |
|
525 | + foreach ($tickets_removed as $id) { |
|
526 | + $id = absint($id); |
|
527 | 527 | |
528 | 528 | //get the ticket for this id |
529 | 529 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
530 | 530 | |
531 | 531 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
532 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
532 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
533 | 533 | continue; |
534 | 534 | |
535 | 535 | // if this tkt has any registrations attached so then we just ARCHIVE |
536 | 536 | // because we don't actually permanently delete these tickets. |
537 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
537 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
538 | 538 | $tkt_to_remove->delete(); |
539 | 539 | continue; |
540 | 540 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | // (remember this process can ONLY kick off if there are NO tkts_sold) |
544 | 544 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
545 | 545 | |
546 | - foreach( $dtts as $dtt ) { |
|
546 | + foreach ($dtts as $dtt) { |
|
547 | 547 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
548 | 548 | } |
549 | 549 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
552 | 552 | $tkt_to_remove->delete_related_permanently('Price'); |
553 | 553 | |
554 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
554 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
555 | 555 | |
556 | 556 | // finally let's delete this ticket |
557 | 557 | // (which should not be blocked at this point b/c we've removed all our relationships) |
@@ -583,39 +583,39 @@ discard block |
||
583 | 583 | // and removing the ticket from datetimes it got removed from. |
584 | 584 | |
585 | 585 | // first let's add datetimes |
586 | - if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) { |
|
587 | - foreach ( $added_datetimes as $row_id ) { |
|
586 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
587 | + foreach ($added_datetimes as $row_id) { |
|
588 | 588 | $row_id = (int) $row_id; |
589 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
590 | - $ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
589 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
590 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
591 | 591 | // Is this an existing ticket (has an ID) and does it have any sold? |
592 | 592 | // If so, then we need to add that to the DTT sold because this DTT is getting added. |
593 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
594 | - $saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() ); |
|
595 | - $saved_datetimes[ $row_id ]->save(); |
|
593 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
594 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
595 | + $saved_datetimes[$row_id]->save(); |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
599 | 599 | } |
600 | 600 | // then remove datetimes |
601 | - if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) { |
|
602 | - foreach ( $removed_datetimes as $row_id ) { |
|
603 | - $row_id = (int)$row_id; |
|
601 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
602 | + foreach ($removed_datetimes as $row_id) { |
|
603 | + $row_id = (int) $row_id; |
|
604 | 604 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
605 | 605 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
606 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
607 | - $ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
606 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
607 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
608 | 608 | // Is this an existing ticket (has an ID) and does it have any sold? |
609 | 609 | // If so, then we need to remove it's sold from the DTT_sold. |
610 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
611 | - $saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() ); |
|
612 | - $saved_datetimes[ $row_id ]->save(); |
|
610 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
611 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
612 | + $saved_datetimes[$row_id]->save(); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
617 | 617 | // cap ticket qty by datetime reg limits |
618 | - $ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) ); |
|
618 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
619 | 619 | return $ticket; |
620 | 620 | } |
621 | 621 | |
@@ -636,39 +636,39 @@ discard block |
||
636 | 636 | EE_Ticket $ticket, |
637 | 637 | $price_rows = array(), |
638 | 638 | $ticket_price = 0, |
639 | - $base_price = 0 , |
|
639 | + $base_price = 0, |
|
640 | 640 | $base_price_id = 0 |
641 | 641 | ) { |
642 | 642 | |
643 | 643 | // create new ticket that's a copy of the existing |
644 | 644 | // except a new id of course (and not archived) |
645 | 645 | // AND has the new TKT_price associated with it. |
646 | - $new_ticket = clone( $ticket ); |
|
647 | - $new_ticket->set( 'TKT_ID', 0 ); |
|
648 | - $new_ticket->set( 'TKT_deleted', 0 ); |
|
649 | - $new_ticket->set( 'TKT_price', $ticket_price ); |
|
650 | - $new_ticket->set( 'TKT_sold', 0 ); |
|
646 | + $new_ticket = clone($ticket); |
|
647 | + $new_ticket->set('TKT_ID', 0); |
|
648 | + $new_ticket->set('TKT_deleted', 0); |
|
649 | + $new_ticket->set('TKT_price', $ticket_price); |
|
650 | + $new_ticket->set('TKT_sold', 0); |
|
651 | 651 | // let's get a new ID for this ticket |
652 | 652 | $new_ticket->save(); |
653 | 653 | // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
654 | - $datetimes_on_existing = $ticket->get_many_related( 'Datetime' ); |
|
654 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
655 | 655 | $new_ticket = $this->_update_ticket_datetimes( |
656 | 656 | $new_ticket, |
657 | 657 | $datetimes_on_existing, |
658 | - array_keys( $datetimes_on_existing ) |
|
658 | + array_keys($datetimes_on_existing) |
|
659 | 659 | ); |
660 | 660 | |
661 | 661 | // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
662 | 662 | // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
663 | 663 | // available. |
664 | - if ( $ticket->sold() > 0 ) { |
|
664 | + if ($ticket->sold() > 0) { |
|
665 | 665 | $new_qty = $ticket->qty() - $ticket->sold(); |
666 | - $new_ticket->set_qty( $new_qty ); |
|
666 | + $new_ticket->set_qty($new_qty); |
|
667 | 667 | } |
668 | 668 | //now we update the prices just for this ticket |
669 | - $new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true ); |
|
669 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
670 | 670 | //and we update the base price |
671 | - $new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id ); |
|
671 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
672 | 672 | return $new_ticket; |
673 | 673 | } |
674 | 674 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
689 | 689 | * @return EE_Ticket |
690 | 690 | */ |
691 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
691 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
692 | 692 | |
693 | 693 | //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
694 | 694 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | $updated_prices = array(); |
697 | 697 | |
698 | 698 | // if $base_price ! FALSE then updating a base price. |
699 | - if ( $base_price !== FALSE ) { |
|
699 | + if ($base_price !== FALSE) { |
|
700 | 700 | $prices[1] = array( |
701 | 701 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
702 | 702 | 'PRT_ID' => 1, |
@@ -707,47 +707,47 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | //possibly need to save tkt |
710 | - if ( ! $ticket->ID() ) |
|
710 | + if ( ! $ticket->ID()) |
|
711 | 711 | $ticket->save(); |
712 | 712 | |
713 | - foreach ( $prices as $row => $prc ) { |
|
714 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
715 | - if ( empty($prt_id) ) |
|
713 | + foreach ($prices as $row => $prc) { |
|
714 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
715 | + if (empty($prt_id)) |
|
716 | 716 | continue; //prices MUST have a price type id. |
717 | 717 | $PRC_values = array( |
718 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
718 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
719 | 719 | 'PRT_ID' => $prt_id, |
720 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
721 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
722 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
720 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
721 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
722 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
723 | 723 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
724 | 724 | 'PRC_order' => $row |
725 | 725 | ); |
726 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
726 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
727 | 727 | $PRC_values['PRC_ID'] = 0; |
728 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
728 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
729 | 729 | } else { |
730 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
730 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
731 | 731 | //update this price with new values |
732 | - foreach ( $PRC_values as $field => $newprc ) { |
|
733 | - $PRC->set( $field, $newprc ); |
|
732 | + foreach ($PRC_values as $field => $newprc) { |
|
733 | + $PRC->set($field, $newprc); |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | $PRC->save(); |
737 | 737 | $prcid = $PRC->ID(); |
738 | 738 | $updated_prices[$prcid] = $PRC; |
739 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
739 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | //now let's remove any prices that got removed from the ticket |
743 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
743 | + if ( ! empty ($current_prices_on_ticket)) { |
|
744 | 744 | $current = array_keys($current_prices_on_ticket); |
745 | 745 | $updated = array_keys($updated_prices); |
746 | 746 | $prices_to_remove = array_diff($current, $updated); |
747 | - if ( !empty( $prices_to_remove ) ) { |
|
748 | - foreach ( $prices_to_remove as $prc_id ) { |
|
747 | + if ( ! empty($prices_to_remove)) { |
|
748 | + foreach ($prices_to_remove as $prc_id) { |
|
749 | 749 | $p = $current_prices_on_ticket[$prc_id]; |
750 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
750 | + $ticket->_remove_relation_to($p, 'Price'); |
|
751 | 751 | |
752 | 752 | //delete permanently the price |
753 | 753 | $p->delete_permanently(); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | |
761 | 761 | |
762 | 762 | |
763 | - public function autosave_handling( $event_admin_obj ) { |
|
763 | + public function autosave_handling($event_admin_obj) { |
|
764 | 764 | return $event_admin_obj; //doing nothing for the moment. |
765 | 765 | //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
766 | 766 | |
@@ -794,12 +794,12 @@ discard block |
||
794 | 794 | |
795 | 795 | //default main template args |
796 | 796 | $main_template_args = array( |
797 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
797 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
798 | 798 | 'existing_datetime_ids' => '', |
799 | 799 | 'total_dtt_rows' => 1, |
800 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
800 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
801 | 801 | 'datetime_rows' => '', |
802 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
802 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
803 | 803 | 'ticket_rows' => '', |
804 | 804 | 'existing_ticket_ids' => '', |
805 | 805 | 'total_ticket_rows' => 1, |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | |
810 | 810 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
811 | 811 | |
812 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
812 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
813 | 813 | |
814 | 814 | /** |
815 | 815 | * 1. Start with retrieving Datetimes |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | * 3. For each ticket get related prices |
818 | 818 | */ |
819 | 819 | |
820 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
821 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
820 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
821 | + $times = $DTM->get_all_event_dates($evtID); |
|
822 | 822 | |
823 | 823 | |
824 | 824 | |
@@ -826,31 +826,31 @@ discard block |
||
826 | 826 | |
827 | 827 | /** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */ |
828 | 828 | $dttrow = 1; |
829 | - foreach ( $times as $time ) { |
|
829 | + foreach ($times as $time) { |
|
830 | 830 | $dttid = $time->get('DTT_ID'); |
831 | - $time->set( 'DTT_order', $dttrow ); |
|
831 | + $time->set('DTT_order', $dttrow); |
|
832 | 832 | $existing_datetime_ids[] = $dttid; |
833 | 833 | |
834 | 834 | //tickets attached |
835 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array(); |
|
835 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array(); |
|
836 | 836 | |
837 | 837 | //if there are no related tickets this is likely a new event OR autodraft |
838 | 838 | // event so we need to generate the default tickets because dtts |
839 | 839 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
840 | 840 | // datetime on the event. |
841 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
841 | + if (empty ($related_tickets) && count($times) < 2) { |
|
842 | 842 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
843 | 843 | |
844 | 844 | //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save). |
845 | 845 | $default_prices = EEM_Price::instance()->get_all_default_prices(); |
846 | 846 | |
847 | - $main_default_ticket = reset( $related_tickets ); |
|
848 | - if ( $main_default_ticket instanceof EE_Ticket ) { |
|
849 | - foreach ( $default_prices as $default_price ) { |
|
850 | - if ( $default_price->is_base_price() ) { |
|
847 | + $main_default_ticket = reset($related_tickets); |
|
848 | + if ($main_default_ticket instanceof EE_Ticket) { |
|
849 | + foreach ($default_prices as $default_price) { |
|
850 | + if ($default_price->is_base_price()) { |
|
851 | 851 | continue; |
852 | 852 | } |
853 | - $main_default_ticket->cache( 'Price', $default_price ); |
|
853 | + $main_default_ticket->cache('Price', $default_price); |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | } |
@@ -859,11 +859,11 @@ discard block |
||
859 | 859 | //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information. |
860 | 860 | |
861 | 861 | //loop through and setup the ticket rows and make sure the order is set. |
862 | - foreach ( $related_tickets as $ticket ) { |
|
862 | + foreach ($related_tickets as $ticket) { |
|
863 | 863 | $tktid = $ticket->get('TKT_ID'); |
864 | 864 | $tktrow = $ticket->get('TKT_row'); |
865 | 865 | //we only want unique tickets in our final display!! |
866 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
866 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
867 | 867 | $existing_ticket_ids[] = $tktid; |
868 | 868 | $all_tickets[] = $ticket; |
869 | 869 | } |
@@ -872,57 +872,57 @@ discard block |
||
872 | 872 | $datetime_tickets[$dttid][] = $tktrow; |
873 | 873 | |
874 | 874 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
875 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
875 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
876 | 876 | $ticket_datetimes[$tktid][] = $dttrow; |
877 | 877 | } |
878 | 878 | $dttrow++; |
879 | 879 | } |
880 | 880 | |
881 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
882 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
883 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
881 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
882 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
883 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
884 | 884 | |
885 | 885 | //sort $all_tickets by order |
886 | - usort( $all_tickets, function( $a, $b ) { |
|
886 | + usort($all_tickets, function($a, $b) { |
|
887 | 887 | $a_order = (int) $a->get('TKT_order'); |
888 | 888 | $b_order = (int) $b->get('TKT_order'); |
889 | - if ( $a_order == $b_order ) { |
|
889 | + if ($a_order == $b_order) { |
|
890 | 890 | return 0; |
891 | 891 | } |
892 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
892 | + return ($a_order < $b_order) ? -1 : 1; |
|
893 | 893 | }); |
894 | 894 | |
895 | 895 | //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
896 | 896 | $dttrow = 1; |
897 | - foreach ( $times as $time ) { |
|
898 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
897 | + foreach ($times as $time) { |
|
898 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
899 | 899 | $dttrow++; |
900 | 900 | } |
901 | 901 | |
902 | 902 | //then loop through all tickets for the ticket rows. |
903 | 903 | $tktrow = 1; |
904 | - foreach ( $all_tickets as $ticket ) { |
|
905 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
904 | + foreach ($all_tickets as $ticket) { |
|
905 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
906 | 906 | $tktrow++; |
907 | 907 | } |
908 | 908 | |
909 | 909 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
910 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
911 | - EEH_Template::display_template( $template, $main_template_args ); |
|
910 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
911 | + EEH_Template::display_template($template, $main_template_args); |
|
912 | 912 | return; |
913 | 913 | } |
914 | 914 | |
915 | 915 | |
916 | 916 | |
917 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
917 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
918 | 918 | |
919 | 919 | $dtt_display_template_args = array( |
920 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
921 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
920 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
921 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
922 | 922 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
923 | 923 | ); |
924 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
924 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return string Generated edit row. |
942 | 942 | */ |
943 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
943 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
944 | 944 | |
945 | 945 | // if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true. |
946 | 946 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -948,36 +948,36 @@ discard block |
||
948 | 948 | $template_args = array( |
949 | 949 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
950 | 950 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
951 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
951 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
952 | 952 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
953 | 953 | 'DTT_name' => $default ? '' : $dtt->name(), |
954 | 954 | 'DTT_description' => $default ? '' : $dtt->description(), |
955 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
956 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
957 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
955 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
956 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
957 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
958 | 958 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
959 | 959 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
960 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
960 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable', |
|
962 | 962 | 'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event |
963 | 963 | ? '' |
964 | 964 | : EE_Admin_Page::add_query_args_and_nonce( |
965 | - array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ), |
|
965 | + array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()), |
|
966 | 966 | REG_ADMIN_URL |
967 | 967 | ) |
968 | 968 | ); |
969 | 969 | |
970 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
970 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
971 | 971 | |
972 | 972 | //allow filtering of template args at this point. |
973 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event ); |
|
973 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
974 | 974 | |
975 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
976 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
975 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
976 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | |
980 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
980 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
981 | 981 | |
982 | 982 | $template_args = array( |
983 | 983 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -985,47 +985,47 @@ discard block |
||
985 | 985 | 'DTT_description' => $default ? '' : $dtt->description(), |
986 | 986 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
987 | 987 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
988 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
988 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
989 | 989 | 'DTT_ID' => $default ? '' : $dtt->ID() |
990 | 990 | ); |
991 | 991 | |
992 | 992 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
993 | - if ( !$default ) { |
|
993 | + if ( ! $default) { |
|
994 | 994 | $tktrow = 1; |
995 | - foreach ( $all_tickets as $ticket ) { |
|
996 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
995 | + foreach ($all_tickets as $ticket) { |
|
996 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
997 | 997 | $tktrow++; |
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | //filter template args at this point |
1002 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event ); |
|
1002 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
1003 | 1003 | |
1004 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1005 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1004 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
1005 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
1009 | 1009 | |
1010 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
1011 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
1012 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1010 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
1011 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
1012 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1013 | 1013 | |
1014 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
1014 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
1015 | 1015 | $template_args = array( |
1016 | 1016 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
1017 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
1017 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1018 | 1018 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
1019 | 1019 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
1020 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1021 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1020 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1021 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
1022 | 1022 | ); |
1023 | 1023 | |
1024 | 1024 | //filter template args |
1025 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event ); |
|
1025 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
1026 | 1026 | |
1027 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1028 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1027 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1028 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1047,37 +1047,37 @@ discard block |
||
1047 | 1047 | * |
1048 | 1048 | * @return [type] [description] |
1049 | 1049 | */ |
1050 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
1050 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
1051 | 1051 | |
1052 | 1052 | //if $ticket is not an instance of EE_Ticket then force default to true. |
1053 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1053 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1054 | 1054 | |
1055 | - $prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
1055 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1056 | 1056 | |
1057 | 1057 | //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on |
1058 | 1058 | //the object. This is done by not including any query_params. |
1059 | - if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1 || empty( $prices ) ) ) { |
|
1060 | - $prices = $ticket->get_many_related( 'Price' ); |
|
1059 | + if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) { |
|
1060 | + $prices = $ticket->get_many_related('Price'); |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
1064 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
1064 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
1065 | 1065 | |
1066 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1066 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1067 | 1067 | |
1068 | 1068 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
1069 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
1069 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
1070 | 1070 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
1071 | 1071 | |
1072 | 1072 | //breaking out complicated condition for ticket_status |
1073 | - if ( $default ) { |
|
1074 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1073 | + if ($default) { |
|
1074 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1075 | 1075 | } else { |
1076 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1076 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //breaking out complicated condition for TKT_taxable |
1080 | - if ( $default ) { |
|
1080 | + if ($default) { |
|
1081 | 1081 | $TKT_taxable = ''; |
1082 | 1082 | } else { |
1083 | 1083 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -1092,19 +1092,19 @@ discard block |
||
1092 | 1092 | 'edit_tkt_expanded' => '', |
1093 | 1093 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1094 | 1094 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1095 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1096 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1097 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1095 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1096 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1097 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1098 | 1098 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
1099 | 1099 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1100 | 1100 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1101 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1102 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1103 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1104 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1105 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1101 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1102 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1103 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1104 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1105 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1106 | 1106 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1107 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1107 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1108 | 1108 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1109 | 1109 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1110 | 1110 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1113,99 +1113,99 @@ discard block |
||
1113 | 1113 | 'ticket_price_rows' => '', |
1114 | 1114 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1115 | 1115 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1116 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1117 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1116 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1117 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1118 | 1118 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1119 | 1119 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1120 | 1120 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1121 | 1121 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1122 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1122 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1123 | 1123 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1124 | 1124 | 'TKT_taxable' => $TKT_taxable, |
1125 | 1125 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1126 | 1126 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1127 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1127 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1128 | 1128 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1129 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1130 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1129 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1130 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1131 | 1131 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1132 | 1132 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1133 | 1133 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1134 | 1134 | ); |
1135 | 1135 | |
1136 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1136 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1137 | 1137 | |
1138 | 1138 | //handle rows that should NOT be empty |
1139 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1139 | + if (empty($template_args['TKT_start_date'])) { |
|
1140 | 1140 | //if empty then the start date will be now. |
1141 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1142 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1141 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1142 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1145 | + if (empty($template_args['TKT_end_date'])) { |
|
1146 | 1146 | |
1147 | 1147 | //get the earliest datetime (if present); |
1148 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1148 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1149 | 1149 | |
1150 | - if ( !empty( $earliest_dtt ) ) { |
|
1151 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1150 | + if ( ! empty($earliest_dtt)) { |
|
1151 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1152 | 1152 | } else { |
1153 | 1153 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1154 | - $template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") ) ); |
|
1154 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1155 | 1155 | } |
1156 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1156 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | //generate ticket_datetime items |
1160 | - if ( ! $default ) { |
|
1160 | + if ( ! $default) { |
|
1161 | 1161 | $dttrow = 1; |
1162 | - foreach ( $all_dtts as $dtt ) { |
|
1163 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1162 | + foreach ($all_dtts as $dtt) { |
|
1163 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1164 | 1164 | $dttrow++; |
1165 | 1165 | } |
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | $prcrow = 1; |
1169 | - foreach ( $prices as $price ) { |
|
1170 | - if ( $price->is_base_price() ) { |
|
1169 | + foreach ($prices as $price) { |
|
1170 | + if ($price->is_base_price()) { |
|
1171 | 1171 | $prcrow++; |
1172 | 1172 | continue; |
1173 | 1173 | } |
1174 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1175 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1176 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1174 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1175 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1176 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1177 | 1177 | $prcrow++; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | //filter $template_args |
1181 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event ); |
|
1181 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event); |
|
1182 | 1182 | |
1183 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1184 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1183 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1184 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | |
1188 | 1188 | |
1189 | 1189 | |
1190 | 1190 | |
1191 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1191 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1192 | 1192 | $tax_rows = ''; |
1193 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1193 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1194 | 1194 | $template_args = array(); |
1195 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1196 | - foreach ( $taxes as $tax ) { |
|
1197 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1195 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1196 | + foreach ($taxes as $tax) { |
|
1197 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1198 | 1198 | $template_args = array( |
1199 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1199 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1200 | 1200 | 'tax_id' => $tax->ID(), |
1201 | 1201 | 'tkt_row' => $tktrow, |
1202 | 1202 | 'tax_label' => $tax->get('PRC_name'), |
1203 | 1203 | 'tax_added' => $tax_added, |
1204 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1204 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1205 | 1205 | 'tax_amount' => $tax->get('PRC_amount') |
1206 | 1206 | ); |
1207 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1208 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1207 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1208 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | |
@@ -1213,81 +1213,81 @@ discard block |
||
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | |
1216 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1217 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1216 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1217 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1218 | 1218 | return $subtotal * $tax->get('PRC_amount') / 100; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | |
1222 | 1222 | |
1223 | 1223 | |
1224 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1225 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1224 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1225 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1226 | 1226 | $template_args = array( |
1227 | 1227 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1228 | 1228 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1229 | 1229 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1230 | - 'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ), |
|
1230 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1231 | 1231 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1232 | 1232 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1233 | 1233 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1234 | 1234 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1235 | 1235 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1236 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1237 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1238 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1239 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1240 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1236 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1237 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1238 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1239 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1240 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1241 | 1241 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1242 | 1242 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1243 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1244 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1243 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1244 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1245 | 1245 | ); |
1246 | 1246 | |
1247 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event ); |
|
1247 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event); |
|
1248 | 1248 | |
1249 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1250 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1249 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1250 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
1254 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1255 | - if ( $price->is_base_price() ) { |
|
1256 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1254 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1255 | + if ($price->is_base_price()) { |
|
1256 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1257 | 1257 | } else { |
1258 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1258 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | |
1264 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1264 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1265 | 1265 | $template_args = array( |
1266 | 1266 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1267 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1268 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1267 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1268 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1269 | 1269 | 'PRT_name' => __('Price', 'event_espresso'), |
1270 | 1270 | 'price_selected_operator' => '+', |
1271 | 1271 | 'price_selected_is_percent' => 0 |
1272 | 1272 | ); |
1273 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1273 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1274 | 1274 | |
1275 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event ); |
|
1275 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1276 | 1276 | |
1277 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1277 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | |
1281 | 1281 | |
1282 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1283 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1284 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1285 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1286 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1287 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1282 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1283 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1284 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1285 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1286 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1287 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1288 | 1288 | $price_option_spans = ''; |
1289 | 1289 | //setup pricetypes for selector |
1290 | - foreach ( $price_types as $price_type ) { |
|
1290 | + foreach ($price_types as $price_type) { |
|
1291 | 1291 | $all_price_types[] = array( |
1292 | 1292 | 'id' => $price_type->ID(), |
1293 | 1293 | 'text' => $price_type->get('PRT_name'), |
@@ -1299,50 +1299,50 @@ discard block |
||
1299 | 1299 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1300 | 1300 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1301 | 1301 | ); |
1302 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1302 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1305 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1306 | 1306 | $main_name = $select_name; |
1307 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1307 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1308 | 1308 | |
1309 | 1309 | $template_args = array( |
1310 | 1310 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1311 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1312 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1311 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1312 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1313 | 1313 | 'main_name' => $main_name, |
1314 | 1314 | 'selected_price_type_id' => $selected_price_type_id, |
1315 | 1315 | 'price_option_spans' => $price_option_spans, |
1316 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1317 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1316 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1317 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1318 | 1318 | 'disabled' => $disabled |
1319 | 1319 | ); |
1320 | 1320 | |
1321 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event ); |
|
1321 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1322 | 1322 | |
1323 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1323 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1324 | 1324 | |
1325 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1325 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | |
1329 | 1329 | |
1330 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1331 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1332 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1333 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1330 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1331 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1332 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1333 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1334 | 1334 | $template_args = array( |
1335 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1335 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1336 | 1336 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1337 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1338 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1339 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1337 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1338 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1339 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1340 | 1340 | 'tkt_status_class' => '', |
1341 | 1341 | ); |
1342 | 1342 | |
1343 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event ); |
|
1344 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1345 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1343 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1344 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1345 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | |
@@ -1350,53 +1350,53 @@ discard block |
||
1350 | 1350 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1351 | 1351 | $template_args = array( |
1352 | 1352 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1353 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1354 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1353 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1354 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1355 | 1355 | 'default_price_rows' => '', |
1356 | 1356 | 'default_base_price_amount' => 0, |
1357 | 1357 | 'default_base_price_name' => '', |
1358 | 1358 | 'default_base_price_description' => '', |
1359 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1360 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1359 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1360 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1361 | 1361 | 'existing_available_datetime_tickets_list' => '', |
1362 | 1362 | 'existing_available_ticket_datetimes_list' => '', |
1363 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1364 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1363 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1364 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1365 | 1365 | ); |
1366 | 1366 | |
1367 | 1367 | $tktrow = 1; |
1368 | - foreach ( $all_tickets as $ticket ) { |
|
1369 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1368 | + foreach ($all_tickets as $ticket) { |
|
1369 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1370 | 1370 | $tktrow++; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | |
1374 | 1374 | $dttrow = 1; |
1375 | - foreach ( $all_dtts as $dtt ) { |
|
1376 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1375 | + foreach ($all_dtts as $dtt) { |
|
1376 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1377 | 1377 | $dttrow++; |
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1381 | 1381 | $prcrow = 1; |
1382 | - foreach ( $default_prices as $price ) { |
|
1383 | - if ( $price->is_base_price() ) { |
|
1382 | + foreach ($default_prices as $price) { |
|
1383 | + if ($price->is_base_price()) { |
|
1384 | 1384 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1385 | 1385 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1386 | 1386 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1387 | 1387 | $prcrow++; |
1388 | 1388 | continue; |
1389 | 1389 | } |
1390 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1391 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1392 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1390 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1391 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1392 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1393 | 1393 | $prcrow++; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event ); |
|
1396 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1397 | 1397 | |
1398 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1399 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1398 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1399 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 |
@@ -8,34 +8,34 @@ |
||
8 | 8 | ?> |
9 | 9 | |
10 | 10 | <h4 id="reg-page-totals-hdr" class=""> |
11 | - <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?> |
|
11 | + <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?> |
|
12 | 12 | </h4> |
13 | 13 | |
14 | 14 | <div class="spco-payment-info-dv"> |
15 | 15 | <table id="spco-payment-info-table"> |
16 | 16 | <thead> |
17 | 17 | <tr> |
18 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
19 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th> |
|
20 | - <th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th> |
|
21 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th> |
|
22 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?> |
|
18 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
19 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th> |
|
20 | + <th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th> |
|
21 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th> |
|
22 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?> |
|
23 | 23 | </tr> |
24 | 24 | </thead> |
25 | 25 | <tbody> |
26 | - <?php echo $transaction_details;?> |
|
27 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?> |
|
26 | + <?php echo $transaction_details; ?> |
|
27 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?> |
|
28 | 28 | </tbody> |
29 | 29 | </table> |
30 | 30 | </div> |
31 | 31 | <div class="clear-float"> </div> |
32 | 32 | |
33 | - <?php echo $before_payment_options; ?> |
|
33 | + <?php echo $before_payment_options; ?> |
|
34 | 34 | |
35 | 35 | <div id="methods-of-payment"> |
36 | 36 | <?php echo $payment_options; ?> |
37 | 37 | </div> |
38 | 38 | <!-- end #methods-of-payment --> |
39 | 39 | |
40 | - <?php echo $after_payment_options; ?> |
|
40 | + <?php echo $after_payment_options; ?> |
|
41 | 41 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | */ |
43 | 43 | |
44 | -if ( function_exists( 'espresso_version' ) ) { |
|
44 | +if (function_exists('espresso_version')) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * espresso_duplicate_plugin_error |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function espresso_duplicate_plugin_error() { |
51 | 51 | ?> |
52 | 52 | <div class="error"> |
53 | - <p><?php _e( '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.', 'event_espresso' ); ?></p> |
|
53 | + <p><?php _e('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.', 'event_espresso'); ?></p> |
|
54 | 54 | </div> |
55 | 55 | <?php |
56 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
56 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
57 | 57 | } |
58 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
58 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
@@ -66,103 +66,103 @@ discard block |
||
66 | 66 | * @return string |
67 | 67 | */ |
68 | 68 | function espresso_version() { |
69 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.8.rc.011' ); |
|
69 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.8.rc.011'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // define versions |
73 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
74 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
75 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
76 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
77 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
78 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
73 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
74 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
75 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
76 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
77 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
78 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |