@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
37 | 37 | //$this->_response->set_notice( 1, 'hey look at this' ); |
38 | 38 | // check required WP version |
39 | - if (! $this->_minimum_wp_version_required()) { |
|
39 | + if ( ! $this->_minimum_wp_version_required()) { |
|
40 | 40 | $this->_request->un_set('activate', true); |
41 | 41 | add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
42 | 42 | //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | $this->_response->deactivate_plugin(); |
45 | 45 | } |
46 | 46 | // check recommended PHP version |
47 | - if (! $this->_minimum_php_version_recommended()) { |
|
47 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
48 | 48 | $this->_display_minimum_recommended_php_version_notice(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | //upcoming required version |
52 | - if (! $this->upcomingRequiredPhpVersion()) { |
|
52 | + if ( ! $this->upcomingRequiredPhpVersion()) { |
|
53 | 53 | $this->displayUpcomingRequiredVersion(); |
54 | 54 | } |
55 | 55 | $this->_response = $this->process_request_stack($this->_request, $this->_response); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | */ |
173 | 173 | private function _display_minimum_recommended_php_version_notice() |
174 | 174 | { |
175 | - if($this->_request->isAdmin()){ |
|
175 | + if ($this->_request->isAdmin()) { |
|
176 | 176 | new PersistentAdminNotice( |
177 | - 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
177 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
178 | 178 | sprintf( |
179 | 179 | __( |
180 | 180 | 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->_request) |
200 | 200 | && current_user_can('update_plugins') |
201 | 201 | ) { |
202 | - add_action('admin_notices', function () { |
|
202 | + add_action('admin_notices', function() { |
|
203 | 203 | echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
204 | 204 | . sprintf( |
205 | 205 | esc_html__( |
@@ -21,199 +21,199 @@ |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * converts a Request to a Response |
|
26 | - * |
|
27 | - * @param EE_Request $request |
|
28 | - * @param EE_Response $response |
|
29 | - * @return EE_Response |
|
30 | - * @throws InvalidDataTypeException |
|
31 | - */ |
|
32 | - public function handle_request(EE_Request $request, EE_Response $response) |
|
33 | - { |
|
34 | - $this->_request = $request; |
|
35 | - $this->_response = $response; |
|
36 | - //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
|
37 | - //$this->_response->set_notice( 1, 'hey look at this' ); |
|
38 | - // check required WP version |
|
39 | - if (! $this->_minimum_wp_version_required()) { |
|
40 | - $this->_request->un_set('activate', true); |
|
41 | - add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
42 | - //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
|
43 | - $this->_response->terminate_request(); |
|
44 | - $this->_response->deactivate_plugin(); |
|
45 | - } |
|
46 | - // check recommended PHP version |
|
47 | - if (! $this->_minimum_php_version_recommended()) { |
|
48 | - $this->_display_minimum_recommended_php_version_notice(); |
|
49 | - } |
|
50 | - |
|
51 | - //upcoming required version |
|
52 | - if (! $this->upcomingRequiredPhpVersion()) { |
|
53 | - $this->displayUpcomingRequiredVersion(); |
|
54 | - } |
|
55 | - $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
56 | - //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
|
57 | - return $this->_response; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Helper method to assess installed wp version against given values. |
|
63 | - * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
64 | - * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
65 | - * against) so consider that when sending in your values. |
|
66 | - * |
|
67 | - * @param string $version_to_check |
|
68 | - * @param string $operator |
|
69 | - * @return bool |
|
70 | - */ |
|
71 | - public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
72 | - { |
|
73 | - global $wp_version; |
|
74 | - return version_compare( |
|
75 | - // first account for wp_version being pre-release |
|
76 | - // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
77 | - strpos($wp_version, '-') > 0 |
|
78 | - ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
79 | - : $wp_version, |
|
80 | - $version_to_check, |
|
81 | - $operator |
|
82 | - ); |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * _minimum_wp_version_required |
|
89 | - * |
|
90 | - * @access private |
|
91 | - * @return boolean |
|
92 | - */ |
|
93 | - private function _minimum_wp_version_required() |
|
94 | - { |
|
95 | - return EE_Recommended_Versions::check_wp_version(); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * _check_php_version |
|
102 | - * |
|
103 | - * @access private |
|
104 | - * @param string $min_version |
|
105 | - * @return boolean |
|
106 | - */ |
|
107 | - private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
108 | - { |
|
109 | - return version_compare(PHP_VERSION, $min_version, '>='); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * _minimum_php_version_recommended |
|
116 | - * |
|
117 | - * @access private |
|
118 | - * @return boolean |
|
119 | - */ |
|
120 | - private function _minimum_php_version_recommended() |
|
121 | - { |
|
122 | - return $this->_check_php_version(); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Returns whether the provided php version number is greater than the current version of php installed on the server. |
|
128 | - * @param string $version_required |
|
129 | - * @return bool |
|
130 | - */ |
|
131 | - private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
132 | - { |
|
133 | - return $this->_check_php_version($version_required); |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * minimum_wp_version_error |
|
140 | - * |
|
141 | - * @return void |
|
142 | - */ |
|
143 | - public function minimum_wp_version_error() |
|
144 | - { |
|
145 | - global $wp_version; |
|
146 | - ?> |
|
24 | + /** |
|
25 | + * converts a Request to a Response |
|
26 | + * |
|
27 | + * @param EE_Request $request |
|
28 | + * @param EE_Response $response |
|
29 | + * @return EE_Response |
|
30 | + * @throws InvalidDataTypeException |
|
31 | + */ |
|
32 | + public function handle_request(EE_Request $request, EE_Response $response) |
|
33 | + { |
|
34 | + $this->_request = $request; |
|
35 | + $this->_response = $response; |
|
36 | + //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
|
37 | + //$this->_response->set_notice( 1, 'hey look at this' ); |
|
38 | + // check required WP version |
|
39 | + if (! $this->_minimum_wp_version_required()) { |
|
40 | + $this->_request->un_set('activate', true); |
|
41 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
42 | + //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
|
43 | + $this->_response->terminate_request(); |
|
44 | + $this->_response->deactivate_plugin(); |
|
45 | + } |
|
46 | + // check recommended PHP version |
|
47 | + if (! $this->_minimum_php_version_recommended()) { |
|
48 | + $this->_display_minimum_recommended_php_version_notice(); |
|
49 | + } |
|
50 | + |
|
51 | + //upcoming required version |
|
52 | + if (! $this->upcomingRequiredPhpVersion()) { |
|
53 | + $this->displayUpcomingRequiredVersion(); |
|
54 | + } |
|
55 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
56 | + //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
|
57 | + return $this->_response; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Helper method to assess installed wp version against given values. |
|
63 | + * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
64 | + * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
65 | + * against) so consider that when sending in your values. |
|
66 | + * |
|
67 | + * @param string $version_to_check |
|
68 | + * @param string $operator |
|
69 | + * @return bool |
|
70 | + */ |
|
71 | + public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
72 | + { |
|
73 | + global $wp_version; |
|
74 | + return version_compare( |
|
75 | + // first account for wp_version being pre-release |
|
76 | + // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
77 | + strpos($wp_version, '-') > 0 |
|
78 | + ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
79 | + : $wp_version, |
|
80 | + $version_to_check, |
|
81 | + $operator |
|
82 | + ); |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * _minimum_wp_version_required |
|
89 | + * |
|
90 | + * @access private |
|
91 | + * @return boolean |
|
92 | + */ |
|
93 | + private function _minimum_wp_version_required() |
|
94 | + { |
|
95 | + return EE_Recommended_Versions::check_wp_version(); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * _check_php_version |
|
102 | + * |
|
103 | + * @access private |
|
104 | + * @param string $min_version |
|
105 | + * @return boolean |
|
106 | + */ |
|
107 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
108 | + { |
|
109 | + return version_compare(PHP_VERSION, $min_version, '>='); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * _minimum_php_version_recommended |
|
116 | + * |
|
117 | + * @access private |
|
118 | + * @return boolean |
|
119 | + */ |
|
120 | + private function _minimum_php_version_recommended() |
|
121 | + { |
|
122 | + return $this->_check_php_version(); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Returns whether the provided php version number is greater than the current version of php installed on the server. |
|
128 | + * @param string $version_required |
|
129 | + * @return bool |
|
130 | + */ |
|
131 | + private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
132 | + { |
|
133 | + return $this->_check_php_version($version_required); |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * minimum_wp_version_error |
|
140 | + * |
|
141 | + * @return void |
|
142 | + */ |
|
143 | + public function minimum_wp_version_error() |
|
144 | + { |
|
145 | + global $wp_version; |
|
146 | + ?> |
|
147 | 147 | <div class="error"> |
148 | 148 | <p> |
149 | 149 | <?php |
150 | - printf( |
|
151 | - __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
152 | - 'event_espresso'), |
|
153 | - EE_MIN_WP_VER_REQUIRED, |
|
154 | - $wp_version, |
|
155 | - '<br/>', |
|
156 | - '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
157 | - ); |
|
158 | - ?> |
|
150 | + printf( |
|
151 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
152 | + 'event_espresso'), |
|
153 | + EE_MIN_WP_VER_REQUIRED, |
|
154 | + $wp_version, |
|
155 | + '<br/>', |
|
156 | + '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
157 | + ); |
|
158 | + ?> |
|
159 | 159 | </p> |
160 | 160 | </div> |
161 | 161 | <?php |
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * _display_minimum_recommended_php_version_notice |
|
168 | - * |
|
169 | - * @access private |
|
170 | - * @return void |
|
171 | - * @throws InvalidDataTypeException |
|
172 | - */ |
|
173 | - private function _display_minimum_recommended_php_version_notice() |
|
174 | - { |
|
175 | - if($this->_request->isAdmin()){ |
|
176 | - new PersistentAdminNotice( |
|
177 | - 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
178 | - sprintf( |
|
179 | - __( |
|
180 | - 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
181 | - 'event_espresso' |
|
182 | - ), |
|
183 | - EE_MIN_PHP_VER_RECOMMENDED, |
|
184 | - PHP_VERSION, |
|
185 | - '<br/>', |
|
186 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
187 | - ) |
|
188 | - ); |
|
189 | - } |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
195 | - */ |
|
196 | - private function displayUpcomingRequiredVersion() |
|
197 | - { |
|
198 | - if ($this->_request->isAdmin() |
|
199 | - && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->_request) |
|
200 | - && current_user_can('update_plugins') |
|
201 | - ) { |
|
202 | - add_action('admin_notices', function () { |
|
203 | - echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
204 | - . sprintf( |
|
205 | - esc_html__( |
|
206 | - 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
207 | - 'event_espresso' |
|
208 | - ), |
|
209 | - '<strong>', |
|
210 | - '</strong>', |
|
211 | - PHP_VERSION, |
|
212 | - '<a href="https://wordpress.org/support/upgrade-php/">', |
|
213 | - '</a>' |
|
214 | - ) |
|
215 | - . '</p></div>'; |
|
216 | - }); |
|
217 | - } |
|
218 | - } |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * _display_minimum_recommended_php_version_notice |
|
168 | + * |
|
169 | + * @access private |
|
170 | + * @return void |
|
171 | + * @throws InvalidDataTypeException |
|
172 | + */ |
|
173 | + private function _display_minimum_recommended_php_version_notice() |
|
174 | + { |
|
175 | + if($this->_request->isAdmin()){ |
|
176 | + new PersistentAdminNotice( |
|
177 | + 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
178 | + sprintf( |
|
179 | + __( |
|
180 | + 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
181 | + 'event_espresso' |
|
182 | + ), |
|
183 | + EE_MIN_PHP_VER_RECOMMENDED, |
|
184 | + PHP_VERSION, |
|
185 | + '<br/>', |
|
186 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
187 | + ) |
|
188 | + ); |
|
189 | + } |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
195 | + */ |
|
196 | + private function displayUpcomingRequiredVersion() |
|
197 | + { |
|
198 | + if ($this->_request->isAdmin() |
|
199 | + && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->_request) |
|
200 | + && current_user_can('update_plugins') |
|
201 | + ) { |
|
202 | + add_action('admin_notices', function () { |
|
203 | + echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
204 | + . sprintf( |
|
205 | + esc_html__( |
|
206 | + 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
207 | + 'event_espresso' |
|
208 | + ), |
|
209 | + '<strong>', |
|
210 | + '</strong>', |
|
211 | + PHP_VERSION, |
|
212 | + '<a href="https://wordpress.org/support/upgrade-php/">', |
|
213 | + '</a>' |
|
214 | + ) |
|
215 | + . '</p></div>'; |
|
216 | + }); |
|
217 | + } |
|
218 | + } |
|
219 | 219 | } |
@@ -18,530 +18,530 @@ |
||
18 | 18 | class Events_Admin_List_Table extends EE_Admin_List_Table |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var EE_Datetime |
|
23 | - */ |
|
24 | - private $_dtt; |
|
25 | - |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Initial setup of data properties for the list table. |
|
30 | - */ |
|
31 | - protected function _setup_data() |
|
32 | - { |
|
33 | - $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
34 | - $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Set up of additional properties for the list table. |
|
41 | - */ |
|
42 | - protected function _set_properties() |
|
43 | - { |
|
44 | - $this->_wp_list_args = array( |
|
45 | - 'singular' => esc_html__('event', 'event_espresso'), |
|
46 | - 'plural' => esc_html__('events', 'event_espresso'), |
|
47 | - 'ajax' => true, //for now |
|
48 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
49 | - ); |
|
50 | - $this->_columns = array( |
|
51 | - 'cb' => '<input type="checkbox" />', |
|
52 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
53 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
54 | - 'author' => esc_html__('Author', 'event_espresso'), |
|
55 | - 'venue' => esc_html__('Venue', 'event_espresso'), |
|
56 | - 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
57 | - 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
58 | - 'attendees' => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">' |
|
59 | - . '<span class="screen-reader-text">' |
|
60 | - . esc_html__('Approved Registrations', 'event_espresso') |
|
61 | - . '</span>' |
|
62 | - . '</span>', |
|
63 | - //'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'), |
|
64 | - 'actions' => esc_html__('Actions', 'event_espresso'), |
|
65 | - ); |
|
66 | - $this->_sortable_columns = array( |
|
67 | - 'id' => array('EVT_ID' => true), |
|
68 | - 'name' => array('EVT_name' => false), |
|
69 | - 'author' => array('EVT_wp_user' => false), |
|
70 | - 'venue' => array('Venue.VNU_name' => false), |
|
71 | - 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
|
72 | - 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
|
73 | - ); |
|
74 | - $this->_primary_column = 'id'; |
|
75 | - $this->_hidden_columns = array('author'); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - protected function _get_table_filters() |
|
84 | - { |
|
85 | - return array(); //no filters with decaf |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * Setup of views properties. |
|
92 | - * |
|
93 | - * @throws InvalidDataTypeException |
|
94 | - * @throws InvalidInterfaceException |
|
95 | - * @throws InvalidArgumentException |
|
96 | - */ |
|
97 | - protected function _add_view_counts() |
|
98 | - { |
|
99 | - $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
100 | - $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
101 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
102 | - 'ee_delete_events', |
|
103 | - 'espresso_events_trash_events' |
|
104 | - )) { |
|
105 | - $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - |
|
111 | - /** |
|
112 | - * @param EE_Event $item |
|
113 | - * @return string |
|
114 | - * @throws EE_Error |
|
115 | - */ |
|
116 | - protected function _get_row_class($item) |
|
117 | - { |
|
118 | - $class = parent::_get_row_class($item); |
|
119 | - //add status class |
|
120 | - $class .= $item instanceof EE_Event |
|
121 | - ? ' ee-status-strip event-status-' . $item->get_active_status() |
|
122 | - : ''; |
|
123 | - if ($this->_has_checkbox_column) { |
|
124 | - $class .= ' has-checkbox-column'; |
|
125 | - } |
|
126 | - return $class; |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * @param EE_Event $item |
|
133 | - * @return string |
|
134 | - * @throws EE_Error |
|
135 | - */ |
|
136 | - public function column_status(EE_Event $item) |
|
137 | - { |
|
138 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' |
|
139 | - . $item->get_active_status() |
|
140 | - . '"></span>'; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - |
|
145 | - /** |
|
146 | - * @param EE_Event $item |
|
147 | - * @return string |
|
148 | - * @throws EE_Error |
|
149 | - */ |
|
150 | - public function column_cb($item) |
|
151 | - { |
|
152 | - if (! $item instanceof EE_Event) { |
|
153 | - return ''; |
|
154 | - } |
|
155 | - $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
|
156 | - //does event have any attached registrations? |
|
157 | - $regs = $item->count_related('Registration'); |
|
158 | - return $regs > 0 && $this->_view === 'trash' |
|
159 | - ? '<span class="ee-lock-icon"></span>' |
|
160 | - : sprintf( |
|
161 | - '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
162 | - $item->ID() |
|
163 | - ); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - |
|
168 | - /** |
|
169 | - * @param EE_Event $item |
|
170 | - * @return mixed|string |
|
171 | - * @throws EE_Error |
|
172 | - */ |
|
173 | - public function column_id(EE_Event $item) |
|
174 | - { |
|
175 | - $content = $item->ID(); |
|
176 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
177 | - return $content; |
|
178 | - } |
|
179 | - |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * @param EE_Event $item |
|
184 | - * @return string |
|
185 | - * @throws EE_Error |
|
186 | - * @throws InvalidArgumentException |
|
187 | - * @throws InvalidDataTypeException |
|
188 | - * @throws InvalidInterfaceException |
|
189 | - */ |
|
190 | - public function column_name(EE_Event $item) |
|
191 | - { |
|
192 | - $edit_query_args = array( |
|
193 | - 'action' => 'edit', |
|
194 | - 'post' => $item->ID(), |
|
195 | - ); |
|
196 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
197 | - $actions = $this->_column_name_action_setup($item); |
|
198 | - $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
|
199 | - $content = '<strong><a class="row-title" href="' |
|
200 | - . $edit_link . '">' |
|
201 | - . $item->name() |
|
202 | - . '</a></strong>' |
|
203 | - . $status; |
|
204 | - $content .= '<br><span class="ee-status-text-small">' |
|
205 | - . EEH_Template::pretty_status( |
|
206 | - $item->get_active_status(), |
|
207 | - false, |
|
208 | - 'sentence' |
|
209 | - ) |
|
210 | - . '</span>'; |
|
211 | - $content .= $this->row_actions($actions); |
|
212 | - return $content; |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * Just a method for setting up the actions for the name column |
|
219 | - * |
|
220 | - * @param EE_Event $item |
|
221 | - * @return array array of actions |
|
222 | - * @throws EE_Error |
|
223 | - * @throws InvalidArgumentException |
|
224 | - * @throws InvalidDataTypeException |
|
225 | - * @throws InvalidInterfaceException |
|
226 | - */ |
|
227 | - protected function _column_name_action_setup(EE_Event $item) |
|
228 | - { |
|
229 | - //todo: remove when attendees is active |
|
230 | - if (! defined('REG_ADMIN_URL')) { |
|
231 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
232 | - } |
|
233 | - $actions = array(); |
|
234 | - $restore_event_link = ''; |
|
235 | - $delete_event_link = ''; |
|
236 | - $trash_event_link = ''; |
|
237 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
238 | - 'ee_edit_event', |
|
239 | - 'espresso_events_edit', |
|
240 | - $item->ID() |
|
241 | - )) { |
|
242 | - $edit_query_args = array( |
|
243 | - 'action' => 'edit', |
|
244 | - 'post' => $item->ID(), |
|
245 | - ); |
|
246 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
247 | - $actions['edit'] = '<a href="' . $edit_link . '"' |
|
248 | - . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
249 | - . esc_html__('Edit', 'event_espresso') |
|
250 | - . '</a>'; |
|
251 | - } |
|
252 | - if ( |
|
253 | - EE_Registry::instance()->CAP->current_user_can( |
|
254 | - 'ee_read_registrations', |
|
255 | - 'espresso_registrations_view_registration' |
|
256 | - ) |
|
257 | - && EE_Registry::instance()->CAP->current_user_can( |
|
258 | - 'ee_read_event', |
|
259 | - 'espresso_registrations_view_registration', |
|
260 | - $item->ID() |
|
261 | - ) |
|
262 | - ) { |
|
263 | - $attendees_query_args = array( |
|
264 | - 'action' => 'default', |
|
265 | - 'event_id' => $item->ID(), |
|
266 | - ); |
|
267 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
268 | - $actions['attendees'] = '<a href="' . $attendees_link . '"' |
|
269 | - . ' title="' . esc_attr__('View Registrations', 'event_espresso') . '">' |
|
270 | - . esc_html__('Registrations', 'event_espresso') |
|
271 | - . '</a>'; |
|
272 | - } |
|
273 | - if ( |
|
274 | - EE_Registry::instance()->CAP->current_user_can( |
|
275 | - 'ee_delete_event', |
|
276 | - 'espresso_events_trash_event', |
|
277 | - $item->ID() |
|
278 | - ) |
|
279 | - ) { |
|
280 | - $trash_event_query_args = array( |
|
281 | - 'action' => 'trash_event', |
|
282 | - 'EVT_ID' => $item->ID(), |
|
283 | - ); |
|
284 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
285 | - $trash_event_query_args, |
|
286 | - EVENTS_ADMIN_URL |
|
287 | - ); |
|
288 | - } |
|
289 | - if ( |
|
290 | - EE_Registry::instance()->CAP->current_user_can( |
|
291 | - 'ee_delete_event', |
|
292 | - 'espresso_events_restore_event', |
|
293 | - $item->ID() |
|
294 | - ) |
|
295 | - ) { |
|
296 | - $restore_event_query_args = array( |
|
297 | - 'action' => 'restore_event', |
|
298 | - 'EVT_ID' => $item->ID(), |
|
299 | - ); |
|
300 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
301 | - $restore_event_query_args, |
|
302 | - EVENTS_ADMIN_URL |
|
303 | - ); |
|
304 | - } |
|
305 | - if ( |
|
306 | - EE_Registry::instance()->CAP->current_user_can( |
|
307 | - 'ee_delete_event', |
|
308 | - 'espresso_events_delete_event', |
|
309 | - $item->ID() |
|
310 | - ) |
|
311 | - ) { |
|
312 | - $delete_event_query_args = array( |
|
313 | - 'action' => 'delete_event', |
|
314 | - 'EVT_ID' => $item->ID(), |
|
315 | - ); |
|
316 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
317 | - $delete_event_query_args, |
|
318 | - EVENTS_ADMIN_URL |
|
319 | - ); |
|
320 | - } |
|
321 | - $view_link = get_permalink($item->ID()); |
|
322 | - $actions['view'] = '<a href="' . $view_link . '"' |
|
323 | - . ' title="' . esc_attr__('View Event', 'event_espresso') . '">' |
|
324 | - . esc_html__('View', 'event_espresso') |
|
325 | - . '</a>'; |
|
326 | - if ($item->get('status') === 'trash') { |
|
327 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
328 | - 'ee_delete_event', |
|
329 | - 'espresso_events_restore_event', |
|
330 | - $item->ID() |
|
331 | - )) { |
|
332 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"' |
|
333 | - . ' title="' . esc_attr__('Restore from Trash', 'event_espresso') |
|
334 | - . '">' |
|
335 | - . esc_html__('Restore from Trash', 'event_espresso') |
|
336 | - . '</a>'; |
|
337 | - } |
|
338 | - if ( |
|
339 | - $item->count_related('Registration') === 0 |
|
340 | - && EE_Registry::instance()->CAP->current_user_can( |
|
341 | - 'ee_delete_event', |
|
342 | - 'espresso_events_delete_event', |
|
343 | - $item->ID() |
|
344 | - ) |
|
345 | - ) { |
|
346 | - $actions['delete'] = '<a href="' . $delete_event_link . '"' |
|
347 | - . ' title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' |
|
348 | - . esc_html__('Delete Permanently', 'event_espresso') |
|
349 | - . '</a>'; |
|
350 | - } |
|
351 | - } else { |
|
352 | - if ( |
|
353 | - EE_Registry::instance()->CAP->current_user_can( |
|
354 | - 'ee_delete_event', |
|
355 | - 'espresso_events_trash_event', |
|
356 | - $item->ID() |
|
357 | - ) |
|
358 | - ) { |
|
359 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '"' |
|
360 | - . ' title="' . esc_attr__('Trash Event', 'event_espresso') . '">' |
|
361 | - . esc_html__('Trash', 'event_espresso') |
|
362 | - . '</a>'; |
|
363 | - } |
|
364 | - } |
|
365 | - return $actions; |
|
366 | - } |
|
367 | - |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * @param EE_Event $item |
|
372 | - * @return string |
|
373 | - * @throws EE_Error |
|
374 | - */ |
|
375 | - public function column_author(EE_Event $item) |
|
376 | - { |
|
377 | - //user author info |
|
378 | - $event_author = get_userdata($item->wp_user()); |
|
379 | - $gravatar = get_avatar($item->wp_user(), '15'); |
|
380 | - //filter link |
|
381 | - $query_args = array( |
|
382 | - 'action' => 'default', |
|
383 | - 'EVT_wp_user' => $item->wp_user(), |
|
384 | - ); |
|
385 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
386 | - return $gravatar . ' <a href="' . $filter_url . '"' |
|
387 | - . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
388 | - . $event_author->display_name |
|
389 | - . '</a>'; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - |
|
394 | - /** |
|
395 | - * @param EE_Event $item |
|
396 | - * @return string |
|
397 | - * @throws EE_Error |
|
398 | - */ |
|
399 | - public function column_venue(EE_Event $item) |
|
400 | - { |
|
401 | - $venue = $item->get_first_related('Venue'); |
|
402 | - return ! empty($venue) |
|
403 | - ? $venue->name() |
|
404 | - : ''; |
|
405 | - } |
|
406 | - |
|
407 | - |
|
408 | - /** |
|
409 | - * @param EE_Event $item |
|
410 | - * @return string |
|
411 | - * @throws EE_Error |
|
412 | - */ |
|
413 | - public function column_start_date_time(EE_Event $item) |
|
414 | - { |
|
415 | - return $this->_dtt instanceof EE_Datetime |
|
416 | - ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
417 | - : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
418 | - } |
|
419 | - |
|
420 | - |
|
421 | - /** |
|
422 | - * @param EE_Event $item |
|
423 | - * @return string |
|
424 | - * @throws EE_Error |
|
425 | - */ |
|
426 | - public function column_reg_begins(EE_Event $item) |
|
427 | - { |
|
428 | - $reg_start = $item->get_ticket_with_earliest_start_time(); |
|
429 | - return $reg_start instanceof EE_Ticket |
|
430 | - ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
431 | - : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
432 | - } |
|
433 | - |
|
434 | - |
|
435 | - |
|
436 | - /** |
|
437 | - * @param EE_Event $item |
|
438 | - * @return int|string |
|
439 | - * @throws EE_Error |
|
440 | - * @throws InvalidArgumentException |
|
441 | - * @throws InvalidDataTypeException |
|
442 | - * @throws InvalidInterfaceException |
|
443 | - */ |
|
444 | - public function column_attendees(EE_Event $item) |
|
445 | - { |
|
446 | - $attendees_query_args = array( |
|
447 | - 'action' => 'default', |
|
448 | - 'event_id' => $item->ID(), |
|
449 | - ); |
|
450 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
451 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
452 | - return EE_Registry::instance()->CAP->current_user_can( |
|
453 | - 'ee_read_event', |
|
454 | - 'espresso_registrations_view_registration', |
|
455 | - $item->ID() |
|
456 | - ) |
|
457 | - && EE_Registry::instance()->CAP->current_user_can( |
|
458 | - 'ee_read_registrations', |
|
459 | - 'espresso_registrations_view_registration' |
|
460 | - ) |
|
461 | - ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
462 | - : $registered_attendees; |
|
463 | - } |
|
464 | - |
|
465 | - |
|
466 | - |
|
467 | - /** |
|
468 | - * @param EE_Event $item |
|
469 | - * @return float |
|
470 | - * @throws EE_Error |
|
471 | - * @throws InvalidArgumentException |
|
472 | - * @throws InvalidDataTypeException |
|
473 | - * @throws InvalidInterfaceException |
|
474 | - */ |
|
475 | - public function column_tkts_sold(EE_Event $item) |
|
476 | - { |
|
477 | - return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
478 | - } |
|
479 | - |
|
480 | - |
|
481 | - |
|
482 | - /** |
|
483 | - * @param EE_Event $item |
|
484 | - * @return string |
|
485 | - * @throws EE_Error |
|
486 | - * @throws InvalidArgumentException |
|
487 | - * @throws InvalidDataTypeException |
|
488 | - * @throws InvalidInterfaceException |
|
489 | - */ |
|
490 | - public function column_actions(EE_Event $item) |
|
491 | - { |
|
492 | - //todo: remove when attendees is active |
|
493 | - if (! defined('REG_ADMIN_URL')) { |
|
494 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
495 | - } |
|
496 | - $action_links = array(); |
|
497 | - $view_link = get_permalink($item->ID()); |
|
498 | - $action_links[] = '<a href="' . $view_link . '"' |
|
499 | - . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
500 | - $action_links[] = '<div class="dashicons dashicons-search"></div></a>'; |
|
501 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
502 | - 'ee_edit_event', |
|
503 | - 'espresso_events_edit', |
|
504 | - $item->ID() |
|
505 | - )) { |
|
506 | - $edit_query_args = array( |
|
507 | - 'action' => 'edit', |
|
508 | - 'post' => $item->ID(), |
|
509 | - ); |
|
510 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
511 | - $action_links[] = '<a href="' . $edit_link . '"' |
|
512 | - . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
513 | - . '<div class="ee-icon ee-icon-calendar-edit"></div>' |
|
514 | - . '</a>'; |
|
515 | - } |
|
516 | - if ( |
|
517 | - EE_Registry::instance()->CAP->current_user_can( |
|
518 | - 'ee_read_registrations', |
|
519 | - 'espresso_registrations_view_registration' |
|
520 | - ) && EE_Registry::instance()->CAP->current_user_can( |
|
521 | - 'ee_read_event', |
|
522 | - 'espresso_registrations_view_registration', |
|
523 | - $item->ID() |
|
524 | - ) |
|
525 | - ) { |
|
526 | - $attendees_query_args = array( |
|
527 | - 'action' => 'default', |
|
528 | - 'event_id' => $item->ID(), |
|
529 | - ); |
|
530 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
531 | - $action_links[] = '<a href="' . $attendees_link . '"' |
|
532 | - . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
533 | - . '<div class="dashicons dashicons-groups"></div>' |
|
534 | - . '</a>'; |
|
535 | - } |
|
536 | - $action_links = apply_filters( |
|
537 | - 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
538 | - $action_links, |
|
539 | - $item |
|
540 | - ); |
|
541 | - return $this->_action_string( |
|
542 | - implode("\n\t", $action_links), |
|
543 | - $item, |
|
544 | - 'div' |
|
545 | - ); |
|
546 | - } |
|
21 | + /** |
|
22 | + * @var EE_Datetime |
|
23 | + */ |
|
24 | + private $_dtt; |
|
25 | + |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Initial setup of data properties for the list table. |
|
30 | + */ |
|
31 | + protected function _setup_data() |
|
32 | + { |
|
33 | + $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
|
34 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, true); |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Set up of additional properties for the list table. |
|
41 | + */ |
|
42 | + protected function _set_properties() |
|
43 | + { |
|
44 | + $this->_wp_list_args = array( |
|
45 | + 'singular' => esc_html__('event', 'event_espresso'), |
|
46 | + 'plural' => esc_html__('events', 'event_espresso'), |
|
47 | + 'ajax' => true, //for now |
|
48 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
49 | + ); |
|
50 | + $this->_columns = array( |
|
51 | + 'cb' => '<input type="checkbox" />', |
|
52 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
53 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
54 | + 'author' => esc_html__('Author', 'event_espresso'), |
|
55 | + 'venue' => esc_html__('Venue', 'event_espresso'), |
|
56 | + 'start_date_time' => esc_html__('Event Start', 'event_espresso'), |
|
57 | + 'reg_begins' => esc_html__('On Sale', 'event_espresso'), |
|
58 | + 'attendees' => '<span class="dashicons dashicons-groups ee-icon-color-ee-green ee-icon-size-20">' |
|
59 | + . '<span class="screen-reader-text">' |
|
60 | + . esc_html__('Approved Registrations', 'event_espresso') |
|
61 | + . '</span>' |
|
62 | + . '</span>', |
|
63 | + //'tkts_sold' => esc_html__('Tickets Sold', 'event_espresso'), |
|
64 | + 'actions' => esc_html__('Actions', 'event_espresso'), |
|
65 | + ); |
|
66 | + $this->_sortable_columns = array( |
|
67 | + 'id' => array('EVT_ID' => true), |
|
68 | + 'name' => array('EVT_name' => false), |
|
69 | + 'author' => array('EVT_wp_user' => false), |
|
70 | + 'venue' => array('Venue.VNU_name' => false), |
|
71 | + 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
|
72 | + 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
|
73 | + ); |
|
74 | + $this->_primary_column = 'id'; |
|
75 | + $this->_hidden_columns = array('author'); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + protected function _get_table_filters() |
|
84 | + { |
|
85 | + return array(); //no filters with decaf |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * Setup of views properties. |
|
92 | + * |
|
93 | + * @throws InvalidDataTypeException |
|
94 | + * @throws InvalidInterfaceException |
|
95 | + * @throws InvalidArgumentException |
|
96 | + */ |
|
97 | + protected function _add_view_counts() |
|
98 | + { |
|
99 | + $this->_views['all']['count'] = $this->_admin_page->total_events(); |
|
100 | + $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
102 | + 'ee_delete_events', |
|
103 | + 'espresso_events_trash_events' |
|
104 | + )) { |
|
105 | + $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + |
|
111 | + /** |
|
112 | + * @param EE_Event $item |
|
113 | + * @return string |
|
114 | + * @throws EE_Error |
|
115 | + */ |
|
116 | + protected function _get_row_class($item) |
|
117 | + { |
|
118 | + $class = parent::_get_row_class($item); |
|
119 | + //add status class |
|
120 | + $class .= $item instanceof EE_Event |
|
121 | + ? ' ee-status-strip event-status-' . $item->get_active_status() |
|
122 | + : ''; |
|
123 | + if ($this->_has_checkbox_column) { |
|
124 | + $class .= ' has-checkbox-column'; |
|
125 | + } |
|
126 | + return $class; |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * @param EE_Event $item |
|
133 | + * @return string |
|
134 | + * @throws EE_Error |
|
135 | + */ |
|
136 | + public function column_status(EE_Event $item) |
|
137 | + { |
|
138 | + return '<span class="ee-status-strip ee-status-strip-td event-status-' |
|
139 | + . $item->get_active_status() |
|
140 | + . '"></span>'; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + |
|
145 | + /** |
|
146 | + * @param EE_Event $item |
|
147 | + * @return string |
|
148 | + * @throws EE_Error |
|
149 | + */ |
|
150 | + public function column_cb($item) |
|
151 | + { |
|
152 | + if (! $item instanceof EE_Event) { |
|
153 | + return ''; |
|
154 | + } |
|
155 | + $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
|
156 | + //does event have any attached registrations? |
|
157 | + $regs = $item->count_related('Registration'); |
|
158 | + return $regs > 0 && $this->_view === 'trash' |
|
159 | + ? '<span class="ee-lock-icon"></span>' |
|
160 | + : sprintf( |
|
161 | + '<input type="checkbox" name="EVT_IDs[]" value="%s" />', |
|
162 | + $item->ID() |
|
163 | + ); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + |
|
168 | + /** |
|
169 | + * @param EE_Event $item |
|
170 | + * @return mixed|string |
|
171 | + * @throws EE_Error |
|
172 | + */ |
|
173 | + public function column_id(EE_Event $item) |
|
174 | + { |
|
175 | + $content = $item->ID(); |
|
176 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
177 | + return $content; |
|
178 | + } |
|
179 | + |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * @param EE_Event $item |
|
184 | + * @return string |
|
185 | + * @throws EE_Error |
|
186 | + * @throws InvalidArgumentException |
|
187 | + * @throws InvalidDataTypeException |
|
188 | + * @throws InvalidInterfaceException |
|
189 | + */ |
|
190 | + public function column_name(EE_Event $item) |
|
191 | + { |
|
192 | + $edit_query_args = array( |
|
193 | + 'action' => 'edit', |
|
194 | + 'post' => $item->ID(), |
|
195 | + ); |
|
196 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
197 | + $actions = $this->_column_name_action_setup($item); |
|
198 | + $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
|
199 | + $content = '<strong><a class="row-title" href="' |
|
200 | + . $edit_link . '">' |
|
201 | + . $item->name() |
|
202 | + . '</a></strong>' |
|
203 | + . $status; |
|
204 | + $content .= '<br><span class="ee-status-text-small">' |
|
205 | + . EEH_Template::pretty_status( |
|
206 | + $item->get_active_status(), |
|
207 | + false, |
|
208 | + 'sentence' |
|
209 | + ) |
|
210 | + . '</span>'; |
|
211 | + $content .= $this->row_actions($actions); |
|
212 | + return $content; |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * Just a method for setting up the actions for the name column |
|
219 | + * |
|
220 | + * @param EE_Event $item |
|
221 | + * @return array array of actions |
|
222 | + * @throws EE_Error |
|
223 | + * @throws InvalidArgumentException |
|
224 | + * @throws InvalidDataTypeException |
|
225 | + * @throws InvalidInterfaceException |
|
226 | + */ |
|
227 | + protected function _column_name_action_setup(EE_Event $item) |
|
228 | + { |
|
229 | + //todo: remove when attendees is active |
|
230 | + if (! defined('REG_ADMIN_URL')) { |
|
231 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
232 | + } |
|
233 | + $actions = array(); |
|
234 | + $restore_event_link = ''; |
|
235 | + $delete_event_link = ''; |
|
236 | + $trash_event_link = ''; |
|
237 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
238 | + 'ee_edit_event', |
|
239 | + 'espresso_events_edit', |
|
240 | + $item->ID() |
|
241 | + )) { |
|
242 | + $edit_query_args = array( |
|
243 | + 'action' => 'edit', |
|
244 | + 'post' => $item->ID(), |
|
245 | + ); |
|
246 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
247 | + $actions['edit'] = '<a href="' . $edit_link . '"' |
|
248 | + . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
249 | + . esc_html__('Edit', 'event_espresso') |
|
250 | + . '</a>'; |
|
251 | + } |
|
252 | + if ( |
|
253 | + EE_Registry::instance()->CAP->current_user_can( |
|
254 | + 'ee_read_registrations', |
|
255 | + 'espresso_registrations_view_registration' |
|
256 | + ) |
|
257 | + && EE_Registry::instance()->CAP->current_user_can( |
|
258 | + 'ee_read_event', |
|
259 | + 'espresso_registrations_view_registration', |
|
260 | + $item->ID() |
|
261 | + ) |
|
262 | + ) { |
|
263 | + $attendees_query_args = array( |
|
264 | + 'action' => 'default', |
|
265 | + 'event_id' => $item->ID(), |
|
266 | + ); |
|
267 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
268 | + $actions['attendees'] = '<a href="' . $attendees_link . '"' |
|
269 | + . ' title="' . esc_attr__('View Registrations', 'event_espresso') . '">' |
|
270 | + . esc_html__('Registrations', 'event_espresso') |
|
271 | + . '</a>'; |
|
272 | + } |
|
273 | + if ( |
|
274 | + EE_Registry::instance()->CAP->current_user_can( |
|
275 | + 'ee_delete_event', |
|
276 | + 'espresso_events_trash_event', |
|
277 | + $item->ID() |
|
278 | + ) |
|
279 | + ) { |
|
280 | + $trash_event_query_args = array( |
|
281 | + 'action' => 'trash_event', |
|
282 | + 'EVT_ID' => $item->ID(), |
|
283 | + ); |
|
284 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
285 | + $trash_event_query_args, |
|
286 | + EVENTS_ADMIN_URL |
|
287 | + ); |
|
288 | + } |
|
289 | + if ( |
|
290 | + EE_Registry::instance()->CAP->current_user_can( |
|
291 | + 'ee_delete_event', |
|
292 | + 'espresso_events_restore_event', |
|
293 | + $item->ID() |
|
294 | + ) |
|
295 | + ) { |
|
296 | + $restore_event_query_args = array( |
|
297 | + 'action' => 'restore_event', |
|
298 | + 'EVT_ID' => $item->ID(), |
|
299 | + ); |
|
300 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
301 | + $restore_event_query_args, |
|
302 | + EVENTS_ADMIN_URL |
|
303 | + ); |
|
304 | + } |
|
305 | + if ( |
|
306 | + EE_Registry::instance()->CAP->current_user_can( |
|
307 | + 'ee_delete_event', |
|
308 | + 'espresso_events_delete_event', |
|
309 | + $item->ID() |
|
310 | + ) |
|
311 | + ) { |
|
312 | + $delete_event_query_args = array( |
|
313 | + 'action' => 'delete_event', |
|
314 | + 'EVT_ID' => $item->ID(), |
|
315 | + ); |
|
316 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( |
|
317 | + $delete_event_query_args, |
|
318 | + EVENTS_ADMIN_URL |
|
319 | + ); |
|
320 | + } |
|
321 | + $view_link = get_permalink($item->ID()); |
|
322 | + $actions['view'] = '<a href="' . $view_link . '"' |
|
323 | + . ' title="' . esc_attr__('View Event', 'event_espresso') . '">' |
|
324 | + . esc_html__('View', 'event_espresso') |
|
325 | + . '</a>'; |
|
326 | + if ($item->get('status') === 'trash') { |
|
327 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
328 | + 'ee_delete_event', |
|
329 | + 'espresso_events_restore_event', |
|
330 | + $item->ID() |
|
331 | + )) { |
|
332 | + $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '"' |
|
333 | + . ' title="' . esc_attr__('Restore from Trash', 'event_espresso') |
|
334 | + . '">' |
|
335 | + . esc_html__('Restore from Trash', 'event_espresso') |
|
336 | + . '</a>'; |
|
337 | + } |
|
338 | + if ( |
|
339 | + $item->count_related('Registration') === 0 |
|
340 | + && EE_Registry::instance()->CAP->current_user_can( |
|
341 | + 'ee_delete_event', |
|
342 | + 'espresso_events_delete_event', |
|
343 | + $item->ID() |
|
344 | + ) |
|
345 | + ) { |
|
346 | + $actions['delete'] = '<a href="' . $delete_event_link . '"' |
|
347 | + . ' title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' |
|
348 | + . esc_html__('Delete Permanently', 'event_espresso') |
|
349 | + . '</a>'; |
|
350 | + } |
|
351 | + } else { |
|
352 | + if ( |
|
353 | + EE_Registry::instance()->CAP->current_user_can( |
|
354 | + 'ee_delete_event', |
|
355 | + 'espresso_events_trash_event', |
|
356 | + $item->ID() |
|
357 | + ) |
|
358 | + ) { |
|
359 | + $actions['move to trash'] = '<a href="' . $trash_event_link . '"' |
|
360 | + . ' title="' . esc_attr__('Trash Event', 'event_espresso') . '">' |
|
361 | + . esc_html__('Trash', 'event_espresso') |
|
362 | + . '</a>'; |
|
363 | + } |
|
364 | + } |
|
365 | + return $actions; |
|
366 | + } |
|
367 | + |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * @param EE_Event $item |
|
372 | + * @return string |
|
373 | + * @throws EE_Error |
|
374 | + */ |
|
375 | + public function column_author(EE_Event $item) |
|
376 | + { |
|
377 | + //user author info |
|
378 | + $event_author = get_userdata($item->wp_user()); |
|
379 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
380 | + //filter link |
|
381 | + $query_args = array( |
|
382 | + 'action' => 'default', |
|
383 | + 'EVT_wp_user' => $item->wp_user(), |
|
384 | + ); |
|
385 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
386 | + return $gravatar . ' <a href="' . $filter_url . '"' |
|
387 | + . ' title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' |
|
388 | + . $event_author->display_name |
|
389 | + . '</a>'; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + |
|
394 | + /** |
|
395 | + * @param EE_Event $item |
|
396 | + * @return string |
|
397 | + * @throws EE_Error |
|
398 | + */ |
|
399 | + public function column_venue(EE_Event $item) |
|
400 | + { |
|
401 | + $venue = $item->get_first_related('Venue'); |
|
402 | + return ! empty($venue) |
|
403 | + ? $venue->name() |
|
404 | + : ''; |
|
405 | + } |
|
406 | + |
|
407 | + |
|
408 | + /** |
|
409 | + * @param EE_Event $item |
|
410 | + * @return string |
|
411 | + * @throws EE_Error |
|
412 | + */ |
|
413 | + public function column_start_date_time(EE_Event $item) |
|
414 | + { |
|
415 | + return $this->_dtt instanceof EE_Datetime |
|
416 | + ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') |
|
417 | + : esc_html__('No Date was saved for this Event', 'event_espresso'); |
|
418 | + } |
|
419 | + |
|
420 | + |
|
421 | + /** |
|
422 | + * @param EE_Event $item |
|
423 | + * @return string |
|
424 | + * @throws EE_Error |
|
425 | + */ |
|
426 | + public function column_reg_begins(EE_Event $item) |
|
427 | + { |
|
428 | + $reg_start = $item->get_ticket_with_earliest_start_time(); |
|
429 | + return $reg_start instanceof EE_Ticket |
|
430 | + ? $reg_start->get_i18n_datetime('TKT_start_date') |
|
431 | + : esc_html__('No Tickets have been setup for this Event', 'event_espresso'); |
|
432 | + } |
|
433 | + |
|
434 | + |
|
435 | + |
|
436 | + /** |
|
437 | + * @param EE_Event $item |
|
438 | + * @return int|string |
|
439 | + * @throws EE_Error |
|
440 | + * @throws InvalidArgumentException |
|
441 | + * @throws InvalidDataTypeException |
|
442 | + * @throws InvalidInterfaceException |
|
443 | + */ |
|
444 | + public function column_attendees(EE_Event $item) |
|
445 | + { |
|
446 | + $attendees_query_args = array( |
|
447 | + 'action' => 'default', |
|
448 | + 'event_id' => $item->ID(), |
|
449 | + ); |
|
450 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
451 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
452 | + return EE_Registry::instance()->CAP->current_user_can( |
|
453 | + 'ee_read_event', |
|
454 | + 'espresso_registrations_view_registration', |
|
455 | + $item->ID() |
|
456 | + ) |
|
457 | + && EE_Registry::instance()->CAP->current_user_can( |
|
458 | + 'ee_read_registrations', |
|
459 | + 'espresso_registrations_view_registration' |
|
460 | + ) |
|
461 | + ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' |
|
462 | + : $registered_attendees; |
|
463 | + } |
|
464 | + |
|
465 | + |
|
466 | + |
|
467 | + /** |
|
468 | + * @param EE_Event $item |
|
469 | + * @return float |
|
470 | + * @throws EE_Error |
|
471 | + * @throws InvalidArgumentException |
|
472 | + * @throws InvalidDataTypeException |
|
473 | + * @throws InvalidInterfaceException |
|
474 | + */ |
|
475 | + public function column_tkts_sold(EE_Event $item) |
|
476 | + { |
|
477 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
478 | + } |
|
479 | + |
|
480 | + |
|
481 | + |
|
482 | + /** |
|
483 | + * @param EE_Event $item |
|
484 | + * @return string |
|
485 | + * @throws EE_Error |
|
486 | + * @throws InvalidArgumentException |
|
487 | + * @throws InvalidDataTypeException |
|
488 | + * @throws InvalidInterfaceException |
|
489 | + */ |
|
490 | + public function column_actions(EE_Event $item) |
|
491 | + { |
|
492 | + //todo: remove when attendees is active |
|
493 | + if (! defined('REG_ADMIN_URL')) { |
|
494 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
495 | + } |
|
496 | + $action_links = array(); |
|
497 | + $view_link = get_permalink($item->ID()); |
|
498 | + $action_links[] = '<a href="' . $view_link . '"' |
|
499 | + . ' title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
500 | + $action_links[] = '<div class="dashicons dashicons-search"></div></a>'; |
|
501 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
502 | + 'ee_edit_event', |
|
503 | + 'espresso_events_edit', |
|
504 | + $item->ID() |
|
505 | + )) { |
|
506 | + $edit_query_args = array( |
|
507 | + 'action' => 'edit', |
|
508 | + 'post' => $item->ID(), |
|
509 | + ); |
|
510 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
511 | + $action_links[] = '<a href="' . $edit_link . '"' |
|
512 | + . ' title="' . esc_attr__('Edit Event', 'event_espresso') . '">' |
|
513 | + . '<div class="ee-icon ee-icon-calendar-edit"></div>' |
|
514 | + . '</a>'; |
|
515 | + } |
|
516 | + if ( |
|
517 | + EE_Registry::instance()->CAP->current_user_can( |
|
518 | + 'ee_read_registrations', |
|
519 | + 'espresso_registrations_view_registration' |
|
520 | + ) && EE_Registry::instance()->CAP->current_user_can( |
|
521 | + 'ee_read_event', |
|
522 | + 'espresso_registrations_view_registration', |
|
523 | + $item->ID() |
|
524 | + ) |
|
525 | + ) { |
|
526 | + $attendees_query_args = array( |
|
527 | + 'action' => 'default', |
|
528 | + 'event_id' => $item->ID(), |
|
529 | + ); |
|
530 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
531 | + $action_links[] = '<a href="' . $attendees_link . '"' |
|
532 | + . ' title="' . esc_attr__('View Registrants', 'event_espresso') . '">' |
|
533 | + . '<div class="dashicons dashicons-groups"></div>' |
|
534 | + . '</a>'; |
|
535 | + } |
|
536 | + $action_links = apply_filters( |
|
537 | + 'FHEE__Events_Admin_List_Table__column_actions__action_links', |
|
538 | + $action_links, |
|
539 | + $item |
|
540 | + ); |
|
541 | + return $this->_action_string( |
|
542 | + implode("\n\t", $action_links), |
|
543 | + $item, |
|
544 | + 'div' |
|
545 | + ); |
|
546 | + } |
|
547 | 547 | } |
@@ -8,643 +8,643 @@ |
||
8 | 8 | class EE_Email_messenger extends EE_messenger |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * To field for email |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $_to = ''; |
|
16 | - |
|
17 | - |
|
18 | - /** |
|
19 | - * CC field for email. |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $_cc = ''; |
|
23 | - |
|
24 | - /** |
|
25 | - * From field for email |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $_from = ''; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * Subject field for email |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_subject = ''; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * Content field for email |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $_content = ''; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * constructor |
|
47 | - * |
|
48 | - * @access public |
|
49 | - */ |
|
50 | - public function __construct() |
|
51 | - { |
|
52 | - //set name and description properties |
|
53 | - $this->name = 'email'; |
|
54 | - $this->description = sprintf( |
|
55 | - esc_html__( |
|
56 | - 'This messenger delivers messages via email using the built-in %s function included with WordPress', |
|
57 | - 'event_espresso' |
|
58 | - ), |
|
59 | - '<code>wp_mail</code>' |
|
60 | - ); |
|
61 | - $this->label = array( |
|
62 | - 'singular' => esc_html__('email', 'event_espresso'), |
|
63 | - 'plural' => esc_html__('emails', 'event_espresso'), |
|
64 | - ); |
|
65 | - $this->activate_on_install = true; |
|
66 | - |
|
67 | - //we're using defaults so let's call parent constructor that will take care of setting up all the other |
|
68 | - // properties |
|
69 | - parent::__construct(); |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * see abstract declaration in parent class for details. |
|
75 | - */ |
|
76 | - protected function _set_admin_pages() |
|
77 | - { |
|
78 | - $this->admin_registered_pages = array( |
|
79 | - 'events_edit' => true, |
|
80 | - ); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * see abstract declaration in parent class for details |
|
86 | - */ |
|
87 | - protected function _set_valid_shortcodes() |
|
88 | - { |
|
89 | - //remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the |
|
90 | - // message type. |
|
91 | - $this->_valid_shortcodes = array( |
|
92 | - 'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
93 | - 'cc' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
94 | - 'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
95 | - ); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * see abstract declaration in parent class for details |
|
101 | - * |
|
102 | - * @access protected |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - protected function _set_validator_config() |
|
106 | - { |
|
107 | - $valid_shortcodes = $this->get_valid_shortcodes(); |
|
108 | - |
|
109 | - $this->_validator_config = array( |
|
110 | - 'to' => array( |
|
111 | - 'shortcodes' => $valid_shortcodes['to'], |
|
112 | - 'type' => 'email', |
|
113 | - ), |
|
114 | - 'cc' => array( |
|
115 | - 'shortcodes' => $valid_shortcodes['to'], |
|
116 | - 'type' => 'email', |
|
117 | - ), |
|
118 | - 'from' => array( |
|
119 | - 'shortcodes' => $valid_shortcodes['from'], |
|
120 | - 'type' => 'email', |
|
121 | - ), |
|
122 | - 'subject' => array( |
|
123 | - 'shortcodes' => array( |
|
124 | - 'organization', |
|
125 | - 'primary_registration_details', |
|
126 | - 'event_author', |
|
127 | - 'primary_registration_details', |
|
128 | - 'recipient_details', |
|
129 | - ), |
|
130 | - ), |
|
131 | - 'content' => array( |
|
132 | - 'shortcodes' => array( |
|
133 | - 'event_list', |
|
134 | - 'attendee_list', |
|
135 | - 'ticket_list', |
|
136 | - 'organization', |
|
137 | - 'primary_registration_details', |
|
138 | - 'primary_registration_list', |
|
139 | - 'event_author', |
|
140 | - 'recipient_details', |
|
141 | - 'recipient_list', |
|
142 | - 'transaction', |
|
143 | - 'messenger', |
|
144 | - ), |
|
145 | - ), |
|
146 | - 'attendee_list' => array( |
|
147 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
148 | - 'required' => array('[ATTENDEE_LIST]'), |
|
149 | - ), |
|
150 | - 'event_list' => array( |
|
151 | - 'shortcodes' => array( |
|
152 | - 'event', |
|
153 | - 'attendee_list', |
|
154 | - 'ticket_list', |
|
155 | - 'venue', |
|
156 | - 'datetime_list', |
|
157 | - 'attendee', |
|
158 | - 'primary_registration_details', |
|
159 | - 'primary_registration_list', |
|
160 | - 'event_author', |
|
161 | - 'recipient_details', |
|
162 | - 'recipient_list', |
|
163 | - ), |
|
164 | - 'required' => array('[EVENT_LIST]'), |
|
165 | - ), |
|
166 | - 'ticket_list' => array( |
|
167 | - 'shortcodes' => array( |
|
168 | - 'event_list', |
|
169 | - 'attendee_list', |
|
170 | - 'ticket', |
|
171 | - 'datetime_list', |
|
172 | - 'primary_registration_details', |
|
173 | - 'recipient_details', |
|
174 | - ), |
|
175 | - 'required' => array('[TICKET_LIST]'), |
|
176 | - ), |
|
177 | - 'datetime_list' => array( |
|
178 | - 'shortcodes' => array('datetime'), |
|
179 | - 'required' => array('[DATETIME_LIST]'), |
|
180 | - ), |
|
181 | - ); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * @see parent EE_messenger class for docs |
|
187 | - * @since 4.5.0 |
|
188 | - */ |
|
189 | - public function do_secondary_messenger_hooks($sending_messenger_name) |
|
190 | - { |
|
191 | - if ($sending_messenger_name = 'html') { |
|
192 | - add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
193 | - } |
|
194 | - } |
|
195 | - |
|
196 | - |
|
197 | - public function add_email_css( |
|
198 | - $variation_path, |
|
199 | - $messenger, |
|
200 | - $message_type, |
|
201 | - $type, |
|
202 | - $variation, |
|
203 | - $file_extension, |
|
204 | - $url, |
|
205 | - EE_Messages_Template_Pack $template_pack |
|
206 | - ) { |
|
207 | - //prevent recursion on this callback. |
|
208 | - remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10); |
|
209 | - $variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, false); |
|
210 | - |
|
211 | - add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
212 | - return $variation; |
|
213 | - } |
|
214 | - |
|
215 | - |
|
216 | - /** |
|
217 | - * See parent for details |
|
218 | - * |
|
219 | - * @access protected |
|
220 | - * @return void |
|
221 | - */ |
|
222 | - protected function _set_test_settings_fields() |
|
223 | - { |
|
224 | - $this->_test_settings_fields = array( |
|
225 | - 'to' => array( |
|
226 | - 'input' => 'text', |
|
227 | - 'label' => esc_html__('Send a test email to', 'event_espresso'), |
|
228 | - 'type' => 'email', |
|
229 | - 'required' => true, |
|
230 | - 'validation' => true, |
|
231 | - 'css_class' => 'large-text', |
|
232 | - 'format' => '%s', |
|
233 | - 'default' => get_bloginfo('admin_email'), |
|
234 | - ), |
|
235 | - 'subject' => array( |
|
236 | - 'input' => 'hidden', |
|
237 | - 'label' => '', |
|
238 | - 'type' => 'string', |
|
239 | - 'required' => false, |
|
240 | - 'validation' => false, |
|
241 | - 'format' => '%s', |
|
242 | - 'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')), |
|
243 | - 'default' => '', |
|
244 | - 'css_class' => '', |
|
245 | - ), |
|
246 | - ); |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - /** |
|
251 | - * _set_template_fields |
|
252 | - * This sets up the fields that a messenger requires for the message to go out. |
|
253 | - * |
|
254 | - * @access protected |
|
255 | - * @return void |
|
256 | - */ |
|
257 | - protected function _set_template_fields() |
|
258 | - { |
|
259 | - // any extra template fields that are NOT used by the messenger but will get used by a messenger field for |
|
260 | - // shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field |
|
261 | - // they relate to. This is important for the Messages_admin to know what fields to display to the user. |
|
262 | - // Also, notice that the "values" are equal to the field type that messages admin will use to know what |
|
263 | - // kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array |
|
264 | - // indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be |
|
265 | - // displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and |
|
266 | - // will not be displayed/parsed. |
|
267 | - $this->_template_fields = array( |
|
268 | - 'to' => array( |
|
269 | - 'input' => 'text', |
|
270 | - 'label' => esc_html_x( |
|
271 | - 'To', |
|
272 | - 'Label for the "To" field for email addresses', |
|
273 | - 'event_espresso' |
|
274 | - ), |
|
275 | - 'type' => 'string', |
|
276 | - 'required' => true, |
|
277 | - 'validation' => true, |
|
278 | - 'css_class' => 'large-text', |
|
279 | - 'format' => '%s', |
|
280 | - ), |
|
281 | - 'cc' => array( |
|
282 | - 'input' => 'text', |
|
283 | - 'label' => esc_html_x( |
|
284 | - 'CC', |
|
285 | - 'Label for the "Carbon Copy" field used for additional email addresses', |
|
286 | - 'event_espresso' |
|
287 | - ), |
|
288 | - 'type' => 'string', |
|
289 | - 'required' => false, |
|
290 | - 'validation' => true, |
|
291 | - 'css_class' => 'large-text', |
|
292 | - 'format' => '%s', |
|
293 | - ), |
|
294 | - 'from' => array( |
|
295 | - 'input' => 'text', |
|
296 | - 'label' => esc_html_x( |
|
297 | - 'From', |
|
298 | - 'Label for the "From" field for email addresses.', |
|
299 | - 'event_espresso' |
|
300 | - ), |
|
301 | - 'type' => 'string', |
|
302 | - 'required' => true, |
|
303 | - 'validation' => true, |
|
304 | - 'css_class' => 'large-text', |
|
305 | - 'format' => '%s', |
|
306 | - ), |
|
307 | - 'subject' => array( |
|
308 | - 'input' => 'text', |
|
309 | - 'label' => esc_html_x( |
|
310 | - 'Subject', |
|
311 | - 'Label for the "Subject" field (short description of contents) for emails.', |
|
312 | - 'event_espresso' |
|
313 | - ), |
|
314 | - 'type' => 'string', |
|
315 | - 'required' => true, |
|
316 | - 'validation' => true, |
|
317 | - 'css_class' => 'large-text', |
|
318 | - 'format' => '%s', |
|
319 | - ), |
|
320 | - 'content' => '', |
|
321 | - //left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
322 | - 'extra' => array( |
|
323 | - 'content' => array( |
|
324 | - 'main' => array( |
|
325 | - 'input' => 'wp_editor', |
|
326 | - 'label' => esc_html__('Main Content', 'event_espresso'), |
|
327 | - 'type' => 'string', |
|
328 | - 'required' => true, |
|
329 | - 'validation' => true, |
|
330 | - 'format' => '%s', |
|
331 | - 'rows' => '15', |
|
332 | - ), |
|
333 | - 'event_list' => array( |
|
334 | - 'input' => 'wp_editor', |
|
335 | - 'label' => '[EVENT_LIST]', |
|
336 | - 'type' => 'string', |
|
337 | - 'required' => true, |
|
338 | - 'validation' => true, |
|
339 | - 'format' => '%s', |
|
340 | - 'rows' => '15', |
|
341 | - 'shortcodes_required' => array('[EVENT_LIST]'), |
|
342 | - ), |
|
343 | - 'attendee_list' => array( |
|
344 | - 'input' => 'textarea', |
|
345 | - 'label' => '[ATTENDEE_LIST]', |
|
346 | - 'type' => 'string', |
|
347 | - 'required' => true, |
|
348 | - 'validation' => true, |
|
349 | - 'format' => '%s', |
|
350 | - 'css_class' => 'large-text', |
|
351 | - 'rows' => '5', |
|
352 | - 'shortcodes_required' => array('[ATTENDEE_LIST]'), |
|
353 | - ), |
|
354 | - 'ticket_list' => array( |
|
355 | - 'input' => 'textarea', |
|
356 | - 'label' => '[TICKET_LIST]', |
|
357 | - 'type' => 'string', |
|
358 | - 'required' => true, |
|
359 | - 'validation' => true, |
|
360 | - 'format' => '%s', |
|
361 | - 'css_class' => 'large-text', |
|
362 | - 'rows' => '10', |
|
363 | - 'shortcodes_required' => array('[TICKET_LIST]'), |
|
364 | - ), |
|
365 | - 'datetime_list' => array( |
|
366 | - 'input' => 'textarea', |
|
367 | - 'label' => '[DATETIME_LIST]', |
|
368 | - 'type' => 'string', |
|
369 | - 'required' => true, |
|
370 | - 'validation' => true, |
|
371 | - 'format' => '%s', |
|
372 | - 'css_class' => 'large-text', |
|
373 | - 'rows' => '10', |
|
374 | - 'shortcodes_required' => array('[DATETIME_LIST]'), |
|
375 | - ), |
|
376 | - ), |
|
377 | - ), |
|
378 | - ); |
|
379 | - } |
|
380 | - |
|
381 | - |
|
382 | - /** |
|
383 | - * See definition of this class in parent |
|
384 | - */ |
|
385 | - protected function _set_default_message_types() |
|
386 | - { |
|
387 | - $this->_default_message_types = array( |
|
388 | - 'payment', |
|
389 | - 'payment_refund', |
|
390 | - 'registration', |
|
391 | - 'not_approved_registration', |
|
392 | - 'pending_approval', |
|
393 | - ); |
|
394 | - } |
|
395 | - |
|
396 | - |
|
397 | - /** |
|
398 | - * @see definition of this class in parent |
|
399 | - * @since 4.5.0 |
|
400 | - */ |
|
401 | - protected function _set_valid_message_types() |
|
402 | - { |
|
403 | - $this->_valid_message_types = array( |
|
404 | - 'payment', |
|
405 | - 'registration', |
|
406 | - 'not_approved_registration', |
|
407 | - 'declined_registration', |
|
408 | - 'cancelled_registration', |
|
409 | - 'pending_approval', |
|
410 | - 'registration_summary', |
|
411 | - 'payment_reminder', |
|
412 | - 'payment_declined', |
|
413 | - 'payment_refund', |
|
414 | - ); |
|
415 | - } |
|
416 | - |
|
417 | - |
|
418 | - /** |
|
419 | - * setting up admin_settings_fields for messenger. |
|
420 | - */ |
|
421 | - protected function _set_admin_settings_fields() |
|
422 | - { |
|
423 | - } |
|
424 | - |
|
425 | - /** |
|
426 | - * We just deliver the messages don't kill us!! |
|
427 | - * |
|
428 | - * @return bool|WP_Error true if message delivered, false if it didn't deliver OR bubble up any error object if |
|
429 | - * present. |
|
430 | - * @throws EE_Error |
|
431 | - * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
432 | - */ |
|
433 | - protected function _send_message() |
|
434 | - { |
|
435 | - $success = wp_mail( |
|
436 | - $this->_to, |
|
437 | - //some old values for subject may be expecting HTML entities to be decoded in the subject |
|
438 | - //and subjects aren't interpreted as HTML, so there should be no HTML in them |
|
439 | - wp_strip_all_tags(wp_specialchars_decode($this->_subject, ENT_QUOTES)), |
|
440 | - $this->_body(), |
|
441 | - $this->_headers() |
|
442 | - ); |
|
443 | - if (! $success) { |
|
444 | - EE_Error::add_error( |
|
445 | - sprintf( |
|
446 | - esc_html__( |
|
447 | - 'The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', |
|
448 | - 'event_espresso' |
|
449 | - ), |
|
450 | - $this->_to, |
|
451 | - $this->_from, |
|
452 | - '<br />' |
|
453 | - ), |
|
454 | - __FILE__, |
|
455 | - __FUNCTION__, |
|
456 | - __LINE__ |
|
457 | - ); |
|
458 | - } |
|
459 | - return $success; |
|
460 | - } |
|
461 | - |
|
462 | - |
|
463 | - /** |
|
464 | - * see parent for definition |
|
465 | - * |
|
466 | - * @return string html body of the message content and the related css. |
|
467 | - * @throws EE_Error |
|
468 | - * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
469 | - */ |
|
470 | - protected function _preview() |
|
471 | - { |
|
472 | - return $this->_body(true); |
|
473 | - } |
|
474 | - |
|
475 | - |
|
476 | - /** |
|
477 | - * Setup headers for email |
|
478 | - * |
|
479 | - * @access protected |
|
480 | - * @return string formatted header for email |
|
481 | - */ |
|
482 | - protected function _headers() |
|
483 | - { |
|
484 | - $this->_ensure_has_from_email_address(); |
|
485 | - $from = $this->_from; |
|
486 | - $headers = array( |
|
487 | - 'From:' . $from, |
|
488 | - 'Reply-To:' . $from, |
|
489 | - 'Content-Type:text/html; charset=utf-8', |
|
490 | - ); |
|
491 | - |
|
492 | - if (! empty($this->_cc)) { |
|
493 | - $headers[] = 'cc: ' . $this->_cc; |
|
494 | - } |
|
495 | - |
|
496 | - //but wait! Header's for the from is NOT reliable because some plugins don't respect From: as set in the |
|
497 | - // header. |
|
498 | - add_filter('wp_mail_from', array($this, 'set_from_address'), 100); |
|
499 | - add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100); |
|
500 | - return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this); |
|
501 | - } |
|
502 | - |
|
503 | - |
|
504 | - /** |
|
505 | - * This simply ensures that the from address is not empty. If it is, then we use whatever is set as the site email |
|
506 | - * address for the from address to avoid problems with sending emails. |
|
507 | - */ |
|
508 | - protected function _ensure_has_from_email_address() |
|
509 | - { |
|
510 | - if (empty($this->_from)) { |
|
511 | - $this->_from = get_bloginfo('admin_email'); |
|
512 | - } |
|
513 | - } |
|
514 | - |
|
515 | - |
|
516 | - /** |
|
517 | - * This simply parses whatever is set as the $_from address and determines if it is in the format {name} <{email}> |
|
518 | - * or just {email} and returns an array with the "from_name" and "from_email" as the values. Note from_name *MAY* |
|
519 | - * be empty |
|
520 | - * |
|
521 | - * @since 4.3.1 |
|
522 | - * @return array |
|
523 | - */ |
|
524 | - private function _parse_from() |
|
525 | - { |
|
526 | - if (strpos($this->_from, '<') !== false) { |
|
527 | - $from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1); |
|
528 | - $from_name = str_replace('"', '', $from_name); |
|
529 | - $from_name = trim($from_name); |
|
530 | - |
|
531 | - $from_email = substr($this->_from, strpos($this->_from, '<') + 1); |
|
532 | - $from_email = str_replace('>', '', $from_email); |
|
533 | - $from_email = trim($from_email); |
|
534 | - } elseif (trim($this->_from) !== '') { |
|
535 | - $from_name = ''; |
|
536 | - $from_email = trim($this->_from); |
|
537 | - } else { |
|
538 | - $from_name = $from_email = ''; |
|
539 | - } |
|
540 | - return array($from_name, $from_email); |
|
541 | - } |
|
542 | - |
|
543 | - |
|
544 | - /** |
|
545 | - * Callback for the wp_mail_from filter. |
|
546 | - * |
|
547 | - * @since 4.3.1 |
|
548 | - * @param string $from_email What the original from_email is. |
|
549 | - * @return string |
|
550 | - */ |
|
551 | - public function set_from_address($from_email) |
|
552 | - { |
|
553 | - $parsed_from = $this->_parse_from(); |
|
554 | - //includes fallback if the parsing failed. |
|
555 | - $from_email = is_array($parsed_from) && ! empty($parsed_from[1]) |
|
556 | - ? $parsed_from[1] |
|
557 | - : get_bloginfo('admin_email'); |
|
558 | - return $from_email; |
|
559 | - } |
|
560 | - |
|
561 | - |
|
562 | - /** |
|
563 | - * Callback fro the wp_mail_from_name filter. |
|
564 | - * |
|
565 | - * @since 4.3.1 |
|
566 | - * @param string $from_name The original from_name. |
|
567 | - * @return string |
|
568 | - */ |
|
569 | - public function set_from_name($from_name) |
|
570 | - { |
|
571 | - $parsed_from = $this->_parse_from(); |
|
572 | - if (is_array($parsed_from) && ! empty($parsed_from[0])) { |
|
573 | - $from_name = $parsed_from[0]; |
|
574 | - } |
|
575 | - |
|
576 | - //if from name is "WordPress" let's sub in the site name instead (more friendly!) |
|
577 | - $from_name = $from_name == 'WordPress' ? get_bloginfo() : $from_name; |
|
578 | - |
|
579 | - return $from_name; |
|
580 | - } |
|
581 | - |
|
582 | - |
|
583 | - /** |
|
584 | - * setup body for email |
|
585 | - * |
|
586 | - * @param bool $preview will determine whether this is preview template or not. |
|
587 | - * @return string formatted body for email. |
|
588 | - * @throws EE_Error |
|
589 | - * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
590 | - */ |
|
591 | - protected function _body($preview = false) |
|
592 | - { |
|
593 | - //setup template args! |
|
594 | - $this->_template_args = array( |
|
595 | - 'subject' => $this->_subject, |
|
596 | - 'from' => $this->_from, |
|
597 | - 'main_body' => wpautop($this->_content), |
|
598 | - ); |
|
599 | - $body = $this->_get_main_template($preview); |
|
600 | - |
|
601 | - /** |
|
602 | - * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched. |
|
603 | - * |
|
604 | - * @type bool $preview Indicates whether a preview is being generated or not. |
|
605 | - * @return bool true indicates to use the inliner, false bypasses it. |
|
606 | - */ |
|
607 | - if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) { |
|
608 | - //require CssToInlineStyles library and its dependencies via composer autoloader |
|
609 | - require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php'; |
|
610 | - |
|
611 | - //now if this isn't a preview, let's setup the body so it has inline styles |
|
612 | - if (! $preview || ($preview && defined('DOING_AJAX'))) { |
|
613 | - $style = file_get_contents( |
|
614 | - $this->get_variation( |
|
615 | - $this->_tmp_pack, |
|
616 | - $this->_incoming_message_type->name, |
|
617 | - false, |
|
618 | - 'main', |
|
619 | - $this->_variation |
|
620 | - ), |
|
621 | - true |
|
622 | - ); |
|
623 | - $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style); |
|
624 | - //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
625 | - $body = ltrim($CSS->convert(true), ">\n"); |
|
626 | - //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
627 | - $body = ltrim($body, "<?"); |
|
628 | - } |
|
629 | - |
|
630 | - } |
|
631 | - return $body; |
|
632 | - } |
|
633 | - |
|
634 | - |
|
635 | - /** |
|
636 | - * This just returns any existing test settings that might be saved in the database |
|
637 | - * |
|
638 | - * @access public |
|
639 | - * @return array |
|
640 | - */ |
|
641 | - public function get_existing_test_settings() |
|
642 | - { |
|
643 | - $settings = parent::get_existing_test_settings(); |
|
644 | - //override subject if present because we always want it to be fresh. |
|
645 | - if (is_array($settings) && ! empty($settings['subject'])) { |
|
646 | - $settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')); |
|
647 | - } |
|
648 | - return $settings; |
|
649 | - } |
|
11 | + /** |
|
12 | + * To field for email |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $_to = ''; |
|
16 | + |
|
17 | + |
|
18 | + /** |
|
19 | + * CC field for email. |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $_cc = ''; |
|
23 | + |
|
24 | + /** |
|
25 | + * From field for email |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $_from = ''; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * Subject field for email |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_subject = ''; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * Content field for email |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $_content = ''; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * constructor |
|
47 | + * |
|
48 | + * @access public |
|
49 | + */ |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + //set name and description properties |
|
53 | + $this->name = 'email'; |
|
54 | + $this->description = sprintf( |
|
55 | + esc_html__( |
|
56 | + 'This messenger delivers messages via email using the built-in %s function included with WordPress', |
|
57 | + 'event_espresso' |
|
58 | + ), |
|
59 | + '<code>wp_mail</code>' |
|
60 | + ); |
|
61 | + $this->label = array( |
|
62 | + 'singular' => esc_html__('email', 'event_espresso'), |
|
63 | + 'plural' => esc_html__('emails', 'event_espresso'), |
|
64 | + ); |
|
65 | + $this->activate_on_install = true; |
|
66 | + |
|
67 | + //we're using defaults so let's call parent constructor that will take care of setting up all the other |
|
68 | + // properties |
|
69 | + parent::__construct(); |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * see abstract declaration in parent class for details. |
|
75 | + */ |
|
76 | + protected function _set_admin_pages() |
|
77 | + { |
|
78 | + $this->admin_registered_pages = array( |
|
79 | + 'events_edit' => true, |
|
80 | + ); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * see abstract declaration in parent class for details |
|
86 | + */ |
|
87 | + protected function _set_valid_shortcodes() |
|
88 | + { |
|
89 | + //remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the |
|
90 | + // message type. |
|
91 | + $this->_valid_shortcodes = array( |
|
92 | + 'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
93 | + 'cc' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
94 | + 'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
95 | + ); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * see abstract declaration in parent class for details |
|
101 | + * |
|
102 | + * @access protected |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + protected function _set_validator_config() |
|
106 | + { |
|
107 | + $valid_shortcodes = $this->get_valid_shortcodes(); |
|
108 | + |
|
109 | + $this->_validator_config = array( |
|
110 | + 'to' => array( |
|
111 | + 'shortcodes' => $valid_shortcodes['to'], |
|
112 | + 'type' => 'email', |
|
113 | + ), |
|
114 | + 'cc' => array( |
|
115 | + 'shortcodes' => $valid_shortcodes['to'], |
|
116 | + 'type' => 'email', |
|
117 | + ), |
|
118 | + 'from' => array( |
|
119 | + 'shortcodes' => $valid_shortcodes['from'], |
|
120 | + 'type' => 'email', |
|
121 | + ), |
|
122 | + 'subject' => array( |
|
123 | + 'shortcodes' => array( |
|
124 | + 'organization', |
|
125 | + 'primary_registration_details', |
|
126 | + 'event_author', |
|
127 | + 'primary_registration_details', |
|
128 | + 'recipient_details', |
|
129 | + ), |
|
130 | + ), |
|
131 | + 'content' => array( |
|
132 | + 'shortcodes' => array( |
|
133 | + 'event_list', |
|
134 | + 'attendee_list', |
|
135 | + 'ticket_list', |
|
136 | + 'organization', |
|
137 | + 'primary_registration_details', |
|
138 | + 'primary_registration_list', |
|
139 | + 'event_author', |
|
140 | + 'recipient_details', |
|
141 | + 'recipient_list', |
|
142 | + 'transaction', |
|
143 | + 'messenger', |
|
144 | + ), |
|
145 | + ), |
|
146 | + 'attendee_list' => array( |
|
147 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
|
148 | + 'required' => array('[ATTENDEE_LIST]'), |
|
149 | + ), |
|
150 | + 'event_list' => array( |
|
151 | + 'shortcodes' => array( |
|
152 | + 'event', |
|
153 | + 'attendee_list', |
|
154 | + 'ticket_list', |
|
155 | + 'venue', |
|
156 | + 'datetime_list', |
|
157 | + 'attendee', |
|
158 | + 'primary_registration_details', |
|
159 | + 'primary_registration_list', |
|
160 | + 'event_author', |
|
161 | + 'recipient_details', |
|
162 | + 'recipient_list', |
|
163 | + ), |
|
164 | + 'required' => array('[EVENT_LIST]'), |
|
165 | + ), |
|
166 | + 'ticket_list' => array( |
|
167 | + 'shortcodes' => array( |
|
168 | + 'event_list', |
|
169 | + 'attendee_list', |
|
170 | + 'ticket', |
|
171 | + 'datetime_list', |
|
172 | + 'primary_registration_details', |
|
173 | + 'recipient_details', |
|
174 | + ), |
|
175 | + 'required' => array('[TICKET_LIST]'), |
|
176 | + ), |
|
177 | + 'datetime_list' => array( |
|
178 | + 'shortcodes' => array('datetime'), |
|
179 | + 'required' => array('[DATETIME_LIST]'), |
|
180 | + ), |
|
181 | + ); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * @see parent EE_messenger class for docs |
|
187 | + * @since 4.5.0 |
|
188 | + */ |
|
189 | + public function do_secondary_messenger_hooks($sending_messenger_name) |
|
190 | + { |
|
191 | + if ($sending_messenger_name = 'html') { |
|
192 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
193 | + } |
|
194 | + } |
|
195 | + |
|
196 | + |
|
197 | + public function add_email_css( |
|
198 | + $variation_path, |
|
199 | + $messenger, |
|
200 | + $message_type, |
|
201 | + $type, |
|
202 | + $variation, |
|
203 | + $file_extension, |
|
204 | + $url, |
|
205 | + EE_Messages_Template_Pack $template_pack |
|
206 | + ) { |
|
207 | + //prevent recursion on this callback. |
|
208 | + remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10); |
|
209 | + $variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, false); |
|
210 | + |
|
211 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
212 | + return $variation; |
|
213 | + } |
|
214 | + |
|
215 | + |
|
216 | + /** |
|
217 | + * See parent for details |
|
218 | + * |
|
219 | + * @access protected |
|
220 | + * @return void |
|
221 | + */ |
|
222 | + protected function _set_test_settings_fields() |
|
223 | + { |
|
224 | + $this->_test_settings_fields = array( |
|
225 | + 'to' => array( |
|
226 | + 'input' => 'text', |
|
227 | + 'label' => esc_html__('Send a test email to', 'event_espresso'), |
|
228 | + 'type' => 'email', |
|
229 | + 'required' => true, |
|
230 | + 'validation' => true, |
|
231 | + 'css_class' => 'large-text', |
|
232 | + 'format' => '%s', |
|
233 | + 'default' => get_bloginfo('admin_email'), |
|
234 | + ), |
|
235 | + 'subject' => array( |
|
236 | + 'input' => 'hidden', |
|
237 | + 'label' => '', |
|
238 | + 'type' => 'string', |
|
239 | + 'required' => false, |
|
240 | + 'validation' => false, |
|
241 | + 'format' => '%s', |
|
242 | + 'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')), |
|
243 | + 'default' => '', |
|
244 | + 'css_class' => '', |
|
245 | + ), |
|
246 | + ); |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + /** |
|
251 | + * _set_template_fields |
|
252 | + * This sets up the fields that a messenger requires for the message to go out. |
|
253 | + * |
|
254 | + * @access protected |
|
255 | + * @return void |
|
256 | + */ |
|
257 | + protected function _set_template_fields() |
|
258 | + { |
|
259 | + // any extra template fields that are NOT used by the messenger but will get used by a messenger field for |
|
260 | + // shortcode replacement get added to the 'extra' key in an associated array indexed by the messenger field |
|
261 | + // they relate to. This is important for the Messages_admin to know what fields to display to the user. |
|
262 | + // Also, notice that the "values" are equal to the field type that messages admin will use to know what |
|
263 | + // kind of field to display. The values ALSO have one index labeled "shortcode". the values in that array |
|
264 | + // indicate which ACTUAL SHORTCODE (i.e. [SHORTCODE]) is required in order for this extra field to be |
|
265 | + // displayed. If the required shortcode isn't part of the shortcodes array then the field is not needed and |
|
266 | + // will not be displayed/parsed. |
|
267 | + $this->_template_fields = array( |
|
268 | + 'to' => array( |
|
269 | + 'input' => 'text', |
|
270 | + 'label' => esc_html_x( |
|
271 | + 'To', |
|
272 | + 'Label for the "To" field for email addresses', |
|
273 | + 'event_espresso' |
|
274 | + ), |
|
275 | + 'type' => 'string', |
|
276 | + 'required' => true, |
|
277 | + 'validation' => true, |
|
278 | + 'css_class' => 'large-text', |
|
279 | + 'format' => '%s', |
|
280 | + ), |
|
281 | + 'cc' => array( |
|
282 | + 'input' => 'text', |
|
283 | + 'label' => esc_html_x( |
|
284 | + 'CC', |
|
285 | + 'Label for the "Carbon Copy" field used for additional email addresses', |
|
286 | + 'event_espresso' |
|
287 | + ), |
|
288 | + 'type' => 'string', |
|
289 | + 'required' => false, |
|
290 | + 'validation' => true, |
|
291 | + 'css_class' => 'large-text', |
|
292 | + 'format' => '%s', |
|
293 | + ), |
|
294 | + 'from' => array( |
|
295 | + 'input' => 'text', |
|
296 | + 'label' => esc_html_x( |
|
297 | + 'From', |
|
298 | + 'Label for the "From" field for email addresses.', |
|
299 | + 'event_espresso' |
|
300 | + ), |
|
301 | + 'type' => 'string', |
|
302 | + 'required' => true, |
|
303 | + 'validation' => true, |
|
304 | + 'css_class' => 'large-text', |
|
305 | + 'format' => '%s', |
|
306 | + ), |
|
307 | + 'subject' => array( |
|
308 | + 'input' => 'text', |
|
309 | + 'label' => esc_html_x( |
|
310 | + 'Subject', |
|
311 | + 'Label for the "Subject" field (short description of contents) for emails.', |
|
312 | + 'event_espresso' |
|
313 | + ), |
|
314 | + 'type' => 'string', |
|
315 | + 'required' => true, |
|
316 | + 'validation' => true, |
|
317 | + 'css_class' => 'large-text', |
|
318 | + 'format' => '%s', |
|
319 | + ), |
|
320 | + 'content' => '', |
|
321 | + //left empty b/c it is in the "extra array" but messenger still needs needs to know this is a field. |
|
322 | + 'extra' => array( |
|
323 | + 'content' => array( |
|
324 | + 'main' => array( |
|
325 | + 'input' => 'wp_editor', |
|
326 | + 'label' => esc_html__('Main Content', 'event_espresso'), |
|
327 | + 'type' => 'string', |
|
328 | + 'required' => true, |
|
329 | + 'validation' => true, |
|
330 | + 'format' => '%s', |
|
331 | + 'rows' => '15', |
|
332 | + ), |
|
333 | + 'event_list' => array( |
|
334 | + 'input' => 'wp_editor', |
|
335 | + 'label' => '[EVENT_LIST]', |
|
336 | + 'type' => 'string', |
|
337 | + 'required' => true, |
|
338 | + 'validation' => true, |
|
339 | + 'format' => '%s', |
|
340 | + 'rows' => '15', |
|
341 | + 'shortcodes_required' => array('[EVENT_LIST]'), |
|
342 | + ), |
|
343 | + 'attendee_list' => array( |
|
344 | + 'input' => 'textarea', |
|
345 | + 'label' => '[ATTENDEE_LIST]', |
|
346 | + 'type' => 'string', |
|
347 | + 'required' => true, |
|
348 | + 'validation' => true, |
|
349 | + 'format' => '%s', |
|
350 | + 'css_class' => 'large-text', |
|
351 | + 'rows' => '5', |
|
352 | + 'shortcodes_required' => array('[ATTENDEE_LIST]'), |
|
353 | + ), |
|
354 | + 'ticket_list' => array( |
|
355 | + 'input' => 'textarea', |
|
356 | + 'label' => '[TICKET_LIST]', |
|
357 | + 'type' => 'string', |
|
358 | + 'required' => true, |
|
359 | + 'validation' => true, |
|
360 | + 'format' => '%s', |
|
361 | + 'css_class' => 'large-text', |
|
362 | + 'rows' => '10', |
|
363 | + 'shortcodes_required' => array('[TICKET_LIST]'), |
|
364 | + ), |
|
365 | + 'datetime_list' => array( |
|
366 | + 'input' => 'textarea', |
|
367 | + 'label' => '[DATETIME_LIST]', |
|
368 | + 'type' => 'string', |
|
369 | + 'required' => true, |
|
370 | + 'validation' => true, |
|
371 | + 'format' => '%s', |
|
372 | + 'css_class' => 'large-text', |
|
373 | + 'rows' => '10', |
|
374 | + 'shortcodes_required' => array('[DATETIME_LIST]'), |
|
375 | + ), |
|
376 | + ), |
|
377 | + ), |
|
378 | + ); |
|
379 | + } |
|
380 | + |
|
381 | + |
|
382 | + /** |
|
383 | + * See definition of this class in parent |
|
384 | + */ |
|
385 | + protected function _set_default_message_types() |
|
386 | + { |
|
387 | + $this->_default_message_types = array( |
|
388 | + 'payment', |
|
389 | + 'payment_refund', |
|
390 | + 'registration', |
|
391 | + 'not_approved_registration', |
|
392 | + 'pending_approval', |
|
393 | + ); |
|
394 | + } |
|
395 | + |
|
396 | + |
|
397 | + /** |
|
398 | + * @see definition of this class in parent |
|
399 | + * @since 4.5.0 |
|
400 | + */ |
|
401 | + protected function _set_valid_message_types() |
|
402 | + { |
|
403 | + $this->_valid_message_types = array( |
|
404 | + 'payment', |
|
405 | + 'registration', |
|
406 | + 'not_approved_registration', |
|
407 | + 'declined_registration', |
|
408 | + 'cancelled_registration', |
|
409 | + 'pending_approval', |
|
410 | + 'registration_summary', |
|
411 | + 'payment_reminder', |
|
412 | + 'payment_declined', |
|
413 | + 'payment_refund', |
|
414 | + ); |
|
415 | + } |
|
416 | + |
|
417 | + |
|
418 | + /** |
|
419 | + * setting up admin_settings_fields for messenger. |
|
420 | + */ |
|
421 | + protected function _set_admin_settings_fields() |
|
422 | + { |
|
423 | + } |
|
424 | + |
|
425 | + /** |
|
426 | + * We just deliver the messages don't kill us!! |
|
427 | + * |
|
428 | + * @return bool|WP_Error true if message delivered, false if it didn't deliver OR bubble up any error object if |
|
429 | + * present. |
|
430 | + * @throws EE_Error |
|
431 | + * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
432 | + */ |
|
433 | + protected function _send_message() |
|
434 | + { |
|
435 | + $success = wp_mail( |
|
436 | + $this->_to, |
|
437 | + //some old values for subject may be expecting HTML entities to be decoded in the subject |
|
438 | + //and subjects aren't interpreted as HTML, so there should be no HTML in them |
|
439 | + wp_strip_all_tags(wp_specialchars_decode($this->_subject, ENT_QUOTES)), |
|
440 | + $this->_body(), |
|
441 | + $this->_headers() |
|
442 | + ); |
|
443 | + if (! $success) { |
|
444 | + EE_Error::add_error( |
|
445 | + sprintf( |
|
446 | + esc_html__( |
|
447 | + 'The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', |
|
448 | + 'event_espresso' |
|
449 | + ), |
|
450 | + $this->_to, |
|
451 | + $this->_from, |
|
452 | + '<br />' |
|
453 | + ), |
|
454 | + __FILE__, |
|
455 | + __FUNCTION__, |
|
456 | + __LINE__ |
|
457 | + ); |
|
458 | + } |
|
459 | + return $success; |
|
460 | + } |
|
461 | + |
|
462 | + |
|
463 | + /** |
|
464 | + * see parent for definition |
|
465 | + * |
|
466 | + * @return string html body of the message content and the related css. |
|
467 | + * @throws EE_Error |
|
468 | + * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
469 | + */ |
|
470 | + protected function _preview() |
|
471 | + { |
|
472 | + return $this->_body(true); |
|
473 | + } |
|
474 | + |
|
475 | + |
|
476 | + /** |
|
477 | + * Setup headers for email |
|
478 | + * |
|
479 | + * @access protected |
|
480 | + * @return string formatted header for email |
|
481 | + */ |
|
482 | + protected function _headers() |
|
483 | + { |
|
484 | + $this->_ensure_has_from_email_address(); |
|
485 | + $from = $this->_from; |
|
486 | + $headers = array( |
|
487 | + 'From:' . $from, |
|
488 | + 'Reply-To:' . $from, |
|
489 | + 'Content-Type:text/html; charset=utf-8', |
|
490 | + ); |
|
491 | + |
|
492 | + if (! empty($this->_cc)) { |
|
493 | + $headers[] = 'cc: ' . $this->_cc; |
|
494 | + } |
|
495 | + |
|
496 | + //but wait! Header's for the from is NOT reliable because some plugins don't respect From: as set in the |
|
497 | + // header. |
|
498 | + add_filter('wp_mail_from', array($this, 'set_from_address'), 100); |
|
499 | + add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100); |
|
500 | + return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this); |
|
501 | + } |
|
502 | + |
|
503 | + |
|
504 | + /** |
|
505 | + * This simply ensures that the from address is not empty. If it is, then we use whatever is set as the site email |
|
506 | + * address for the from address to avoid problems with sending emails. |
|
507 | + */ |
|
508 | + protected function _ensure_has_from_email_address() |
|
509 | + { |
|
510 | + if (empty($this->_from)) { |
|
511 | + $this->_from = get_bloginfo('admin_email'); |
|
512 | + } |
|
513 | + } |
|
514 | + |
|
515 | + |
|
516 | + /** |
|
517 | + * This simply parses whatever is set as the $_from address and determines if it is in the format {name} <{email}> |
|
518 | + * or just {email} and returns an array with the "from_name" and "from_email" as the values. Note from_name *MAY* |
|
519 | + * be empty |
|
520 | + * |
|
521 | + * @since 4.3.1 |
|
522 | + * @return array |
|
523 | + */ |
|
524 | + private function _parse_from() |
|
525 | + { |
|
526 | + if (strpos($this->_from, '<') !== false) { |
|
527 | + $from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1); |
|
528 | + $from_name = str_replace('"', '', $from_name); |
|
529 | + $from_name = trim($from_name); |
|
530 | + |
|
531 | + $from_email = substr($this->_from, strpos($this->_from, '<') + 1); |
|
532 | + $from_email = str_replace('>', '', $from_email); |
|
533 | + $from_email = trim($from_email); |
|
534 | + } elseif (trim($this->_from) !== '') { |
|
535 | + $from_name = ''; |
|
536 | + $from_email = trim($this->_from); |
|
537 | + } else { |
|
538 | + $from_name = $from_email = ''; |
|
539 | + } |
|
540 | + return array($from_name, $from_email); |
|
541 | + } |
|
542 | + |
|
543 | + |
|
544 | + /** |
|
545 | + * Callback for the wp_mail_from filter. |
|
546 | + * |
|
547 | + * @since 4.3.1 |
|
548 | + * @param string $from_email What the original from_email is. |
|
549 | + * @return string |
|
550 | + */ |
|
551 | + public function set_from_address($from_email) |
|
552 | + { |
|
553 | + $parsed_from = $this->_parse_from(); |
|
554 | + //includes fallback if the parsing failed. |
|
555 | + $from_email = is_array($parsed_from) && ! empty($parsed_from[1]) |
|
556 | + ? $parsed_from[1] |
|
557 | + : get_bloginfo('admin_email'); |
|
558 | + return $from_email; |
|
559 | + } |
|
560 | + |
|
561 | + |
|
562 | + /** |
|
563 | + * Callback fro the wp_mail_from_name filter. |
|
564 | + * |
|
565 | + * @since 4.3.1 |
|
566 | + * @param string $from_name The original from_name. |
|
567 | + * @return string |
|
568 | + */ |
|
569 | + public function set_from_name($from_name) |
|
570 | + { |
|
571 | + $parsed_from = $this->_parse_from(); |
|
572 | + if (is_array($parsed_from) && ! empty($parsed_from[0])) { |
|
573 | + $from_name = $parsed_from[0]; |
|
574 | + } |
|
575 | + |
|
576 | + //if from name is "WordPress" let's sub in the site name instead (more friendly!) |
|
577 | + $from_name = $from_name == 'WordPress' ? get_bloginfo() : $from_name; |
|
578 | + |
|
579 | + return $from_name; |
|
580 | + } |
|
581 | + |
|
582 | + |
|
583 | + /** |
|
584 | + * setup body for email |
|
585 | + * |
|
586 | + * @param bool $preview will determine whether this is preview template or not. |
|
587 | + * @return string formatted body for email. |
|
588 | + * @throws EE_Error |
|
589 | + * @throws \TijsVerkoyen\CssToInlineStyles\Exception |
|
590 | + */ |
|
591 | + protected function _body($preview = false) |
|
592 | + { |
|
593 | + //setup template args! |
|
594 | + $this->_template_args = array( |
|
595 | + 'subject' => $this->_subject, |
|
596 | + 'from' => $this->_from, |
|
597 | + 'main_body' => wpautop($this->_content), |
|
598 | + ); |
|
599 | + $body = $this->_get_main_template($preview); |
|
600 | + |
|
601 | + /** |
|
602 | + * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched. |
|
603 | + * |
|
604 | + * @type bool $preview Indicates whether a preview is being generated or not. |
|
605 | + * @return bool true indicates to use the inliner, false bypasses it. |
|
606 | + */ |
|
607 | + if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) { |
|
608 | + //require CssToInlineStyles library and its dependencies via composer autoloader |
|
609 | + require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php'; |
|
610 | + |
|
611 | + //now if this isn't a preview, let's setup the body so it has inline styles |
|
612 | + if (! $preview || ($preview && defined('DOING_AJAX'))) { |
|
613 | + $style = file_get_contents( |
|
614 | + $this->get_variation( |
|
615 | + $this->_tmp_pack, |
|
616 | + $this->_incoming_message_type->name, |
|
617 | + false, |
|
618 | + 'main', |
|
619 | + $this->_variation |
|
620 | + ), |
|
621 | + true |
|
622 | + ); |
|
623 | + $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style); |
|
624 | + //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
625 | + $body = ltrim($CSS->convert(true), ">\n"); |
|
626 | + //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
627 | + $body = ltrim($body, "<?"); |
|
628 | + } |
|
629 | + |
|
630 | + } |
|
631 | + return $body; |
|
632 | + } |
|
633 | + |
|
634 | + |
|
635 | + /** |
|
636 | + * This just returns any existing test settings that might be saved in the database |
|
637 | + * |
|
638 | + * @access public |
|
639 | + * @return array |
|
640 | + */ |
|
641 | + public function get_existing_test_settings() |
|
642 | + { |
|
643 | + $settings = parent::get_existing_test_settings(); |
|
644 | + //override subject if present because we always want it to be fresh. |
|
645 | + if (is_array($settings) && ! empty($settings['subject'])) { |
|
646 | + $settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')); |
|
647 | + } |
|
648 | + return $settings; |
|
649 | + } |
|
650 | 650 | } |
@@ -15,115 +15,115 @@ |
||
15 | 15 | class Extend_EE_Registrations_List_Table extends EE_Registrations_List_Table |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param EE_Registration $item |
|
20 | - * @return string |
|
21 | - * @throws EE_Error |
|
22 | - * @throws InvalidArgumentException |
|
23 | - * @throws ReflectionException |
|
24 | - * @throws InvalidDataTypeException |
|
25 | - * @throws InvalidInterfaceException |
|
26 | - */ |
|
27 | - function column__REG_date(EE_Registration $item) |
|
28 | - { |
|
29 | - $date_linked = parent::column__REG_date($item); |
|
30 | - $actions = array(); |
|
31 | - //Build row actions |
|
32 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
33 | - 'action' => 'event_registrations', |
|
34 | - 'event_id' => $item->event_ID(), |
|
35 | - ), REG_ADMIN_URL); |
|
36 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( |
|
37 | - 'ee_read_registration', |
|
38 | - 'espresso_registrations_registration_checkins', |
|
39 | - $item->ID() |
|
40 | - ) && EE_Registry::instance()->CAP->current_user_can( |
|
41 | - 'ee_read_checkins', |
|
42 | - 'espresso_registrations_registration_checkins' |
|
43 | - ) |
|
44 | - ? '<a href="' . $check_in_url . '"' |
|
45 | - . ' title="' . esc_attr__( |
|
46 | - 'The Check-In List allows you to easily toggle check-in status for this event', |
|
47 | - 'event_espresso' |
|
48 | - ) |
|
49 | - . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
50 | - : esc_html__('View Check-ins', 'event_espresso'); |
|
18 | + /** |
|
19 | + * @param EE_Registration $item |
|
20 | + * @return string |
|
21 | + * @throws EE_Error |
|
22 | + * @throws InvalidArgumentException |
|
23 | + * @throws ReflectionException |
|
24 | + * @throws InvalidDataTypeException |
|
25 | + * @throws InvalidInterfaceException |
|
26 | + */ |
|
27 | + function column__REG_date(EE_Registration $item) |
|
28 | + { |
|
29 | + $date_linked = parent::column__REG_date($item); |
|
30 | + $actions = array(); |
|
31 | + //Build row actions |
|
32 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
33 | + 'action' => 'event_registrations', |
|
34 | + 'event_id' => $item->event_ID(), |
|
35 | + ), REG_ADMIN_URL); |
|
36 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( |
|
37 | + 'ee_read_registration', |
|
38 | + 'espresso_registrations_registration_checkins', |
|
39 | + $item->ID() |
|
40 | + ) && EE_Registry::instance()->CAP->current_user_can( |
|
41 | + 'ee_read_checkins', |
|
42 | + 'espresso_registrations_registration_checkins' |
|
43 | + ) |
|
44 | + ? '<a href="' . $check_in_url . '"' |
|
45 | + . ' title="' . esc_attr__( |
|
46 | + 'The Check-In List allows you to easily toggle check-in status for this event', |
|
47 | + 'event_espresso' |
|
48 | + ) |
|
49 | + . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
50 | + : esc_html__('View Check-ins', 'event_espresso'); |
|
51 | 51 | |
52 | - return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
|
53 | - } |
|
52 | + return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * column_default |
|
58 | - * |
|
59 | - * @param \EE_Registration $item |
|
60 | - * @return string |
|
61 | - * @throws EE_Error |
|
62 | - * @throws InvalidArgumentException |
|
63 | - * @throws InvalidDataTypeException |
|
64 | - * @throws InvalidInterfaceException |
|
65 | - * @throws ReflectionException |
|
66 | - */ |
|
67 | - public function column_DTT_EVT_start(EE_Registration $item) |
|
68 | - { |
|
69 | - $remove_defaults = array('default_where_conditions' => 'none'); |
|
70 | - $ticket = $item->ticket(); |
|
71 | - $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
|
72 | - $EVT_ID = $item->event_ID(); |
|
73 | - $datetimes_for_display = array(); |
|
74 | - foreach ($datetimes as $datetime) { |
|
75 | - $datetime_string = ''; |
|
76 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
77 | - 'ee_read_checkin', |
|
78 | - 'espresso_registrations_registration_checkins', |
|
79 | - $item->ID() |
|
80 | - )) { |
|
81 | - // open "a" tag and "href" |
|
82 | - $datetime_string .= '<a href="'; |
|
83 | - // checkin URL |
|
84 | - $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
85 | - array( |
|
86 | - 'action' => 'event_registrations', |
|
87 | - 'event_id' => $EVT_ID, |
|
88 | - 'DTT_ID' => $datetime->ID(), |
|
89 | - ), |
|
90 | - REG_ADMIN_URL |
|
91 | - ); |
|
92 | - // close "href" |
|
93 | - $datetime_string .= '"'; |
|
94 | - // open "title" tag |
|
95 | - $datetime_string .= ' title="'; |
|
96 | - // link title text |
|
97 | - $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
98 | - // close "title" tag and end of "a" tag opening |
|
99 | - $datetime_string .= '">'; |
|
100 | - // link text |
|
101 | - $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
102 | - // close "a" tag |
|
103 | - $datetime_string .= '</a>'; |
|
104 | - } else { |
|
105 | - $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
106 | - } |
|
107 | - // add a "View Registrations" link that filters list by event AND datetime |
|
108 | - $datetime_string .= $this->row_actions( |
|
109 | - array( |
|
110 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
111 | - array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
112 | - REG_ADMIN_URL |
|
113 | - ) |
|
114 | - . '" title="' . sprintf( |
|
115 | - esc_attr__( |
|
116 | - 'Filter this list to only show registrations for this datetime %s', |
|
117 | - 'event_espresso' |
|
118 | - ), |
|
119 | - $datetime->name() |
|
120 | - ) . '">' |
|
121 | - . esc_html__('View Registrations', 'event_espresso') |
|
122 | - . '</a>', |
|
123 | - ) |
|
124 | - ); |
|
125 | - $datetimes_for_display[] = $datetime_string; |
|
126 | - } |
|
127 | - return $this->generateDisplayForDateTimes($datetimes_for_display); |
|
128 | - } |
|
56 | + /** |
|
57 | + * column_default |
|
58 | + * |
|
59 | + * @param \EE_Registration $item |
|
60 | + * @return string |
|
61 | + * @throws EE_Error |
|
62 | + * @throws InvalidArgumentException |
|
63 | + * @throws InvalidDataTypeException |
|
64 | + * @throws InvalidInterfaceException |
|
65 | + * @throws ReflectionException |
|
66 | + */ |
|
67 | + public function column_DTT_EVT_start(EE_Registration $item) |
|
68 | + { |
|
69 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
70 | + $ticket = $item->ticket(); |
|
71 | + $datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array(); |
|
72 | + $EVT_ID = $item->event_ID(); |
|
73 | + $datetimes_for_display = array(); |
|
74 | + foreach ($datetimes as $datetime) { |
|
75 | + $datetime_string = ''; |
|
76 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
77 | + 'ee_read_checkin', |
|
78 | + 'espresso_registrations_registration_checkins', |
|
79 | + $item->ID() |
|
80 | + )) { |
|
81 | + // open "a" tag and "href" |
|
82 | + $datetime_string .= '<a href="'; |
|
83 | + // checkin URL |
|
84 | + $datetime_string .= EE_Admin_Page::add_query_args_and_nonce( |
|
85 | + array( |
|
86 | + 'action' => 'event_registrations', |
|
87 | + 'event_id' => $EVT_ID, |
|
88 | + 'DTT_ID' => $datetime->ID(), |
|
89 | + ), |
|
90 | + REG_ADMIN_URL |
|
91 | + ); |
|
92 | + // close "href" |
|
93 | + $datetime_string .= '"'; |
|
94 | + // open "title" tag |
|
95 | + $datetime_string .= ' title="'; |
|
96 | + // link title text |
|
97 | + $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso'); |
|
98 | + // close "title" tag and end of "a" tag opening |
|
99 | + $datetime_string .= '">'; |
|
100 | + // link text |
|
101 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
102 | + // close "a" tag |
|
103 | + $datetime_string .= '</a>'; |
|
104 | + } else { |
|
105 | + $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
106 | + } |
|
107 | + // add a "View Registrations" link that filters list by event AND datetime |
|
108 | + $datetime_string .= $this->row_actions( |
|
109 | + array( |
|
110 | + 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
111 | + array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
|
112 | + REG_ADMIN_URL |
|
113 | + ) |
|
114 | + . '" title="' . sprintf( |
|
115 | + esc_attr__( |
|
116 | + 'Filter this list to only show registrations for this datetime %s', |
|
117 | + 'event_espresso' |
|
118 | + ), |
|
119 | + $datetime->name() |
|
120 | + ) . '">' |
|
121 | + . esc_html__('View Registrations', 'event_espresso') |
|
122 | + . '</a>', |
|
123 | + ) |
|
124 | + ); |
|
125 | + $datetimes_for_display[] = $datetime_string; |
|
126 | + } |
|
127 | + return $this->generateDisplayForDateTimes($datetimes_for_display); |
|
128 | + } |
|
129 | 129 | } |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | 'ee_read_checkins', |
42 | 42 | 'espresso_registrations_registration_checkins' |
43 | 43 | ) |
44 | - ? '<a href="' . $check_in_url . '"' |
|
45 | - . ' title="' . esc_attr__( |
|
44 | + ? '<a href="'.$check_in_url.'"' |
|
45 | + . ' title="'.esc_attr__( |
|
46 | 46 | 'The Check-In List allows you to easily toggle check-in status for this event', |
47 | 47 | 'event_espresso' |
48 | 48 | ) |
49 | - . '">' . esc_html__('View Check-ins', 'event_espresso') . '</a>' |
|
49 | + . '">'.esc_html__('View Check-ins', 'event_espresso').'</a>' |
|
50 | 50 | : esc_html__('View Check-ins', 'event_espresso'); |
51 | 51 | |
52 | 52 | return sprintf('%1$s %2$s', $date_linked, $this->row_actions($actions)); |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | // add a "View Registrations" link that filters list by event AND datetime |
108 | 108 | $datetime_string .= $this->row_actions( |
109 | 109 | array( |
110 | - 'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce( |
|
110 | + 'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce( |
|
111 | 111 | array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()), |
112 | 112 | REG_ADMIN_URL |
113 | 113 | ) |
114 | - . '" title="' . sprintf( |
|
114 | + . '" title="'.sprintf( |
|
115 | 115 | esc_attr__( |
116 | 116 | 'Filter this list to only show registrations for this datetime %s', |
117 | 117 | 'event_espresso' |
118 | 118 | ), |
119 | 119 | $datetime->name() |
120 | - ) . '">' |
|
120 | + ).'">' |
|
121 | 121 | . esc_html__('View Registrations', 'event_espresso') |
122 | 122 | . '</a>', |
123 | 123 | ) |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
4 | 4 | |
5 | 5 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
6 | - exit('No direct script access allowed'); |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -28,1006 +28,1006 @@ discard block |
||
28 | 28 | { |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - private $_status; |
|
31 | + /** |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + private $_status; |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * An array of transaction details for the related transaction to the registration being processed. |
|
39 | - * This is set via the _set_related_details method. |
|
40 | - * |
|
41 | - * @var array |
|
42 | - */ |
|
43 | - protected $_transaction_details = array(); |
|
37 | + /** |
|
38 | + * An array of transaction details for the related transaction to the registration being processed. |
|
39 | + * This is set via the _set_related_details method. |
|
40 | + * |
|
41 | + * @var array |
|
42 | + */ |
|
43 | + protected $_transaction_details = array(); |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * An array of event details for the related event to the registration being processed. |
|
48 | - * This is set via the _set_related_details method. |
|
49 | - * |
|
50 | - * @var array |
|
51 | - */ |
|
52 | - protected $_event_details = array(); |
|
46 | + /** |
|
47 | + * An array of event details for the related event to the registration being processed. |
|
48 | + * This is set via the _set_related_details method. |
|
49 | + * |
|
50 | + * @var array |
|
51 | + */ |
|
52 | + protected $_event_details = array(); |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * @param \Registrations_Admin_Page $admin_page |
|
57 | - */ |
|
58 | - public function __construct(Registrations_Admin_Page $admin_page) |
|
59 | - { |
|
60 | - if (! empty($_GET['event_id'])) { |
|
61 | - $extra_query_args = array(); |
|
62 | - foreach ($admin_page->get_views() as $key => $view_details) { |
|
63 | - $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
64 | - } |
|
65 | - $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
66 | - } |
|
67 | - parent::__construct($admin_page); |
|
68 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
69 | - } |
|
55 | + /** |
|
56 | + * @param \Registrations_Admin_Page $admin_page |
|
57 | + */ |
|
58 | + public function __construct(Registrations_Admin_Page $admin_page) |
|
59 | + { |
|
60 | + if (! empty($_GET['event_id'])) { |
|
61 | + $extra_query_args = array(); |
|
62 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
63 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
64 | + } |
|
65 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
66 | + } |
|
67 | + parent::__construct($admin_page); |
|
68 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * _setup_data |
|
74 | - * |
|
75 | - * @access protected |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - protected function _setup_data() |
|
79 | - { |
|
80 | - $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
81 | - $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false); |
|
82 | - } |
|
72 | + /** |
|
73 | + * _setup_data |
|
74 | + * |
|
75 | + * @access protected |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + protected function _setup_data() |
|
79 | + { |
|
80 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
81 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * _set_properties |
|
87 | - * |
|
88 | - * @access protected |
|
89 | - * @return void |
|
90 | - */ |
|
91 | - protected function _set_properties() |
|
92 | - { |
|
93 | - $this->_wp_list_args = array( |
|
94 | - 'singular' => __('registration', 'event_espresso'), |
|
95 | - 'plural' => __('registrations', 'event_espresso'), |
|
96 | - 'ajax' => true, |
|
97 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
98 | - ); |
|
99 | - $ID_column_name = __('ID', 'event_espresso'); |
|
100 | - $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
101 | - $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
102 | - $ID_column_name .= '</span> '; |
|
103 | - if (isset($_GET['event_id'])) { |
|
104 | - $this->_columns = array( |
|
105 | - 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
|
106 | - '_REG_ID' => $ID_column_name, |
|
107 | - 'ATT_fname' => __('Name', 'event_espresso'), |
|
108 | - 'ATT_email' => __('Email', 'event_espresso'), |
|
109 | - '_REG_date' => __('Reg Date', 'event_espresso'), |
|
110 | - 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
111 | - '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
112 | - 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
113 | - 'TXN_paid' => __('Paid', 'event_espresso'), |
|
114 | - 'actions' => __('Actions', 'event_espresso'), |
|
115 | - ); |
|
116 | - $this->_bottom_buttons = array( |
|
117 | - 'report' => array( |
|
118 | - 'route' => 'registrations_report', |
|
119 | - 'extra_request' => array( |
|
120 | - 'EVT_ID' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
121 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
122 | - ), |
|
123 | - ), |
|
124 | - ); |
|
125 | - } else { |
|
126 | - $this->_columns = array( |
|
127 | - 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
|
128 | - '_REG_ID' => $ID_column_name, |
|
129 | - 'ATT_fname' => __('Name', 'event_espresso'), |
|
130 | - '_REG_date' => __('TXN Date', 'event_espresso'), |
|
131 | - 'event_name' => __('Event', 'event_espresso'), |
|
132 | - 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
133 | - '_REG_final_price' => __('Price', 'event_espresso'), |
|
134 | - '_REG_paid' => __('Paid', 'event_espresso'), |
|
135 | - 'actions' => __('Actions', 'event_espresso'), |
|
136 | - ); |
|
137 | - $this->_bottom_buttons = array( |
|
138 | - 'report_all' => array( |
|
139 | - 'route' => 'registrations_report', |
|
140 | - 'extra_request' => array( |
|
141 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
142 | - ), |
|
143 | - ), |
|
144 | - ); |
|
145 | - } |
|
146 | - $this->_bottom_buttons['report_filtered'] = array( |
|
147 | - 'route' => 'registrations_report', |
|
148 | - 'extra_request' => array( |
|
149 | - 'use_filters' => true, |
|
150 | - 'filters' => array_diff_key($this->_req_data, array_flip(array( |
|
151 | - 'page', |
|
152 | - 'action', |
|
153 | - 'default_nonce', |
|
154 | - ))), |
|
155 | - 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
156 | - ), |
|
157 | - ); |
|
158 | - $this->_primary_column = '_REG_ID'; |
|
159 | - $this->_sortable_columns = array( |
|
160 | - '_REG_date' => array('_REG_date' => true), //true means its already sorted |
|
161 | - /** |
|
162 | - * Allows users to change the default sort if they wish. |
|
163 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
164 | - * name. |
|
165 | - */ |
|
166 | - 'ATT_fname' => array( |
|
167 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
168 | - true, |
|
169 | - $this, |
|
170 | - ) |
|
171 | - ? array('ATT_lname' => false) |
|
172 | - : array('ATT_fname' => false), |
|
173 | - 'event_name' => array('event_name' => false), |
|
174 | - 'DTT_EVT_start' => array('DTT_EVT_start' => false), |
|
175 | - '_REG_ID' => array('_REG_ID' => false), |
|
176 | - ); |
|
177 | - $this->_hidden_columns = array(); |
|
178 | - } |
|
85 | + /** |
|
86 | + * _set_properties |
|
87 | + * |
|
88 | + * @access protected |
|
89 | + * @return void |
|
90 | + */ |
|
91 | + protected function _set_properties() |
|
92 | + { |
|
93 | + $this->_wp_list_args = array( |
|
94 | + 'singular' => __('registration', 'event_espresso'), |
|
95 | + 'plural' => __('registrations', 'event_espresso'), |
|
96 | + 'ajax' => true, |
|
97 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
98 | + ); |
|
99 | + $ID_column_name = __('ID', 'event_espresso'); |
|
100 | + $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
|
101 | + $ID_column_name .= __('Registrant Name', 'event_espresso'); |
|
102 | + $ID_column_name .= '</span> '; |
|
103 | + if (isset($_GET['event_id'])) { |
|
104 | + $this->_columns = array( |
|
105 | + 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
|
106 | + '_REG_ID' => $ID_column_name, |
|
107 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
108 | + 'ATT_email' => __('Email', 'event_espresso'), |
|
109 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
110 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
111 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
112 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
113 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
114 | + 'actions' => __('Actions', 'event_espresso'), |
|
115 | + ); |
|
116 | + $this->_bottom_buttons = array( |
|
117 | + 'report' => array( |
|
118 | + 'route' => 'registrations_report', |
|
119 | + 'extra_request' => array( |
|
120 | + 'EVT_ID' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
121 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
122 | + ), |
|
123 | + ), |
|
124 | + ); |
|
125 | + } else { |
|
126 | + $this->_columns = array( |
|
127 | + 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
|
128 | + '_REG_ID' => $ID_column_name, |
|
129 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
130 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
131 | + 'event_name' => __('Event', 'event_espresso'), |
|
132 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
133 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
134 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
135 | + 'actions' => __('Actions', 'event_espresso'), |
|
136 | + ); |
|
137 | + $this->_bottom_buttons = array( |
|
138 | + 'report_all' => array( |
|
139 | + 'route' => 'registrations_report', |
|
140 | + 'extra_request' => array( |
|
141 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
142 | + ), |
|
143 | + ), |
|
144 | + ); |
|
145 | + } |
|
146 | + $this->_bottom_buttons['report_filtered'] = array( |
|
147 | + 'route' => 'registrations_report', |
|
148 | + 'extra_request' => array( |
|
149 | + 'use_filters' => true, |
|
150 | + 'filters' => array_diff_key($this->_req_data, array_flip(array( |
|
151 | + 'page', |
|
152 | + 'action', |
|
153 | + 'default_nonce', |
|
154 | + ))), |
|
155 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
156 | + ), |
|
157 | + ); |
|
158 | + $this->_primary_column = '_REG_ID'; |
|
159 | + $this->_sortable_columns = array( |
|
160 | + '_REG_date' => array('_REG_date' => true), //true means its already sorted |
|
161 | + /** |
|
162 | + * Allows users to change the default sort if they wish. |
|
163 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
164 | + * name. |
|
165 | + */ |
|
166 | + 'ATT_fname' => array( |
|
167 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
168 | + true, |
|
169 | + $this, |
|
170 | + ) |
|
171 | + ? array('ATT_lname' => false) |
|
172 | + : array('ATT_fname' => false), |
|
173 | + 'event_name' => array('event_name' => false), |
|
174 | + 'DTT_EVT_start' => array('DTT_EVT_start' => false), |
|
175 | + '_REG_ID' => array('_REG_ID' => false), |
|
176 | + ); |
|
177 | + $this->_hidden_columns = array(); |
|
178 | + } |
|
179 | 179 | |
180 | 180 | |
181 | - /** |
|
182 | - * This simply sets up the row class for the table rows. |
|
183 | - * Allows for easier overriding of child methods for setting up sorting. |
|
184 | - * |
|
185 | - * @param EE_Registration $item the current item |
|
186 | - * @return string |
|
187 | - */ |
|
188 | - protected function _get_row_class($item) |
|
189 | - { |
|
190 | - $class = parent::_get_row_class($item); |
|
191 | - //add status class |
|
192 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
193 | - if ($this->_has_checkbox_column) { |
|
194 | - $class .= ' has-checkbox-column'; |
|
195 | - } |
|
196 | - return $class; |
|
197 | - } |
|
181 | + /** |
|
182 | + * This simply sets up the row class for the table rows. |
|
183 | + * Allows for easier overriding of child methods for setting up sorting. |
|
184 | + * |
|
185 | + * @param EE_Registration $item the current item |
|
186 | + * @return string |
|
187 | + */ |
|
188 | + protected function _get_row_class($item) |
|
189 | + { |
|
190 | + $class = parent::_get_row_class($item); |
|
191 | + //add status class |
|
192 | + $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
193 | + if ($this->_has_checkbox_column) { |
|
194 | + $class .= ' has-checkbox-column'; |
|
195 | + } |
|
196 | + return $class; |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | - /** |
|
201 | - * Set the $_transaction_details property if not set yet. |
|
202 | - * |
|
203 | - * @param EE_Registration $registration |
|
204 | - * @throws EE_Error |
|
205 | - * @throws InvalidArgumentException |
|
206 | - * @throws ReflectionException |
|
207 | - * @throws InvalidDataTypeException |
|
208 | - * @throws InvalidInterfaceException |
|
209 | - */ |
|
210 | - protected function _set_related_details(EE_Registration $registration) |
|
211 | - { |
|
212 | - $transaction = $registration->get_first_related('Transaction'); |
|
213 | - $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() |
|
214 | - : EEM_Transaction::failed_status_code; |
|
215 | - $this->_transaction_details = array( |
|
216 | - 'transaction' => $transaction, |
|
217 | - 'status' => $status, |
|
218 | - 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
|
219 | - 'title_attr' => sprintf( |
|
220 | - __('View Transaction Details (%s)', 'event_espresso'), |
|
221 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
222 | - ), |
|
223 | - ); |
|
224 | - try { |
|
225 | - $event = $registration->event(); |
|
226 | - } catch (EntityNotFoundException $e) { |
|
227 | - $event = null; |
|
228 | - } |
|
229 | - $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; |
|
230 | - $this->_event_details = array( |
|
231 | - 'event' => $event, |
|
232 | - 'status' => $status, |
|
233 | - 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
|
234 | - 'title_attr' => sprintf( |
|
235 | - __('Edit Event (%s)', 'event_espresso'), |
|
236 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
237 | - ), |
|
238 | - ); |
|
239 | - } |
|
200 | + /** |
|
201 | + * Set the $_transaction_details property if not set yet. |
|
202 | + * |
|
203 | + * @param EE_Registration $registration |
|
204 | + * @throws EE_Error |
|
205 | + * @throws InvalidArgumentException |
|
206 | + * @throws ReflectionException |
|
207 | + * @throws InvalidDataTypeException |
|
208 | + * @throws InvalidInterfaceException |
|
209 | + */ |
|
210 | + protected function _set_related_details(EE_Registration $registration) |
|
211 | + { |
|
212 | + $transaction = $registration->get_first_related('Transaction'); |
|
213 | + $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() |
|
214 | + : EEM_Transaction::failed_status_code; |
|
215 | + $this->_transaction_details = array( |
|
216 | + 'transaction' => $transaction, |
|
217 | + 'status' => $status, |
|
218 | + 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
|
219 | + 'title_attr' => sprintf( |
|
220 | + __('View Transaction Details (%s)', 'event_espresso'), |
|
221 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
222 | + ), |
|
223 | + ); |
|
224 | + try { |
|
225 | + $event = $registration->event(); |
|
226 | + } catch (EntityNotFoundException $e) { |
|
227 | + $event = null; |
|
228 | + } |
|
229 | + $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive; |
|
230 | + $this->_event_details = array( |
|
231 | + 'event' => $event, |
|
232 | + 'status' => $status, |
|
233 | + 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
|
234 | + 'title_attr' => sprintf( |
|
235 | + __('Edit Event (%s)', 'event_espresso'), |
|
236 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
237 | + ), |
|
238 | + ); |
|
239 | + } |
|
240 | 240 | |
241 | 241 | |
242 | - /** |
|
243 | - * _get_table_filters |
|
244 | - * |
|
245 | - * @access protected |
|
246 | - * @return array |
|
247 | - */ |
|
248 | - protected function _get_table_filters() |
|
249 | - { |
|
250 | - $filters = array(); |
|
251 | - //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
252 | - // methods. |
|
253 | - $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
254 | - $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
255 | - $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
256 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
257 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
258 | - $status = array(); |
|
259 | - $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
260 | - foreach ($this->_status as $key => $value) { |
|
261 | - $status[] = array('id' => $key, 'text' => $value); |
|
262 | - } |
|
263 | - if ($this->_view !== 'incomplete') { |
|
264 | - $filters[] = EEH_Form_Fields::select_input( |
|
265 | - '_reg_status', |
|
266 | - $status, |
|
267 | - isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
268 | - : '' |
|
269 | - ); |
|
270 | - } |
|
271 | - if (isset($this->_req_data['event_id'])) { |
|
272 | - $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
273 | - } |
|
274 | - return $filters; |
|
275 | - } |
|
242 | + /** |
|
243 | + * _get_table_filters |
|
244 | + * |
|
245 | + * @access protected |
|
246 | + * @return array |
|
247 | + */ |
|
248 | + protected function _get_table_filters() |
|
249 | + { |
|
250 | + $filters = array(); |
|
251 | + //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
252 | + // methods. |
|
253 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
254 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
255 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
256 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
257 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
258 | + $status = array(); |
|
259 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
260 | + foreach ($this->_status as $key => $value) { |
|
261 | + $status[] = array('id' => $key, 'text' => $value); |
|
262 | + } |
|
263 | + if ($this->_view !== 'incomplete') { |
|
264 | + $filters[] = EEH_Form_Fields::select_input( |
|
265 | + '_reg_status', |
|
266 | + $status, |
|
267 | + isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
268 | + : '' |
|
269 | + ); |
|
270 | + } |
|
271 | + if (isset($this->_req_data['event_id'])) { |
|
272 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
273 | + } |
|
274 | + return $filters; |
|
275 | + } |
|
276 | 276 | |
277 | 277 | |
278 | - /** |
|
279 | - * _add_view_counts |
|
280 | - * |
|
281 | - * @access protected |
|
282 | - * @return void |
|
283 | - * @throws EE_Error |
|
284 | - * @throws InvalidArgumentException |
|
285 | - * @throws InvalidDataTypeException |
|
286 | - * @throws InvalidInterfaceException |
|
287 | - */ |
|
288 | - protected function _add_view_counts() |
|
289 | - { |
|
290 | - $this->_views['all']['count'] = $this->_total_registrations(); |
|
291 | - $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
292 | - $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
293 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
294 | - 'ee_delete_registrations', |
|
295 | - 'espresso_registrations_trash_registrations' |
|
296 | - )) { |
|
297 | - $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
298 | - $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
299 | - } |
|
300 | - } |
|
278 | + /** |
|
279 | + * _add_view_counts |
|
280 | + * |
|
281 | + * @access protected |
|
282 | + * @return void |
|
283 | + * @throws EE_Error |
|
284 | + * @throws InvalidArgumentException |
|
285 | + * @throws InvalidDataTypeException |
|
286 | + * @throws InvalidInterfaceException |
|
287 | + */ |
|
288 | + protected function _add_view_counts() |
|
289 | + { |
|
290 | + $this->_views['all']['count'] = $this->_total_registrations(); |
|
291 | + $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
292 | + $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
293 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
294 | + 'ee_delete_registrations', |
|
295 | + 'espresso_registrations_trash_registrations' |
|
296 | + )) { |
|
297 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
298 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
299 | + } |
|
300 | + } |
|
301 | 301 | |
302 | 302 | |
303 | - /** |
|
304 | - * _total_registrations |
|
305 | - * |
|
306 | - * @access protected |
|
307 | - * @param string $view |
|
308 | - * @return int |
|
309 | - * @throws EE_Error |
|
310 | - * @throws InvalidArgumentException |
|
311 | - * @throws InvalidDataTypeException |
|
312 | - * @throws InvalidInterfaceException |
|
313 | - */ |
|
314 | - protected function _total_registrations($view = '') |
|
315 | - { |
|
316 | - $_where = array(); |
|
317 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
318 | - if ($EVT_ID) { |
|
319 | - $_where['EVT_ID'] = $EVT_ID; |
|
320 | - } |
|
321 | - switch ($view) { |
|
322 | - case 'trash': |
|
323 | - return EEM_Registration::instance()->count_deleted(array($_where)); |
|
324 | - break; |
|
325 | - case 'incomplete': |
|
326 | - $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
327 | - break; |
|
328 | - default: |
|
329 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
330 | - } |
|
331 | - return EEM_Registration::instance()->count(array($_where)); |
|
332 | - } |
|
303 | + /** |
|
304 | + * _total_registrations |
|
305 | + * |
|
306 | + * @access protected |
|
307 | + * @param string $view |
|
308 | + * @return int |
|
309 | + * @throws EE_Error |
|
310 | + * @throws InvalidArgumentException |
|
311 | + * @throws InvalidDataTypeException |
|
312 | + * @throws InvalidInterfaceException |
|
313 | + */ |
|
314 | + protected function _total_registrations($view = '') |
|
315 | + { |
|
316 | + $_where = array(); |
|
317 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
318 | + if ($EVT_ID) { |
|
319 | + $_where['EVT_ID'] = $EVT_ID; |
|
320 | + } |
|
321 | + switch ($view) { |
|
322 | + case 'trash': |
|
323 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
324 | + break; |
|
325 | + case 'incomplete': |
|
326 | + $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
327 | + break; |
|
328 | + default: |
|
329 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
330 | + } |
|
331 | + return EEM_Registration::instance()->count(array($_where)); |
|
332 | + } |
|
333 | 333 | |
334 | 334 | |
335 | - /** |
|
336 | - * _total_registrations_this_month |
|
337 | - * |
|
338 | - * @access protected |
|
339 | - * @return int |
|
340 | - * @throws EE_Error |
|
341 | - * @throws InvalidArgumentException |
|
342 | - * @throws InvalidDataTypeException |
|
343 | - * @throws InvalidInterfaceException |
|
344 | - */ |
|
345 | - protected function _total_registrations_this_month() |
|
346 | - { |
|
347 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
348 | - $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
349 | - $this_year_r = date('Y', current_time('timestamp')); |
|
350 | - $time_start = ' 00:00:00'; |
|
351 | - $time_end = ' 23:59:59'; |
|
352 | - $this_month_r = date('m', current_time('timestamp')); |
|
353 | - $days_this_month = date('t', current_time('timestamp')); |
|
354 | - //setup date query. |
|
355 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
356 | - 'REG_date', |
|
357 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
358 | - 'Y-m-d H:i:s' |
|
359 | - ); |
|
360 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
361 | - 'REG_date', |
|
362 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
363 | - 'Y-m-d H:i:s' |
|
364 | - ); |
|
365 | - $_where['REG_date'] = array( |
|
366 | - 'BETWEEN', |
|
367 | - array( |
|
368 | - $beginning_string, |
|
369 | - $end_string, |
|
370 | - ), |
|
371 | - ); |
|
372 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
373 | - return EEM_Registration::instance()->count(array($_where)); |
|
374 | - } |
|
335 | + /** |
|
336 | + * _total_registrations_this_month |
|
337 | + * |
|
338 | + * @access protected |
|
339 | + * @return int |
|
340 | + * @throws EE_Error |
|
341 | + * @throws InvalidArgumentException |
|
342 | + * @throws InvalidDataTypeException |
|
343 | + * @throws InvalidInterfaceException |
|
344 | + */ |
|
345 | + protected function _total_registrations_this_month() |
|
346 | + { |
|
347 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
348 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
349 | + $this_year_r = date('Y', current_time('timestamp')); |
|
350 | + $time_start = ' 00:00:00'; |
|
351 | + $time_end = ' 23:59:59'; |
|
352 | + $this_month_r = date('m', current_time('timestamp')); |
|
353 | + $days_this_month = date('t', current_time('timestamp')); |
|
354 | + //setup date query. |
|
355 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
356 | + 'REG_date', |
|
357 | + $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
358 | + 'Y-m-d H:i:s' |
|
359 | + ); |
|
360 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
361 | + 'REG_date', |
|
362 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
363 | + 'Y-m-d H:i:s' |
|
364 | + ); |
|
365 | + $_where['REG_date'] = array( |
|
366 | + 'BETWEEN', |
|
367 | + array( |
|
368 | + $beginning_string, |
|
369 | + $end_string, |
|
370 | + ), |
|
371 | + ); |
|
372 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
373 | + return EEM_Registration::instance()->count(array($_where)); |
|
374 | + } |
|
375 | 375 | |
376 | 376 | |
377 | - /** |
|
378 | - * _total_registrations_today |
|
379 | - * |
|
380 | - * @access protected |
|
381 | - * @return int |
|
382 | - * @throws EE_Error |
|
383 | - * @throws InvalidArgumentException |
|
384 | - * @throws InvalidDataTypeException |
|
385 | - * @throws InvalidInterfaceException |
|
386 | - */ |
|
387 | - protected function _total_registrations_today() |
|
388 | - { |
|
389 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
390 | - $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
391 | - $current_date = date('Y-m-d', current_time('timestamp')); |
|
392 | - $time_start = ' 00:00:00'; |
|
393 | - $time_end = ' 23:59:59'; |
|
394 | - $_where['REG_date'] = array( |
|
395 | - 'BETWEEN', |
|
396 | - array( |
|
397 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
398 | - 'REG_date', |
|
399 | - $current_date . $time_start, |
|
400 | - 'Y-m-d H:i:s' |
|
401 | - ), |
|
402 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
403 | - 'REG_date', |
|
404 | - $current_date . $time_end, |
|
405 | - 'Y-m-d H:i:s' |
|
406 | - ), |
|
407 | - ), |
|
408 | - ); |
|
409 | - $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
410 | - return EEM_Registration::instance()->count(array($_where)); |
|
411 | - } |
|
377 | + /** |
|
378 | + * _total_registrations_today |
|
379 | + * |
|
380 | + * @access protected |
|
381 | + * @return int |
|
382 | + * @throws EE_Error |
|
383 | + * @throws InvalidArgumentException |
|
384 | + * @throws InvalidDataTypeException |
|
385 | + * @throws InvalidInterfaceException |
|
386 | + */ |
|
387 | + protected function _total_registrations_today() |
|
388 | + { |
|
389 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
390 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
391 | + $current_date = date('Y-m-d', current_time('timestamp')); |
|
392 | + $time_start = ' 00:00:00'; |
|
393 | + $time_end = ' 23:59:59'; |
|
394 | + $_where['REG_date'] = array( |
|
395 | + 'BETWEEN', |
|
396 | + array( |
|
397 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
398 | + 'REG_date', |
|
399 | + $current_date . $time_start, |
|
400 | + 'Y-m-d H:i:s' |
|
401 | + ), |
|
402 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
403 | + 'REG_date', |
|
404 | + $current_date . $time_end, |
|
405 | + 'Y-m-d H:i:s' |
|
406 | + ), |
|
407 | + ), |
|
408 | + ); |
|
409 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
410 | + return EEM_Registration::instance()->count(array($_where)); |
|
411 | + } |
|
412 | 412 | |
413 | 413 | |
414 | - /** |
|
415 | - * column_cb |
|
416 | - * |
|
417 | - * @access public |
|
418 | - * @param \EE_Registration $item |
|
419 | - * @return string |
|
420 | - * @throws EE_Error |
|
421 | - * @throws InvalidArgumentException |
|
422 | - * @throws InvalidDataTypeException |
|
423 | - * @throws InvalidInterfaceException |
|
424 | - * @throws ReflectionException |
|
425 | - */ |
|
426 | - public function column_cb($item) |
|
427 | - { |
|
428 | - /** checkbox/lock **/ |
|
429 | - $transaction = $item->get_first_related('Transaction'); |
|
430 | - $payment_count = $transaction instanceof EE_Transaction |
|
431 | - ? $transaction->count_related('Payment') |
|
432 | - : 0; |
|
433 | - return $payment_count > 0 |
|
434 | - || ! EE_Registry::instance()->CAP->current_user_can( |
|
435 | - 'ee_edit_registration', |
|
436 | - 'registration_list_table_checkbox_input', |
|
437 | - $item->ID() |
|
438 | - ) |
|
439 | - ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
440 | - . '<span class="ee-lock-icon"></span>' |
|
441 | - : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
442 | - } |
|
414 | + /** |
|
415 | + * column_cb |
|
416 | + * |
|
417 | + * @access public |
|
418 | + * @param \EE_Registration $item |
|
419 | + * @return string |
|
420 | + * @throws EE_Error |
|
421 | + * @throws InvalidArgumentException |
|
422 | + * @throws InvalidDataTypeException |
|
423 | + * @throws InvalidInterfaceException |
|
424 | + * @throws ReflectionException |
|
425 | + */ |
|
426 | + public function column_cb($item) |
|
427 | + { |
|
428 | + /** checkbox/lock **/ |
|
429 | + $transaction = $item->get_first_related('Transaction'); |
|
430 | + $payment_count = $transaction instanceof EE_Transaction |
|
431 | + ? $transaction->count_related('Payment') |
|
432 | + : 0; |
|
433 | + return $payment_count > 0 |
|
434 | + || ! EE_Registry::instance()->CAP->current_user_can( |
|
435 | + 'ee_edit_registration', |
|
436 | + 'registration_list_table_checkbox_input', |
|
437 | + $item->ID() |
|
438 | + ) |
|
439 | + ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()) |
|
440 | + . '<span class="ee-lock-icon"></span>' |
|
441 | + : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$d" />', $item->ID()); |
|
442 | + } |
|
443 | 443 | |
444 | 444 | |
445 | - /** |
|
446 | - * column__REG_ID |
|
447 | - * |
|
448 | - * @access public |
|
449 | - * @param \EE_Registration $item |
|
450 | - * @return string |
|
451 | - * @throws EE_Error |
|
452 | - * @throws InvalidArgumentException |
|
453 | - * @throws InvalidDataTypeException |
|
454 | - * @throws InvalidInterfaceException |
|
455 | - * @throws ReflectionException |
|
456 | - */ |
|
457 | - public function column__REG_ID(EE_Registration $item) |
|
458 | - { |
|
459 | - $attendee = $item->attendee(); |
|
460 | - $content = $item->ID(); |
|
461 | - $content .= '<div class="show-on-mobile-view-only">'; |
|
462 | - $content .= '<br>'; |
|
463 | - $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
464 | - $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
465 | - $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
466 | - $content .= '</div>'; |
|
467 | - return $content; |
|
468 | - } |
|
445 | + /** |
|
446 | + * column__REG_ID |
|
447 | + * |
|
448 | + * @access public |
|
449 | + * @param \EE_Registration $item |
|
450 | + * @return string |
|
451 | + * @throws EE_Error |
|
452 | + * @throws InvalidArgumentException |
|
453 | + * @throws InvalidDataTypeException |
|
454 | + * @throws InvalidInterfaceException |
|
455 | + * @throws ReflectionException |
|
456 | + */ |
|
457 | + public function column__REG_ID(EE_Registration $item) |
|
458 | + { |
|
459 | + $attendee = $item->attendee(); |
|
460 | + $content = $item->ID(); |
|
461 | + $content .= '<div class="show-on-mobile-view-only">'; |
|
462 | + $content .= '<br>'; |
|
463 | + $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
464 | + $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
465 | + $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
466 | + $content .= '</div>'; |
|
467 | + return $content; |
|
468 | + } |
|
469 | 469 | |
470 | 470 | |
471 | - /** |
|
472 | - * column__REG_date |
|
473 | - * |
|
474 | - * @access public |
|
475 | - * @param \EE_Registration $item |
|
476 | - * @return string |
|
477 | - * @throws EE_Error |
|
478 | - * @throws InvalidArgumentException |
|
479 | - * @throws InvalidDataTypeException |
|
480 | - * @throws InvalidInterfaceException |
|
481 | - * @throws ReflectionException |
|
482 | - */ |
|
483 | - public function column__REG_date(EE_Registration $item) |
|
484 | - { |
|
485 | - $this->_set_related_details($item); |
|
486 | - //Build row actions |
|
487 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
488 | - 'action' => 'view_transaction', |
|
489 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
490 | - ), TXN_ADMIN_URL); |
|
491 | - $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
492 | - 'ee_read_transaction', |
|
493 | - 'espresso_transactions_view_transaction' |
|
494 | - ) |
|
495 | - ? '<a class="ee-status-color-' |
|
496 | - . $this->_transaction_details['status'] |
|
497 | - . '" href="' |
|
498 | - . $view_lnk_url |
|
499 | - . '" title="' |
|
500 | - . esc_attr($this->_transaction_details['title_attr']) |
|
501 | - . '">' |
|
502 | - . $item->get_i18n_datetime('REG_date') |
|
503 | - . '</a>' : $item->get_i18n_datetime('REG_date'); |
|
504 | - $view_link .= '<br><span class="ee-status-text-small">' |
|
505 | - . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
506 | - . '</span>'; |
|
507 | - return $view_link; |
|
508 | - } |
|
471 | + /** |
|
472 | + * column__REG_date |
|
473 | + * |
|
474 | + * @access public |
|
475 | + * @param \EE_Registration $item |
|
476 | + * @return string |
|
477 | + * @throws EE_Error |
|
478 | + * @throws InvalidArgumentException |
|
479 | + * @throws InvalidDataTypeException |
|
480 | + * @throws InvalidInterfaceException |
|
481 | + * @throws ReflectionException |
|
482 | + */ |
|
483 | + public function column__REG_date(EE_Registration $item) |
|
484 | + { |
|
485 | + $this->_set_related_details($item); |
|
486 | + //Build row actions |
|
487 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
488 | + 'action' => 'view_transaction', |
|
489 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
490 | + ), TXN_ADMIN_URL); |
|
491 | + $view_link = EE_Registry::instance()->CAP->current_user_can( |
|
492 | + 'ee_read_transaction', |
|
493 | + 'espresso_transactions_view_transaction' |
|
494 | + ) |
|
495 | + ? '<a class="ee-status-color-' |
|
496 | + . $this->_transaction_details['status'] |
|
497 | + . '" href="' |
|
498 | + . $view_lnk_url |
|
499 | + . '" title="' |
|
500 | + . esc_attr($this->_transaction_details['title_attr']) |
|
501 | + . '">' |
|
502 | + . $item->get_i18n_datetime('REG_date') |
|
503 | + . '</a>' : $item->get_i18n_datetime('REG_date'); |
|
504 | + $view_link .= '<br><span class="ee-status-text-small">' |
|
505 | + . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence') |
|
506 | + . '</span>'; |
|
507 | + return $view_link; |
|
508 | + } |
|
509 | 509 | |
510 | 510 | |
511 | - /** |
|
512 | - * column_event_name |
|
513 | - * |
|
514 | - * @access public |
|
515 | - * @param \EE_Registration $item |
|
516 | - * @return string |
|
517 | - * @throws EE_Error |
|
518 | - * @throws InvalidArgumentException |
|
519 | - * @throws InvalidDataTypeException |
|
520 | - * @throws InvalidInterfaceException |
|
521 | - * @throws ReflectionException |
|
522 | - */ |
|
523 | - public function column_event_name(EE_Registration $item) |
|
524 | - { |
|
525 | - $this->_set_related_details($item); |
|
526 | - // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
527 | - $EVT_ID = $item->event_ID(); |
|
528 | - $event_name = $item->event_name(); |
|
529 | - $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
530 | - $event_name = wp_trim_words($event_name, 30, '...'); |
|
531 | - if ($EVT_ID) { |
|
532 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
533 | - array('action' => 'edit', 'post' => $EVT_ID), |
|
534 | - EVENTS_ADMIN_URL |
|
535 | - ); |
|
536 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
537 | - ? '<a class="ee-status-color-' |
|
538 | - . $this->_event_details['status'] |
|
539 | - . '" href="' |
|
540 | - . $edit_event_url |
|
541 | - . '" title="' |
|
542 | - . esc_attr($this->_event_details['title_attr']) |
|
543 | - . '">' |
|
544 | - . $event_name |
|
545 | - . '</a>' : $event_name; |
|
546 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
547 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
548 | - $actions['event_filter'] .= sprintf( |
|
549 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
550 | - $event_name |
|
551 | - ); |
|
552 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
553 | - } else { |
|
554 | - $edit_event = $event_name; |
|
555 | - $actions['event_filter'] = ''; |
|
556 | - } |
|
557 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
558 | - } |
|
511 | + /** |
|
512 | + * column_event_name |
|
513 | + * |
|
514 | + * @access public |
|
515 | + * @param \EE_Registration $item |
|
516 | + * @return string |
|
517 | + * @throws EE_Error |
|
518 | + * @throws InvalidArgumentException |
|
519 | + * @throws InvalidDataTypeException |
|
520 | + * @throws InvalidInterfaceException |
|
521 | + * @throws ReflectionException |
|
522 | + */ |
|
523 | + public function column_event_name(EE_Registration $item) |
|
524 | + { |
|
525 | + $this->_set_related_details($item); |
|
526 | + // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
|
527 | + $EVT_ID = $item->event_ID(); |
|
528 | + $event_name = $item->event_name(); |
|
529 | + $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
|
530 | + $event_name = wp_trim_words($event_name, 30, '...'); |
|
531 | + if ($EVT_ID) { |
|
532 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
533 | + array('action' => 'edit', 'post' => $EVT_ID), |
|
534 | + EVENTS_ADMIN_URL |
|
535 | + ); |
|
536 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID) |
|
537 | + ? '<a class="ee-status-color-' |
|
538 | + . $this->_event_details['status'] |
|
539 | + . '" href="' |
|
540 | + . $edit_event_url |
|
541 | + . '" title="' |
|
542 | + . esc_attr($this->_event_details['title_attr']) |
|
543 | + . '">' |
|
544 | + . $event_name |
|
545 | + . '</a>' : $event_name; |
|
546 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
|
547 | + $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
548 | + $actions['event_filter'] .= sprintf( |
|
549 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
550 | + $event_name |
|
551 | + ); |
|
552 | + $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
553 | + } else { |
|
554 | + $edit_event = $event_name; |
|
555 | + $actions['event_filter'] = ''; |
|
556 | + } |
|
557 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
558 | + } |
|
559 | 559 | |
560 | 560 | |
561 | - /** |
|
562 | - * column_DTT_EVT_start |
|
563 | - * |
|
564 | - * @access public |
|
565 | - * @param \EE_Registration $item |
|
566 | - * @return string |
|
567 | - * @throws EE_Error |
|
568 | - * @throws InvalidArgumentException |
|
569 | - * @throws InvalidDataTypeException |
|
570 | - * @throws InvalidInterfaceException |
|
571 | - * @throws ReflectionException |
|
572 | - */ |
|
573 | - public function column_DTT_EVT_start(EE_Registration $item) |
|
574 | - { |
|
575 | - $datetime_strings = array(); |
|
576 | - $ticket = $item->ticket(true); |
|
577 | - if ($ticket instanceof EE_Ticket) { |
|
578 | - $remove_defaults = array('default_where_conditions' => 'none'); |
|
579 | - $datetimes = $ticket->datetimes($remove_defaults); |
|
580 | - foreach ($datetimes as $datetime) { |
|
581 | - $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
582 | - } |
|
583 | - return $this->generateDisplayForDatetimes($datetime_strings); |
|
584 | - } |
|
585 | - return __('There is no ticket on this registration', 'event_espresso'); |
|
586 | - } |
|
561 | + /** |
|
562 | + * column_DTT_EVT_start |
|
563 | + * |
|
564 | + * @access public |
|
565 | + * @param \EE_Registration $item |
|
566 | + * @return string |
|
567 | + * @throws EE_Error |
|
568 | + * @throws InvalidArgumentException |
|
569 | + * @throws InvalidDataTypeException |
|
570 | + * @throws InvalidInterfaceException |
|
571 | + * @throws ReflectionException |
|
572 | + */ |
|
573 | + public function column_DTT_EVT_start(EE_Registration $item) |
|
574 | + { |
|
575 | + $datetime_strings = array(); |
|
576 | + $ticket = $item->ticket(true); |
|
577 | + if ($ticket instanceof EE_Ticket) { |
|
578 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
579 | + $datetimes = $ticket->datetimes($remove_defaults); |
|
580 | + foreach ($datetimes as $datetime) { |
|
581 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
582 | + } |
|
583 | + return $this->generateDisplayForDatetimes($datetime_strings); |
|
584 | + } |
|
585 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
586 | + } |
|
587 | 587 | |
588 | 588 | |
589 | - /** |
|
590 | - * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
591 | - * |
|
592 | - * @param array $datetime_strings |
|
593 | - * @return string |
|
594 | - */ |
|
595 | - public function generateDisplayForDateTimes(array $datetime_strings) |
|
596 | - { |
|
597 | - $content = '<div class="ee-registration-event-datetimes-container">'; |
|
598 | - $expand_toggle = count($datetime_strings) > 1 |
|
599 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
600 | - . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
601 | - : ''; |
|
602 | - //get first item for initial visibility |
|
603 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
604 | - $content .= $expand_toggle; |
|
605 | - if ($datetime_strings) { |
|
606 | - $content .= '<div style="clear:both"></div>'; |
|
607 | - $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
608 | - $content .= implode("<br />", $datetime_strings); |
|
609 | - $content .= '</div>'; |
|
610 | - } |
|
611 | - $content .= '</div>'; |
|
612 | - return $content; |
|
613 | - } |
|
589 | + /** |
|
590 | + * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
591 | + * |
|
592 | + * @param array $datetime_strings |
|
593 | + * @return string |
|
594 | + */ |
|
595 | + public function generateDisplayForDateTimes(array $datetime_strings) |
|
596 | + { |
|
597 | + $content = '<div class="ee-registration-event-datetimes-container">'; |
|
598 | + $expand_toggle = count($datetime_strings) > 1 |
|
599 | + ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
600 | + . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
|
601 | + : ''; |
|
602 | + //get first item for initial visibility |
|
603 | + $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
604 | + $content .= $expand_toggle; |
|
605 | + if ($datetime_strings) { |
|
606 | + $content .= '<div style="clear:both"></div>'; |
|
607 | + $content .= '<div class="ee-registration-event-datetimes-container more-items hidden">'; |
|
608 | + $content .= implode("<br />", $datetime_strings); |
|
609 | + $content .= '</div>'; |
|
610 | + } |
|
611 | + $content .= '</div>'; |
|
612 | + return $content; |
|
613 | + } |
|
614 | 614 | |
615 | 615 | |
616 | - /** |
|
617 | - * column_ATT_fname |
|
618 | - * |
|
619 | - * @access public |
|
620 | - * @param \EE_Registration $item |
|
621 | - * @return string |
|
622 | - * @throws EE_Error |
|
623 | - * @throws InvalidArgumentException |
|
624 | - * @throws InvalidDataTypeException |
|
625 | - * @throws InvalidInterfaceException |
|
626 | - * @throws ReflectionException |
|
627 | - */ |
|
628 | - public function column_ATT_fname(EE_Registration $item) |
|
629 | - { |
|
630 | - $attendee = $item->attendee(); |
|
631 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
632 | - 'action' => 'view_registration', |
|
633 | - '_REG_ID' => $item->ID(), |
|
634 | - ), REG_ADMIN_URL); |
|
635 | - $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
636 | - $link = EE_Registry::instance()->CAP->current_user_can( |
|
637 | - 'ee_read_registration', |
|
638 | - 'espresso_registrations_view_registration', |
|
639 | - $item->ID() |
|
640 | - ) |
|
641 | - ? '<a href="' |
|
642 | - . $edit_lnk_url |
|
643 | - . '" title="' |
|
644 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
645 | - . '">' |
|
646 | - . $attendee_name |
|
647 | - . '</a>' : $attendee_name; |
|
648 | - $link .= $item->count() === 1 |
|
649 | - ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
|
650 | - $t = $item->get_first_related('Transaction'); |
|
651 | - $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
|
652 | - //append group count to name |
|
653 | - $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
654 | - //append reg_code |
|
655 | - $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
656 | - //reg status text for accessibility |
|
657 | - $link .= '<br><span class="ee-status-text-small">' |
|
658 | - . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
659 | - . '</span>'; |
|
660 | - //trash/restore/delete actions |
|
661 | - $actions = array(); |
|
662 | - if ($this->_view !== 'trash' |
|
663 | - && $payment_count === 0 |
|
664 | - && EE_Registry::instance()->CAP->current_user_can( |
|
665 | - 'ee_delete_registration', |
|
666 | - 'espresso_registrations_trash_registrations', |
|
667 | - $item->ID() |
|
668 | - )) { |
|
669 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
670 | - 'action' => 'trash_registrations', |
|
671 | - '_REG_ID' => $item->ID(), |
|
672 | - ), REG_ADMIN_URL); |
|
673 | - $actions['trash'] = '<a href="' |
|
674 | - . $trash_lnk_url |
|
675 | - . '" title="' |
|
676 | - . esc_attr__('Trash Registration', 'event_espresso') |
|
677 | - . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
678 | - } elseif ($this->_view === 'trash') { |
|
679 | - // restore registration link |
|
680 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
681 | - 'ee_delete_registration', |
|
682 | - 'espresso_registrations_restore_registrations', |
|
683 | - $item->ID() |
|
684 | - )) { |
|
685 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
686 | - 'action' => 'restore_registrations', |
|
687 | - '_REG_ID' => $item->ID(), |
|
688 | - ), REG_ADMIN_URL); |
|
689 | - $actions['restore'] = '<a href="' |
|
690 | - . $restore_lnk_url |
|
691 | - . '" title="' |
|
692 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
693 | - . __('Restore', 'event_espresso') . '</a>'; |
|
694 | - } |
|
695 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
696 | - 'ee_delete_registration', |
|
697 | - 'espresso_registrations_ee_delete_registrations', |
|
698 | - $item->ID() |
|
699 | - )) { |
|
700 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
701 | - 'action' => 'delete_registrations', |
|
702 | - '_REG_ID' => $item->ID(), |
|
703 | - ), REG_ADMIN_URL); |
|
704 | - $actions['delete'] = '<a href="' |
|
705 | - . $delete_lnk_url |
|
706 | - . '" title="' |
|
707 | - . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
708 | - . '">' |
|
709 | - . __('Delete', 'event_espresso') |
|
710 | - . '</a>'; |
|
711 | - } |
|
712 | - } |
|
713 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
714 | - } |
|
616 | + /** |
|
617 | + * column_ATT_fname |
|
618 | + * |
|
619 | + * @access public |
|
620 | + * @param \EE_Registration $item |
|
621 | + * @return string |
|
622 | + * @throws EE_Error |
|
623 | + * @throws InvalidArgumentException |
|
624 | + * @throws InvalidDataTypeException |
|
625 | + * @throws InvalidInterfaceException |
|
626 | + * @throws ReflectionException |
|
627 | + */ |
|
628 | + public function column_ATT_fname(EE_Registration $item) |
|
629 | + { |
|
630 | + $attendee = $item->attendee(); |
|
631 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
632 | + 'action' => 'view_registration', |
|
633 | + '_REG_ID' => $item->ID(), |
|
634 | + ), REG_ADMIN_URL); |
|
635 | + $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
|
636 | + $link = EE_Registry::instance()->CAP->current_user_can( |
|
637 | + 'ee_read_registration', |
|
638 | + 'espresso_registrations_view_registration', |
|
639 | + $item->ID() |
|
640 | + ) |
|
641 | + ? '<a href="' |
|
642 | + . $edit_lnk_url |
|
643 | + . '" title="' |
|
644 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
645 | + . '">' |
|
646 | + . $attendee_name |
|
647 | + . '</a>' : $attendee_name; |
|
648 | + $link .= $item->count() === 1 |
|
649 | + ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
|
650 | + $t = $item->get_first_related('Transaction'); |
|
651 | + $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
|
652 | + //append group count to name |
|
653 | + $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
654 | + //append reg_code |
|
655 | + $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
656 | + //reg status text for accessibility |
|
657 | + $link .= '<br><span class="ee-status-text-small">' |
|
658 | + . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
|
659 | + . '</span>'; |
|
660 | + //trash/restore/delete actions |
|
661 | + $actions = array(); |
|
662 | + if ($this->_view !== 'trash' |
|
663 | + && $payment_count === 0 |
|
664 | + && EE_Registry::instance()->CAP->current_user_can( |
|
665 | + 'ee_delete_registration', |
|
666 | + 'espresso_registrations_trash_registrations', |
|
667 | + $item->ID() |
|
668 | + )) { |
|
669 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
670 | + 'action' => 'trash_registrations', |
|
671 | + '_REG_ID' => $item->ID(), |
|
672 | + ), REG_ADMIN_URL); |
|
673 | + $actions['trash'] = '<a href="' |
|
674 | + . $trash_lnk_url |
|
675 | + . '" title="' |
|
676 | + . esc_attr__('Trash Registration', 'event_espresso') |
|
677 | + . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
678 | + } elseif ($this->_view === 'trash') { |
|
679 | + // restore registration link |
|
680 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
681 | + 'ee_delete_registration', |
|
682 | + 'espresso_registrations_restore_registrations', |
|
683 | + $item->ID() |
|
684 | + )) { |
|
685 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
686 | + 'action' => 'restore_registrations', |
|
687 | + '_REG_ID' => $item->ID(), |
|
688 | + ), REG_ADMIN_URL); |
|
689 | + $actions['restore'] = '<a href="' |
|
690 | + . $restore_lnk_url |
|
691 | + . '" title="' |
|
692 | + . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
693 | + . __('Restore', 'event_espresso') . '</a>'; |
|
694 | + } |
|
695 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
696 | + 'ee_delete_registration', |
|
697 | + 'espresso_registrations_ee_delete_registrations', |
|
698 | + $item->ID() |
|
699 | + )) { |
|
700 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
701 | + 'action' => 'delete_registrations', |
|
702 | + '_REG_ID' => $item->ID(), |
|
703 | + ), REG_ADMIN_URL); |
|
704 | + $actions['delete'] = '<a href="' |
|
705 | + . $delete_lnk_url |
|
706 | + . '" title="' |
|
707 | + . esc_attr__('Delete Registration Permanently', 'event_espresso') |
|
708 | + . '">' |
|
709 | + . __('Delete', 'event_espresso') |
|
710 | + . '</a>'; |
|
711 | + } |
|
712 | + } |
|
713 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
714 | + } |
|
715 | 715 | |
716 | 716 | |
717 | - /** |
|
718 | - * column_ATT_email |
|
719 | - * |
|
720 | - * @access public |
|
721 | - * @param \EE_Registration $item |
|
722 | - * @return string |
|
723 | - * @throws EE_Error |
|
724 | - * @throws InvalidArgumentException |
|
725 | - * @throws InvalidDataTypeException |
|
726 | - * @throws InvalidInterfaceException |
|
727 | - * @throws ReflectionException |
|
728 | - */ |
|
729 | - public function column_ATT_email(EE_Registration $item) |
|
730 | - { |
|
731 | - $attendee = $item->get_first_related('Attendee'); |
|
732 | - return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') |
|
733 | - : $attendee->email(); |
|
734 | - } |
|
717 | + /** |
|
718 | + * column_ATT_email |
|
719 | + * |
|
720 | + * @access public |
|
721 | + * @param \EE_Registration $item |
|
722 | + * @return string |
|
723 | + * @throws EE_Error |
|
724 | + * @throws InvalidArgumentException |
|
725 | + * @throws InvalidDataTypeException |
|
726 | + * @throws InvalidInterfaceException |
|
727 | + * @throws ReflectionException |
|
728 | + */ |
|
729 | + public function column_ATT_email(EE_Registration $item) |
|
730 | + { |
|
731 | + $attendee = $item->get_first_related('Attendee'); |
|
732 | + return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') |
|
733 | + : $attendee->email(); |
|
734 | + } |
|
735 | 735 | |
736 | 736 | |
737 | - /** |
|
738 | - * column__REG_count |
|
739 | - * |
|
740 | - * @access public |
|
741 | - * @param \EE_Registration $item |
|
742 | - * @return string |
|
743 | - */ |
|
744 | - public function column__REG_count(EE_Registration $item) |
|
745 | - { |
|
746 | - return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
747 | - } |
|
737 | + /** |
|
738 | + * column__REG_count |
|
739 | + * |
|
740 | + * @access public |
|
741 | + * @param \EE_Registration $item |
|
742 | + * @return string |
|
743 | + */ |
|
744 | + public function column__REG_count(EE_Registration $item) |
|
745 | + { |
|
746 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
747 | + } |
|
748 | 748 | |
749 | 749 | |
750 | - /** |
|
751 | - * column_PRC_amount |
|
752 | - * |
|
753 | - * @access public |
|
754 | - * @param \EE_Registration $item |
|
755 | - * @return string |
|
756 | - * @throws EE_Error |
|
757 | - */ |
|
758 | - public function column_PRC_amount(EE_Registration $item) |
|
759 | - { |
|
760 | - $ticket = $item->ticket(); |
|
761 | - $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' |
|
762 | - . $ticket->name() |
|
763 | - . '</span><br />' : ''; |
|
764 | - if ($item->final_price() > 0) { |
|
765 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
766 | - } else { |
|
767 | - // free event |
|
768 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
769 | - . __('free', 'event_espresso') |
|
770 | - . '</span>'; |
|
771 | - } |
|
772 | - return $content; |
|
773 | - } |
|
750 | + /** |
|
751 | + * column_PRC_amount |
|
752 | + * |
|
753 | + * @access public |
|
754 | + * @param \EE_Registration $item |
|
755 | + * @return string |
|
756 | + * @throws EE_Error |
|
757 | + */ |
|
758 | + public function column_PRC_amount(EE_Registration $item) |
|
759 | + { |
|
760 | + $ticket = $item->ticket(); |
|
761 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' |
|
762 | + . $ticket->name() |
|
763 | + . '</span><br />' : ''; |
|
764 | + if ($item->final_price() > 0) { |
|
765 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
766 | + } else { |
|
767 | + // free event |
|
768 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
|
769 | + . __('free', 'event_espresso') |
|
770 | + . '</span>'; |
|
771 | + } |
|
772 | + return $content; |
|
773 | + } |
|
774 | 774 | |
775 | 775 | |
776 | - /** |
|
777 | - * column__REG_final_price |
|
778 | - * |
|
779 | - * @access public |
|
780 | - * @param \EE_Registration $item |
|
781 | - * @return string |
|
782 | - * @throws EE_Error |
|
783 | - */ |
|
784 | - public function column__REG_final_price(EE_Registration $item) |
|
785 | - { |
|
786 | - $ticket = $item->ticket(); |
|
787 | - $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket |
|
788 | - ? '' |
|
789 | - : '<span class="TKT_name">' |
|
790 | - . $ticket->name() |
|
791 | - . '</span><br />'; |
|
792 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
793 | - return $content; |
|
794 | - } |
|
776 | + /** |
|
777 | + * column__REG_final_price |
|
778 | + * |
|
779 | + * @access public |
|
780 | + * @param \EE_Registration $item |
|
781 | + * @return string |
|
782 | + * @throws EE_Error |
|
783 | + */ |
|
784 | + public function column__REG_final_price(EE_Registration $item) |
|
785 | + { |
|
786 | + $ticket = $item->ticket(); |
|
787 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket |
|
788 | + ? '' |
|
789 | + : '<span class="TKT_name">' |
|
790 | + . $ticket->name() |
|
791 | + . '</span><br />'; |
|
792 | + $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
793 | + return $content; |
|
794 | + } |
|
795 | 795 | |
796 | 796 | |
797 | - /** |
|
798 | - * column__REG_paid |
|
799 | - * |
|
800 | - * @access public |
|
801 | - * @param \EE_Registration $item |
|
802 | - * @return string |
|
803 | - * @throws EE_Error |
|
804 | - */ |
|
805 | - public function column__REG_paid(EE_Registration $item) |
|
806 | - { |
|
807 | - $payment_method = $item->payment_method(); |
|
808 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
|
809 | - : __('Unknown', 'event_espresso'); |
|
810 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
811 | - if ($item->paid() > 0) { |
|
812 | - $content .= '<br><span class="ee-status-text-small">' |
|
813 | - . sprintf( |
|
814 | - __('...via %s', 'event_espresso'), |
|
815 | - $payment_method_name |
|
816 | - ) |
|
817 | - . '</span>'; |
|
818 | - } |
|
819 | - return $content; |
|
820 | - } |
|
797 | + /** |
|
798 | + * column__REG_paid |
|
799 | + * |
|
800 | + * @access public |
|
801 | + * @param \EE_Registration $item |
|
802 | + * @return string |
|
803 | + * @throws EE_Error |
|
804 | + */ |
|
805 | + public function column__REG_paid(EE_Registration $item) |
|
806 | + { |
|
807 | + $payment_method = $item->payment_method(); |
|
808 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
|
809 | + : __('Unknown', 'event_espresso'); |
|
810 | + $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
811 | + if ($item->paid() > 0) { |
|
812 | + $content .= '<br><span class="ee-status-text-small">' |
|
813 | + . sprintf( |
|
814 | + __('...via %s', 'event_espresso'), |
|
815 | + $payment_method_name |
|
816 | + ) |
|
817 | + . '</span>'; |
|
818 | + } |
|
819 | + return $content; |
|
820 | + } |
|
821 | 821 | |
822 | 822 | |
823 | - /** |
|
824 | - * column_TXN_total |
|
825 | - * |
|
826 | - * @access public |
|
827 | - * @param \EE_Registration $item |
|
828 | - * @return string |
|
829 | - * @throws EE_Error |
|
830 | - * @throws EntityNotFoundException |
|
831 | - * @throws InvalidArgumentException |
|
832 | - * @throws InvalidDataTypeException |
|
833 | - * @throws InvalidInterfaceException |
|
834 | - */ |
|
835 | - public function column_TXN_total(EE_Registration $item) |
|
836 | - { |
|
837 | - if ($item->transaction()) { |
|
838 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
839 | - 'action' => 'view_transaction', |
|
840 | - 'TXN_ID' => $item->transaction_ID(), |
|
841 | - ), TXN_ADMIN_URL); |
|
842 | - return EE_Registry::instance()->CAP->current_user_can( |
|
843 | - 'ee_read_transaction', |
|
844 | - 'espresso_transactions_view_transaction', |
|
845 | - $item->transaction_ID() |
|
846 | - ) |
|
847 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
848 | - . $item->transaction()->status_ID() |
|
849 | - . '" href="' |
|
850 | - . $view_txn_lnk_url |
|
851 | - . '" title="' |
|
852 | - . esc_attr__('View Transaction', 'event_espresso') |
|
853 | - . '">' |
|
854 | - . $item->transaction()->pretty_total() |
|
855 | - . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
856 | - } else { |
|
857 | - return __("None", "event_espresso"); |
|
858 | - } |
|
859 | - } |
|
823 | + /** |
|
824 | + * column_TXN_total |
|
825 | + * |
|
826 | + * @access public |
|
827 | + * @param \EE_Registration $item |
|
828 | + * @return string |
|
829 | + * @throws EE_Error |
|
830 | + * @throws EntityNotFoundException |
|
831 | + * @throws InvalidArgumentException |
|
832 | + * @throws InvalidDataTypeException |
|
833 | + * @throws InvalidInterfaceException |
|
834 | + */ |
|
835 | + public function column_TXN_total(EE_Registration $item) |
|
836 | + { |
|
837 | + if ($item->transaction()) { |
|
838 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
839 | + 'action' => 'view_transaction', |
|
840 | + 'TXN_ID' => $item->transaction_ID(), |
|
841 | + ), TXN_ADMIN_URL); |
|
842 | + return EE_Registry::instance()->CAP->current_user_can( |
|
843 | + 'ee_read_transaction', |
|
844 | + 'espresso_transactions_view_transaction', |
|
845 | + $item->transaction_ID() |
|
846 | + ) |
|
847 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
848 | + . $item->transaction()->status_ID() |
|
849 | + . '" href="' |
|
850 | + . $view_txn_lnk_url |
|
851 | + . '" title="' |
|
852 | + . esc_attr__('View Transaction', 'event_espresso') |
|
853 | + . '">' |
|
854 | + . $item->transaction()->pretty_total() |
|
855 | + . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
856 | + } else { |
|
857 | + return __("None", "event_espresso"); |
|
858 | + } |
|
859 | + } |
|
860 | 860 | |
861 | 861 | |
862 | - /** |
|
863 | - * column_TXN_paid |
|
864 | - * |
|
865 | - * @access public |
|
866 | - * @param \EE_Registration $item |
|
867 | - * @return string |
|
868 | - * @throws EE_Error |
|
869 | - * @throws EntityNotFoundException |
|
870 | - * @throws InvalidArgumentException |
|
871 | - * @throws InvalidDataTypeException |
|
872 | - * @throws InvalidInterfaceException |
|
873 | - */ |
|
874 | - public function column_TXN_paid(EE_Registration $item) |
|
875 | - { |
|
876 | - if ($item->count() === 1) { |
|
877 | - $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
|
878 | - if ($transaction->paid() >= $transaction->total()) { |
|
879 | - return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
880 | - } else { |
|
881 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
882 | - 'action' => 'view_transaction', |
|
883 | - 'TXN_ID' => $item->transaction_ID(), |
|
884 | - ), TXN_ADMIN_URL); |
|
885 | - return EE_Registry::instance()->CAP->current_user_can( |
|
886 | - 'ee_read_transaction', |
|
887 | - 'espresso_transactions_view_transaction', |
|
888 | - $item->transaction_ID() |
|
889 | - ) |
|
890 | - ? '<span class="reg-pad-rght"><a class="status-' |
|
891 | - . $transaction->status_ID() |
|
892 | - . '" href="' |
|
893 | - . $view_txn_lnk_url |
|
894 | - . '" title="' |
|
895 | - . esc_attr__('View Transaction', 'event_espresso') |
|
896 | - . '">' |
|
897 | - . $item->transaction()->pretty_paid() |
|
898 | - . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
899 | - } |
|
900 | - } |
|
901 | - return ' '; |
|
902 | - } |
|
862 | + /** |
|
863 | + * column_TXN_paid |
|
864 | + * |
|
865 | + * @access public |
|
866 | + * @param \EE_Registration $item |
|
867 | + * @return string |
|
868 | + * @throws EE_Error |
|
869 | + * @throws EntityNotFoundException |
|
870 | + * @throws InvalidArgumentException |
|
871 | + * @throws InvalidDataTypeException |
|
872 | + * @throws InvalidInterfaceException |
|
873 | + */ |
|
874 | + public function column_TXN_paid(EE_Registration $item) |
|
875 | + { |
|
876 | + if ($item->count() === 1) { |
|
877 | + $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
|
878 | + if ($transaction->paid() >= $transaction->total()) { |
|
879 | + return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
|
880 | + } else { |
|
881 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
882 | + 'action' => 'view_transaction', |
|
883 | + 'TXN_ID' => $item->transaction_ID(), |
|
884 | + ), TXN_ADMIN_URL); |
|
885 | + return EE_Registry::instance()->CAP->current_user_can( |
|
886 | + 'ee_read_transaction', |
|
887 | + 'espresso_transactions_view_transaction', |
|
888 | + $item->transaction_ID() |
|
889 | + ) |
|
890 | + ? '<span class="reg-pad-rght"><a class="status-' |
|
891 | + . $transaction->status_ID() |
|
892 | + . '" href="' |
|
893 | + . $view_txn_lnk_url |
|
894 | + . '" title="' |
|
895 | + . esc_attr__('View Transaction', 'event_espresso') |
|
896 | + . '">' |
|
897 | + . $item->transaction()->pretty_paid() |
|
898 | + . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
899 | + } |
|
900 | + } |
|
901 | + return ' '; |
|
902 | + } |
|
903 | 903 | |
904 | 904 | |
905 | - /** |
|
906 | - * column_actions |
|
907 | - * |
|
908 | - * @access public |
|
909 | - * @param \EE_Registration $item |
|
910 | - * @return string |
|
911 | - * @throws EE_Error |
|
912 | - * @throws InvalidArgumentException |
|
913 | - * @throws InvalidDataTypeException |
|
914 | - * @throws InvalidInterfaceException |
|
915 | - * @throws ReflectionException |
|
916 | - */ |
|
917 | - public function column_actions(EE_Registration $item) |
|
918 | - { |
|
919 | - $actions = array(); |
|
920 | - $attendee = $item->attendee(); |
|
921 | - $this->_set_related_details($item); |
|
922 | - //Build row actions |
|
923 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
924 | - 'action' => 'view_registration', |
|
925 | - '_REG_ID' => $item->ID(), |
|
926 | - ), REG_ADMIN_URL); |
|
927 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
928 | - 'action' => 'edit_attendee', |
|
929 | - 'post' => $item->attendee_ID(), |
|
930 | - ), REG_ADMIN_URL); |
|
931 | - // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
|
932 | - //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
|
933 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
934 | - 'action' => 'resend_registration', |
|
935 | - '_REG_ID' => $item->ID(), |
|
936 | - ), REG_ADMIN_URL, true); |
|
937 | - //Build row actions |
|
938 | - $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
939 | - 'ee_read_registration', |
|
940 | - 'espresso_registrations_view_registration', |
|
941 | - $item->ID() |
|
942 | - ) ? '<li><a href="' |
|
943 | - . $view_lnk_url |
|
944 | - . '" title="' |
|
945 | - . esc_attr__('View Registration Details', 'event_espresso') |
|
946 | - . '" class="tiny-text"> |
|
905 | + /** |
|
906 | + * column_actions |
|
907 | + * |
|
908 | + * @access public |
|
909 | + * @param \EE_Registration $item |
|
910 | + * @return string |
|
911 | + * @throws EE_Error |
|
912 | + * @throws InvalidArgumentException |
|
913 | + * @throws InvalidDataTypeException |
|
914 | + * @throws InvalidInterfaceException |
|
915 | + * @throws ReflectionException |
|
916 | + */ |
|
917 | + public function column_actions(EE_Registration $item) |
|
918 | + { |
|
919 | + $actions = array(); |
|
920 | + $attendee = $item->attendee(); |
|
921 | + $this->_set_related_details($item); |
|
922 | + //Build row actions |
|
923 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
924 | + 'action' => 'view_registration', |
|
925 | + '_REG_ID' => $item->ID(), |
|
926 | + ), REG_ADMIN_URL); |
|
927 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
928 | + 'action' => 'edit_attendee', |
|
929 | + 'post' => $item->attendee_ID(), |
|
930 | + ), REG_ADMIN_URL); |
|
931 | + // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
|
932 | + //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
|
933 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
934 | + 'action' => 'resend_registration', |
|
935 | + '_REG_ID' => $item->ID(), |
|
936 | + ), REG_ADMIN_URL, true); |
|
937 | + //Build row actions |
|
938 | + $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
939 | + 'ee_read_registration', |
|
940 | + 'espresso_registrations_view_registration', |
|
941 | + $item->ID() |
|
942 | + ) ? '<li><a href="' |
|
943 | + . $view_lnk_url |
|
944 | + . '" title="' |
|
945 | + . esc_attr__('View Registration Details', 'event_espresso') |
|
946 | + . '" class="tiny-text"> |
|
947 | 947 | <div class="dashicons dashicons-clipboard"></div> |
948 | 948 | </a> |
949 | 949 | </li>' |
950 | - : ''; |
|
951 | - $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
952 | - 'ee_edit_contacts', |
|
953 | - 'espresso_registrations_edit_attendee' |
|
954 | - ) |
|
955 | - && $attendee instanceof EE_Attendee |
|
956 | - ? ' |
|
950 | + : ''; |
|
951 | + $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
952 | + 'ee_edit_contacts', |
|
953 | + 'espresso_registrations_edit_attendee' |
|
954 | + ) |
|
955 | + && $attendee instanceof EE_Attendee |
|
956 | + ? ' |
|
957 | 957 | <li> |
958 | 958 | <a href="' . $edit_lnk_url . '" title="' |
959 | - . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
959 | + . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
960 | 960 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
961 | 961 | </a> |
962 | 962 | </li>' : ''; |
963 | - $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee |
|
964 | - && EE_Registry::instance()->CAP->current_user_can( |
|
965 | - 'ee_send_message', |
|
966 | - 'espresso_registrations_resend_registration', |
|
967 | - $item->ID() |
|
968 | - ) |
|
969 | - ? ' |
|
963 | + $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee |
|
964 | + && EE_Registry::instance()->CAP->current_user_can( |
|
965 | + 'ee_send_message', |
|
966 | + 'espresso_registrations_resend_registration', |
|
967 | + $item->ID() |
|
968 | + ) |
|
969 | + ? ' |
|
970 | 970 | <li> |
971 | 971 | <a href="' |
972 | - . $resend_reg_lnk_url |
|
973 | - . '" title="' |
|
974 | - . esc_attr__('Resend Registration Details', 'event_espresso') |
|
975 | - . '" class="tiny-text"> |
|
972 | + . $resend_reg_lnk_url |
|
973 | + . '" title="' |
|
974 | + . esc_attr__('Resend Registration Details', 'event_espresso') |
|
975 | + . '" class="tiny-text"> |
|
976 | 976 | <div class="dashicons dashicons-email-alt"></div> |
977 | 977 | </a> |
978 | 978 | </li>' : ''; |
979 | - // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
|
980 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
981 | - 'action' => 'view_transaction', |
|
982 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
983 | - ), TXN_ADMIN_URL); |
|
984 | - $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
985 | - 'ee_read_transaction', |
|
986 | - 'espresso_transactions_view_transaction', |
|
987 | - $this->_transaction_details['id'] |
|
988 | - ) |
|
989 | - ? ' |
|
979 | + // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
|
980 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
981 | + 'action' => 'view_transaction', |
|
982 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
983 | + ), TXN_ADMIN_URL); |
|
984 | + $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( |
|
985 | + 'ee_read_transaction', |
|
986 | + 'espresso_transactions_view_transaction', |
|
987 | + $this->_transaction_details['id'] |
|
988 | + ) |
|
989 | + ? ' |
|
990 | 990 | <li> |
991 | 991 | <a class="ee-status-color-' |
992 | - . $this->_transaction_details['status'] |
|
993 | - . ' tiny-text" href="' |
|
994 | - . $view_txn_lnk_url |
|
995 | - . '" title="' |
|
996 | - . $this->_transaction_details['title_attr'] |
|
997 | - . '"> |
|
992 | + . $this->_transaction_details['status'] |
|
993 | + . ' tiny-text" href="' |
|
994 | + . $view_txn_lnk_url |
|
995 | + . '" title="' |
|
996 | + . $this->_transaction_details['title_attr'] |
|
997 | + . '"> |
|
998 | 998 | <div class="dashicons dashicons-cart"></div> |
999 | 999 | </a> |
1000 | 1000 | </li>' : ''; |
1001 | - //invoice link |
|
1002 | - $actions['dl_invoice_lnk'] = ''; |
|
1003 | - $dl_invoice_lnk_url = $item->invoice_url(); |
|
1004 | - //only show invoice link if message type is active. |
|
1005 | - if ($attendee instanceof EE_Attendee |
|
1006 | - && $item->is_primary_registrant() |
|
1007 | - && EEH_MSG_Template::is_mt_active('invoice') |
|
1008 | - ) { |
|
1009 | - $actions['dl_invoice_lnk'] = ' |
|
1001 | + //invoice link |
|
1002 | + $actions['dl_invoice_lnk'] = ''; |
|
1003 | + $dl_invoice_lnk_url = $item->invoice_url(); |
|
1004 | + //only show invoice link if message type is active. |
|
1005 | + if ($attendee instanceof EE_Attendee |
|
1006 | + && $item->is_primary_registrant() |
|
1007 | + && EEH_MSG_Template::is_mt_active('invoice') |
|
1008 | + ) { |
|
1009 | + $actions['dl_invoice_lnk'] = ' |
|
1010 | 1010 | <li> |
1011 | 1011 | <a title="' |
1012 | - . esc_attr__('View Transaction Invoice', 'event_espresso') |
|
1013 | - . '" target="_blank" href="' |
|
1014 | - . $dl_invoice_lnk_url |
|
1015 | - . '" class="tiny-text"> |
|
1012 | + . esc_attr__('View Transaction Invoice', 'event_espresso') |
|
1013 | + . '" target="_blank" href="' |
|
1014 | + . $dl_invoice_lnk_url |
|
1015 | + . '" class="tiny-text"> |
|
1016 | 1016 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
1017 | 1017 | </a> |
1018 | 1018 | </li>'; |
1019 | - } |
|
1020 | - $actions['filtered_messages_link'] = ''; |
|
1021 | - //message list table link (filtered by REG_ID |
|
1022 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
1023 | - $actions['filtered_messages_link'] = '<li>' |
|
1024 | - . EEH_MSG_Template::get_message_action_link( |
|
1025 | - 'see_notifications_for', |
|
1026 | - null, |
|
1027 | - array('_REG_ID' => $item->ID()) |
|
1028 | - ) . '</li>'; |
|
1029 | - } |
|
1030 | - $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
1031 | - return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
1032 | - } |
|
1019 | + } |
|
1020 | + $actions['filtered_messages_link'] = ''; |
|
1021 | + //message list table link (filtered by REG_ID |
|
1022 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
1023 | + $actions['filtered_messages_link'] = '<li>' |
|
1024 | + . EEH_MSG_Template::get_message_action_link( |
|
1025 | + 'see_notifications_for', |
|
1026 | + null, |
|
1027 | + array('_REG_ID' => $item->ID()) |
|
1028 | + ) . '</li>'; |
|
1029 | + } |
|
1030 | + $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
|
1031 | + return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
|
1032 | + } |
|
1033 | 1033 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
3 | 3 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
4 | 4 | |
5 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | 6 | exit('No direct script access allowed'); |
7 | 7 | } |
8 | 8 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function __construct(Registrations_Admin_Page $admin_page) |
59 | 59 | { |
60 | - if (! empty($_GET['event_id'])) { |
|
60 | + if ( ! empty($_GET['event_id'])) { |
|
61 | 61 | $extra_query_args = array(); |
62 | 62 | foreach ($admin_page->get_views() as $key => $view_details) { |
63 | 63 | $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ); |
158 | 158 | $this->_primary_column = '_REG_ID'; |
159 | 159 | $this->_sortable_columns = array( |
160 | - '_REG_date' => array('_REG_date' => true), //true means its already sorted |
|
160 | + '_REG_date' => array('_REG_date' => true), //true means its already sorted |
|
161 | 161 | /** |
162 | 162 | * Allows users to change the default sort if they wish. |
163 | 163 | * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $class = parent::_get_row_class($item); |
191 | 191 | //add status class |
192 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
192 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
193 | 193 | if ($this->_has_checkbox_column) { |
194 | 194 | $class .= ' has-checkbox-column'; |
195 | 195 | } |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | //setup date query. |
355 | 355 | $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
356 | 356 | 'REG_date', |
357 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
357 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
358 | 358 | 'Y-m-d H:i:s' |
359 | 359 | ); |
360 | 360 | $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
361 | 361 | 'REG_date', |
362 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
362 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
363 | 363 | 'Y-m-d H:i:s' |
364 | 364 | ); |
365 | 365 | $_where['REG_date'] = array( |
@@ -396,12 +396,12 @@ discard block |
||
396 | 396 | array( |
397 | 397 | EEM_Registration::instance()->convert_datetime_for_query( |
398 | 398 | 'REG_date', |
399 | - $current_date . $time_start, |
|
399 | + $current_date.$time_start, |
|
400 | 400 | 'Y-m-d H:i:s' |
401 | 401 | ), |
402 | 402 | EEM_Registration::instance()->convert_datetime_for_query( |
403 | 403 | 'REG_date', |
404 | - $current_date . $time_end, |
|
404 | + $current_date.$time_end, |
|
405 | 405 | 'Y-m-d H:i:s' |
406 | 406 | ), |
407 | 407 | ), |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | $content .= '<div class="show-on-mobile-view-only">'; |
462 | 462 | $content .= '<br>'; |
463 | 463 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
464 | - $content .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
465 | - $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
464 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
465 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
466 | 466 | $content .= '</div>'; |
467 | 467 | return $content; |
468 | 468 | } |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | . $event_name |
545 | 545 | . '</a>' : $event_name; |
546 | 546 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL); |
547 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="'; |
|
547 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'; |
|
548 | 548 | $actions['event_filter'] .= sprintf( |
549 | 549 | esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
550 | 550 | $event_name |
551 | 551 | ); |
552 | - $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>'; |
|
552 | + $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>'; |
|
553 | 553 | } else { |
554 | 554 | $edit_event = $event_name; |
555 | 555 | $actions['event_filter'] = ''; |
@@ -596,11 +596,11 @@ discard block |
||
596 | 596 | { |
597 | 597 | $content = '<div class="ee-registration-event-datetimes-container">'; |
598 | 598 | $expand_toggle = count($datetime_strings) > 1 |
599 | - ? ' <span title="' . esc_attr__('Click to view all dates', 'event_espresso') |
|
599 | + ? ' <span title="'.esc_attr__('Click to view all dates', 'event_espresso') |
|
600 | 600 | . '" class="ee-js ee-more-datetimes-toggle dashicons dashicons-plus"></span>' |
601 | 601 | : ''; |
602 | 602 | //get first item for initial visibility |
603 | - $content .= '<div class="left">' . array_shift($datetime_strings) . '</div>'; |
|
603 | + $content .= '<div class="left">'.array_shift($datetime_strings).'</div>'; |
|
604 | 604 | $content .= $expand_toggle; |
605 | 605 | if ($datetime_strings) { |
606 | 606 | $content .= '<div style="clear:both"></div>'; |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | $t = $item->get_first_related('Transaction'); |
651 | 651 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
652 | 652 | //append group count to name |
653 | - $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
653 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
654 | 654 | //append reg_code |
655 | - $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
655 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
656 | 656 | //reg status text for accessibility |
657 | 657 | $link .= '<br><span class="ee-status-text-small">' |
658 | 658 | . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | . $trash_lnk_url |
675 | 675 | . '" title="' |
676 | 676 | . esc_attr__('Trash Registration', 'event_espresso') |
677 | - . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
677 | + . '">'.__('Trash', 'event_espresso').'</a>'; |
|
678 | 678 | } elseif ($this->_view === 'trash') { |
679 | 679 | // restore registration link |
680 | 680 | if (EE_Registry::instance()->CAP->current_user_can( |
@@ -689,8 +689,8 @@ discard block |
||
689 | 689 | $actions['restore'] = '<a href="' |
690 | 690 | . $restore_lnk_url |
691 | 691 | . '" title="' |
692 | - . esc_attr__('Restore Registration', 'event_espresso') . '">' |
|
693 | - . __('Restore', 'event_espresso') . '</a>'; |
|
692 | + . esc_attr__('Restore Registration', 'event_espresso').'">' |
|
693 | + . __('Restore', 'event_espresso').'</a>'; |
|
694 | 694 | } |
695 | 695 | if (EE_Registry::instance()->CAP->current_user_can( |
696 | 696 | 'ee_delete_registration', |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | . $ticket->name() |
763 | 763 | . '</span><br />' : ''; |
764 | 764 | if ($item->final_price() > 0) { |
765 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
765 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
766 | 766 | } else { |
767 | 767 | // free event |
768 | 768 | $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | : '<span class="TKT_name">' |
790 | 790 | . $ticket->name() |
791 | 791 | . '</span><br />'; |
792 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
792 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
793 | 793 | return $content; |
794 | 794 | } |
795 | 795 | |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $payment_method = $item->payment_method(); |
808 | 808 | $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() |
809 | 809 | : __('Unknown', 'event_espresso'); |
810 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
810 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
811 | 811 | if ($item->paid() > 0) { |
812 | 812 | $content .= '<br><span class="ee-status-text-small">' |
813 | 813 | . sprintf( |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | . esc_attr__('View Transaction', 'event_espresso') |
853 | 853 | . '">' |
854 | 854 | . $item->transaction()->pretty_total() |
855 | - . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
855 | + . '</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
856 | 856 | } else { |
857 | 857 | return __("None", "event_espresso"); |
858 | 858 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | . esc_attr__('View Transaction', 'event_espresso') |
896 | 896 | . '">' |
897 | 897 | . $item->transaction()->pretty_paid() |
898 | - . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
898 | + . '</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
899 | 899 | } |
900 | 900 | } |
901 | 901 | return ' '; |
@@ -955,8 +955,8 @@ discard block |
||
955 | 955 | && $attendee instanceof EE_Attendee |
956 | 956 | ? ' |
957 | 957 | <li> |
958 | - <a href="' . $edit_lnk_url . '" title="' |
|
959 | - . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text"> |
|
958 | + <a href="' . $edit_lnk_url.'" title="' |
|
959 | + . esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
960 | 960 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
961 | 961 | </a> |
962 | 962 | </li>' : ''; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | 'see_notifications_for', |
1026 | 1026 | null, |
1027 | 1027 | array('_REG_ID' => $item->ID()) |
1028 | - ) . '</li>'; |
|
1028 | + ).'</li>'; |
|
1029 | 1029 | } |
1030 | 1030 | $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this); |
1031 | 1031 | return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul'); |
@@ -38,216 +38,216 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | |
64 | 64 | } else { |
65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | - /** |
|
68 | - * espresso_minimum_php_version_error |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | + /** |
|
68 | + * espresso_minimum_php_version_error |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.000'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.000'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | - /** |
|
119 | - * espresso_load_error_handling |
|
120 | - * this function loads EE's class for handling exceptions and errors |
|
121 | - */ |
|
122 | - function espresso_load_error_handling() |
|
123 | - { |
|
124 | - static $error_handling_loaded = false; |
|
125 | - if ($error_handling_loaded) { |
|
126 | - return; |
|
127 | - } |
|
128 | - // load debugging tools |
|
129 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
130 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
131 | - \EEH_Debug_Tools::instance(); |
|
132 | - } |
|
133 | - // load error handling |
|
134 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
135 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
136 | - } else { |
|
137 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
138 | - } |
|
139 | - $error_handling_loaded = true; |
|
140 | - } |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | + /** |
|
119 | + * espresso_load_error_handling |
|
120 | + * this function loads EE's class for handling exceptions and errors |
|
121 | + */ |
|
122 | + function espresso_load_error_handling() |
|
123 | + { |
|
124 | + static $error_handling_loaded = false; |
|
125 | + if ($error_handling_loaded) { |
|
126 | + return; |
|
127 | + } |
|
128 | + // load debugging tools |
|
129 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
130 | + require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
131 | + \EEH_Debug_Tools::instance(); |
|
132 | + } |
|
133 | + // load error handling |
|
134 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
135 | + require_once EE_CORE . 'EE_Error.core.php'; |
|
136 | + } else { |
|
137 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
138 | + } |
|
139 | + $error_handling_loaded = true; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * espresso_load_required |
|
144 | - * given a class name and path, this function will load that file or throw an exception |
|
145 | - * |
|
146 | - * @param string $classname |
|
147 | - * @param string $full_path_to_file |
|
148 | - * @throws EE_Error |
|
149 | - */ |
|
150 | - function espresso_load_required($classname, $full_path_to_file) |
|
151 | - { |
|
152 | - if (is_readable($full_path_to_file)) { |
|
153 | - require_once $full_path_to_file; |
|
154 | - } else { |
|
155 | - throw new \EE_Error ( |
|
156 | - sprintf( |
|
157 | - esc_html__( |
|
158 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
159 | - 'event_espresso' |
|
160 | - ), |
|
161 | - $classname |
|
162 | - ) |
|
163 | - ); |
|
164 | - } |
|
165 | - } |
|
142 | + /** |
|
143 | + * espresso_load_required |
|
144 | + * given a class name and path, this function will load that file or throw an exception |
|
145 | + * |
|
146 | + * @param string $classname |
|
147 | + * @param string $full_path_to_file |
|
148 | + * @throws EE_Error |
|
149 | + */ |
|
150 | + function espresso_load_required($classname, $full_path_to_file) |
|
151 | + { |
|
152 | + if (is_readable($full_path_to_file)) { |
|
153 | + require_once $full_path_to_file; |
|
154 | + } else { |
|
155 | + throw new \EE_Error ( |
|
156 | + sprintf( |
|
157 | + esc_html__( |
|
158 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
159 | + 'event_espresso' |
|
160 | + ), |
|
161 | + $classname |
|
162 | + ) |
|
163 | + ); |
|
164 | + } |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * @since 4.9.27 |
|
169 | - * @throws \EE_Error |
|
170 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
171 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
172 | - * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
173 | - * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
174 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
175 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
176 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
177 | - * @throws \OutOfBoundsException |
|
178 | - */ |
|
179 | - function bootstrap_espresso() |
|
180 | - { |
|
181 | - require_once __DIR__ . '/core/espresso_definitions.php'; |
|
182 | - try { |
|
183 | - espresso_load_error_handling(); |
|
184 | - espresso_load_required( |
|
185 | - 'EEH_Base', |
|
186 | - EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
187 | - ); |
|
188 | - espresso_load_required( |
|
189 | - 'EEH_File', |
|
190 | - EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
191 | - ); |
|
192 | - espresso_load_required( |
|
193 | - 'EEH_File', |
|
194 | - EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
195 | - ); |
|
196 | - espresso_load_required( |
|
197 | - 'EEH_Array', |
|
198 | - EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
199 | - ); |
|
200 | - // instantiate and configure PSR4 autoloader |
|
201 | - espresso_load_required( |
|
202 | - 'Psr4Autoloader', |
|
203 | - EE_CORE . 'Psr4Autoloader.php' |
|
204 | - ); |
|
205 | - espresso_load_required( |
|
206 | - 'EE_Psr4AutoloaderInit', |
|
207 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
208 | - ); |
|
209 | - $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
210 | - $AutoloaderInit->initializeAutoloader(); |
|
211 | - espresso_load_required( |
|
212 | - 'EE_Request', |
|
213 | - EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
214 | - ); |
|
215 | - espresso_load_required( |
|
216 | - 'EE_Response', |
|
217 | - EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
218 | - ); |
|
219 | - espresso_load_required( |
|
220 | - 'EE_Bootstrap', |
|
221 | - EE_CORE . 'EE_Bootstrap.core.php' |
|
222 | - ); |
|
223 | - // bootstrap EE and the request stack |
|
224 | - new EE_Bootstrap( |
|
225 | - new EE_Request($_GET, $_POST, $_COOKIE), |
|
226 | - new EE_Response() |
|
227 | - ); |
|
228 | - } catch (Exception $e) { |
|
229 | - require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
230 | - new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
231 | - } |
|
232 | - } |
|
233 | - bootstrap_espresso(); |
|
234 | - } |
|
167 | + /** |
|
168 | + * @since 4.9.27 |
|
169 | + * @throws \EE_Error |
|
170 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
171 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
172 | + * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
173 | + * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
174 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
175 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
176 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
177 | + * @throws \OutOfBoundsException |
|
178 | + */ |
|
179 | + function bootstrap_espresso() |
|
180 | + { |
|
181 | + require_once __DIR__ . '/core/espresso_definitions.php'; |
|
182 | + try { |
|
183 | + espresso_load_error_handling(); |
|
184 | + espresso_load_required( |
|
185 | + 'EEH_Base', |
|
186 | + EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
187 | + ); |
|
188 | + espresso_load_required( |
|
189 | + 'EEH_File', |
|
190 | + EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
191 | + ); |
|
192 | + espresso_load_required( |
|
193 | + 'EEH_File', |
|
194 | + EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
195 | + ); |
|
196 | + espresso_load_required( |
|
197 | + 'EEH_Array', |
|
198 | + EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
199 | + ); |
|
200 | + // instantiate and configure PSR4 autoloader |
|
201 | + espresso_load_required( |
|
202 | + 'Psr4Autoloader', |
|
203 | + EE_CORE . 'Psr4Autoloader.php' |
|
204 | + ); |
|
205 | + espresso_load_required( |
|
206 | + 'EE_Psr4AutoloaderInit', |
|
207 | + EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
208 | + ); |
|
209 | + $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
210 | + $AutoloaderInit->initializeAutoloader(); |
|
211 | + espresso_load_required( |
|
212 | + 'EE_Request', |
|
213 | + EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
214 | + ); |
|
215 | + espresso_load_required( |
|
216 | + 'EE_Response', |
|
217 | + EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
218 | + ); |
|
219 | + espresso_load_required( |
|
220 | + 'EE_Bootstrap', |
|
221 | + EE_CORE . 'EE_Bootstrap.core.php' |
|
222 | + ); |
|
223 | + // bootstrap EE and the request stack |
|
224 | + new EE_Bootstrap( |
|
225 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
226 | + new EE_Response() |
|
227 | + ); |
|
228 | + } catch (Exception $e) { |
|
229 | + require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
230 | + new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
231 | + } |
|
232 | + } |
|
233 | + bootstrap_espresso(); |
|
234 | + } |
|
235 | 235 | } |
236 | 236 | if (! function_exists('espresso_deactivate_plugin')) { |
237 | - /** |
|
238 | - * deactivate_plugin |
|
239 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | - * |
|
241 | - * @access public |
|
242 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | - * @return void |
|
244 | - */ |
|
245 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
246 | - { |
|
247 | - if (! function_exists('deactivate_plugins')) { |
|
248 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
249 | - } |
|
250 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
251 | - deactivate_plugins($plugin_basename); |
|
252 | - } |
|
237 | + /** |
|
238 | + * deactivate_plugin |
|
239 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | + * |
|
241 | + * @access public |
|
242 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | + * @return void |
|
244 | + */ |
|
245 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
246 | + { |
|
247 | + if (! function_exists('deactivate_plugins')) { |
|
248 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
249 | + } |
|
250 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
251 | + deactivate_plugins($plugin_basename); |
|
252 | + } |
|
253 | 253 | } |
@@ -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 | * Event Espresso |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | </th> |
52 | 52 | <td> |
53 | 53 | <?php |
54 | - if($payment_log->object() instanceof EE_Transaction) { |
|
54 | + if ($payment_log->object() instanceof EE_Transaction) { |
|
55 | 55 | echo __('Unknown', 'event_espresso'); |
56 | 56 | } else { |
57 | 57 | echo $payment_method ? $payment_method->admin_name() : __("No Longer Exists", 'event_espresso'); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </label> |
67 | 67 | </th> |
68 | 68 | <td> |
69 | - <?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso');?> |
|
69 | + <?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso'); ?> |
|
70 | 70 | |
71 | 71 | </td> |
72 | 72 | </tr> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | </label> |
78 | 78 | </th> |
79 | 79 | <td> |
80 | - <?php echo $payment_log->e('LOG_message','as_table');//EEH_Template::layout_array_as_table($payment_log->content())?> |
|
80 | + <?php echo $payment_log->e('LOG_message', 'as_table'); //EEH_Template::layout_array_as_table($payment_log->content())?> |
|
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | </tbody> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -27,207 +27,207 @@ discard block |
||
27 | 27 | class Payment_Log_Admin_List_Table extends EE_Admin_List_Table |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * @param \EE_Admin_Page $admin_page |
|
32 | - * @return Payment_Log_Admin_List_Table |
|
33 | - */ |
|
34 | - public function __construct($admin_page) |
|
35 | - { |
|
36 | - parent::__construct($admin_page); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * _setup_data |
|
43 | - * |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - protected function _setup_data() |
|
47 | - { |
|
48 | - $this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page); |
|
49 | - // if(isset($this->_req_data['status'] ) && $this->_req_data['status'] == 'trash'){ |
|
50 | - // $this->_data = $this->_admin_page->get_trashed_questions( $this->_per_page,$this->_current_page, FALSE ); |
|
51 | - // }else{ |
|
52 | - // $this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE ); |
|
53 | - // } |
|
54 | - $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
55 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox')); |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * add_download_logs_checkbox |
|
62 | - * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters |
|
63 | - * |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function add_download_logs_checkbox() |
|
67 | - { |
|
68 | - echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='" . __('Download Results', 'event_espresso') . "'>"; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * _set_properties |
|
75 | - * |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - protected function _set_properties() |
|
79 | - { |
|
80 | - $this->_wp_list_args = array( |
|
81 | - 'singular' => __('payment log', 'event_espresso'), |
|
82 | - 'plural' => __('payment logs', 'event_espresso'), |
|
83 | - 'ajax' => true, //for now, |
|
84 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
85 | - ); |
|
86 | - $this->_columns = array( |
|
87 | - 'cb' => '<input type="checkbox" />', |
|
88 | - 'id' => __('ID', 'event_espresso'), |
|
89 | - 'LOG_time' => __('Time', 'event_espresso'), |
|
90 | - 'PMD_ID' => __('Payment Method', 'event_espresso'), |
|
91 | - 'TXN_ID' => __('Transaction ID', 'event_espresso'), |
|
92 | - ); |
|
93 | - $this->_sortable_columns = array( |
|
94 | - 'LOG_time' => array('LOG_time' => true), |
|
95 | - ); |
|
96 | - $this->_hidden_columns = array(); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * _get_table_filters |
|
103 | - * |
|
104 | - * @return array |
|
105 | - */ |
|
106 | - protected function _get_table_filters() |
|
107 | - { |
|
108 | - $filters = array(); |
|
109 | - //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
|
110 | - $payment_methods = EEM_Payment_Method::instance()->get_all(); |
|
111 | - $payment_method_names = array(array('id' => 'all', 'text' => __("All", 'event_espresso')), array('id' => '0', 'text' => __("Unknown Payment Method", 'event_espresso'))); |
|
112 | - foreach ($payment_methods as $payment_method) { |
|
113 | - $payment_method_names[] = array('id' => $payment_method->ID(), 'text' => $payment_method->admin_name()); |
|
114 | - } |
|
115 | - $filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all'); |
|
116 | - $start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months')); |
|
117 | - $end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y'); |
|
118 | - ob_start(); |
|
119 | - ?> |
|
30 | + /** |
|
31 | + * @param \EE_Admin_Page $admin_page |
|
32 | + * @return Payment_Log_Admin_List_Table |
|
33 | + */ |
|
34 | + public function __construct($admin_page) |
|
35 | + { |
|
36 | + parent::__construct($admin_page); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * _setup_data |
|
43 | + * |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + protected function _setup_data() |
|
47 | + { |
|
48 | + $this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page); |
|
49 | + // if(isset($this->_req_data['status'] ) && $this->_req_data['status'] == 'trash'){ |
|
50 | + // $this->_data = $this->_admin_page->get_trashed_questions( $this->_per_page,$this->_current_page, FALSE ); |
|
51 | + // }else{ |
|
52 | + // $this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE ); |
|
53 | + // } |
|
54 | + $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
55 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox')); |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * add_download_logs_checkbox |
|
62 | + * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters |
|
63 | + * |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function add_download_logs_checkbox() |
|
67 | + { |
|
68 | + echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='" . __('Download Results', 'event_espresso') . "'>"; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * _set_properties |
|
75 | + * |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + protected function _set_properties() |
|
79 | + { |
|
80 | + $this->_wp_list_args = array( |
|
81 | + 'singular' => __('payment log', 'event_espresso'), |
|
82 | + 'plural' => __('payment logs', 'event_espresso'), |
|
83 | + 'ajax' => true, //for now, |
|
84 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
85 | + ); |
|
86 | + $this->_columns = array( |
|
87 | + 'cb' => '<input type="checkbox" />', |
|
88 | + 'id' => __('ID', 'event_espresso'), |
|
89 | + 'LOG_time' => __('Time', 'event_espresso'), |
|
90 | + 'PMD_ID' => __('Payment Method', 'event_espresso'), |
|
91 | + 'TXN_ID' => __('Transaction ID', 'event_espresso'), |
|
92 | + ); |
|
93 | + $this->_sortable_columns = array( |
|
94 | + 'LOG_time' => array('LOG_time' => true), |
|
95 | + ); |
|
96 | + $this->_hidden_columns = array(); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * _get_table_filters |
|
103 | + * |
|
104 | + * @return array |
|
105 | + */ |
|
106 | + protected function _get_table_filters() |
|
107 | + { |
|
108 | + $filters = array(); |
|
109 | + //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
|
110 | + $payment_methods = EEM_Payment_Method::instance()->get_all(); |
|
111 | + $payment_method_names = array(array('id' => 'all', 'text' => __("All", 'event_espresso')), array('id' => '0', 'text' => __("Unknown Payment Method", 'event_espresso'))); |
|
112 | + foreach ($payment_methods as $payment_method) { |
|
113 | + $payment_method_names[] = array('id' => $payment_method->ID(), 'text' => $payment_method->admin_name()); |
|
114 | + } |
|
115 | + $filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all'); |
|
116 | + $start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months')); |
|
117 | + $end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y'); |
|
118 | + ob_start(); |
|
119 | + ?> |
|
120 | 120 | <label for="txn-filter-start-date"><?php _e('Display Transactions from ', 'event_espresso'); ?></label> |
121 | 121 | <input id="payment-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>" name="payment-filter-start-date" size="15"/> |
122 | 122 | <label for="txn-filter-end-date"><?php _e(' until ', 'event_espresso'); ?></label> |
123 | 123 | <input id="payment-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>" name="payment-filter-end-date" size="15"/> |
124 | 124 | <?php |
125 | - $filters[] = ob_get_clean(); |
|
126 | - return $filters; |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * _add_view_counts |
|
133 | - * |
|
134 | - * @return void |
|
135 | - */ |
|
136 | - protected function _add_view_counts() |
|
137 | - { |
|
138 | - $this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * column_cb |
|
145 | - * |
|
146 | - * @param \EE_Change_Log $item |
|
147 | - * @return string |
|
148 | - */ |
|
149 | - public function column_cb($item) |
|
150 | - { |
|
151 | - return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * column_id |
|
158 | - * |
|
159 | - * @param \EE_Change_Log $item |
|
160 | - * @return string |
|
161 | - */ |
|
162 | - public function column_id(EE_Change_Log $item) |
|
163 | - { |
|
164 | - $details_query_args = array( |
|
165 | - 'action' => 'payment_log_details', |
|
166 | - 'ID' => $item->ID(), |
|
167 | - ); |
|
168 | - $url = EE_Admin_Page::add_query_args_and_nonce($details_query_args, EE_PAYMENTS_ADMIN_URL); |
|
169 | - return "<a href='$url'>{$item->ID()}</a>"; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * column_LOG_time |
|
176 | - * |
|
177 | - * @param \EE_Change_Log $item |
|
178 | - * @return string |
|
179 | - */ |
|
180 | - public function column_LOG_time(EE_Change_Log $item) |
|
181 | - { |
|
182 | - return $item->get_datetime('LOG_time'); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - |
|
187 | - /** |
|
188 | - * column_PMD_ID |
|
189 | - * |
|
190 | - * @param \EE_Change_Log $item |
|
191 | - * @return string |
|
192 | - */ |
|
193 | - public function column_PMD_ID(EE_Change_Log $item) |
|
194 | - { |
|
195 | - if ($item->object() instanceof EE_Payment_Method) { |
|
196 | - return $item->object()->admin_name(); |
|
197 | - } elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) { |
|
198 | - return $item->object()->payment_method()->admin_name(); |
|
199 | - } elseif ($item->object() instanceof EE_Transaction) { |
|
200 | - return __('Unknown', 'event_espresso'); |
|
201 | - } else { |
|
202 | - return __("No longer exists", 'event_espresso'); |
|
203 | - } |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * column_TXN_ID |
|
210 | - * |
|
211 | - * @param \EE_Change_Log $item |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public function column_TXN_ID(EE_Change_Log $item) |
|
215 | - { |
|
216 | - if ($item->object() instanceof EE_Payment) { |
|
217 | - $transaction_id = $item->object()->TXN_ID(); |
|
218 | - } elseif ($item->object() instanceof EE_Transaction) { |
|
219 | - $transaction_id = $item->object()->ID(); |
|
220 | - } else { |
|
221 | - $transaction_id = null; |
|
222 | - } |
|
223 | - if ($transaction_id && EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $transaction_id)) { |
|
224 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction_id), TXN_ADMIN_URL); |
|
225 | - return '<a href="' . $view_txn_lnk_url . '" title="' . sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $transaction_id) . '">' . sprintf(__('view txn %s', |
|
226 | - 'event_espresso'), $transaction_id) . '</a>'; |
|
227 | - } else { |
|
228 | - return __("Unable to find transaction", 'event_espresso'); |
|
229 | - } |
|
230 | - } |
|
125 | + $filters[] = ob_get_clean(); |
|
126 | + return $filters; |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * _add_view_counts |
|
133 | + * |
|
134 | + * @return void |
|
135 | + */ |
|
136 | + protected function _add_view_counts() |
|
137 | + { |
|
138 | + $this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * column_cb |
|
145 | + * |
|
146 | + * @param \EE_Change_Log $item |
|
147 | + * @return string |
|
148 | + */ |
|
149 | + public function column_cb($item) |
|
150 | + { |
|
151 | + return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * column_id |
|
158 | + * |
|
159 | + * @param \EE_Change_Log $item |
|
160 | + * @return string |
|
161 | + */ |
|
162 | + public function column_id(EE_Change_Log $item) |
|
163 | + { |
|
164 | + $details_query_args = array( |
|
165 | + 'action' => 'payment_log_details', |
|
166 | + 'ID' => $item->ID(), |
|
167 | + ); |
|
168 | + $url = EE_Admin_Page::add_query_args_and_nonce($details_query_args, EE_PAYMENTS_ADMIN_URL); |
|
169 | + return "<a href='$url'>{$item->ID()}</a>"; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * column_LOG_time |
|
176 | + * |
|
177 | + * @param \EE_Change_Log $item |
|
178 | + * @return string |
|
179 | + */ |
|
180 | + public function column_LOG_time(EE_Change_Log $item) |
|
181 | + { |
|
182 | + return $item->get_datetime('LOG_time'); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + |
|
187 | + /** |
|
188 | + * column_PMD_ID |
|
189 | + * |
|
190 | + * @param \EE_Change_Log $item |
|
191 | + * @return string |
|
192 | + */ |
|
193 | + public function column_PMD_ID(EE_Change_Log $item) |
|
194 | + { |
|
195 | + if ($item->object() instanceof EE_Payment_Method) { |
|
196 | + return $item->object()->admin_name(); |
|
197 | + } elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) { |
|
198 | + return $item->object()->payment_method()->admin_name(); |
|
199 | + } elseif ($item->object() instanceof EE_Transaction) { |
|
200 | + return __('Unknown', 'event_espresso'); |
|
201 | + } else { |
|
202 | + return __("No longer exists", 'event_espresso'); |
|
203 | + } |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * column_TXN_ID |
|
210 | + * |
|
211 | + * @param \EE_Change_Log $item |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public function column_TXN_ID(EE_Change_Log $item) |
|
215 | + { |
|
216 | + if ($item->object() instanceof EE_Payment) { |
|
217 | + $transaction_id = $item->object()->TXN_ID(); |
|
218 | + } elseif ($item->object() instanceof EE_Transaction) { |
|
219 | + $transaction_id = $item->object()->ID(); |
|
220 | + } else { |
|
221 | + $transaction_id = null; |
|
222 | + } |
|
223 | + if ($transaction_id && EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $transaction_id)) { |
|
224 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction_id), TXN_ADMIN_URL); |
|
225 | + return '<a href="' . $view_txn_lnk_url . '" title="' . sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $transaction_id) . '">' . sprintf(__('view txn %s', |
|
226 | + 'event_espresso'), $transaction_id) . '</a>'; |
|
227 | + } else { |
|
228 | + return __("Unable to find transaction", 'event_espresso'); |
|
229 | + } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | |
233 | 233 |